示例#1
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         // only teamMembers & observers can access this page
         if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) {
             $this->smartyHelper->assign('accessDenied', TRUE);
         } else {
             // use the servicecontractid set in the form, if not defined (first page call) use session servicecontractid
             $servicecontractid = 0;
             if (isset($_POST['servicecontractid'])) {
                 $servicecontractid = Tools::getSecurePOSTIntValue('servicecontractid');
                 $_SESSION['servicecontractid'] = $servicecontractid;
             } else {
                 if (isset($_GET['servicecontractid'])) {
                     $servicecontractid = Tools::getSecureGETIntValue('servicecontractid');
                     $_SESSION['servicecontractid'] = $servicecontractid;
                 } else {
                     if (isset($_SESSION['servicecontractid'])) {
                         $servicecontractid = $_SESSION['servicecontractid'];
                     }
                 }
             }
             // set TeamList (including observed teams)
             $oTeamList = $this->session_user->getObservedTeamList();
             $mTeamList = $this->session_user->getManagedTeamList();
             $teamList = $oTeamList + $mTeamList;
             // array_merge does not work ?!
             if (empty($teamList) || !array_key_exists($this->teamid, $teamList)) {
                 // only managers (and observers) can access this page.
                 return;
             }
             $isManager = $this->session_user->isTeamManager($this->teamid);
             $isObserver = $this->session_user->isTeamObserver($this->teamid);
             if ($isManager || $isObserver) {
                 $this->smartyHelper->assign('isManager', true);
             }
             $this->smartyHelper->assign('servicecontracts', ServiceContractTools::getServiceContracts($this->teamid, $servicecontractid));
             if (0 != $servicecontractid) {
                 $servicecontract = ServiceContractCache::getInstance()->getServiceContract($servicecontractid);
                 if ($this->teamid == $servicecontract->getTeamid()) {
                     $this->smartyHelper->assign('servicecontractid', $servicecontractid);
                     // get selected filters
                     $selectedFilters = "";
                     if (isset($_GET['selectedFilters'])) {
                         $selectedFilters = Tools::getSecureGETStringValue('selectedFilters');
                     } else {
                         $selectedFilters = $this->session_user->getServiceContractFilters($servicecontractid);
                     }
                     ServiceContractTools::displayServiceContract($this->smartyHelper, $servicecontract, $isManager || $isObserver, $selectedFilters);
                     // ConsistencyCheck
                     $consistencyErrors = $this->getConsistencyErrors($servicecontract);
                     if (0 != $consistencyErrors) {
                         $this->smartyHelper->assign('ccheckButtonTitle', count($consistencyErrors) . ' ' . T_("Errors"));
                         $this->smartyHelper->assign('ccheckBoxTitle', count($consistencyErrors) . ' ' . T_("Errors"));
                         $this->smartyHelper->assign('ccheckErrList', $consistencyErrors);
                     }
                     // access rights
                     if ($isManager || $this->session_user->isTeamLeader($servicecontract->getTeamid())) {
                         $this->smartyHelper->assign('isEditGranted', true);
                     }
                     // old-style plugins (deprecated)
                     $this->smartyHelper->assign('detailedChargesIndicatorFile', DetailedChargesIndicator::getSmartyFilename());
                     // Dashboard
                     ServiceContractTools::dashboardSettings($this->smartyHelper, $servicecontract, $this->session_userid);
                 }
             } else {
                 unset($_SESSION['cmdid']);
                 unset($_SESSION['commandsetid']);
                 $action = filter_input(INPUT_POST, 'action');
                 if ('displayServiceContract' == $action) {
                     header('Location:servicecontract_edit.php?servicecontractid=0');
                 }
             }
         }
     }
 }
示例#2
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         // only teamMembers & observers can access this page
         if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) {
             $this->smartyHelper->assign('accessDenied', TRUE);
         } else {
             // if cmdid set in URL, use it. else:
             // use the commandsetid set in the form, if not defined (first page call) use session commandsetid
             $cmdid = 0;
             if (isset($_POST['cmdid'])) {
                 $cmdid = Tools::getSecurePOSTIntValue('cmdid');
                 $_SESSION['cmdid'] = $cmdid;
             } else {
                 if (isset($_GET['cmdid'])) {
                     $cmdid = Tools::getSecureGETIntValue('cmdid');
                     $_SESSION['cmdid'] = $cmdid;
                 } else {
                     if (isset($_SESSION['cmdid'])) {
                         $cmdid = $_SESSION['cmdid'];
                     }
                 }
             }
             if (!array_key_exists($this->teamid, $this->teamList)) {
                 $this->teamid = 0;
                 $cmdid = 0;
             } else {
                 $isManager = $this->session_user->isTeamManager($this->teamid);
                 $isObserver = $this->session_user->isTeamObserver($this->teamid);
                 if ($isManager || $isObserver) {
                     // observers have access to the same info
                     $this->smartyHelper->assign('isManager', true);
                 }
             }
             $action = Tools::getSecurePOSTStringValue('action', '');
             // --- CmdStateFilters
             if ('setCmdStateFilters' == $action) {
                 $cmdStateFiltersStr = Tools::getSecurePOSTStringValue('checkedCmdStateFilters');
                 $this->session_user->setCmdStateFilters($cmdStateFiltersStr, $this->teamid);
             } else {
                 $cmdStateFiltersStr = $this->session_user->getCmdStateFilters($this->teamid);
             }
             if (!empty($cmdStateFiltersStr)) {
                 $cmdStateFilters = Tools::doubleExplode(':', ',', $cmdStateFiltersStr);
                 $this->smartyHelper->assign('isCmdStateFilter', true);
             } else {
                 $cmdStateFilters = array();
             }
             $cmdStateFilterInfo = array();
             foreach (Command::$stateNames as $stateId => $stateName) {
                 $cmdStateFilterInfo[$stateId] = array('stateId' => $stateId, 'stateName' => $stateName, 'isChecked' => array_key_exists($stateId, $cmdStateFilters) ? $cmdStateFilters[$stateId] : 1);
             }
             $this->smartyHelper->assign('cmdStateFilterInfo', $cmdStateFilterInfo);
             // --- commands combobox
             $commands = $this->getCommands($this->teamid, $cmdid, $cmdStateFilters);
             $this->smartyHelper->assign('commands', $commands);
             // check if current cmd should be hidden
             if (!array_key_exists($cmdid, $commands)) {
                 $cmdid = 0;
             }
             // ------ Display Command
             if (0 != $cmdid) {
                 $cmd = CommandCache::getInstance()->getCommand($cmdid);
                 if ($cmd->getTeamid() == $this->teamid) {
                     $this->smartyHelper->assign('commandid', $cmdid);
                     // get selected filters
                     if (isset($_GET['selectedFilters'])) {
                         $selectedFilters = Tools::getSecureGETStringValue('selectedFilters');
                     } else {
                         $selectedFilters = $this->session_user->getCommandFilters($cmdid);
                     }
                     // cleanup filters (remove empty lines)
                     $filterList = explode(',', $selectedFilters);
                     $filterList = array_filter($filterList, create_function('$a', 'return $a!="";'));
                     $selectedFilters = implode(',', $filterList);
                     CommandTools::displayCommand($this->smartyHelper, $cmd, $isManager || $isObserver, $selectedFilters);
                     // ConsistencyCheck
                     $consistencyErrors = $this->getConsistencyErrors($cmd);
                     if (count($consistencyErrors) > 0) {
                         $this->smartyHelper->assign('ccheckButtonTitle', count($consistencyErrors) . ' ' . T_("Errors"));
                         $this->smartyHelper->assign('ccheckBoxTitle', count($consistencyErrors) . ' ' . T_("Errors"));
                         $this->smartyHelper->assign('ccheckErrList', $consistencyErrors);
                     }
                     // check if sold days warning should be displayed
                     if (0 != $cmd->getTotalSoldDays()) {
                         $checkTotalSoldDays = $cmd->getTotalSoldDays() - $cmd->getIssueSelection()->mgrEffortEstim - $cmd->getProvisionDays();
                         $checkTotalSoldDays = round($checkTotalSoldDays, 2);
                         if (0 !== checkTotalSoldDays) {
                             $this->smartyHelper->assign('checkTotalSoldDays', $checkTotalSoldDays);
                         }
                     }
                     // access rights
                     if ($isManager || $this->session_user->isTeamLeader($cmd->getTeamid())) {
                         $this->smartyHelper->assign('isEditGranted', true);
                     }
                     // WBS
                     $this->smartyHelper->assign('wbsRootId', $cmd->getWbsid());
                     // indicator_plugins (old style plugins - deprecated)
                     $this->smartyHelper->assign('detailedChargesIndicatorFile', DetailedChargesIndicator::getSmartyFilename());
                     // Dashboard
                     CommandTools::dashboardSettings($this->smartyHelper, $cmd, $this->session_userid);
                 }
             } else {
                 unset($_SESSION['commandsetid']);
                 unset($_SESSION['servicecontractid']);
                 if ('displayCommand' == $action) {
                     header('Location:command_edit.php?cmdid=0');
                 }
             }
         }
     }
 }
示例#3
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         // only teamMembers & observers can access this page
         if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) {
             $this->smartyHelper->assign('accessDenied', TRUE);
         } else {
             $tmpTeamList = array($this->teamid => $this->teamList[$this->teamid]);
             $projList = $this->session_user->getProjectList($tmpTeamList, true, false);
             if (isset($_GET['projectid'])) {
                 $projectid = Tools::getSecureGETIntValue('projectid');
                 $_SESSION['projectid'] = $projectid;
             } else {
                 if (isset($_SESSION['projectid'])) {
                     $projectid = $_SESSION['projectid'];
                 } else {
                     $projectsid = array_keys($projList);
                     $projectid = $projectsid[0];
                 }
             }
             $this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($projList, $projectid));
             // if display project allowed
             if (in_array($projectid, array_keys($projList))) {
                 $this->smartyHelper->assign('projectid', $projectid);
                 // Managers can see detailed view
                 $isManager = $this->session_user->isTeamManager($this->teamid);
                 $isObserver = $this->session_user->isTeamObserver($this->teamid);
                 $this->smartyHelper->assign("isManager", $isManager || $isObserver);
                 $project = ProjectCache::getInstance()->getProject($projectid);
                 $projectIssueSel = $project->getIssueSelection();
                 // --- FILTER TABS -------------
                 // get selected filters
                 if (isset($_GET['selectedFilters'])) {
                     $selectedFilters = Tools::getSecureGETStringValue('selectedFilters');
                 } else {
                     $selectedFilters = $this->session_user->getProjectFilters($projectid);
                 }
                 // cleanup filters (remove empty lines)
                 $filterList = explode(',', $selectedFilters);
                 $filterList = array_filter($filterList, create_function('$a', 'return $a!="";'));
                 $selectedFilters = implode(',', $filterList);
                 // save user preferances
                 $this->session_user->setProjectFilters($selectedFilters, $projectid);
                 // TODO: get allFilters from config.ini
                 $data = ProjectInfoTools::getDetailedCharges($projectid, $isManager || $isObserver, $selectedFilters);
                 foreach ($data as $smartyKey => $smartyVariable) {
                     $this->smartyHelper->assign($smartyKey, $smartyVariable);
                 }
                 // --- DRIFT TABS -------------------
                 $currentIssuesInDrift = NULL;
                 $resolvedIssuesInDrift = NULL;
                 foreach ($projectIssueSel->getIssuesInDrift($isManager || $isObserver) as $issue) {
                     $smartyIssue = $this->getSmartyDirftedIssue($issue, $isManager || $isObserver);
                     if (NULL != $smartyIssue) {
                         if ($issue->isResolved()) {
                             $resolvedIssuesInDrift[] = $smartyIssue;
                         } else {
                             $currentIssuesInDrift[] = $smartyIssue;
                         }
                     }
                 }
                 $this->smartyHelper->assign("currentIssuesInDrift", $currentIssuesInDrift);
                 $this->smartyHelper->assign("resolvedIssuesInDrift", $resolvedIssuesInDrift);
                 // indicator_plugins (old style plugins - deprecated)
                 $this->smartyHelper->assign('detailedChargesIndicatorFile', DetailedChargesIndicator::getSmartyFilename());
                 // Dashboard
                 ProjectInfoTools::dashboardSettings($this->smartyHelper, $project, $this->session_userid, $this->teamid);
             }
         }
     }
 }