graphicsUrl/widgets/select.gif\" value=\"submit\" border=\"0\"/>\n";
return $sToRender;
}
// display the listbox initially ..then just display the text
function getGroupDisplay($oGroup, $iSelectedValue = 0) {
global $default;
if (!isset($oGroup)) {
if (Permission::userIsSystemAdministrator()) {
// if this is the system administrator, prepend group names with unit name
$oPatternListBox = & new PatternListBox($default->owl_groups_table, "name", "id", "fGroupID");
$oPatternListBox->setFromClause("LEFT OUTER JOIN groups_units_link GUL on ST.id=GUL.group_id " .
"LEFT OUTER JOIN units_lookup UL on GUL.unit_id=UL.id");
$oPatternListBox->setCompositeDisplayName("DISTINCT COALESCE(CONCAT(CONCAT(UL.name, '-'),ST.name),ST.name)");
} else if (Permission::userIsUnitAdministrator()) {
// else if this is a unit administrator, only display the groups in your unit
$oPatternListBox = & new PatternListBox($default->owl_groups_table, "name", "id", "fGroupID");
$oPatternListBox->setFromClause("INNER JOIN $default->owl_groups_units_table GUL on ST.id=GUL.group_id");
$oPatternListBox->setWhereClause("GUL.unit_id=" . User::getUnitID($_SESSION["userID"]));
}
if ($iSelectedValue != 0) {
$oPatternListBox->setSelectedValue($iSelectedValue);
}
return $oPatternListBox->render();
} else {
return "iId . "\">\n" .
$oGroup->getName();
}
}
function getFilterOptions($fGroupID = 0){
global $default;
$sToRender .= getGroupDisplay($aGroups, $fGroupID);
/*
$sToRender .= "
\n";
//$sToRender .= "getDocumentID() . "&fAddComment=1") . "\">graphicsUrl/widgets/addcomment.gif\" border=\"0\" />\n";
//$sToRender .= "graphicsUrl/widgets/back.gif\" onmouseover=\"this.style.cursor='hand'\" onclick=\"javascript: history.go(-1);\" />\n";
return $sToRender ;
}
// If there are no threads to view for a document
function getViewFailPage($sMessage)
{
global $default;
if (strlen($sMessage)>0){
$sToRender = $sMessage;
}
else $sToRender = "Current document has no discussion. Press the ADD button to start a discussion.";
return $sToRender;
}
/**
* Page to create a new thread
*
* @param $fDocumentID -> a valid document ID
*/
function getNewThreadOption($fDocumentID) {
global $default;
$sToRender .= "Would you like to create a new Discussion thread for this document?";
$sToRender .= " ";
$sToRender .= "graphicsUrl/widgets/new.gif\" border=\"0\">";
$sToRender .= "graphicsUrl/widgets/cancel.gif\" border=\"0\">";
return $sToRender;
}
/**
* Renders the heading for the page
*
* @param $sHeading -> text heading for the page
*/
function renderHeading1($sHeading) {
global $default;
$sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
$sColor = $default->siteMap->getSectionColour($sSectionName, "th");
$sToRender = "
\n";
$sToRender .= "
$sHeading
\n";
$sToRender .= "
\n";
$sToRender .= "
\n";
$sToRender .= "
\n";
return $sToRender;
}
/**
* Renders the path for the document
*
* @param $fDocumentID -> a valid document ID
*/
function renderDocumentPath($iDocumentID) {
global $default;
$oDocument = & Document::get($iDocumentID);
$sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
$sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td");
$sDocumentPath = displayFolderPathLink(Folder::getFolderPathAsArray($oDocument->getFolderID()), Folder::getFolderPathNamesAsArray($oDocument->getFolderID()), "$default->rootUrl/control.php?action=browse") . " > ";
$sDocumentPath .= "rootUrl/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php?fDocumentID=" . $oDocument->getID() . "&fForInlineView=1\">" . $oDocument->getName() . "";
return "
$sDocumentPath
\n";
}
/**
* Views the list of comments for a document
* Prints out 1 comment
* User needs to call this function many times to list all comments
*
* @param $iNum -> its the iterative index of the current comment
* @param $iThread -> a valid Thread Object
* @param $oComment -> a valid Comment Object
* @param $oUser -> a valid User Object (Logged in user)
*/
function getViewComment($iNum,$oThread,$oComment,$oUser) {
global $default;
$iSubjectChars = 59;
// If iNum is odd then highlight it
if (($iNum%2) == 1) $BGcolor = "#F5F6EE";
if (($iNum%2) == 0) $UserBGcolor = "#F5F6EE";
// If the Subject string is too long
if (strlen($oComment->getSubject())>$iSubjectChars ) $dotdot = " ...";
if (strlen($oUser->getUserName())> 13 ) $Userdotdot = " ...";
// If this is the first Subject line then create a table
if ($iNum == 1) {
$sHeading = "Document Discussion Comments";
$sToRender .= renderHeading($sHeading );
$sToRender .= renderDocumentPath($oThread->getDocumentID());
$sToRender .= "
\n";
// If this is the last subject line then close the table
if ($iNum == ($oThread->getNumberOfReplies())) { $sToRender .= "\n
\n\n";}
return $sToRender;
}
/**
* Views a single thread comment with its text body
*
* @param $iDocumentID -> a valid Document ID
* @param $oComment -> a valid Comment Object
* @param $oUser -> a valid User Object (Logged in user)
*/
function getCommentBody($oComment, $iDocumentID, $oUser) {
global $default;
$sHeading = "Document Comment";
$sToRender .= renderHeading($sHeading);
$sToRender .= renderDocumentPath($iDocumentID);
$sToRender .= "