コード例 #1
0
ファイル: Manager.php プロジェクト: wispira/framework
 public function add($name, $description = null, $handler = null)
 {
     $command = new Command();
     $command->setName($name);
     $command->setDescription($description);
     $command->setHandler($handler);
     $this->addCommand($command);
     return $command;
 }
コード例 #2
0
ファイル: command_edit.php プロジェクト: fg-ok/codev
 /**
  * @param Command $cmd
  */
 private function updateCmdInfo(Command $cmd)
 {
     // TODO check cmd_teamid in grantedTeams
     $cmd_teamid = Tools::getSecurePOSTIntValue('cmd_teamid');
     if ($cmd_teamid != $this->teamid) {
         // switch team (because you won't find the cmd in current team's contract list)
         $_SESSION['teamid'] = $cmd_teamid;
         $this->updateTeamSelector();
     }
     $cmd->setTeamid($cmd_teamid);
     $formattedValue = Tools::getSecurePOSTStringValue('cmdName');
     // TODO UGLY WORKAROUND: command name cannot contain commas (,) because it is used as field separator in FilterManager
     $formattedValue = str_replace(",", ' ', $formattedValue);
     $cmd->setName($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('cmdReference', '');
     $cmd->setReference($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('cmdVersion', '');
     $cmd->setVersion($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('cmdReporter', '');
     $cmd->setReporter($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('cmdDesc', '');
     $cmd->setDesc($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('cmdStartDate', '');
     if ('' != $formattedValue) {
         $cmd->setStartDate(Tools::date2timestamp($formattedValue));
     }
     $formattedValue = Tools::getSecurePOSTStringValue('cmdDeadline', '');
     if ('' != $formattedValue) {
         $cmd->setDeadline(Tools::date2timestamp($formattedValue));
     }
     $cmd->setState(SmartyTools::checkNumericValue($_POST['cmdState'], true));
     $cmd->setAverageDailyRate(SmartyTools::checkNumericValue($_POST['cmdAverageDailyRate'], true));
     $cmd->setTotalSoldDays(SmartyTools::checkNumericValue($_POST['cmdTotalSoldDays'], true));
 }