<option value="">— <?php echo __('Anyone');?> —</option> <option value="s0">— <?php echo __('Unassigned');?> —</option> <option value="s<?php echo $thisstaff->getId(); ?>"><?php echo __('Me');?></option> <?php if(($users=Staff::getStaffMembers())) { echo '<OPTGROUP label="'.sprintf(__('Agents (%d)'),count($users)-1).'">'; foreach($users as $id => $name) { if ($id == $thisstaff->getId()) continue; $k="s$id"; echo sprintf('<option value="%s">%s</option>', $k, $name); } echo '</OPTGROUP>'; } if(($teams=Team::getTeams())) { echo '<OPTGROUP label="'.__('Teams').' ('.count($teams).')">'; foreach($teams as $id => $name) { $k="t$id"; echo sprintf('<option value="%s">%s</option>', $k, $name); } echo '</OPTGROUP>'; } ?> </select> </fieldset> <fieldset class="span6"> <label for="topicId"><?php echo __('Help Topics');?>:</label> <select id="topicId" name="topicId"> <option value="" selected >— <?php echo __('All Help Topics');?> —</option> <?php
public function teamNameDumpAction() { if ($this->version < 1) { throw new BadRequestException(); } // Create an array to store all teams and the BZIDs $teamArray = array(); foreach (Team::getTeams() as $team) { $memberList = ""; foreach ($team->getMembers() as $member) { $memberList .= $member->getBZID() . ","; } $teamName = preg_replace("/&[^\\s]*;/", "", $team->getName()); $teamID = $team->getId(); $teamMembers = rtrim($memberList, ","); $teamArray[] = array("team" => $teamName, "members" => $teamMembers, "team_id" => $teamID, "team_name" => $teamName, "team_members" => $teamMembers); } return new JsonResponse(array("teamDump" => &$teamArray, "team_list" => &$teamArray)); }
public static function makeList() { global $lng, $coach, $settings; HTMLOUT::frame_begin(); # Make page frame, banner and menu. title($lng->getTrn('name', __CLASS__)); echo $lng->getTrn('desc', __CLASS__) . "<br><br>\n"; list($sel_node, $sel_node_id) = HTMLOUT::nodeSelector(array()); $ALLOW_EDIT = is_object($coach) && $coach->isNodeCommish($sel_node, $sel_node_id); /* A new entry was sent. Add it to system */ if ($ALLOW_EDIT && isset($_POST['tid']) && isset($_POST['trid'])) { if (get_magic_quotes_gpc()) { $_POST['title'] = stripslashes($_POST['title']); $_POST['txt'] = stripslashes($_POST['txt']); } switch ($_GET['action']) { case 'new': status(self::create($_POST['ptype'], $_POST['tid'], $_POST['trid'], $_POST['title'], $_POST['txt'])); break; } } /* Was a request for a new entry made? */ if (isset($_GET['action']) && $ALLOW_EDIT) { switch ($_GET['action']) { case 'delete': if (isset($_GET['prid']) && is_numeric($_GET['prid'])) { $pr = new Prize($_GET['prid']); status($pr->delete()); unset($pr); } else { fatal('Sorry. You did not specify which prize ID you wish to delete.'); } break; case 'new': echo "<a href='handler.php?type=prize'><-- " . $lng->getTrn('common/back') . "</a><br><br>"; $_DISABLED = !isset($_POST['trid']) ? 'DISABLED' : ''; ?> <form name="STS" method="POST" enctype="multipart/form-data"> <b><?php echo $lng->getTrn('common/tournament'); ?> </b><br> <?php echo HTMLOUT::nodeList(T_NODE_TOURNAMENT, 'trid'); ?> <input type='submit' value='<?php echo $lng->getTrn('common/select'); ?> '> </form> <br> <form method="POST" enctype="multipart/form-data"> <b><?php echo $lng->getTrn('team', __CLASS__); ?> </b><br> <select name="tid" <?php echo $_DISABLED; ?> > <?php $teams = isset($_POST['trid']) ? Team::getTeams(false, array(get_parent_id(T_NODE_TOURNAMENT, (int) $_POST['trid'], T_NODE_LEAGUE)), true) : array(); foreach ($teams as $tid => $name) { echo "<option value='{$tid}'>{$name}</option>\n"; } ?> </select> <br><br> <b><?php echo $lng->getTrn('kind', __CLASS__); ?> </b><br> <select name="ptype" <?php echo $_DISABLED; ?> > <?php foreach (self::getTypes() as $ptype => $desc) { echo "<option value='{$ptype}'>{$desc}</option>\n"; } ?> </select> <br><br> <?php echo '<b>' . $lng->getTrn('g_title', __CLASS__) . '</b> — ' . $lng->getTrn('title', __CLASS__); ?> <br> <input type="text" name="title" size="60" maxlength="100" value="" <?php echo $_DISABLED; ?> > <br><br> <?php echo '<b>' . $lng->getTrn('g_about', __CLASS__) . '</b> — ' . $lng->getTrn('about', __CLASS__); ?> <br> <textarea name="txt" rows="15" cols="100" <?php echo $_DISABLED; ?> ></textarea> <br><br><br> <input type='hidden' name='trid' value='<?php echo $_DISABLED ? 0 : $_POST['trid']; ?> '> <input type="submit" value="<?php echo $lng->getTrn('submit', __CLASS__); ?> " name="Submit" <?php echo $_DISABLED; ?> > </form> <br> <?php return; break; } } if ($ALLOW_EDIT) { echo "<br><a href='handler.php?type=prize&action=new'>" . $lng->getTrn('new', __CLASS__) . "</a><br>\n"; } /* Print the prizes */ self::printList($sel_node, $sel_node_id, $ALLOW_EDIT); HTMLOUT::frame_end(); }
echo '<td>' . $team->getStatus() . '</td>'; if ($_SESSION['login']['role'] == 3 || $_SESSION['login']['role'] == 2 && $_SESSION['login']['id_person'] == $team->getLeader()->getId()) { if ($team->getStatus() != 'Inativa') { echo '<td>' . '<a href="forms.php?p=altEquipe&cod=' . $team->getId() . '">' . '<i class="icon icon-pencil"></i> Editar' . '</a>' . '</td>'; } else { echo '<td></td>'; } } else { echo '<td></td>'; } echo '</tr>'; } } } else { if (Team::getTeams() != '') { foreach (Team::getTeams() as $team) { $calebe = false; foreach ($team->getMembers() as $cal) { if ($cal->getId() == $_SESSION['login']['id_person']) { $calebe = true; } } if ($calebe) { echo '<tr>'; echo '<td>' . $team->getId() . '</td>'; echo '<td>' . '<a class="modalTeam" data-id="' . $team->getId() . '" >' . $team->getName() . '</a>' . '</td>'; echo '<td>' . '<a class="modalCalebe" data-id="' . $team->getLeader()->getId() . '" >' . $team->getLeader()->getName() . '</a>' . '</td>'; echo '<td>' . count($team->getMembersTeam($team->getId())) . '</td>'; echo '<td>' . $team->getStatus() . '</td>'; echo '<td></td>'; echo '</tr>';
public function listAction() { return array("teams" => Team::getTeams()); }
?> " readonly="" /> <span class="input-group-addon add-on"><i class="icon-calendar"></i></span> </div> </div> </div> <div class="form-group"> <label for="pass1" class="control-label col-lg-4" title="É necessário que tenha ao menos uma equipe disponivel">Equipe da Missão</label> <div class="col-lg-5"> <select name="ID_TEAM" class="form-control" required title="É necessário que tenha ao menos uma equipe disponivel"> <option value="">Selecione a Equipe</option> <?php if (Team::getTeams()) { foreach (Team::getTeams() as $rel) { if ($rel->getStatus() == 'Disponível') { echo '<option value="' . $rel->getId() . '">' . $rel->getName() . '</option>'; } } } else { echo '<script> alert("Para agendar uma Missão é necessário ter ao menos uma Equipe!"); window.location = "consulta.php?p=equipe"; </script>'; } ?> </select> </div> </div>
protected function display() { if (Tools::isConnectedUser()) { $teamList = NULL; // leadedTeams only, except Admins: they can edit all teams if ($this->session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) { $teamList = Team::getTeams(true); } else { $teamList = $this->session_user->getLeadedTeamList(true); } if (count($teamList) > 0) { if (isset($_POST['deletedteam'])) { $teamidToDelete = Tools::getSecurePOSTIntValue("deletedteam"); if (array_key_exists($teamidToDelete, $teamList)) { $retCode = Team::delete($teamidToDelete); if (!$retCode) { $this->smartyHelper->assign('error', T_("Couldn't delete the team")); } else { if ($teamidToDelete == $_SESSION['teamid']) { unset($_SESSION['teamid']); $this->updateTeamSelector(); } unset($teamList[$teamidToDelete]); } } } // use the teamid set in the form, if not defined (first page call) use session teamid if (isset($_POST['displayed_teamid'])) { $displayed_teamid = Tools::getSecurePOSTIntValue('displayed_teamid'); } else { if (isset($_SESSION['teamid']) && array_key_exists($_SESSION['teamid'], $teamList)) { $displayed_teamid = $_SESSION['teamid']; } else { $teamIds = array_keys($teamList); if (count($teamIds) > 0) { $displayed_teamid = $teamIds[0]; } else { $displayed_teamid = 0; } } } $this->smartyHelper->assign('availableTeams', SmartyTools::getSmartyArray($teamList, $displayed_teamid)); if (array_key_exists($displayed_teamid, $teamList)) { $team = TeamCache::getInstance()->getTeam($displayed_teamid); if ($displayed_teamid != Config::getInstance()->getValue(Config::id_adminTeamId)) { $this->smartyHelper->assign('allowDeleteTeam', 1); } // ----------- actions ---------- $action = isset($_POST['action']) ? $_POST['action'] : ''; if ($action == "updateTeamLeader") { $teamleader_id = Tools::getSecurePOSTIntValue('leaderid'); if (!$team->setLeader($teamleader_id)) { $this->smartyHelper->assign('error', T_("Couldn't update the team leader")); } else { // --- add teamLeader as Mantis manager of the SideTaskProject //$leader = UserCache::getInstance()->getUser($teamleader_id); //$access_level = 70; // TODO mantis manager //$leader->setProjectAccessLevel($stproj_id, $access_level); } } elseif ($action == "updateTeamCreationDate") { $formatedDate = Tools::getSecurePOSTStringValue("date_createTeam"); $date_create = Tools::date2timestamp($formatedDate); if (!$team->setCreationDate($date_create)) { $this->smartyHelper->assign('error', T_("Couldn't update the creation date")); } } elseif ($action == "setTeamEnabled") { $isTeamEnabled = 0 == Tools::getSecurePOSTIntValue("isTeamEnabled") ? false : true; if (!$team->setEnabled($isTeamEnabled)) { $this->smartyHelper->assign('error', T_("Couldn't enable/disable team")); } } elseif ($action == "addTeamMember") { $memberid = Tools::getSecurePOSTIntValue('memberid'); $memberAccess = Tools::getSecurePOSTIntValue('member_access'); $formatedDate = Tools::getSecurePOSTStringValue("date1"); $arrivalTimestamp = Tools::date2timestamp($formatedDate); try { // save to DB $team->addMember($memberid, $arrivalTimestamp, $memberAccess); // CodevTT administrators can manage ExternalTasksProject in Mantis if (Config::getInstance()->getValue(Config::id_adminTeamId) == $team->getId()) { $newUser = UserCache::getInstance()->getUser($memberid); $extProjId = Config::getInstance()->getValue(Config::id_externalTasksProject); $access_level = 70; // TODO mantis manager $newUser->setProjectAccessLevel($extProjId, $access_level); } } catch (Exception $e) { $this->smartyHelper->assign('error', "Couldn't add user {$memberid} to the team"); } } elseif ($action == "setMemberDepartureDate") { $formatedDate = Tools::getSecurePOSTStringValue("date2"); $departureTimestamp = Tools::date2timestamp($formatedDate); $memberid = Tools::getSecurePOSTIntValue('memberid'); $team->setMemberDepartureDate($memberid, $departureTimestamp); } elseif ($action == 'addMembersFrom') { $src_teamid = Tools::getSecurePOSTIntValue('f_src_teamid'); // add all members declared in Team $src_teamid (same dates, same access) // except if already declared $team->addMembersFrom($src_teamid); } elseif ($action == 'removeIssueTooltip') { $projectid = Tools::getSecurePOSTIntValue('projectid'); $project = ProjectCache::getInstance()->getProject($projectid); $project->setIssueTooltipFields(NULL, $displayed_teamid); } elseif ($action == 'setConsistencyCheck') { $keyvalue = Tools::getSecurePOSTStringValue('checkItems'); $checkList = Tools::doubleExplode(':', ',', $keyvalue); $team->setConsistencyCheckList($checkList); } elseif ($action == 'setGeneralPrefs') { $keyvalue = Tools::getSecurePOSTStringValue('checkItems'); $checkList = Tools::doubleExplode(':', ',', $keyvalue); $team->setGeneralPrefsList($checkList); } elseif ($action == 'createSideTaskProject') { $stprojName = Tools::getSecurePOSTStringValue('stprojName'); $stproj_id = $team->createSideTaskProject($stprojName); if ($stproj_id > 0) { $stproj = ProjectCache::getInstance()->getProject($stproj_id); // add teamLeader as Mantis manager of the SideTaskProject $leader = UserCache::getInstance()->getUser($team->getLeaderId()); $access_level = 70; // TODO mantis manager $leader->setProjectAccessLevel($stproj_id, $access_level); // add SideTaskProject Categories $stproj->addCategoryProjManagement(T_("Project Management")); $stproj->addCategoryInactivity(T_("Inactivity")); $stproj->addCategoryIncident(T_("Incident")); $stproj->addCategoryTools(T_("Tools")); $stproj->addCategoryWorkshop(T_("Team Workshop")); } } elseif (isset($_POST["deleteValue"])) { $duration = TimeTrackingTools::getDurationList($displayed_teamid); $duration_value = Tools::getSecurePOSTStringValue('deleteValue'); unset($duration[$duration_value]); if (count($duration) == 0) { Config::deleteValue(Config::id_durationList, array(0, 0, $displayed_teamid, 0, 0, 0)); } else { Config::setValue(Config::id_durationList, Tools::doubleImplode(":", ",", $duration), Config::configType_keyValue, NULL, 0, 0, $displayed_teamid); } } elseif (isset($_POST["addValue"])) { $duration = TimeTrackingTools::getDurationList($displayed_teamid); $duration_value = Tools::getSecurePOSTStringValue('addValue'); $duration_display = Tools::getSecurePOSTStringValue('addDisplay'); $duration[$duration_value] = $duration_display; Config::setValue(Config::id_durationList, Tools::doubleImplode(":", ",", $duration), Config::configType_keyValue, NULL, 0, 0, $displayed_teamid); } elseif (isset($_POST["updateValue"])) { $duration = TimeTrackingTools::getDurationList($displayed_teamid); $duration_value = Tools::getSecurePOSTStringValue('updateValue'); $duration_display = Tools::getSecurePOSTStringValue('updateDisplay'); $duration[$duration_value] = $duration_display; Config::setValue(Config::id_durationList, Tools::doubleImplode(":", ",", $duration), Config::configType_keyValue, NULL, 0, 0, $displayed_teamid); } elseif (isset($_POST["deletememberid"])) { $memberid = Tools::getSecurePOSTIntValue('deletememberid'); $query = "DELETE FROM `codev_team_user_table` WHERE id = {$memberid};"; $result = SqlWrapper::getInstance()->sql_query($query); if (!$result) { $this->smartyHelper->assign('error', T_("Couldn't delete the member of the team")); } } elseif (isset($_POST['addedprojectid'])) { $projectid = Tools::getSecurePOSTIntValue('addedprojectid'); if (0 != $projectid) { $projecttype = Tools::getSecurePOSTIntValue('project_type'); try { // prepare Project to CoDev (associate with CoDev customFields if needed) // WARN: Project constructor cannot be used in here. Project::prepareProjectToCodev($projectid); // save to DB if (!$team->addProject($projectid, $projecttype)) { $this->smartyHelper->assign('error', T_("Couldn't add the project to the team")); } } catch (Exception $e) { $this->smartyHelper->assign('error', T_("Couldn't add the project to the team")); } } } elseif (isset($_POST['deletedprojectid'])) { $projectid = Tools::getSecurePOSTIntValue('deletedprojectid'); if (!$team->removeProject($projectid)) { $this->smartyHelper->assign('error', T_("Could NOT remove the project from the team")); } } elseif (isset($_POST['addedastreinte_id'])) { $onduty_id = Tools::getSecurePOSTIntValue('addedastreinte_id'); if (0 != $onduty_id) { $team->addOnDutyTask($onduty_id); } } elseif (isset($_POST['deletedastreinte_id'])) { $onduty_id = Tools::getSecurePOSTIntValue('deletedastreinte_id'); $team->removeOnDutyTask($onduty_id); } $this->smartyHelper->assign('team', $team); $smartyUserList = array(); $userList = User::getUsers(); $selectedUserid = $team->getLeaderId(); foreach ($userList as $id => $name) { $u = UserCache::getInstance()->getUser($id); $uname = $u->getRealname(); if (empty($uname)) { $uname = $name; } $smartyUserList[$id] = array('id' => $id, 'name' => $uname, 'selected' => $id == $selectedUserid); } $this->smartyHelper->assign('users', $smartyUserList); $this->smartyHelper->assign('date', date("Y-m-d", $team->getDate())); $this->smartyHelper->assign('accessLevel', Team::$accessLevelNames); $this->smartyHelper->assign('arrivalDate', date("Y-m-d", time())); $this->smartyHelper->assign('departureDate', date("Y-m-d", time())); $this->smartyHelper->assign('teamMembers', $this->getTeamMembers($displayed_teamid)); $this->smartyHelper->assign('teamEnabled', $team->isEnabled()); $this->smartyHelper->assign('otherProjects', $team->getOtherProjects()); $this->smartyHelper->assign('typeNames', Project::$typeNames); $this->smartyHelper->assign('teamProjects', $this->getTeamProjects($displayed_teamid)); $this->smartyHelper->assign('onDutyCandidates', $this->getOnDutyCandidates($team, $team->getTrueProjects())); $this->smartyHelper->assign('onDutyTasks', $this->getOnDutyTasks($team)); $this->smartyHelper->assign('duration', TimeTrackingTools::getDurationList($displayed_teamid)); $projectList = $this->getTooltipProjectCandidates($team); $this->smartyHelper->assign('tooltipProjectCandidates', $projectList); $this->smartyHelper->assign('issueTooltips', $this->getIssueTooltips($projectList, $displayed_teamid)); $this->smartyHelper->assign('itemSelection_openDialogBtLabel', T_('Configure Tooltips')); $consistencyChecks = $this->getConsistencyChecks($team); $this->smartyHelper->assign('consistencyChecks', $consistencyChecks); $teamGeneralPrefs = $this->getTeamGeneralPrefs($team); $this->smartyHelper->assign('teamGeneralPrefs', $teamGeneralPrefs); } } } }
/** * */ public function execute() { $my_endTimestamp = mktime(23, 59, 59, date('m', $this->endTimestamp), date('d', $this->endTimestamp), date('Y', $this->endTimestamp)); // candidate teams $teamList = Team::getTeams(true); if (!array_key_exists($this->displayedTeam, $teamList)) { $teamIds = array_keys($teamList); if (count($teamIds) > 0) { $this->displayedTeam = $teamIds[0]; } else { $this->displayedTeam = 0; } } // get timetracks $timetracks = array(); if (0 != $this->displayedTeam) { $members = TeamCache::getInstance()->getTeam($this->displayedTeam)->getActiveMembers(); if (!empty($members)) { $memberIdList = array_keys($members); $formatedMembers = implode(', ', $memberIdList); $query = "SELECT * FROM `codev_timetracking_table` " . "WHERE date >= {$this->startTimestamp} AND date <= {$my_endTimestamp} " . "AND userid IN ({$formatedMembers})" . "ORDER BY date;"; $result = SqlWrapper::getInstance()->sql_query($query); if (!$result) { echo "<span style='color:red'>ERROR: Query FAILED</span>"; exit; } $jobs = new Jobs(); while ($row = SqlWrapper::getInstance()->sql_fetch_object($result)) { $tt = TimeTrackCache::getInstance()->getTimeTrack($row->id, $row); $user = UserCache::getInstance()->getUser($tt->getUserId()); $issue = IssueCache::getInstance()->getIssue($tt->getIssueId()); if (!is_null($tt->getCommitterId())) { $committer = UserCache::getInstance()->getUser($tt->getCommitterId()); $committer_name = $committer->getName(); $commit_date = date('Y-m-d H:i:s', $tt->getCommitDate()); } else { $committer_name = ''; // this info does not exist before v1.0.4 $commit_date = ''; } $timetracks[$row->id] = array('user' => $user->getName(), 'date' => date('Y-m-d', $tt->getDate()), 'job' => $jobs->getJobName($tt->getJobId()), 'duration' => $tt->getDuration(), 'committer' => $committer_name, 'commit_date' => $commit_date, 'task_id' => $issue->getId(), 'task_extRef' => $issue->getTcId(), 'task_summary' => $issue->getSummary()); } } } $this->execData = array('teamList' => $teamList, 'startTimestamp' => $this->startTimestamp, 'endTimestamp' => $this->endTimestamp, 'timetracks' => $timetracks); return $this->execData; }