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 renderHeading($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 "\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";
$sToRender .= "\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 .= "
| Author: " . $oUser->getUserName() . " | \n";
$sToRender .= "\n";
$sToRender .= "getID()) . "\"> graphicsUrl/widgets/reply.gif\" border=\"0\" />";
$sToRender .= " | graphicsUrl/widgets/back.gif\" onmouseover=\"this.style.cursor='hand'\" onclick=\"javascript: history.go(-1);\" > |
\n";
$sToRender .= "| Subject: | ";
$sToRender .= "" . $oComment->getSubject() . "";
$sToRender .= " | Date: " . $oComment->getDate() . " |
| ";
$sToRender .= " ";
$sToRender .= str_replace("%0D%0A"," ",str_replace("+", " ",$oComment->getBody())); // Div Views as HTML
$sToRender .= " | ";
$sToRender .= "
";
return $sToRender;
}
?>