isGuest()) {
UI::exitError(getMLText("my_account"),getMLText("access_denied"));
}
// Get list of subscriptions for documents or folders for user or groups
function getNotificationList($as_group, $folders) {
global $user,$db;
// First, get the list of groups of which the user is a member.
if ($as_group){
$groups = $user->getGroups();
if (count($groups)==0) return NULL;
$grpList = "";
foreach ($groups as $group) {
$grpList .= (strlen($grpList)==0 ? "" : ", ") . $group->getID();
}
$queryStr = "SELECT `tblNotify`.* FROM `tblNotify` ".
"WHERE `tblNotify`.`groupID` IN (". $grpList .")";
} else {
$queryStr = "SELECT `tblNotify`.* FROM `tblNotify` ".
"WHERE `tblNotify`.`userID` = '". $user->getID()."'" ;
}
$resArr = $db->getResultArray($queryStr);
$ret=array();
foreach ($resArr as $res){
if (($res["targetType"] == T_DOCUMENT)&&(!$folders)) $ret[]=$res["target"];
if (($res["targetType"] == T_FOLDER)&&($folders)) $ret[]=$res["target"];
}
return $ret;
}
function printFolderNotificationList($ret,$deleteaction=true) {
global $dms;
if (count($ret)==0) {
printMLText("empty_notify_list");
}
else {
print "
";
print "\n";
print " | \n";
print "".getMLText("name")." | \n";
print "".getMLText("owner")." | \n";
print "".getMLText("actions")." | \n";
print "
\n\n";
foreach($ret as $ID) {
$fld = $dms->getFolder($ID);
if (is_object($fld)) {
$owner = $fld->getOwner();
print "";
print " | ";
print "" . $fld->getName() . " | \n";
print "".$owner->getFullName()." | ";
print " |
";
}
}
print "
";
}
}
function printDocumentNotificationList($ret,$deleteaction=true) {
global $dms;
if (count($ret)==0) {
printMLText("empty_notify_list");
}
else {
print "";
print "\n\n";
print " | \n";
print "".getMLText("name")." | \n";
print "".getMLText("owner")." | \n";
print "".getMLText("status")." | \n";
print "".getMLText("version")." | \n";
print "".getMLText("actions")." | \n";
print "
\n\n";
foreach ($ret as $ID) {
$doc = $dms->getDocument($ID);
if (is_object($doc)) {
$owner = $doc->getOwner();
$latest = $doc->getLatestContent();
$status = $latest->getStatus();
print "\n";
print " | ";
print "" . $doc->getName() . " | \n";
print "".$owner->getFullName()." | ";
print "".getOverallStatusText($status["status"])." | ";
print "".$latest->getVersion()." | ";
print " |
\n";
}
}
print "
";
}
}
UI::htmlStartPage(getMLText("my_account"));
UI::globalNavigation();
UI::pageNavigation(getMLText("my_account"), "my_account");
UI::contentHeading(getMLText("edit_existing_notify"));
UI::contentContainerStart();
print "";
print "";
UI::contentContainerEnd();
//
// Display the results.
//
UI::contentHeading(getMLText("edit_folder_notify"));
UI::contentContainerStart();
UI::contentSubHeading(getMLText("user"));
$ret=getNotificationList(false,true);
printFolderNotificationList($ret);
UI::contentSubHeading(getMLText("group"));
$ret=getNotificationList(true,true);
printFolderNotificationList($ret,false);
UI::contentContainerEnd();
UI::contentHeading(getMLText("edit_document_notify"));
UI::contentContainerStart();
UI::contentSubHeading(getMLText("user"));
$ret=getNotificationList(false,false);
printDocumentNotificationList($ret);
UI::contentSubHeading(getMLText("group"));
$ret=getNotificationList(true,false);
printDocumentNotificationList($ret,false);
UI::contentContainerEnd();
UI::htmlEndPage();
?>