, Jam Warehouse (Pty) Ltd, South Africa
* @package foldermanagement
*/
function getFolderPath($iFolderID) {
global $default;
$sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"])));
$sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td");
$sFolderPathLink = displayFolderPathLink(Folder::getFolderPathAsArray($iFolderID), Folder::getFolderPathNamesAsArray($iFolderID), "$default->rootUrl/control.php?action=browse");
return "
\n";
}
function getDocumentLinkFolderCollaborationData($iFolderCollaborationID) {
global $default;
/*ok*/ $sQuery = array("SELECT DDT.id, GFAL.folder_id AS folder_id, U.name AS username, DDT.document_title, D.name AS template_document_name, D.id AS template_document_id, DDT.group_folder_approval_link_id, 'Edit' AS edit, 'Delete' AS del " .
"FROM dependant_document_template AS DDT INNER JOIN groups_folders_approval_link AS GFAL ON DDT.group_folder_approval_link_id = GFAL.id " .
"INNER JOIN users AS U ON U.id = DDT.default_user_id " .
"LEFT OUTER JOIN documents AS D ON D.id = DDT.template_document_id " .
"WHERE DDT.group_folder_approval_link_id = ?", $iFolderCollaborationID);
//echo $sQuery;
$aColumns = array("document_title", "username", "template_document_name", "edit", "del");
$aColumnHeaders = array(_("Document title"), _("Default creator"), _("Template document"));
$aColumnTypes = array(1,1,3,3,3);
//$aDBColumnArray = array("id","group_folder_approval_link_id","template_document_id");
$aDBColumnArray = array("id","group_folder_approval_link_id","folder_id");
//$aQueryStringVariableNames = array("fDependantDocumentTemplateID", "fFolderCollaborationID", "fTargetDocumentID");
$aQueryStringVariableNames = array("fDependantDocumentTemplateID","fFolderCollaborationID","fFolderID");
$aLinkURLs = array(2=>"$default->rootUrl/control.php?action=viewDocument", 3=>"$default->rootUrl/control.php?action=viewDependantDocument&fForEdit=1", 4=>"$default->rootUrl/control.php?action=deleteDependantDocument");
$oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "90%", $aLinkURLs, $aDBColumnArray,$aQueryStringVariableNames);
$oPatternTableSqlQuery->setTableHeading(_("Dependant Documents"));
$oPatternTableSqlQuery->setDisplayColumnHeadings(true);
$oPatternTableSqlQuery->setEmptyTableMessage(_("No dependant documents"));
return $oPatternTableSqlQuery->render();
}
function getViewPage($iFolderCollaborationID, $iFolderID) {
global $default;
$sToRender = renderHeading(_("Dependant documents"));
$sToRender .= getFolderPath($iFolderID);
$sToRender .= "\n";
$sToRender .= "\n";
$sToRender .= "" . getDocumentLinkFolderCollaborationData($iFolderCollaborationID) . " \n";
$sToRender .= " \n";
$sToRender .= "\n";
$sToRender .= "\n";
$sToRender .= " \n";
$sToRender .= "
\n";
return $sToRender;
}
function getEditPage($iFolderID, $iDependantDocumentID, $iFolderCollaborationID, $sDocumentTitle, $sTemplateDocumentName, $iDocumentID, $iUserID) {
global $default;
$iDefaultUserUnitID = User::getUnitID($iUserID);
$sToRender = renderHeading(_("Dependant documents"));
$sToRender .= getFolderPath($iFolderID);
$sToRender .= "\n";
$sToRender .= " \n";
return $sToRender . "\n\n" . getValidationJavaScript() . "\n\n" . getBrowseJavaScript();
}
function getAddPage($iFolderCollaborationID, $iFolderID, $iUnitID, $sDocumentTitle, $sTemplateDocument, $iDocumentID) {
global $default;
$sToRender = renderHeading(_("Dependant documents"));
$sToRender .= getFolderPath($iFolderID);
$sToRender .= "\n";
$sToRender .= " \n";
return $sToRender . "\n\n" . getValidationJavaScript() . "\n\n" . getBrowseJavaScript();
}
function getUserDropDown($iUnitID, $iUserID = null) {
global $default;
$oPatternListBox = & new PatternListBox($default->users_table, "Name", "id", "fUserID", "GUL.unit_id = $iUnitID");
$sFromClause = "INNER join $default->users_groups_table AS UGL ON UGL.user_id = ST.id " .
"INNER JOIN groups_units_link AS GUL ON GUL.group_id = UGL.group_id ";
$oPatternListBox->setFromClause($sFromClause);
if (isset($iUserID)) {
$oPatternListBox->setSelectedValue($iUserID);
}
return $oPatternListBox->render();
}
function getUnitDropDown($iFolderCollaborationID, $iFolderID, $iUnitID = null) {
global $default;
$oPatternListBox = & new PatternListBox($default->units_table, "Name", "id", "fUnitID");
$oPatternListBox->setPostBackOnChange(true);
$oPatternListBox->setOnChangeAction("setActionAndSubmit('" . $_SERVER["PHP_SELF"] . "?fFolderID=$iFolderID&fFolderCollaborationID=$iFolderCollaborationID&fForAdd=1')");
if (isset($iUnitID)) {
$oPatternListBox->setSelectedValue($iUnitID);
}
return $oPatternListBox->render();
}
function getValidationJavaScript() {
$sToRender .= "\n\n\n\n";
return $sToRender;
}
function getBrowseJavaScript() {
$sToRender = "\n";
return $sToRender;
}
?>