* @copyright Copyright (C) 2002-2005 Markus Westphal, * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, * 2010-2012 Uwe Steinmann * @version Release: @package_version@ */ /** * Include parent class */ require_once("class.BlueStyle.php"); /** * Class which outputs the html page for ManageNotify view * * @category DMS * @package SeedDMS * @author Markus Westphal, Malcolm Cowe, Uwe Steinmann * @copyright Copyright (C) 2002-2005 Markus Westphal, * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, * 2010-2012 Uwe Steinmann * @version Release: @package_version@ */ class SeedDMS_View_ManageNotify extends SeedDMS_Blue_Style { // Get list of subscriptions for documents or folders for user or groups function getNotificationList($as_group, $folders) { /* {{{ */ // First, get the list of groups of which the user is a member. if ($as_group){ $groups = $this->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` = '". $this->user->getID()."'" ; } $resArr = $this->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) { /* {{{ */ if (count($ret)==0) { printMLText("empty_notify_list"); } else { print ""; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n\n"; foreach($ret as $ID) { $fld = $this->dms->getFolder($ID); if (is_object($fld)) { $owner = $fld->getOwner(); print ""; print ""; print "\n"; print ""; print ""; } } print "
".getMLText("name")."".getMLText("owner")."".getMLText("actions")."
" . htmlspecialchars($fld->getName()) . "".htmlspecialchars($owner->getFullName())."
"; } } /* }}} */ function printDocumentNotificationList($ret,$deleteaction=true) { /* {{{ */ if (count($ret)==0) { printMLText("empty_notify_list"); } else { print ""; print "\n\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n\n"; foreach ($ret as $ID) { $doc = $this->dms->getDocument($ID); if (is_object($doc)) { $owner = $doc->getOwner(); $latest = $doc->getLatestContent(); $status = $latest->getStatus(); print "\n"; print ""; print "\n"; print ""; print ""; print ""; print "\n"; } } print "
".getMLText("name")."".getMLText("owner")."".getMLText("status")."".getMLText("version")."".getMLText("actions")."
" . htmlspecialchars($doc->getName()) . "".htmlspecialchars($owner->getFullName())."".getOverallStatusText($status["status"])."".$latest->getVersion()."
"; } } /* }}} */ function show() { /* {{{ */ $this->dms = $this->params['dms']; $this->user = $this->params['user']; $this->db = $this->dms->getDB(); $this->htmlStartPage(getMLText("my_account")); $this->globalNavigation(); $this->pageNavigation(getMLText("my_account"), "my_account"); $this->contentHeading(getMLText("edit_existing_notify")); $this->contentContainerStart(); print "
"; $this->contentSubHeading(getMLText("choose_target_folder")); $this->printFolderChooser("form1",M_READ); print ""; print getMLText("include_subdirectories"); print ""; print getMLText("include_documents"); print "  "; print "
"; print "
"; $this->contentSubHeading(getMLText("choose_target_document")); $this->printDocumentChooser("form2"); print "  "; print "
"; $this->contentContainerEnd(); // // Display the results. // $this->contentHeading(getMLText("edit_folder_notify")); $this->contentContainerStart(); $this->contentSubHeading(getMLText("user")); $ret=$this->getNotificationList(false,true); $this->printFolderNotificationList($ret); $this->contentSubHeading(getMLText("group")); $ret=$this->getNotificationList(true,true); $this->printFolderNotificationList($ret,false); $this->contentContainerEnd(); $this->contentHeading(getMLText("edit_document_notify")); $this->contentContainerStart(); $this->contentSubHeading(getMLText("user")); $ret=$this->getNotificationList(false,false); $this->printDocumentNotificationList($ret); $this->contentSubHeading(getMLText("group")); $ret=$this->getNotificationList(true,false); $this->printDocumentNotificationList($ret,false); $this->contentContainerEnd(); $this->htmlEndPage(); } /* }}} */ } ?>