コード例 #1
0
ファイル: plugin.php プロジェクト: fg-ok/codev
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         // Admins only
         $userid = $_SESSION['userid'];
         //$session_user = UserCache::getInstance()->getUser($userid);
         $teamid = 9;
         // ASF_OVA_Internet
         $cmdid = 16;
         // ASF Commande Internet
         $cmd = CommandCache::getInstance()->getCommand($cmdid);
         $startTimestamp = Tools::date2timestamp('2013-11-22');
         $endTimestamp = Tools::date2timestamp('2014-06-22');
         // ------ START TESTS
         //if (FALSE == Tools::createClassMap()) { echo "ERROR createClassMap";}
         //$pm = PluginManager::getInstance();
         //$pm->discoverNewPlugins();
         // ------ END TESTS
         // feed the PluginDataProvider
         $pluginDataProvider = PluginDataProvider::getInstance();
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_ISSUE_SELECTION, $cmd->getIssueSelection());
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_TEAM_ID, $teamid);
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $startTimestamp);
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $endTimestamp);
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_PROVISION_DAYS, $cmd->getProvisionDays());
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_SESSION_USER_ID, $userid);
         // save the DataProvider for Ajax calls
         $_SESSION[PluginDataProviderInterface::SESSION_ID] = serialize($pluginDataProvider);
         // create the Dashboard
         $dashboard = new Dashboard('myDashboardId');
         $dashboard->setDomain(IndicatorPluginInterface::DOMAIN_COMMAND);
         $dashboard->setCategories(array(IndicatorPluginInterface::CATEGORY_QUALITY, IndicatorPluginInterface::CATEGORY_ACTIVITY, IndicatorPluginInterface::CATEGORY_ROADMAP, IndicatorPluginInterface::CATEGORY_PLANNING, IndicatorPluginInterface::CATEGORY_RISK, IndicatorPluginInterface::CATEGORY_TEAM));
         $dashboard->setTeamid($teamid);
         $dashboard->setUserid($userid);
         $data = $dashboard->getSmartyVariables($this->smartyHelper);
         foreach ($data as $smartyKey => $smartyVariable) {
             $this->smartyHelper->assign($smartyKey, $smartyVariable);
         }
     } else {
         $this->smartyHelper->assign('error', T_('Sorry, you need to be in the admin-team to access this page.'));
     }
 }
コード例 #2
0
 public function getCommandName()
 {
     $cmd = CommandCache::getInstance()->getCommand($this->command_id);
     return $cmd->getName();
 }
コード例 #3
0
ファイル: command_info.php プロジェクト: dfuzeau/codev
 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');
                 }
             }
         }
     }
 }
コード例 #4
0
 public function actionOperations($id = 0)
 {
     if (isset($_POST['daemon_id'])) {
         $id = $_POST['daemon_id'];
     }
     $all = $id === 'all';
     $did = (int) $id;
     $action = false;
     $params = array();
     $acts = array('active_start', 'active_stop', 'active_restart', 'active_suspend', 'suspended_resume', 'run_chat', 'run_stop', 'run_restart', 'run_console', 'global_clean_players', 'global_clear_cmdcache');
     foreach ($_POST as $k => $v) {
         if (in_array($k, $acts)) {
             $action = $k;
             break;
         }
         $params[$k] = $v;
     }
     if (($did || $all) && preg_match('/^run_/', $action)) {
         $cmd = substr($action, 4);
         if ($action == 'run_console') {
             if (!strlen(@$params['command'])) {
                 Yii::app()->user->setFlash('operations', Yii::t('admin', 'No command to send.'));
                 $this->redirect(array('operations', 'id' => $id));
             }
             $cmd = 'run_s:' . $params['command'];
         } else {
             if ($action == 'run_chat') {
                 if (!strlen(@$params['message'])) {
                     Yii::app()->user->setFlash('operations', Yii::t('admin', 'No message to send.'));
                     $this->redirect(array('operations', 'id' => $id));
                 }
                 $from = strlen(@$params['from']) ? $params['from'] : Yii::app()->user->name;
                 $cmd = 'mc:say <' . $from . '> ' . $params['message'];
             }
         }
         if ($all) {
             $res = McBridge::get()->globalCmd('server running:' . $cmd);
         } else {
             $res = array($did => McBridge::get()->cmd($did, 'server running:' . $cmd));
         }
         $msg = '';
         $runIds = array();
         $failIds = array();
         foreach ($res as $i => $r) {
             if (@$r['success']) {
                 $runIds[] = $i;
             } else {
                 $failIds[] = $i . ': ' . CHtml::encode(@$r['error']);
             }
         }
         $msg = '';
         if (count($runIds)) {
             $msg .= Yii::t('admin', 'Action run for daemons:') . '<br/>' . implode(', ', $runIds);
         }
         if (count($failIds)) {
             $msg .= (count($runIds) ? '<br/><br/>' : '') . Yii::t('admin', 'Action failed for daemons:') . '<br/>' . implode(', ', $failIds);
         }
         if (!strlen($msg)) {
             $msg = Yii::t('admin', 'No daemons affected');
         }
         Yii::app()->user->setFlash('operations', $msg);
         $this->redirect(array('operations', 'id' => $id) + $params);
     } else {
         if (($did || $all) && preg_match('/^(active_|suspended_)/', $action)) {
             $active = false;
             if (preg_match('/^active_/', $action)) {
                 $active = true;
             }
             $cond = array('suspended' => $active ? 0 : 1);
             if (!$all) {
                 $cond['daemon_id'] = $did;
             }
             $svs = Server::model()->findAllByAttributes($cond);
             $runIds = array();
             $failIds = array();
             foreach ($svs as $sv) {
                 $res = $this->runServerAction($sv, $action, $params);
                 if (!$res[0]) {
                     $failIds[] = $sv->id . ': ' . $res[1];
                 } else {
                     $runIds[] = $sv->id;
                 }
             }
             $msg = '';
             if (count($runIds)) {
                 $msg .= Yii::t('admin', 'Action run for servers:') . '<br/>' . implode(', ', $runIds);
             }
             if (count($failIds)) {
                 $msg .= (count($runIds) ? '<br/><br/>' : '') . Yii::t('admin', 'Action failed for servers:') . '<br/>' . implode(', ', $failIds);
             }
             if (!strlen($msg)) {
                 $msg = Yii::t('admin', 'No servers affected');
             }
             Yii::app()->user->setFlash('operations', $msg);
             $this->redirect(array('operations', 'id' => $id) + $params);
         } else {
             if (preg_match('/^global_/', $action)) {
                 if ($action == 'global_clean_players') {
                     $sql = 'delete from `player` where `level`=1 or `level`=(select `default_level`' . ' from `server` where `id`=`server_id`)';
                     $cmd = Yii::app()->bridgeDb->createCommand($sql);
                     $del = $cmd->execute();
                     Yii::log('Player table cleanup: Deleted ' . $del . ' player entries');
                     Yii::app()->user->setFlash('operations', Yii::t('admin', 'Deleted {del} player entries.', array('{del}' => $del)));
                     $this->redirect(array('operations', 'id' => $id));
                 } else {
                     if ($action == 'global_clear_cmdcache') {
                         CommandCache::clear();
                         Yii::log('Cleared command cache table');
                         Yii::app()->user->setFlash('operations', Yii::t('admin', 'Cleared command cache table.'));
                         $this->redirect(array('operations', 'id' => $id));
                     }
                 }
             }
         }
     }
     $this->render('operations', array('daemon_id' => $id));
 }
コード例 #5
0
ファイル: team.class.php プロジェクト: fg-ok/codev
 /**
  * Commands for this team
  * @return Command[] : array id => Command
  */
 public function getCommands()
 {
     if (NULL == $this->commandList) {
         $query = "SELECT * FROM `codev_command_table` " . "WHERE team_id = {$this->id} " . "ORDER BY reference, name;";
         $result = SqlWrapper::getInstance()->sql_query($query);
         if (!$result) {
             echo "<span style='color:red'>ERROR: Query FAILED</span>";
             exit;
         }
         $this->commandList = array();
         while ($row = SqlWrapper::getInstance()->sql_fetch_object($result)) {
             $this->commandList[$row->id] = CommandCache::getInstance()->getCommand($row->id, $row);
         }
     }
     if (self::$logger->isDebugEnabled()) {
         self::$logger->debug("getCommands(teamid={$this->id}) nbEng=" . count($this->commandList));
     }
     return $this->commandList;
 }
コード例 #6
0
ファイル: issue_info_ajax.php プロジェクト: dfuzeau/codev
     } catch (Exception $e) {
         Tools::sendBadRequest("Error: getCmdCandidates bad values: user={$userid} issue={$bugid} cmd={$cmdid}");
     }
 } else {
     if ('addToCmd' === $action) {
         $cmdid = Tools::getSecureGETIntValue('cmdid');
         $bugid = Tools::getSecureGETIntValue('bugid');
         $userid = $_SESSION['userid'];
         $teamid = $_SESSION['teamid'];
         try {
             // cmd,user,issue must exist
             // user must be manager
             // cmd must be in team's cmds
             // issue must be in team's projects
             $user = UserCache::getInstance()->getUser($userid);
             $cmd = CommandCache::getInstance()->getCommand($cmdid);
             $issue = IssueCache::getInstance()->getIssue($bugid);
             $team = TeamCache::getInstance()->getTeam($teamid);
             $prjList = $team->getProjects();
             if (!$user->isTeamManager($teamid)) {
                 $logger->error("addToCmd: NOT_MANAGER user={$userid} issue={$bugid} cmd={$cmdid}");
                 $jsonData = json_encode(array('statusMsg' => T_('Sorry, only managers can add tasks to commands')));
             } else {
                 if (!array_key_exists($issue->getProjectId(), $prjList)) {
                     $jsonData = json_encode(array('statusMsg' => T_("Sorry, this task is not in your team's projects")));
                 } else {
                     if ($teamid != $cmd->getTeamid()) {
                         Tools::sendBadRequest("Error: addToCmd bad cmdid: user={$userid} teamid={$teamid} cmd={$cmdid}");
                     } else {
                         $cmd->addIssue($bugid, true);
                         $jsonData = json_encode(array('statusMsg' => 'SUCCESS', 'cmdid' => $cmdid, 'cmdName' => $cmd->getName()));
コード例 #7
0
 static function clear()
 {
     $cmd = CommandCache::getDbConnection()->createCommand('delete from `command_cache`');
     return $cmd->execute();
 }
コード例 #8
0
ファイル: commandset.class.php プロジェクト: fg-ok/codev
 /**
  * add Command to commandset (in DB & current instance)
  *
  * @param int $cmdid
  * @param int $type Command::type_general
  * @return int id in codev_commandset_cmd_table
  */
 public function addCommand($cmdid, $type)
 {
     try {
         CommandCache::getInstance()->getCommand($cmdid);
     } catch (Exception $e) {
         self::$logger->error("addCommand({$cmdid}): Command {$cmdid} does not exist !");
         echo "<span style='color:red'>ERROR: Command  '{$cmdid}' does not exist !</span>";
         return NULL;
     }
     if (self::$logger->isDebugEnabled()) {
         self::$logger->debug("Add command {$cmdid} to commandset {$this->id}");
     }
     if (NULL == $this->getCommandIds($type)) {
         $this->cmdidByTypeList[$type] = array();
     }
     $this->cmdidByTypeList[$type][] = $cmdid;
     $query = "INSERT INTO `codev_commandset_cmd_table` (`commandset_id`, `command_id`, `type`) VALUES ({$this->id}, {$cmdid}, '{$type}');";
     $result = SqlWrapper::getInstance()->sql_query($query);
     if (!$result) {
         echo "<span style='color:red'>ERROR: Query FAILED</span>";
         exit;
     }
     $id = SqlWrapper::getInstance()->sql_insert_id();
     return $id;
 }
コード例 #9
0
ファイル: command_edit.php プロジェクト: fg-ok/codev
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) {
             $this->smartyHelper->assign('isEditGranted', FALSE);
         } else {
             // only managers can edit the SC
             $isManager = $this->session_user->isTeamManager($this->teamid);
             if (!$isManager) {
                 return;
             }
             $this->smartyHelper->assign('isEditGranted', true);
             // -------- CHECK  --------
             // this will check all existing commands (from all teams !) and remove issues that have been deleted from mantis
             Command::checkCommands();
             // use the cmdid set in the form, if not defined (first page call) use session cmdid
             $cmdid = 0;
             if (isset($_POST['cmdid'])) {
                 $cmdid = $_POST['cmdid'];
                 $_SESSION['cmdid'] = $cmdid;
             } else {
                 if (isset($_GET['cmdid'])) {
                     $cmdid = $_GET['cmdid'];
                     $_SESSION['cmdid'] = $cmdid;
                 } else {
                     if (isset($_SESSION['cmdid'])) {
                         $cmdid = $_SESSION['cmdid'];
                     }
                 }
             }
             // use the commandsetid set in the form, if not defined (first page call) use session commandsetid
             // Note: It is used for createEnv but will be overridden by the displayed command's commandsetid.
             $commandsetid = 0;
             if (isset($_POST['commandsetid'])) {
                 $commandsetid = $_POST['commandsetid'];
                 $_SESSION['commandsetid'] = $commandsetid;
             } else {
                 if (isset($_SESSION['commandsetid'])) {
                     $commandsetid = $_SESSION['commandsetid'];
                 }
             }
             $action = isset($_POST['action']) ? $_POST['action'] : '';
             if (0 == $cmdid) {
                 // -------- CREATE CMD -------
                 if ("createCmd" == $action) {
                     //$this->teamid = Tools::getSecurePOSTIntValue('teamid');
                     //$_SESSION['teamid'] = $this->teamid;
                     if (self::$logger->isDebugEnabled()) {
                         self::$logger->debug("create new Command for team {$this->teamid}<br>");
                     }
                     $cmdName = Tools::getSecurePOSTStringValue('cmdName');
                     // TODO UGLY WORKAROUND: command name cannot contain commas (,) because it is used as field separator in FilterManager
                     $cmdName = str_replace(",", ' ', $cmdName);
                     try {
                         $cmdid = Command::create($cmdName, $this->teamid);
                         $this->smartyHelper->assign('commandid', $cmdid);
                         $cmd = CommandCache::getInstance()->getCommand($cmdid);
                     } catch (Exception $e) {
                         // Smartify
                         echo "Can't create the command because the command name is already used";
                     }
                 }
                 // ------ Display Empty Command Form
                 // Note: this will be overridden by the 'update' section if the 'createCmd' action has been called.
                 $this->smartyHelper->assign('cmdInfoFormBtText', T_('Create'));
                 $this->smartyHelper->assign('cmdInfoFormAction', 'createCmd');
                 $this->smartyHelper->assign('cmdStateList', CommandTools::getCommandStateList());
                 $this->smartyHelper->assign('commandsetid', $commandsetid);
                 $this->smartyHelper->assign('commandsets', CommandSetTools::getCommandSets($this->teamid, $commandsetid));
             }
             if (0 != $cmdid) {
                 // -------- UPDATE CMD -------
                 $cmd = CommandCache::getInstance()->getCommand($cmdid);
                 // Actions
                 if ("addCmdIssue" == $action) {
                     $bugid = Tools::getSecurePOSTIntValue('bugid');
                     if (self::$logger->isDebugEnabled()) {
                         self::$logger->debug("add Issue {$bugid} on Command {$cmdid} team {$this->teamid}");
                     }
                     $cmd->addIssue($bugid, true);
                     // DBonly
                 } else {
                     if ("addCmdIssueList" == $action) {
                         $bugid_list = $_POST['bugid_list'];
                         if (self::$logger->isDebugEnabled()) {
                             self::$logger->debug("add Issues ({$bugid_list}) on Command {$cmdid} team {$this->teamid}");
                         }
                         $bugids = explode(',', $bugid_list);
                         //$cmd->addIssueList($bugids, true); // DBonly
                         foreach ($bugids as $id) {
                             if (is_numeric(trim($id))) {
                                 $cmd->addIssue(intval($id), true);
                                 // DBonly
                             } else {
                                 self::$logger->error('Attempt to set non_numeric value (' . $id . ')');
                                 die("<span style='color:red'>ERROR: Please contact your CodevTT administrator</span>");
                             }
                         }
                     } else {
                         if ("removeCmdIssue" == $action) {
                             $cmd->removeIssue($_POST['bugid']);
                         } else {
                             if ("addToCmdSet" == $action) {
                                 $commandsetid = $_POST['commandsetid'];
                                 if (self::$logger->isDebugEnabled()) {
                                     self::$logger->debug("add Command {$cmdid} to CommandSet {$commandsetid}");
                                 }
                                 $cmdset = CommandSetCache::getInstance()->getCommandSet($commandsetid);
                                 $cmdset->addCommand($cmdid, Command::type_general);
                             } else {
                                 if ("removeFromCmdSet" == $action) {
                                     $commandsetid = $_POST['commandsetid'];
                                     if (self::$logger->isDebugEnabled()) {
                                         self::$logger->debug("remove Command {$cmdid} from CommandSet {$commandsetid}");
                                     }
                                     $cmdset = CommandSetCache::getInstance()->getCommandSet($commandsetid);
                                     $cmdset->removeCommand($cmdid);
                                 } else {
                                     if ("updateCmdInfo" == $action) {
                                         $this->updateCmdInfo($cmd);
                                         header('Location:command_info.php');
                                     } else {
                                         if ("deleteCommand" == $action) {
                                             if (self::$logger->isDebugEnabled()) {
                                                 self::$logger->debug("delete Command {$cmdid}");
                                             }
                                             Command::delete($cmdid);
                                             unset($_SESSION['cmdid']);
                                             header('Location:command_info.php');
                                         } else {
                                             if ("addProvision" == $action) {
                                                 # TODO check injections
                                                 $prov_date = $_POST['date'];
                                                 $prov_type = $_POST['type'];
                                                 $prov_budget = $_POST['budget'];
                                                 $prov_budgetDays = $_POST['budgetDays'];
                                                 $prov_averageDailyRate = $_POST['averageDailyRate'];
                                                 $prov_summary = $_POST['summary'];
                                                 $isInCheckBudget = 0 == Tools::getSecurePOSTIntValue("isInCheckBudget") ? false : true;
                                                 $timestamp = Tools::date2timestamp($prov_date);
                                                 CommandProvision::create($cmd->getId(), $timestamp, $prov_type, $prov_summary, $prov_budgetDays, $prov_budget, $prov_averageDailyRate, $isInCheckBudget);
                                             } else {
                                                 if ("deleteProvision" == $action) {
                                                     # TODO check injections
                                                     $provid = $_POST['provid'];
                                                     $cmd->deleteProvision($provid);
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 // Display Command
                 $this->smartyHelper->assign('commandid', $cmdid);
                 $this->smartyHelper->assign('cmdInfoFormBtText', T_('Save'));
                 $this->smartyHelper->assign('cmdInfoFormAction', 'updateCmdInfo');
                 $this->smartyHelper->assign('isAddIssueForm', true);
                 $parentCmdSets = $this->getParentCmdSetCandidates($this->session_user);
                 $this->smartyHelper->assign('parentCmdSetCandidates', $parentCmdSets);
                 $this->smartyHelper->assign('isAddCmdSetForm', true);
                 $isManager = $this->session_user->isTeamManager($cmd->getTeamid());
                 CommandTools::displayCommand($this->smartyHelper, $cmd, $isManager);
                 $this->smartyHelper->assign('cmdProvisionType', SmartyTools::getSmartyArray(CommandProvision::$provisionNames, 1));
                 // WBS
                 $this->smartyHelper->assign('wbsRootId', $cmd->getWbsid());
                 // multiple selection dialogBox
                 $availableIssueList = $this->getChildIssuesCandidates($this->teamid);
                 $this->smartyHelper->assign('availableIssueList', $availableIssueList);
                 $this->smartyHelper->assign('sendSelectIssuesActionName', "addCmdIssueList");
                 $this->smartyHelper->assign('selectIssuesBoxTitle', T_('Add tasks to Command') . ' \'' . $cmd->getName() . '\'');
                 $this->smartyHelper->assign('openDialogLabel', T_("Add multiple tasks"));
                 $this->smartyHelper->assign('selectIssuesDoneBtText', T_("Add selection"));
                 $this->smartyHelper->assign('selectIssuesBoxDesc', T_("Note: Tasks already assigned to a Command are not displayed."));
                 $this->smartyHelper->assign('selectIssuesConfirmMsg', T_("Add the selected issues to the Command ?"));
             }
             // you can create a command OR move cmd only to managed teams
             $mTeamList = $this->session_user->getManagedTeamList();
             $this->smartyHelper->assign('grantedTeams', SmartyTools::getSmartyArray($mTeamList, $this->teamid));
         }
     }
 }
コード例 #10
0
 public function serverCmd($server, $cmd, &$data = null, $broadcast = false, $nocache = false)
 {
     $command = $cmd;
     $r = array();
     if (($cache = CommandCache::get($server, $command, $r)) === 1) {
         if (@$r['success']) {
             $data = @$r['data'];
             return true;
         }
         $this->addError(@$r['error']);
         return false;
     }
     $cmd = 'server ' . $server . ':' . $cmd;
     $ret = array();
     if ($broadcast) {
         $ret = $this->globalCmd($cmd);
     } else {
         $ret = array($this->cmd(Server::getDaemon($server), $cmd));
     }
     $e = '';
     foreach ($ret as $r) {
         if ($cache !== 0) {
             CommandCache::set($server, $command, $r);
         }
         if ($r['success']) {
             $data = $r['data'];
             return true;
         }
         $e = $r['error'];
     }
     $this->addError($e);
     return false;
 }