コード例 #1
0
ファイル: servicecontract_tools.php プロジェクト: fg-ok/codev
 /**
  *
  * @param SmartyHelper $smartyHelper
  * @param ServiceContract $servicecontract
  * @param int $userid
  */
 public static function dashboardSettings(SmartyHelper $smartyHelper, ServiceContract $servicecontract, $userid)
 {
     $pluginDataProvider = PluginDataProvider::getInstance();
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_ISSUE_SELECTION, $servicecontract->getIssueSelection(CommandSet::type_general, Command::type_general));
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_TEAM_ID, $servicecontract->getTeamid());
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_PROVISION_DAYS, $servicecontract->getProvisionDays(CommandSet::type_general, Command::type_general, TRUE));
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_SESSION_USER_ID, $userid);
     $params = self::computeTimestampsAndInterval($servicecontract);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $params['startTimestamp']);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $params['endTimestamp']);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_INTERVAL, $params['interval']);
     // save the DataProvider for Ajax calls
     $_SESSION[PluginDataProviderInterface::SESSION_ID] = serialize($pluginDataProvider);
     // create the Dashboard
     $dashboard = new Dashboard('ServiceContract' . $servicecontract->getId());
     $dashboard->setDomain(IndicatorPluginInterface::DOMAIN_SERVICE_CONTRACT);
     $dashboard->setCategories(array(IndicatorPluginInterface::CATEGORY_QUALITY, IndicatorPluginInterface::CATEGORY_ACTIVITY, IndicatorPluginInterface::CATEGORY_ROADMAP, IndicatorPluginInterface::CATEGORY_PLANNING, IndicatorPluginInterface::CATEGORY_RISK));
     $dashboard->setTeamid($servicecontract->getTeamid());
     $dashboard->setUserid($userid);
     $data = $dashboard->getSmartyVariables($smartyHelper);
     foreach ($data as $smartyKey => $smartyVariable) {
         $smartyHelper->assign($smartyKey, $smartyVariable);
     }
 }
コード例 #2
0
ファイル: team.class.php プロジェクト: fg-ok/codev
 /**
  * delete a team (and all it's ServiceContracts,CommandSets,Commands)
  * @static
  * @param int $teamidToDelete
  * @return bool
  */
 public static function delete($teamidToDelete)
 {
     try {
         $team = TeamCache::getInstance()->getTeam($teamidToDelete);
         $idlist = array_keys($team->getCommands());
         foreach ($idlist as $id) {
             Command::delete($id);
         }
         $idlist = array_keys($team->getCommandSetList());
         foreach ($idlist as $id) {
             CommandSet::delete($id);
         }
         $idlist = array_keys($team->getServiceContractList());
         foreach ($idlist as $id) {
             ServiceContract::delete($id);
         }
         $query = "DELETE FROM `codev_team_project_table` WHERE team_id = {$teamidToDelete};";
         $result = SqlWrapper::getInstance()->sql_query($query);
         if (!$result) {
             echo "<span style='color:red'>ERROR: Query FAILED</span>\n";
             exit;
         }
         $query = "DELETE FROM `codev_team_user_table` WHERE team_id = {$teamidToDelete};";
         $result = SqlWrapper::getInstance()->sql_query($query);
         if (!$result) {
             echo "<span style='color:red'>ERROR: Query FAILED</span>\n";
             exit;
         }
         $query = "DELETE FROM `codev_team_table` WHERE id = {$teamidToDelete};";
         $result = SqlWrapper::getInstance()->sql_query($query);
         if (!$result) {
             echo "<span style='color:red'>ERROR: Query FAILED</span>\n";
             exit;
         }
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
コード例 #3
0
ファイル: servicecontract.class.php プロジェクト: fg-ok/codev
 /**
  * Initialize complex static variables
  * @static
  */
 public static function staticInit()
 {
     self::$logger = Logger::getLogger(__CLASS__);
 }
コード例 #4
0
ファイル: servicecontract_info.php プロジェクト: fg-ok/codev
 /**
  * Get consistency errors
  * @param ServiceContract $serviceContract
  * @return mixed[]
  */
 private function getConsistencyErrors(ServiceContract $serviceContract)
 {
     $cerrList = $serviceContract->getConsistencyErrors();
     if (count($cerrList) > 0) {
         $consistencyErrors = array();
         foreach ($cerrList as $cerr) {
             if (!is_null($cerr->userId)) {
                 $user = UserCache::getInstance()->getUser($cerr->userId);
             } else {
                 $user = NULL;
             }
             if (Issue::exists($cerr->bugId)) {
                 $issue = IssueCache::getInstance()->getIssue($cerr->bugId);
                 $projName = $issue->getProjectName();
                 $summary = $issue->getSummary();
             } else {
                 $projName = '';
                 $summary = '';
             }
             $titleAttr = array(T_('Project') => $projName, T_('Summary') => $summary);
             $consistencyErrors[] = array('issueURL' => Tools::issueInfoURL($cerr->bugId, $titleAttr), 'issueStatus' => Constants::$statusNames[$cerr->status], 'user' => isset($user) ? $user->getName() : '', 'severity' => $cerr->getLiteralSeverity(), 'severityColor' => $cerr->getSeverityColor(), 'desc' => $cerr->desc);
         }
         return $consistencyErrors;
     }
     return NULL;
 }
コード例 #5
0
ファイル: servicecontract_edit.php プロジェクト: fg-ok/codev
 /**
  * list the Commands that can be added to this ServiceContract.
  *
  * This depends on user's teams
  * @param User $user
  * @return string[]
  */
 private function getCmdSetCandidates(ServiceContract $contract, User $user)
 {
     $cmdsetCandidates = array();
     $lTeamList = $user->getLeadedTeamList();
     $managedTeamList = $user->getManagedTeamList();
     $mTeamList = $user->getDevTeamList();
     $teamList = $mTeamList + $lTeamList + $managedTeamList;
     $contractCmdSets = $contract->getCommandSets(CommandSet::type_general);
     foreach ($teamList as $teamid => $name) {
         $team = TeamCache::getInstance()->getTeam($teamid);
         $commandsetList = $team->getCommandSetList();
         foreach ($commandsetList as $cid => $cmdset) {
             // remove CmdSets already in this contract.
             if (!array_key_exists($cid, $contractCmdSets)) {
                 $cmdsetCandidates[$cid] = $cmdset->getName();
             }
         }
     }
     asort($cmdsetCandidates);
     return $cmdsetCandidates;
 }