/** * @param SmartyHelper $smartyHelper * @param CommandSet $commandset */ public static function displayCommandSet(SmartyHelper $smartyHelper, CommandSet $commandset, $isManager, $selectedFilters = '') { #$smartyHelper->assign('commandsetId', $commandset->getId()); $smartyHelper->assign('teamid', $commandset->getTeamid()); $smartyHelper->assign('commandsetName', $commandset->getName()); $smartyHelper->assign('commandsetReference', $commandset->getReference()); $smartyHelper->assign('commandsetDesc', $commandset->getDesc()); $smartyHelper->assign('commandsetBudget', $commandset->getBudgetDays()); $smartyHelper->assign('commandsetCost', $commandset->getCost()); $smartyHelper->assign('commandsetCurrency', $commandset->getCurrency()); if (!is_null($commandset->getDate())) { $smartyHelper->assign('commandsetDate', Tools::formatDate("%Y-%m-%d", $commandset->getDate())); } $smartyHelper->assign('cmdList', self::getCommandSetCommands($commandset->getId(), Command::type_general)); $smartyHelper->assign('cmdsetDetailedMgr', self::getCommandSetDetailedMgr($commandset->getId(), Command::type_general)); // Budget $cmdList = $commandset->getCommands(Command::type_general); $cmdsProvAndMeeCost = 0; foreach ($cmdList as $cmd) { // TODO math should not be in here ! $mgrEE = $cmd->getIssueSelection()->mgrEffortEstim; $cmdProvAndMeeCost = $mgrEE * $cmd->getAverageDailyRate() + $cmd->getProvisionBudget(TRUE); $cmdsProvAndMeeCost += $cmdProvAndMeeCost; } $smartyHelper->assign('cmdsProvAndMeeCost', $cmdsProvAndMeeCost); $color1 = $cmdProvAndMeeCost > $commandset->getCost() ? "fcbdbd" : "bdfcbd"; $smartyHelper->assign('cmdsProvAndMeeCostColor', $color1); //$cmdTotalElapsed = $commandset->getIssueSelection()->getElapsed($cmd->$commandset(), $commandset->getDeadline()); $csetTotalElapsed = $commandset->getIssueSelection(Command::type_general)->getElapsed(); $smartyHelper->assign('commandsetTotalElapsed', $csetTotalElapsed); $smartyHelper->assign('cmdProvisionList', self::getProvisionList($commandset)); $smartyHelper->assign('cmdProvisionTotalList', self::getProvisionTotalList($commandset)); // DetailedChargesIndicator $data = self::getDetailedCharges($commandset, $isManager, $selectedFilters); foreach ($data as $smartyKey => $smartyVariable) { $smartyHelper->assign($smartyKey, $smartyVariable); } }
/** * list the Commands that can be added to this CommandSet. * * This depends on user's teams * @param User $user * @return string[] */ private function getCmdSetCandidates(CommandSet $cmdset, User $user) { $cmdCandidates = array(); $lTeamList = $user->getLeadedTeamList(); $managedTeamList = $user->getManagedTeamList(); $mTeamList = $user->getDevTeamList(); $teamList = $mTeamList + $lTeamList + $managedTeamList; $cmds = $cmdset->getCommands(Command::type_general); foreach ($teamList as $tid => $name) { $team = TeamCache::getInstance()->getTeam($tid); $cmdList = $team->getCommands(); foreach ($cmdList as $cid => $cmd) { // remove Cmds already in this cset. if (!array_key_exists($cid, $cmds)) { $cmdCandidates[$cid] = $cmd->getReference() . " " . $cmd->getName(); } } } asort($cmdCandidates); return $cmdCandidates; }