Beispiel #1
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         // Admins only
         $session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
         if ($session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
             $projectList = $this->getProjectList(false);
             if (isset($_POST['projectid']) && array_key_exists($_POST['projectid'], $projectList)) {
                 $projectid = Tools::getSecurePOSTIntValue('projectid');
                 $_SESSION['projectid'] = $projectid;
             } elseif (isset($_SESSION['projectid']) && array_key_exists($_SESSION['projectid'], $projectList)) {
                 $projectid = $_SESSION['projectid'];
             } else {
                 $projectIds = array_keys($projectList);
                 if (count($projectIds) > 0) {
                     $projectid = $projectIds[0];
                 } else {
                     $projectid = 0;
                 }
             }
             $this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($projectList, $projectid));
             // display current workflow
             if (0 != $projectid) {
                 $clone_projectid = Tools::getSecurePOSTIntValue('clone_projectid', 0);
                 if ($clone_projectid == $projectid || !array_key_exists($clone_projectid, $projectList)) {
                     $clone_projectid = 0;
                 }
                 $action = Tools::getSecurePOSTStringValue('action', '');
                 if ("cloneToProject" == $action) {
                     #echo "Clone $projectid ---> $clone_projectid<br>";
                     $errMsg = Project::cloneAllProjectConfig($projectid, $clone_projectid);
                     $this->smartyHelper->assign('msg', 'Clone to project : ' . $errMsg);
                 } elseif ("cloneFromProject" == $action) {
                     #echo "Clone $clone_projectid ---> $projectid<br>";
                     $errMsg = Project::cloneAllProjectConfig($clone_projectid, $projectid);
                     $this->smartyHelper->assign('msg', 'Clone from project : ' . $errMsg);
                 }
                 unset($projectList[$projectid]);
                 $this->smartyHelper->assign('cloneProjects', SmartyTools::getSmartyArray($projectList, $clone_projectid));
                 $proj = ProjectCache::getInstance()->getProject($projectid);
                 $this->smartyHelper->assign('currentProjectId', $projectid);
                 $this->smartyHelper->assign('defaultProjectId', $clone_projectid);
                 $this->smartyHelper->assign('currentProjectName', $proj->getName());
                 $this->smartyHelper->assign('disabled', 0 == $clone_projectid);
                 $projectsInfo = array();
                 $projectsInfo[] = $this->getProjectInfo($proj, "tabsProject");
                 if (0 != $clone_projectid) {
                     $cproj = ProjectCache::getInstance()->getProject($clone_projectid);
                     $this->smartyHelper->assign('defaultProjectName', $cproj->getName());
                     $projectsInfo[] = $this->getProjectInfo($cproj, "tabsCloneProject");
                 }
                 $this->smartyHelper->assign('projectsInfo', $projectsInfo);
             }
         }
     }
 }
Beispiel #2
0
 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);
             return;
         }
         $year = Tools::getSecurePOSTIntValue('year', date('Y'));
         $displayed_teamid = 0;
         if (isset($_POST['displayed_teamid'])) {
             $displayed_teamid = Tools::getSecurePOSTIntValue('displayed_teamid', 0);
         } else {
             $displayed_teamid = $this->teamid;
         }
         // --- Filters
         $filtersStr = Tools::getSecurePOSTStringValue('checkedFilters', '');
         if (!empty($filtersStr)) {
             $filters = Tools::doubleExplode(':', ',', $filtersStr);
         } else {
             $filters = array('isExternalTasks' => 1, 'isSidetasksInactivity' => 1);
         }
         $filterInfo = array();
         $filterInfo[] = array('filterId' => 'isExternalTasks', 'filterName' => T_('External Tasks'), 'isChecked' => $filters['isExternalTasks']);
         $filterInfo[] = array('filterId' => 'isSidetasksInactivity', 'filterName' => T_('Sidetasks Inactivity'), 'isChecked' => $filters['isSidetasksInactivity']);
         $this->smartyHelper->assign('filterInfo', $filterInfo);
         $this->smartyHelper->assign('checkedFilters', $filtersStr);
         // ---
         $teams = SmartyTools::getSmartyArray($this->teamList, $displayed_teamid);
         #$teams = SmartyTools::getSmartyArray(Team::getTeams(),$displayed_teamid);
         $this->smartyHelper->assign('availableTeams', $teams);
         $this->smartyHelper->assign('years', SmartyTools::getYears($year, 2));
         if ($displayed_teamid == 0 && count($teams) > 0) {
             $teamids = array_keys($teams);
             $displayed_teamid = $teamids[0];
         }
         $team = TeamCache::getInstance()->getTeam($displayed_teamid);
         $users = $team->getUsers();
         $months = array();
         for ($i = 1; $i <= 12; $i++) {
             $monthTimestamp = mktime(0, 0, 0, $i, 1, $year);
             $nbDaysInMonth = date("t", $monthTimestamp);
             $endMonthTimestamp = strtotime("last day of this month", $monthTimestamp);
             $months[$i] = array("name" => Tools::formatDate("%B %Y", $monthTimestamp), "idcaption" => Tools::formatDate("%B", $monthTimestamp), "days" => $this->getDays($nbDaysInMonth, $i, $year), "users" => $this->getDaysUsers($i, $year, $displayed_teamid, $users, $nbDaysInMonth, $filters), "workdays" => Holidays::getInstance()->getWorkdays($monthTimestamp, $endMonthTimestamp), "filename_csv" => date("Ym", $monthTimestamp) . '_' . str_replace(' ', '_', $team->getName()) . '_holidays.csv');
         }
         $this->smartyHelper->assign('months', $months);
     }
 }
Beispiel #3
0
 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 {
             $weekid = isset($_POST['weekid']) ? $_POST['weekid'] : date('W');
             $year = isset($_POST['year']) ? $_POST['year'] : date('Y');
             $this->smartyHelper->assign('weeks', SmartyTools::getWeeks($weekid, $year));
             $this->smartyHelper->assign('years', SmartyTools::getYears($year, 2));
             if ('computeCsvWeekly' == $_POST['action']) {
                 $formatedteamName = TeamCache::getInstance()->getTeam($this->teamid)->getName();
                 $weekDates = Tools::week_dates($weekid, $year);
                 $startTimestamp = $weekDates[1];
                 $endTimestamp = mktime(23, 59, 59, date("m", $weekDates[5]), date("d", $weekDates[5]), date("Y", $weekDates[5]));
                 $reports = "";
                 $managedIssuesfile = Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports' . DIRECTORY_SEPARATOR . $formatedteamName . "_Mantis_" . Tools::formatDate("%Y%m%d", time()) . ".csv";
                 $managedIssuesfile = ExportCsvTools::exportManagedIssuesToCSV($this->teamid, $startTimestamp, $endTimestamp, $managedIssuesfile);
                 $reports[] = array('file' => basename($managedIssuesfile), 'title' => T_('Export Managed Issues'), 'subtitle' => T_('Issues form Team projects, including issues assigned to other teams'));
                 $timeTracking = new TimeTracking($startTimestamp, $endTimestamp, $this->teamid);
                 $weekActivityReportfile = Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports' . DIRECTORY_SEPARATOR . $formatedteamName . "_CRA_" . Tools::formatDate("%Y_W%W", $startTimestamp) . ".csv";
                 $weekActivityReportfile = $this->exportWeekActivityReportToCSV($this->teamid, $weekDates, $timeTracking, $weekActivityReportfile);
                 $reports[] = array('file' => basename($weekActivityReportfile), 'title' => T_('Export Week') . ' ' . $weekid . ' ' . T_('Member Activity'));
                 $projectActivityFile = Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports' . DIRECTORY_SEPARATOR . $formatedteamName . "_projects_" . Tools::formatDate("%Y_W%W", $startTimestamp) . ".csv";
                 $projectActivityFile = $this->exportProjectActivityToCSV($timeTracking, $projectActivityFile);
                 $reports[] = array('file' => basename($projectActivityFile), 'title' => T_('Export Week') . ' ' . $weekid . ' ' . T_('Projects Activity'));
                 $this->smartyHelper->assign('reports', $reports);
                 $monthsReport = "";
                 // reduce scope to enhance speed
                 $monthsLineReport = "";
                 $startMonth = 1;
                 for ($i = $startMonth; $i <= 12; $i++) {
                     $myFile = ExportCsvTools::exportHolidaystoCSV($i, $year, $this->teamid, $formatedteamName, Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports');
                     $monthsLineReport[] = array('file' => basename($myFile));
                 }
                 $monthsReport['title'] = T_('Export Holidays') . ' ' . $year;
                 $monthsReport['line'] = $monthsLineReport;
                 $this->smartyHelper->assign('monthsReport', $monthsReport);
                 $this->smartyHelper->assign('reportsDir', Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports');
             }
         }
     }
 }
Beispiel #4
0
 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 'support' is set in the URL, display graphs for 'with/without Support'
             $displayNoSupport = isset($_GET['support']) ? TRUE : FALSE;
             $this->smartyHelper->assign('displayNoSupport', $displayNoSupport);
             $team = TeamCache::getInstance()->getTeam($this->teamid);
             $min_year = date("Y", $team->getDate());
             $year = isset($_POST['year']) && $_POST['year'] > $min_year ? $_POST['year'] : $min_year;
             $this->smartyHelper->assign('years', SmartyTools::getYearsToNow($min_year, $year));
             //plugins
             $this->smartyHelper->assign('statusHistoryIndicatorFile', StatusHistoryIndicator::getSmartyFilename());
             $this->smartyHelper->assign('effortEstimReliabilityIndicatorFile', EffortEstimReliabilityIndicator::getSmartyFilename());
             if ('computeTeamHistory' == $_POST['action']) {
                 $month = $year == $min_year ? date("m", $team->getDate()) : 1;
                 $day = $year == $min_year ? date("d", $team->getDate()) : 1;
                 if (count($team->getProjects(FALSE)) > 0) {
                     $timeTrackingTable = $this->createTimeTrackingList($day, $month, $year, $this->teamid);
                     $this->generateSubmittedResolvedGraph($timeTrackingTable, FALSE);
                     $this->generateSubmittedResolvedGraph($timeTrackingTable, TRUE);
                     // ExtRefOnly
                     $this->generateTimeDriftGraph($timeTrackingTable);
                     $this->generateResolvedDriftGraph($timeTrackingTable, $displayNoSupport, FALSE);
                     $this->generateResolvedDriftGraph($timeTrackingTable, $displayNoSupport, TRUE);
                     // ExtRefOnly
                     $this->generateEfficiencyGraph($timeTrackingTable);
                     $this->generateReopenedRateGraph($timeTrackingTable);
                     $this->generateDevelopersWorkloadGraph($timeTrackingTable);
                     // --- BEGIN FDJ SPECIFIC ---
                     $this->generateEffortEstimReliabilityGraph($this->teamid, $timeTrackingTable);
                     // --- END FDJ SPECIFIC ---
                     #$this->generateStatusHistoryGraph($teamid);
                 } else {
                     $this->smartyHelper->assign('error', T_('No projects in this team'));
                 }
             }
         }
     }
 }
Beispiel #5
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         $session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
         $mTeamList = $session_user->getDevTeamList();
         $lTeamList = $session_user->getLeadedTeamList();
         $oTeamList = $session_user->getObservedTeamList();
         $managedTeamList = $session_user->getManagedTeamList();
         $teamList = $mTeamList + $lTeamList + $oTeamList + $managedTeamList;
         $defaultTeam = isset($_SESSION['teamid']) ? $_SESSION['teamid'] : 0;
         $teamid = Tools::getSecureGETIntValue('teamid', $defaultTeam);
         $_SESSION['teamid'] = $teamid;
         $this->smartyHelper->assign('teams', SmartyTools::getSmartyArray($teamList, $teamid));
         // if current team is not in allowed list, do not display
         if (array_key_exists($teamid, $teamList)) {
             $team = TeamCache::getInstance()->getTeam($teamid);
             $start_year = date("Y", $team->getDate());
             $start_month = date("m", $team->getDate());
             $start_day = date("d", $team->getDate());
             $statusNames = Config::getInstance()->getValue("statusNames");
             ksort($statusNames);
             $this->smartyHelper->assign('statusNames', $statusNames);
             $periodStatsReport = new PeriodStatsReport($start_year, $start_month, $start_day, $teamid);
             $periodStatsList = $periodStatsReport->computeReport();
             $periods = array();
             foreach ($periodStatsList as $date => $ps) {
                 $status = array();
                 foreach ($statusNames as $s => $sname) {
                     $status[$s] = $ps->getStatusCount($s);
                 }
                 $periods[Tools::formatDate("%B %Y", $date)] = $status;
             }
             $this->smartyHelper->assign('periods', $periods);
         }
     }
 }
Beispiel #6
0
 protected function updateTeamSelector()
 {
     if (Tools::isConnectedUser()) {
         // use the teamid set in the form, if not defined (first page call) use session teamid
         if (isset($_GET['teamid'])) {
             $this->teamid = Tools::getSecureGETIntValue('teamid');
             $_SESSION['teamid'] = $this->teamid;
         } else {
             $this->teamid = isset($_SESSION['teamid']) ? $_SESSION['teamid'] : 0;
         }
         $this->smartyHelper->assign('teamid', $this->teamid);
         $this->session_userid = $_SESSION['userid'];
         $this->session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
         $this->teamList = $this->session_user->getTeamList();
         if (count($this->teamList) > 0) {
             $this->smartyHelper->assign('teams', SmartyTools::getSmartyArray($this->teamList, $_SESSION['teamid']));
         }
         $this->session_user->setDefaultTeam($this->teamid);
         // used to disable some menu items
         if ($this->session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
             $this->smartyHelper->assign('isAdmin', true);
         }
     }
 }
Beispiel #7
0
 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 {
             $projects[0] = T_('All projects');
             $projects += TeamCache::getInstance()->getTeam($this->teamid)->getProjects(false);
             $projectid = 0;
             if (isset($_POST['projectid']) && array_key_exists($_POST['projectid'], $projects)) {
                 $projectid = Tools::getSecurePOSTIntValue('projectid');
                 $_SESSION['projectid'] = $_POST['projectid'];
             } else {
                 if (isset($_SESSION['projectid']) && array_key_exists($_SESSION['projectid'], $projects)) {
                     $projectid = $_SESSION['projectid'];
                 }
             }
             $this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($projects, $projectid));
             // The first day of the current week
             $weekDates = Tools::week_dates(date('W'), date('Y'));
             $startdate = Tools::getSecurePOSTStringValue('startdate', Tools::formatDate("%Y-%m-%d", $weekDates[1]));
             $this->smartyHelper->assign('startDate', $startdate);
             // The current date plus one year
             $enddate = Tools::getSecurePOSTStringValue('enddate', Tools::formatDate("%Y-%m-%d", strtotime('+6 month')));
             $this->smartyHelper->assign('endDate', $enddate);
             if ('computeGantt' == $_POST['action']) {
                 $startT = Tools::date2timestamp($startdate);
                 $endT = Tools::date2timestamp($enddate);
                 #$endT += 24 * 60 * 60 -1; // + 1 day -1 sec.
                 // draw graph
                 $this->smartyHelper->assign('urlGraph', 'teamid=' . $this->teamid . '&projects=' . $projectid . '&startT=' . $startT . '&endT=' . $endT);
             }
         }
     }
 }
Beispiel #8
0
 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);
             }
         }
     }
 }
 /**
  *
  * @param boolean $isAjaxCall
  * @return array
  */
 public function getSmartyVariables($isAjaxCall = false)
 {
     $availableTeams = SmartyTools::getSmartyArray($this->execData['teamList'], $this->displayedTeam);
     $smartyVariables = array('timetrackDetailsIndicator_availableTeams' => $availableTeams, 'timetrackDetailsIndicator_startDate' => Tools::formatDate("%Y-%m-%d", $this->execData['startTimestamp']), 'timetrackDetailsIndicator_endDate' => Tools::formatDate("%Y-%m-%d", $this->execData['endTimestamp']), 'timetrackDetailsIndicator_timetracks' => $this->execData['timetracks'], 'timetrackDetailsIndicator_' . self::OPTION_DISPLAYED_TEAM => $this->displayedTeam);
     if (false == $isAjaxCall) {
         $smartyVariables['timetrackDetailsIndicator_ajaxFile'] = self::getSmartySubFilename();
         $smartyVariables['timetrackDetailsIndicator_ajaxPhpURL'] = self::getAjaxPhpURL();
     }
     return $smartyVariables;
 }
Beispiel #10
0
 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 {
             $team = TeamCache::getInstance()->getTeam($this->teamid);
             // if first call to this page
             if (!array_key_exists('nextForm', $_POST)) {
                 $activeMembers = $team->getActiveMembers();
                 if ($this->session_user->isTeamManager($this->teamid)) {
                     $this->smartyHelper->assign('users', SmartyTools::getSmartyArray($activeMembers, $this->session_userid));
                 } else {
                     // developper & manager can add timeTracks
                     if (array_key_exists($this->session_userid, $activeMembers)) {
                         $_POST['userid'] = $this->session_userid;
                         $_POST['nextForm'] = "addHolidaysForm";
                         //$_POST['days'] = 'dayid';
                     }
                 }
             }
             $nextForm = Tools::getSecurePOSTStringValue('nextForm', '');
             if ($nextForm == "addHolidaysForm") {
                 $userid = Tools::getSecurePOSTIntValue('userid', $this->session_userid);
                 $managed_user = UserCache::getInstance()->getUser($userid);
                 // dates
                 $startdate = Tools::getSecurePOSTStringValue('startdate', date("Y-m-d"));
                 $enddate = Tools::getSecurePOSTStringValue('enddate', '');
                 $defaultBugid = Tools::getSecurePOSTIntValue('bugid', 0);
                 $action = Tools::getSecurePOSTStringValue('action', '');
                 $duration = Tools::getSecurePOSTNumberValue('duree', 0);
                 if ("addHolidays" == $action) {
                     // TODO add tracks !
                     $job = Tools::getSecurePOSTStringValue('job');
                     $duration = Tools::getSecurePOSTNumberValue('duree');
                     $holydays = Holidays::getInstance();
                     $keyvalue = Tools::getSecurePOSTStringValue('checkedDays');
                     $checkedDaysList = Tools::doubleExplode(':', ',', $keyvalue);
                     $startTimestamp = Tools::date2timestamp($startdate);
                     $endTimestamp = Tools::date2timestamp($enddate);
                     // save to DB
                     $weekday = date('l', strtotime($startdate));
                     $timestamp = $startTimestamp;
                     while ($timestamp <= $endTimestamp) {
                         // check if not a fixed holiday
                         if (!$holydays->isHoliday($timestamp)) {
                             // check existing timetracks on $timestamp and adjust duration
                             $availabletime = $managed_user->getAvailableTime($timestamp);
                             // not imput more than possible
                             if ($duration >= $availabletime) {
                                 $imput = $availabletime;
                             } else {
                                 $imput = $duration;
                             }
                             // check if weekday checkbox is checked
                             if (1 == $checkedDaysList[$weekday]) {
                                 if ($duration > 0) {
                                     if (self::$logger->isDebugEnabled()) {
                                         self::$logger->debug(date("Y-m-d", $timestamp) . " duration {$imput} job {$job}");
                                     }
                                     TimeTrack::create($managed_user->getId(), $defaultBugid, $job, $timestamp, $imput, $this->session_userid);
                                 }
                             }
                         }
                         $timestamp = strtotime("+1 day", $timestamp);
                         $weekday = date('l', strtotime(date("Y-m-d", $timestamp)));
                     }
                     // We redirect to holidays report, so the user can verify his holidays
                     header('Location:holidays_report.php');
                 }
                 $this->smartyHelper->assign('startDate', $startdate);
                 $this->smartyHelper->assign('endDate', $enddate);
                 if ($this->session_userid != $managed_user->getId()) {
                     $this->smartyHelper->assign('otherrealname', $managed_user->getRealname());
                 }
                 // Get Team SideTasks Project List
                 $projList = $team->getProjects(true, false);
                 foreach ($projList as $pid => $pname) {
                     // we want only SideTasks projects
                     try {
                         if (!$team->isSideTasksProject($pid)) {
                             unset($projList[$pid]);
                         }
                     } catch (Exception $e) {
                         self::$logger->error("project {$pid}: " . $e->getMessage());
                     }
                 }
                 $extproj_id = Config::getInstance()->getValue(Config::id_externalTasksProject);
                 $extProj = ProjectCache::getInstance()->getProject($extproj_id);
                 $projList[$extproj_id] = $extProj->getName();
                 $defaultProjectid = Tools::getSecurePOSTIntValue('projectid', 0);
                 if ($defaultBugid != 0 && $action == 'setBugId') {
                     // find ProjectId to update categories
                     $issue = IssueCache::getInstance()->getIssue($defaultBugid);
                     $defaultProjectid = $issue->getProjectId();
                 }
                 $this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($projList, $defaultProjectid));
                 $this->smartyHelper->assign('issues', $this->getIssues($defaultProjectid, $projList, $extproj_id, $defaultBugid));
                 $this->smartyHelper->assign('jobs', $this->getJobs($defaultProjectid, $projList));
                 $this->smartyHelper->assign('duration', SmartyTools::getSmartyArray(TimeTrackingTools::getDurationList($team->getId()), $duration));
                 $this->smartyHelper->assign('userid', $managed_user->getId());
             }
         }
     }
 }
Beispiel #11
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         $user = UserCache::getInstance()->getUser($_SESSION['userid']);
         $teamid = $_SESSION['teamid'];
         $teamList = $user->getTeamList();
         if (count($teamList) > 0) {
             // --- define the list of tasks the user can display
             // All projects from teams where I'm a Developper or Manager AND Observer
             $allProject[0] = T_('(all)');
             $dTeamList = $user->getDevTeamList();
             $devProjList = count($dTeamList) > 0 ? $user->getProjectList($dTeamList, true, false) : array();
             $managedTeamList = $user->getManagedTeamList();
             $managedProjList = count($managedTeamList) > 0 ? $user->getProjectList($managedTeamList, true, false) : array();
             $oTeamList = $user->getObservedTeamList();
             $observedProjList = count($oTeamList) > 0 ? $user->getProjectList($oTeamList, true, false) : array();
             $projList = $allProject + $devProjList + $managedProjList + $observedProjList;
             // if 'support' is set in the URL, display graphs for 'with/without Support'
             $displaySupport = filter_input(INPUT_GET, 'support') ? true : false;
             if ($displaySupport) {
                 $this->smartyHelper->assign('support', $displaySupport);
             }
             if (filter_input(INPUT_GET, 'bugid')) {
                 $bug_id = Tools::getSecureGETIntValue('bugid', 0);
             } else {
                 if (isset($_SESSION['bugid'])) {
                     $bug_id = $_SESSION['bugid'];
                 } else {
                     $bug_id = 0;
                     unset($_SESSION['bugid']);
                 }
             }
             $bugs = NULL;
             $projects = NULL;
             if ($bug_id != 0) {
                 try {
                     $issue = IssueCache::getInstance()->getIssue($bug_id);
                     $defaultProjectid = $issue->getProjectId();
                     $bugs = SmartyTools::getBugs($defaultProjectid, $bug_id);
                     if (array_key_exists($defaultProjectid, $projList) && array_key_exists($bug_id, $bugs)) {
                         $consistencyErrors = NULL;
                         $ccheck = new ConsistencyCheck2(array($issue));
                         $cerrList = $ccheck->check();
                         if (0 != count($cerrList)) {
                             foreach ($cerrList as $cerr) {
                                 $consistencyErrors[] = array('severity' => $cerr->getLiteralSeverity(), 'severityColor' => $cerr->getSeverityColor(), 'desc' => $cerr->desc);
                             }
                             $this->smartyHelper->assign('ccheckButtonTitle', count($consistencyErrors) . ' ' . T_("Errors"));
                             $this->smartyHelper->assign('ccheckBoxTitle', count($consistencyErrors) . ' ' . T_("Errors"));
                             $this->smartyHelper->assign('ccheckErrList', $consistencyErrors);
                         }
                         $this->smartyHelper->assign('isManager', $user->isTeamManager($teamid));
                         $this->smartyHelper->assign('isObserver', $user->isTeamObserver($teamid));
                         $isManagerView = array_key_exists($issue->getProjectId(), $managedProjList) ? true : false;
                         $isObserverView = array_key_exists($issue->getProjectId(), $observedProjList) ? true : false;
                         $this->smartyHelper->assign('issueGeneralInfo', IssueInfoTools::getIssueGeneralInfo($issue, $isManagerView || $isObserverView, $displaySupport));
                         $timeTracks = $issue->getTimeTracks();
                         $this->smartyHelper->assign('jobDetails', $this->getJobDetails($timeTracks));
                         $this->smartyHelper->assign('timeDrift', $this->getTimeDrift($issue));
                         $this->smartyHelper->assign('months', $this->getCalendar($issue, $timeTracks));
                         // set Commands I belong to
                         $parentCmds = $this->getParentCommands($issue);
                         $this->smartyHelper->assign('parentCommands', $parentCmds);
                         $this->smartyHelper->assign('nbParentCommands', count($parentCmds));
                     }
                     $projects = SmartyTools::getSmartyArray($projList, $defaultProjectid);
                     $_SESSION['projectid'] = $defaultProjectid;
                     $_SESSION['bugid'] = $bug_id;
                     // Dashboard
                     IssueInfoTools::dashboardSettings($this->smartyHelper, $issue, $this->session_userid, $this->teamid);
                 } catch (Exception $e) {
                     self::$logger->warn("issue {$bug_id} not found in mantis DB !");
                     unset($_SESSION['bugid']);
                 }
             } else {
                 try {
                     $defaultProjectid = 0;
                     if (isset($_SESSION['projectid']) && 0 != $_SESSION['projectid']) {
                         $defaultProjectid = $_SESSION['projectid'];
                         $bugs = SmartyTools::getBugs($defaultProjectid, $bug_id);
                     } else {
                         $bugs = SmartyTools::getBugs($defaultProjectid, $bug_id, $projList);
                     }
                     $projects = SmartyTools::getSmartyArray($projList, $defaultProjectid);
                 } catch (Exception $e) {
                     self::$logger->warn("issue {$bug_id} not found in mantis DB !");
                     unset($_SESSION['bugid']);
                 }
             }
             $this->smartyHelper->assign('bugs', $bugs);
             $this->smartyHelper->assign('projects', $projects);
         }
     }
 }
Beispiel #12
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         $user = UserCache::getInstance()->getUser($_SESSION['userid']);
         $teamList = $user->getTeamList();
         if (0 != count($teamList)) {
             // ---- select project
             // define the list of tasks the user can display
             // All projects from teams where I'm a Developper or Manager AND Observers
             $dTeamList = $user->getDevTeamList();
             $devProjList = 0 == count($dTeamList) ? array() : $user->getProjectList($dTeamList);
             $managedTeamList = $user->getManagedTeamList();
             $managedProjList = 0 == count($managedTeamList) ? array() : $user->getProjectList($managedTeamList);
             $oTeamList = $user->getObservedTeamList();
             $observedProjList = 0 == count($oTeamList) ? array() : $user->getProjectList($oTeamList);
             $projList = $devProjList + $managedProjList + $observedProjList;
             if (isset($_GET['projectid'])) {
                 $projectid = Tools::getSecureGETIntValue('projectid');
                 $_SESSION['projectid'] = $projectid;
             } else {
                 if (isset($_SESSION['projectid'])) {
                     $projectid = $_SESSION['projectid'];
                 } else {
                     $projectsid = array_keys($projList);
                     $projectid = $projectsid[0];
                 }
             }
             // get selected filters
             if (isset($_GET['selectedFilters']) && NULL != $_GET['selectedFilters']) {
                 $selectedFilters = Tools::getSecureGETStringValue('selectedFilters');
                 #echo "last = ".$selectedFilters[strlen($selectedFilters)-1];
                 if (',' == $selectedFilters[strlen($selectedFilters) - 1]) {
                     $selectedFilters = substr($selectedFilters, 0, -1);
                     // last char is a ','
                 }
                 $filterList = explode(',', $selectedFilters);
             } else {
                 $selectedFilters = "";
                 $filterList = array();
             }
             $this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($projList, $projectid));
             $project = ProjectCache::getInstance()->getProject($projectid);
             // ----
             $availFilterList = array("ProjectVersionFilter" => "Project Version", "ProjectCategoryFilter" => "Project Category", "IssueExtIdFilter" => "Issue External ID", "IssuePublicPrivateFilter" => "Issue Public / Private", "IssueTagFilter" => "Issue Tags");
             $selectedFilterList = array();
             foreach ($filterList as $id) {
                 $selectedFilterList[$id] = $availFilterList[$id];
                 unset($availFilterList[$id]);
             }
             // do the work ...
             $projectIssueSel = $project->getIssueSelection();
             $filterMgr = new FilterManager($projectIssueSel, $filterList);
             $resultList = $filterMgr->execute();
             $issueSelList = $filterMgr->explodeResults($resultList);
             $smatyObj = $this->getDetailedMgr($issueSelList, $filterList);
             $totalLine = array_shift($smatyObj);
             // first line is rootElem (TOTAL)
             $titleLine = array_pop($smatyObj);
             // last line is the table titles
             $this->smartyHelper->assign('availFilterList', $availFilterList);
             $this->smartyHelper->assign('selectedFilterList', $selectedFilterList);
             $this->smartyHelper->assign('selectedFilters', $selectedFilters);
             $this->smartyHelper->assign('nbFilters', count($filterList));
             $this->smartyHelper->assign('filterResultsTitles', $titleLine);
             $this->smartyHelper->assign('filterResults', $smatyObj);
             $this->smartyHelper->assign('filterResultsTotal', $totalLine);
         }
     }
 }
Beispiel #13
0
 /**
  * Action on 'Save' button
  *
  * @param CommandSet $cmdset
  */
 private function updateCommandSetInfo($cmdset)
 {
     // TODO check sc_teamid in grantedTeams
     $cset_teamid = Tools::getSecurePOSTIntValue('cset_teamid');
     if ($cset_teamid != $this->teamid) {
         // switch team (because you won't find the SC in current team's contract list)
         $_SESSION['teamid'] = $cset_teamid;
         $this->updateTeamSelector();
     }
     $cmdset->setTeamid($cset_teamid);
     $formattedValue = Tools::escape_string($_POST['commandsetName']);
     $cmdset->setName($formattedValue);
     $formattedValue = Tools::escape_string($_POST['commandsetReference']);
     $cmdset->setReference($formattedValue);
     $formattedValue = Tools::escape_string($_POST['commandsetDesc']);
     $cmdset->setDesc($formattedValue);
     $formattedValue = Tools::escape_string($_POST['commandsetDate']);
     if ('' != $formattedValue) {
         $cmdset->setDate(Tools::date2timestamp($formattedValue));
     }
     $cmdset->setCost(SmartyTools::checkNumericValue($_POST['commandsetCost'], true));
     $cmdset->setBudgetDays(SmartyTools::checkNumericValue($_POST['commandsetBudget'], true));
 }
Beispiel #14
0
 /**
  * Display HTML page
  */
 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 {
             #$isManager = $this->session_user->isTeamManager($this->teamid);
             #$this->smartyHelper->assign('isManager', $isManager);
             $tmpTeamList = array($this->teamid => $this->teamList[$this->teamid]);
             $projList = $this->session_user->getProjectList($tmpTeamList, true, false);
             reset($projList);
             $projectid = key($projList);
             $odtTemplate = NULL;
             $action = Tools::getSecurePOSTStringValue('action', '');
             if ('downloadODT' == $action) {
                 $projectid = Tools::getSecurePOSTIntValue('projectid', NULL);
                 $formattedCategories = Tools::getSecurePOSTStringValue('categoryList', NULL);
                 $formattedStatuses = Tools::getSecurePOSTStringValue('statusList', NULL);
                 $formattedReporters = Tools::getSecurePOSTStringValue('reporterList', NULL);
                 $formattedHandlers = Tools::getSecurePOSTStringValue('handlerList', NULL);
                 $odtBasename = Tools::getSecurePOSTStringValue('templateFile', NULL);
                 $odtTemplate = Constants::$codevRootDir . '/odt_templates/' . $odtBasename;
             }
             $this->smartyHelper->assign('odtTemplates', $this->getTemplates(NULL, basename($odtTemplate)));
             $this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($projList, $projectid));
             $selectedCategories = empty($formattedCategories) ? array(0) : explode(',', $formattedCategories);
             $this->smartyHelper->assign('categories', $this->getProjectCategories($projectid, $selectedCategories));
             $selectedStatusList = empty($formattedStatuses) ? array(0) : explode(',', $formattedStatuses);
             $this->smartyHelper->assign('statuses', $this->getProjectStatusList($projectid, $selectedStatusList));
             $selectedReporters = empty($formattedReporters) ? array(0) : explode(',', $formattedReporters);
             $this->smartyHelper->assign('reporters', $this->getTeamMembers($selectedReporters));
             $selectedHandlers = empty($formattedHandlers) ? array(0) : explode(',', $formattedHandlers);
             $this->smartyHelper->assign('handlers', $this->getTeamMembers($selectedHandlers));
             if ('downloadODT' == $action) {
                 $iSel = $this->getIssueSelection($projectid, $formattedCategories, $formattedReporters, $formattedHandlers, $formattedStatuses);
                 #echo implode(',', array_keys($iSel->getIssueList())).'<br>';
                 $odfFilepath = $this->generateODT($iSel, $projectid, $odtTemplate);
                 $this->smartyHelper->assign('odtFilename', basename($odfFilepath));
             }
         }
     }
 }
Beispiel #15
0
 /**
  * @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));
 }
Beispiel #16
0
 /**
  * @param int $commandsetid
  * @param int $type Command::type_general
  * @return mixed[]
  */
 private static function getCommandSetDetailedMgr($commandsetid, $type)
 {
     $csetDetailedMgr = NULL;
     if (0 != $commandsetid) {
         $commandset = CommandSetCache::getInstance()->getCommandSet($commandsetid);
         $issueSelection = $commandset->getIssueSelection($type);
         $csetDetailedMgr = SmartyTools::getIssueSelectionDetailedMgr($issueSelection);
     }
     return $csetDetailedMgr;
 }
Beispiel #17
0
 /**
  * Get project activity report
  * @param mixed[][][] $projectTracks
  * @param int $teamid The team id
  * @param boolean $isDetailed
  * @return mixed[]
  */
 private function getProjectActivityReport(array $projectTracks, $teamid, $isDetailed)
 {
     $team = TeamCache::getInstance()->getTeam($teamid);
     $projectActivityReport = NULL;
     foreach ($projectTracks as $projectId => $bugList) {
         $project = ProjectCache::getInstance()->getProject($projectId);
         $jobList = $project->getJobList($team->getProjectType($projectId));
         $jobTypeList = array();
         if ($isDetailed) {
             foreach ($jobList as $jobId => $jobName) {
                 $jobTypeList[$jobId] = $jobName;
             }
         }
         // write table content (by bugid)
         $row_id = 0;
         $bugDetailedList = "";
         foreach ($bugList as $bugid => $jobs) {
             $issue = IssueCache::getInstance()->getIssue($bugid);
             $totalTime = 0;
             $tr_class = $row_id & 1 ? "row_even" : "row_odd";
             $subJobList = array();
             foreach ($jobList as $jobId => $jobName) {
                 $jobTime = 0;
                 if (array_key_exists($jobId, $jobs)) {
                     $jobTime = $jobs[$jobId];
                 }
                 if ($isDetailed) {
                     $subJobList[$jobId] = $jobTime;
                 }
                 $totalTime += $jobTime;
             }
             $row_id += 1;
             $bugDetailedList[$bugid] = array('class' => $tr_class, 'description' => SmartyTools::getIssueDescription($bugid, $issue->getTcId(), $issue->getSummary()), 'jobList' => $subJobList, 'targetVersion' => $issue->getTargetVersion(), 'currentStatusName' => $issue->getCurrentStatusName(), 'progress' => round(100 * $issue->getProgress()), 'backlog' => $issue->getBacklog(), 'totalTime' => $totalTime);
         }
         $projectActivityReport[$projectId] = array('id' => $projectId, 'name' => $project->getName(), 'jobList' => $jobTypeList, 'bugList' => $bugDetailedList);
     }
     return $projectActivityReport;
 }
Beispiel #18
0
 /**
  * @param TimeTracking $timeTracking
  * @param bool $isDetailed
  * @param int[] $weekDates
  * @return mixed[]
  */
 private function getWeekDetails(TimeTracking $timeTracking, $isDetailed, $weekDates, $session_userid)
 {
     $team = TeamCache::getInstance()->getTeam($timeTracking->getTeamid());
     $weekDetails = array();
     $session_users = $team->getUsers();
     foreach ($session_users as $session_user) {
         // if user was working on the project during the timestamp
         if ($session_user->isTeamDeveloper($timeTracking->getTeamid(), $timeTracking->getStartTimestamp(), $timeTracking->getEndTimestamp()) || $session_user->isTeamManager($timeTracking->getTeamid(), $timeTracking->getStartTimestamp(), $timeTracking->getEndTimestamp())) {
             // PERIOD week
             //$thisWeekId=date("W");
             $weekTracks = $timeTracking->getWeekDetails($session_user->getId(), !$isDetailed);
             $holidays = Holidays::getInstance();
             $weekJobDetails = array();
             foreach ($weekTracks as $bugid => $jobList) {
                 try {
                     $issue = IssueCache::getInstance()->getIssue($bugid);
                 } catch (Exception $e) {
                     self::$logger->error("getWeekDetails() skip issue {$bugid} : " . $e->getMessage());
                     $weekJobDetails[] = array("description" => '<span class="error_font">' . $bugid . ' : ' . T_('Error: Task not found in Mantis DB !') . '</span>', "duration" => "!", "progress" => "!", "projectName" => "!", "targetVersion" => "!", "jobName" => "!", "daysDetails" => "!", "totalDuration" => "!");
                     continue;
                 }
                 $project = ProjectCache::getInstance()->getProject($issue->getProjectId());
                 if ($isDetailed) {
                     $formatedJobList = implode(', ', array_keys($jobList));
                     $query = 'SELECT id, name FROM `codev_job_table` WHERE id IN (' . $formatedJobList . ');';
                     $result2 = SqlWrapper::getInstance()->sql_query($query);
                     if (!$result2) {
                         continue;
                     }
                     while ($row2 = SqlWrapper::getInstance()->sql_fetch_object($result2)) {
                         $jobName = $row2->name;
                         $dayList = $jobList[$row2->id];
                         $daysDetails = array();
                         $weekDuration = 0;
                         for ($i = 1; $i <= 7; $i++) {
                             $dayDetails = $this->getDaysDetails($i, $holidays, $weekDates, $dayList[$i]);
                             $weekDuration += $dayDetails['duration'];
                             $daysDetails[] = $dayDetails;
                         }
                         if (!$project->isSideTasksProject(array($team->getId())) && !$project->isExternalTasksProject()) {
                             $tooltipAttr = $issue->getTooltipItems($team->getId(), $session_userid);
                             // force some fields
                             #$tooltipAttr[T_('Elapsed')] = $issue->getElapsed();
                             #$tooltipAttr[T_('Backlog')] = $issue->getDuration();
                             #$tooltipAttr[T_('Drift')] = $issue->getDrift();
                             #$tooltipAttr[T_('DriftColor')] = $issue->getDriftColor();
                             $infoTooltip = Tools::imgWithTooltip('images/b_info.png', $tooltipAttr);
                         } else {
                             $infoTooltip = NULL;
                         }
                         // prepare json data for the IssueNoteDialogbox
                         $issueNoteData = $this->getIssueNoteTooltip($project, $team, $issue);
                         $weekJobDetails[] = array('description' => SmartyTools::getIssueDescription($bugid, $issue->getTcId(), $issue->getSummary()), 'duration' => $issue->getDuration(), 'progress' => round(100 * $issue->getProgress()), 'projectName' => $issue->getProjectName(), 'targetVersion' => $issue->getTargetVersion(), 'jobName' => $jobName, 'daysDetails' => $daysDetails, 'totalDuration' => $weekDuration, 'infoTooltip' => $infoTooltip, 'issueNoteId' => $issueNoteData['id'], 'noteTooltip' => $issueNoteData['tooltip']);
                     }
                 } else {
                     // for each day, concat jobs duration
                     $daysDetails = array();
                     $weekDuration = 0;
                     for ($i = 1; $i <= 7; $i++) {
                         $duration = 0;
                         foreach ($jobList as $dayList) {
                             if (array_key_exists($i, $dayList)) {
                                 $duration += $dayList[$i];
                             }
                         }
                         if ($duration == 0) {
                             $duration = "";
                         }
                         $dayDetails = $this->getDaysDetails($i, $holidays, $weekDates, $duration);
                         $weekDuration += $dayDetails['duration'];
                         $daysDetails[] = $dayDetails;
                     }
                     if (!$project->isSideTasksProject(array($team->getId())) && !$project->isExternalTasksProject()) {
                         $tooltipAttr = $issue->getTooltipItems($team->getId(), $session_userid);
                         // force some fields
                         #$tooltipAttr[T_('Elapsed')] = $issue->getElapsed();
                         #$tooltipAttr[T_('Backlog')] = $issue->getDuration();
                         #$tooltipAttr[T_('Drift')] = $issue->getDrift();
                         #$tooltipAttr[T_('DriftColor')] = $issue->getDriftColor();
                         $infoTooltip = Tools::imgWithTooltip('images/b_info.png', $tooltipAttr);
                     } else {
                         $infoTooltip = NULL;
                     }
                     // prepare json data for the IssueNoteDialogbox
                     $issueNoteData = $this->getIssueNoteTooltip($project, $team, $issue);
                     $weekJobDetails[] = array('description' => SmartyTools::getIssueDescription($bugid, $issue->getTcId(), $issue->getSummary()), 'duration' => $issue->getDuration(), 'progress' => round(100 * $issue->getProgress()), 'projectName' => $issue->getProjectName(), 'daysDetails' => $daysDetails, 'totalDuration' => $weekDuration, 'infoTooltip' => $infoTooltip, 'issueNoteId' => $issueNoteData['id'], 'noteTooltip' => $issueNoteData['tooltip']);
                 }
             }
             if (!empty($weekJobDetails)) {
                 $weekDetails[] = array('name' => $session_user->getName(), 'realname' => $session_user->getRealname(), 'forecastWorkload' => $session_user->getForecastWorkload(), 'weekDates' => array(Tools::formatDate("%A\n%d %b", $weekDates[1]), Tools::formatDate("%A\n%d %b", $weekDates[2]), Tools::formatDate("%A\n%d %b", $weekDates[3]), Tools::formatDate("%A\n%d %b", $weekDates[4]), Tools::formatDate("%A\n%d %b", $weekDates[5])), 'weekEndDates' => array(Tools::formatDate("%A\n%d %b", $weekDates[6]), Tools::formatDate("%A\n%d %b", $weekDates[7])), 'weekJobDetails' => $weekJobDetails);
             }
         }
     }
     return $weekDetails;
 }
Beispiel #19
0
 /**
  * Initialize complex static variables
  * @static
  */
 public static function staticInit()
 {
     self::$logger = Logger::getLogger(__CLASS__);
 }
 private function getMonthlyActivityReport(array $tracks)
 {
     $userList = array();
     // first is 'All', then one per user
     #$userList['0'] = array(); // All users together
     foreach ($tracks as $t) {
         $userid = $t->getUserId();
         $bugid = $t->getIssueId();
         if (!array_key_exists($userid, $userList)) {
             $user = UserCache::getInstance()->getUser($userid);
             $userList["{$userid}"] = array('name' => $user->getName(), 'realname' => $user->getRealname(), 'elapsedInPeriod' => 0, 'tasks' => array());
             #echo "new user $userid<br>";
         }
         if (!array_key_exists($bugid, $userList["{$userid}"]['tasks'])) {
             try {
                 $issue = IssueCache::getInstance()->getIssue($bugid);
                 $project = ProjectCache::getInstance()->getProject($issue->getProjectId());
                 if (!$project->isSideTasksProject(array($this->teamid)) && !$project->isExternalTasksProject()) {
                     $tooltipAttr = $issue->getTooltipItems($this->teamid, $this->session_userid);
                     $infoTooltip = Tools::imgWithTooltip('images/b_info.png', $tooltipAttr);
                     $progress = round(100 * $issue->getProgress());
                     $backlog = $issue->getBacklog();
                 } else {
                     $infoTooltip = NULL;
                     $progress = NULL;
                     $backlog = NULL;
                 }
                 $projectName = $issue->getProjectName();
                 $summary = SmartyTools::getIssueDescription($bugid, $issue->getTcId(), $issue->getSummary());
             } catch (Exception $e) {
                 $infoTooltip = NULL;
                 $progress = NULL;
                 $backlog = NULL;
                 $projectName = '<span class="error_font">' . T_('Error') . '</span>';
                 $summary = $bugid . ' : <span class="error_font">' . T_('Error: Task not found in Mantis DB !') . '</span>';
             }
             $userList["{$userid}"]['tasks']["{$bugid}"] = array('id' => $bugid, 'infoTooltip' => $infoTooltip, 'projectName' => $projectName, 'summary' => $summary, 'progress' => $progress, 'backlog' => $backlog, 'elapsedInPeriod' => 0);
             #echo "new UserTask $bugid : ".$issue->getSummary()."<br>";
         }
         $userList["{$userid}"]['tasks']["{$bugid}"]['elapsedInPeriod'] += $t->getDuration();
         $userList["{$userid}"]['elapsedInPeriod'] += $t->getDuration();
         #echo "user $userid task $bugid elapsedInPeriod = ".$userList["$userid"]['tasks']["$bugid"]['elapsedInPeriod'].'<br>';
     }
     #var_dump($userList);
     return $userList;
 }
Beispiel #21
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         // except Observed teams
         $dTeamList = $this->session_user->getDevTeamList();
         $lTeamList = $this->session_user->getLeadedTeamList();
         $managedTeamList = $this->session_user->getManagedTeamList();
         $teamList = $dTeamList + $lTeamList + $managedTeamList;
         if (0 == $this->teamid || !array_key_exists($this->teamid, $teamList) || $this->session_user->isTeamCustomer($this->teamid)) {
             $this->smartyHelper->assign('accessDenied', TRUE);
         } else {
             #if ((0 != $this->teamid) && array_key_exists($this->teamid, $teamList)) {
             $team = TeamCache::getInstance()->getTeam($this->teamid);
             $this->smartyHelper->assign('teamid', $this->teamid);
             if (0 != $this->teamid) {
                 $this->smartyHelper->assign('teamName', $team->getName());
             }
             // use the projectid set in the form, if not defined (first page call) use session projectid
             if (isset($_POST['projectid'])) {
                 $projectid = Tools::getSecurePOSTIntValue('projectid');
                 $_SESSION['projectid'] = $projectid;
             } else {
                 $projectid = isset($_SESSION['projectid']) ? $_SESSION['projectid'] : 0;
             }
             $this->smartyHelper->assign('projectid', $projectid);
             if (0 != $projectid) {
                 $proj = ProjectCache::getInstance()->getProject($projectid);
                 $this->smartyHelper->assign('projectName', $proj->getName());
             }
             $this->smartyHelper->assign('teams', SmartyTools::getSmartyArray($teamList, $this->teamid));
             // exclude noStatsProjects and disabled projects
             $this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($team->getProjects(false, false), $projectid));
             if (isset($_FILES['uploaded_csv'])) {
                 $filename = $_FILES['uploaded_csv']['name'];
                 $tmpFilename = $_FILES['uploaded_csv']['tmp_name'];
                 $err_msg = NULL;
                 if ($_FILES['uploaded_csv']['error']) {
                     $err_id = $_FILES['uploaded_csv']['error'];
                     switch ($err_id) {
                         case 1:
                             $err_msg = "UPLOAD_ERR_INI_SIZE ({$err_id}) on file : " . $filename;
                             //echo"Le fichier dépasse la limite autorisée par le serveur (fichier php.ini) !";
                             break;
                         case 2:
                             $err_msg = "UPLOAD_ERR_FORM_SIZE ({$err_id}) on file : " . $filename;
                             //echo "Le fichier dépasse la limite autorisée dans le formulaire HTML !";
                             break;
                         case 3:
                             $err_msg = "UPLOAD_ERR_PARTIAL ({$err_id}) on file : " . $filename;
                             //echo "L'envoi du fichier a été interrompu pendant le transfert !";
                             break;
                         case 4:
                             $err_msg = "UPLOAD_ERR_NO_FILE ({$err_id}) on file : " . $filename;
                             //echo "Le fichier que vous avez envoyé a une taille nulle !";
                             break;
                     }
                     self::$logger->error($err_msg);
                 } else {
                     // $_FILES['nom_du_fichier']['error'] vaut 0 soit UPLOAD_ERR_OK
                     // ce qui signifie qu'il n'y a eu aucune erreur
                 }
                 $extensions = array('.csv', '.CSV');
                 $extension = strrchr($filename, '.');
                 if (!in_array($extension, $extensions)) {
                     $err_msg = T_('Please upload files with the following extension: ') . implode(', ', $extensions);
                     self::$logger->error($err_msg);
                 }
                 // --- READ CSV FILE ---
                 #$smartyHelper->assign('newIssues', getFakeNewIssues());
                 $this->smartyHelper->assign('newIssues', $this->getIssuesFromCSV($tmpFilename));
                 if (!$err_msg) {
                     $this->smartyHelper->assign('filename', $filename);
                     $commands = $this->getCommands($team);
                     $projectCategories = $this->getProjectCategories($projectid);
                     $projectTargetVersion = $this->getProjectTargetVersion($projectid);
                     $activeMembers = $team->getActiveMembers();
                     $smartyCmdList = array();
                     foreach ($commands as $id => $name) {
                         $smartyCmdList[$id] = array('id' => $id, 'name' => $name, 'selected' => $id == 0);
                     }
                     $this->smartyHelper->assign('commandList', $smartyCmdList);
                     $this->smartyHelper->assign('categoryList', SmartyTools::getSmartyArray($projectCategories, 0));
                     $this->smartyHelper->assign('targetversionList', SmartyTools::getSmartyArray($projectTargetVersion, 0));
                     $this->smartyHelper->assign('userList', SmartyTools::getSmartyArray($activeMembers, 0));
                     $this->smartyHelper->assign('jed_commandList', Tools::array2json($commands));
                     $this->smartyHelper->assign('jed_categoryList', Tools::array2json($projectCategories));
                     $this->smartyHelper->assign('jed_targetVersionList', Tools::array2json($projectTargetVersion));
                     $this->smartyHelper->assign('jed_userList', Tools::array2json($activeMembers));
                 } else {
                     $this->smartyHelper->assign('errorMsg', $err_msg);
                 }
             }
         }
     }
 }
Beispiel #22
0
 /**
  * @param int[] $weekDates
  * @param int $userid
  * @param TimeTracking $timeTracking
  * @param array $incompleteDays
  * @return mixed[]
  */
 public static function getWeekTask(array $weekDates, $teamid, $userid, TimeTracking $timeTracking, array $incompleteDays)
 {
     $totalElapsed = array();
     $todayAtMidnight = mktime(0, 0, 0);
     for ($i = 1; $i <= 7; $i++) {
         $weekDate = $weekDates[$i];
         $totalElapsed[$weekDate] = array("elapsed" => 0, "class" => in_array($weekDate, $incompleteDays) && $weekDate < $todayAtMidnight ? "incompleteDay" : "");
     }
     $jobs = new Jobs();
     $weekTasks = NULL;
     $holidays = Holidays::getInstance();
     $weekTracks = $timeTracking->getWeekDetails($userid);
     foreach ($weekTracks as $bugid => $jobList) {
         try {
             $issue = IssueCache::getInstance()->getIssue($bugid);
             $backlog = $issue->getBacklog();
             $extRef = $issue->getTcId();
             $summary = $issue->getSummary();
             $description = SmartyTools::getIssueDescription($bugid, $extRef, $summary);
             $projectId = $issue->getProjectId();
         } catch (Exception $e) {
             $backlog = '!';
             $extRef = '';
             $summary = '<span class="error_font">' . T_('Error: Task not found in Mantis DB !') . '</span>';
             //$description = SmartyTools::getIssueDescription($bugid,$extRef,$summary);
             $description = Tools::mantisIssueURL($bugid, NULL, TRUE) . ' ' . $bugid . ' : ' . $summary;
             $projectId = -1;
         }
         foreach ($jobList as $jobid => $dayList) {
             // if no backlog set, display a '?' to allow Backlog edition
             if (is_numeric($backlog)) {
                 $formattedBacklog = $backlog;
                 // prepare json data for the BacklogDialogbox
                 $jsonIssueInfo = self::getUpdateBacklogJsonData($bugid, $jobid, $teamid, $userid);
             } else {
                 #if (($team->isSideTasksProject($issue->projectId)) ||
                 #    ($team->isNoStatsProject($issue->projectId))) {
                 // do not allow to edit sideTasks Backlog
                 $formattedBacklog = '';
                 $jsonIssueInfo = '';
                 #} else {
                 #   $formattedBacklog = '?';
                 #}
                 //
             }
             $dayTasks = "";
             for ($i = 1; $i <= 7; $i++) {
                 $title = NULL;
                 $bgColor = NULL;
                 if ($i <= 5) {
                     $h = $holidays->isHoliday($weekDates[$i]);
                     if ($h) {
                         $bgColor = $h->color;
                         #$bgColor = Holidays::$defaultColor;
                         $title = $h->description;
                     }
                 } else {
                     $bgColor = Holidays::$defaultColor;
                 }
                 $day = 0;
                 if (array_key_exists($i, $dayList)) {
                     $day = $dayList[$i];
                 }
                 $dayTasks[] = array('bgColor' => $bgColor, 'title' => $title, 'day' => $day);
                 $totalElapsed[$weekDates[$i]]['elapsed'] += $day;
             }
             /*          
                         $deadline = $issue->getDeadLine();
             
                         if (!is_null($deadline) || (0 != $deadline)) {
                            $formatedDate = Tools::formatDate(T_("%Y-%m-%d"), $deadline);
                         }
             */
             try {
                 $project = ProjectCache::getInstance()->getProject($projectId);
             } catch (Exception $e) {
                 $project = null;
             }
             if ($project != null) {
                 if (!$project->isSideTasksProject(array($teamid)) && !$project->isExternalTasksProject()) {
                     // TODO does $issue belong to current team's project ? what if not ?
                     $tooltipAttr = $issue->getTooltipItems($teamid, $userid);
                     $infoTooltip = Tools::imgWithTooltip('images/b_info.png', $tooltipAttr);
                 } else {
                     $infoTooltip = '';
                 }
             } else {
                 $infoTooltip = '';
             }
             // prepare json data for the IssueNoteDialogbox
             if ($project != null) {
                 if (!$project->isSideTasksProject(array($teamid)) && !$project->isExternalTasksProject()) {
                     $issueNote = IssueNote::getTimesheetNote($issue->getId());
                     if (!is_null($issueNote)) {
                         $issueNoteId = $issueNote->getId();
                         $user = UserCache::getInstance()->getUser($issueNote->getReporterId());
                         $rawNote = $issueNote->getText();
                         $note = trim(IssueNote::removeAllReadByTags($rawNote));
                         // used for the tooltip NOT the dialoBox
                         $tooltipAttr = array('reporter' => $user->getRealname(), 'date' => date('Y-m-d H:i:s', $issueNote->getLastModified()), 'Note' => $note);
                         $readByList = $issueNote->getReadByList(TRUE);
                         if (0 != count($readByList)) {
                             $tooltipAttr['Read by'] = implode(', ', array_keys($readByList));
                         }
                         $noteTooltip = Tools::imgWithTooltip('images/b_note.png', $tooltipAttr, NULL, 'js-add-note-link', ' style="cursor: pointer;" data-bugId="' . $issueNote->getBugId() . '"');
                     } else {
                         $issueNoteId = 0;
                         $noteTooltip = Tools::imgWithTooltip('images/b_note_grey.png', T_('Click to add a note'), NULL, 'js-add-note-link', ' style="cursor: pointer;" data-bugId="' . $issue->getId() . '"');
                     }
                 } else {
                     $noteTooltip = '';
                 }
             } else {
                 $noteTooltip = '';
             }
             // if project not declared in current team, then
             // user cannot add a timetrack by clicking in the weekTasks table
             // Note: (this would generate an error on addTimetrack)
             $team = TeamCache::getInstance()->getTeam($teamid);
             $isTeamProject = !is_null($team->getProjectType($projectId));
             $weekTasks[$bugid . "_" . $jobid] = array('bugid' => $bugid, 'description' => $description, 'formattedBacklog' => $formattedBacklog, 'jobid' => $jobid, 'jobName' => $jobs->getJobName($jobid), 'dayTasks' => $dayTasks, 'infoTooltip' => $infoTooltip, 'summary' => addslashes(htmlspecialchars($summary)), 'updateBacklogJsonData' => $jsonIssueInfo, 'issueNoteId' => $issueNoteId, 'noteTooltip' => $noteTooltip, 'isTeamProject' => $isTeamProject);
         }
     }
     return array("weekTasks" => $weekTasks, "totalElapsed" => $totalElapsed);
 }
 /**
  *
  * @param boolean $isAjaxCall
  * @return array
  */
 public function getSmartyVariables($isAjaxCall = false)
 {
     $team = TeamCache::getInstance()->getTeam($this->teamid);
     $teamProjects = $team->getProjects(false, true, true);
     $teamProjects['allSidetasksProjects'] = '-- ' . T_('All Sidetasks Projects') . ' --';
     $teamProjects['allProdProjects'] = '-- ' . T_('All Production Projects') . ' --';
     $teamProjects['allProjects'] = '-- ' . T_('All Projects') . ' --';
     $projects = SmartyTools::getSmartyArray($teamProjects, $this->selectedProject);
     //self::$logger->error(var_export($projects, true));
     $data = array();
     foreach ($this->execData as $catInfo) {
         if (0 != $catInfo['duration']) {
             $data[$catInfo['catName']] = $catInfo['duration'];
         }
     }
     $jqplotData = empty($data) ? NULL : Tools::array2plot($data);
     $smartyVariables = array('loadPerProjCategoryIndicator_startDate' => Tools::formatDate("%Y-%m-%d", $this->startTimestamp), 'loadPerProjCategoryIndicator_endDate' => Tools::formatDate("%Y-%m-%d", $this->endTimestamp), 'loadPerProjCategoryIndicator_projects' => $projects, 'loadPerProjCategoryIndicator_tableData' => $this->execData, 'loadPerProjCategoryIndicator_jqplotData' => $jqplotData, 'loadPerProjCategoryIndicator_' . self::OPTION_DISPLAY_TASKS => $this->isDisplayTasks);
     if (false == $isAjaxCall) {
         $smartyVariables['loadPerProjCategoryIndicator_ajaxFile'] = self::getSmartySubFilename();
         $smartyVariables['loadPerProjCategoryIndicator_ajaxPhpURL'] = self::getAjaxPhpURL();
     }
     return $smartyVariables;
 }
Beispiel #24
0
 /**
  * Action on 'Save' button
  *
  * @param ServiceContract $contract
  */
 private function updateServiceContractInfo($contract)
 {
     // TODO check sc_teamid in grantedTeams
     $sc_teamid = Tools::getSecurePOSTIntValue('sc_teamid');
     if ($sc_teamid != $this->teamid) {
         // switch team (because you won't find the SC in current team's contract list)
         $_SESSION['teamid'] = $sc_teamid;
         $this->updateTeamSelector();
     }
     $contract->setTeamid($sc_teamid);
     $formattedValue = Tools::getSecurePOSTStringValue('servicecontractName');
     $contract->setName($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('servicecontractReference', '');
     $contract->setReference($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('servicecontractVersion', '');
     $contract->setVersion($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('servicecontractReporter', '');
     $contract->setReporter($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('servicecontractDesc', '');
     $contract->setDesc($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('serviceContractStartDate', '');
     if ('' != $formattedValue) {
         $contract->setStartDate(Tools::date2timestamp($formattedValue));
     }
     $formattedValue = Tools::getSecurePOSTStringValue('serviceContractEndDate', '');
     if ('' != $formattedValue) {
         $contract->setEndDate(Tools::date2timestamp($formattedValue));
     }
     $contract->setState(SmartyTools::checkNumericValue($_POST['servicecontractState'], true));
 }
Beispiel #25
0
 /**
  * @param SmartyHelper $smartyHelper
  * @param ServiceContract $servicecontract
  */
 public static function displayServiceContract(SmartyHelper $smartyHelper, $servicecontract, $isManager, $selectedFilters = '')
 {
     #$smartyHelper->assign('servicecontractId', $servicecontract->getId());
     $smartyHelper->assign('teamid', $servicecontract->getTeamid());
     $smartyHelper->assign('servicecontractName', $servicecontract->getName());
     $smartyHelper->assign('servicecontractReference', $servicecontract->getReference());
     $smartyHelper->assign('servicecontractVersion', $servicecontract->getVersion());
     $smartyHelper->assign('servicecontractReporter', $servicecontract->getReporter());
     $smartyHelper->assign('servicecontractDesc', $servicecontract->getDesc());
     if (!is_null($servicecontract->getStartDate())) {
         $smartyHelper->assign('servicecontractStartDate', date("Y-m-d", $servicecontract->getStartDate()));
     }
     if (!is_null($servicecontract->getEndDate())) {
         $smartyHelper->assign('servicecontractEndDate', date("Y-m-d", $servicecontract->getEndDate()));
     }
     // Note: StateList is empty, uncomment following lines if ServiceContract::$stateNames is used
     //$smartyHelper->assign('servicecontractStateList', self::getServiceContractStateList($servicecontract));
     //$smartyHelper->assign('servicecontractState', ServiceContract::$stateNames[$servicecontract->getState()]);
     $smartyHelper->assign('cmdsetList', self::getServiceContractCommandSets($servicecontract->getId(), CommandSet::type_general, Command::type_general));
     $smartyHelper->assign('cmdsetTotalDetailedMgr', self::getServiceContractCmdsetTotalDetailedMgr($servicecontract->getId(), CommandSet::type_general, Command::type_general));
     $smartyHelper->assign('cmdList', self::getServiceContractCommands($servicecontract->getId(), CommandSet::type_general, Command::type_general));
     $provDaysByType = $servicecontract->getProvisionDaysByType(CommandSet::type_general, Command::type_general);
     $smartyHelper->assign('sidetasksDetailedMgr', self::getContractSidetasksDetailedMgr($servicecontract->getId(), $provDaysByType));
     $issueSelection = self::getContractSidetasksSelection($servicecontract->getId(), $provDaysByType);
     $smartyHelper->assign('sidetasksTotalDetailedMgr', self::getContractSidetasksTotalDetailedMgr($issueSelection));
     $smartyHelper->assign('sidetasksList', SmartyTools::getIssueListInfo($issueSelection));
     $smartyHelper->assign('nbSidetasksList', $issueSelection->getNbIssues());
     $smartyHelper->assign('cmdProvisionList', self::getProvisionList($servicecontract));
     $smartyHelper->assign('cmdProvisionTotalList', self::getProvisionTotalList($servicecontract));
     $smartyHelper->assign('servicecontractTotalDetailedMgr', self::getContractTotalDetailedMgr($servicecontract->getId(), $provDaysByType));
     // DetailedChargesIndicator
     $data = self::getDetailedCharges($servicecontract, $isManager, $selectedFilters);
     foreach ($data as $smartyKey => $smartyVariable) {
         $smartyHelper->assign($smartyKey, $smartyVariable);
     }
 }
Beispiel #26
0
 protected function display()
 {
     $this->smartyHelper->assign('activeGlobalMenuItem', 'Admin');
     if (Tools::isConnectedUser()) {
         if (!$this->session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
             $this->smartyHelper->assign('accessDenied', TRUE);
         } else {
             if (isset($_POST['team_name'])) {
                 // Form user selections
                 $team_name = Tools::getSecurePOSTStringValue('team_name');
                 $team_desc = Tools::getSecurePOSTStringValue('team_desc', '');
                 $teamleader_id = Tools::getSecurePOSTStringValue('teamleader_id');
                 $formatedDate = date("Y-m-d", time());
                 $now = Tools::date2timestamp($formatedDate);
                 // 1) --- create new Team
                 $teamid = Team::create($team_name, $team_desc, $teamleader_id, $now);
                 if ($teamid > 0) {
                     $team = TeamCache::getInstance()->getTeam($teamid);
                     // --- add teamLeader as 'manager'
                     $team->addMember($teamleader_id, $now, Team::accessLevel_manager);
                     // 2) --- add ExternalTasksProject
                     $team->addExternalTasksProject();
                     $stproj_name = Tools::getSecurePOSTStringValue("stproj_name");
                     if (isset($_POST['cb_createSideTaskProj'])) {
                         // 3) --- add <team> SideTaskProject
                         $stproj_id = $team->createSideTaskProject($stproj_name);
                         if ($stproj_id < 0) {
                             self::$logger->error("SideTaskProject creation FAILED");
                             echo "<span style='color:red'>ERROR: SideTaskProject creation FAILED</span>";
                             exit;
                         } else {
                             $stproj = ProjectCache::getInstance()->getProject($stproj_id);
                             // --- 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);
                             // 4) --- add SideTaskProject Categories
                             $stproj->addCategoryProjManagement(T_("Project Management"));
                             if (isset($_POST['cb_catInactivity'])) {
                                 $stproj->addCategoryInactivity(T_("Inactivity"));
                             }
                             if (isset($_POST['cb_catIncident'])) {
                                 $stproj->addCategoryIncident(T_("Incident"));
                             }
                             if (isset($_POST['cb_catTools'])) {
                                 $stproj->addCategoryTools(T_("Tools"));
                             }
                             if (isset($_POST['cb_catOther'])) {
                                 $stproj->addCategoryWorkshop(T_("Team Workshop"));
                             }
                             // 5) --- add SideTaskProject default SideTasks
                             if (isset($_POST['cb_taskProjManagement'])) {
                                 $stproj->addIssueProjManagement(Tools::getSecurePOSTStringValue('task_projManagement'));
                             }
                             if (isset($_POST['cb_taskMeeting'])) {
                                 $stproj->addIssueProjManagement(Tools::getSecurePOSTStringValue('task_meeting'));
                             }
                             if (isset($_POST['cb_taskIncident'])) {
                                 $stproj->addIssueIncident(Tools::getSecurePOSTStringValue('task_incident'));
                             }
                             if (isset($_POST['cb_taskTools'])) {
                                 $stproj->addIssueTools(Tools::getSecurePOSTStringValue('task_tools'));
                             }
                             if (isset($_POST['cb_taskOther'])) {
                                 $stproj->addIssueWorkshop(Tools::getSecurePOSTStringValue('task_other1'));
                             }
                         }
                     }
                 }
                 // 6) --- open EditTeam Page
                 header('Location: edit_team.php?teamid=' . $teamid);
             } else {
                 $this->smartyHelper->assign('users', SmartyTools::getSmartyArray(User::getUsers(), $this->session_userid));
             }
         }
     }
 }
Beispiel #27
0
 /**
  * @param Command $command
  * @return mixed[]
  */
 public static function getCommandStateList(Command $command = NULL)
 {
     $cmdState = is_null($command) ? 0 : $command->getState();
     return SmartyTools::getSmartyArray(Command::$stateNames, $cmdState);
 }
Beispiel #28
0
 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 {
             $tmpTeamList = array($this->teamid => $this->teamList[$this->teamid]);
             $projList = $this->session_user->getProjectList($tmpTeamList, true, false);
             if (isset($_GET['projectid'])) {
                 $projectid = Tools::getSecureGETIntValue('projectid');
                 $_SESSION['projectid'] = $projectid;
             } else {
                 if (isset($_SESSION['projectid'])) {
                     $projectid = $_SESSION['projectid'];
                 } else {
                     $projectsid = array_keys($projList);
                     $projectid = $projectsid[0];
                 }
             }
             $this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($projList, $projectid));
             // if display project allowed
             if (in_array($projectid, array_keys($projList))) {
                 $this->smartyHelper->assign('projectid', $projectid);
                 // Managers can see detailed view
                 $isManager = $this->session_user->isTeamManager($this->teamid);
                 $isObserver = $this->session_user->isTeamObserver($this->teamid);
                 $this->smartyHelper->assign("isManager", $isManager || $isObserver);
                 $project = ProjectCache::getInstance()->getProject($projectid);
                 $projectIssueSel = $project->getIssueSelection();
                 // --- FILTER TABS -------------
                 // get selected filters
                 if (isset($_GET['selectedFilters'])) {
                     $selectedFilters = Tools::getSecureGETStringValue('selectedFilters');
                 } else {
                     $selectedFilters = $this->session_user->getProjectFilters($projectid);
                 }
                 // cleanup filters (remove empty lines)
                 $filterList = explode(',', $selectedFilters);
                 $filterList = array_filter($filterList, create_function('$a', 'return $a!="";'));
                 $selectedFilters = implode(',', $filterList);
                 // save user preferances
                 $this->session_user->setProjectFilters($selectedFilters, $projectid);
                 // TODO: get allFilters from config.ini
                 $data = ProjectInfoTools::getDetailedCharges($projectid, $isManager || $isObserver, $selectedFilters);
                 foreach ($data as $smartyKey => $smartyVariable) {
                     $this->smartyHelper->assign($smartyKey, $smartyVariable);
                 }
                 // --- DRIFT TABS -------------------
                 $currentIssuesInDrift = NULL;
                 $resolvedIssuesInDrift = NULL;
                 foreach ($projectIssueSel->getIssuesInDrift($isManager || $isObserver) as $issue) {
                     $smartyIssue = $this->getSmartyDirftedIssue($issue, $isManager || $isObserver);
                     if (NULL != $smartyIssue) {
                         if ($issue->isResolved()) {
                             $resolvedIssuesInDrift[] = $smartyIssue;
                         } else {
                             $currentIssuesInDrift[] = $smartyIssue;
                         }
                     }
                 }
                 $this->smartyHelper->assign("currentIssuesInDrift", $currentIssuesInDrift);
                 $this->smartyHelper->assign("resolvedIssuesInDrift", $resolvedIssuesInDrift);
                 // indicator_plugins (old style plugins - deprecated)
                 $this->smartyHelper->assign('detailedChargesIndicatorFile', DetailedChargesIndicator::getSmartyFilename());
                 // Dashboard
                 ProjectInfoTools::dashboardSettings($this->smartyHelper, $project, $this->session_userid, $this->teamid);
             }
         }
     }
 }
Beispiel #29
0
            $managedTeamList = $user->getManagedTeamList();
            $managedProjList = count($managedTeamList) > 0 ? $user->getProjectList($managedTeamList, true, $withDisabled) : array();
            $oTeamList = $user->getObservedTeamList();
            $observedProjList = count($oTeamList) > 0 ? $user->getProjectList($oTeamList, true, $withDisabled) : array();
            $projList = $allProject + $devProjList + $managedProjList + $observedProjList;
            // WORKAROUND
            if ($_GET['bugid'] == 'null') {
                $_GET['bugid'] = 0;
            }
            $smartyHelper->assign('bugs', SmartyTools::getBugs(Tools::getSecureGETIntValue('projectid'), Tools::getSecureGETIntValue('bugid', 0), $projList));
            $smartyHelper->display('form/bugSelector');
        } elseif ($_GET['action'] == 'getYearsToNow') {
            $team = TeamCache::getInstance()->getTeam(Tools::getSecureGETIntValue('teamid'));
            $min_year = date("Y", $team->getDate());
            $year = isset($_POST['year']) && $_POST['year'] > $min_year ? $_POST['year'] : $min_year;
            $smartyHelper->assign('years', SmartyTools::getYearsToNow($min_year, $year));
            $smartyHelper->display('form/yearSelector');
        } else {
            Tools::sendNotFoundAccess();
        }
    } else {
        if ($_POST['action']) {
            if ($_POST['action'] == 'updateBacklogAction') {
                $issue = IssueCache::getInstance()->getIssue(Tools::getSecurePOSTIntValue('bugid'));
                $issue->setBacklog(Tools::getSecurePOSTNumberValue('backlog'));
            } else {
                Tools::sendNotFoundAccess();
            }
        }
    }
} else {
Beispiel #30
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         // only teamMembers can access this page
         if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid) || $this->session_user->isTeamObserver($this->teamid) || !$this->session_user->isTeamMember($this->teamid)) {
             $this->smartyHelper->assign('accessDenied', TRUE);
         } else {
             $team = TeamCache::getInstance()->getTeam($this->teamid);
             $teamMembers = $team->getActiveMembers(NULL, NULL, TRUE);
             $managed_userid = Tools::getSecurePOSTIntValue('userid', $this->session_userid);
             if ($this->session_user->isTeamManager($this->teamid)) {
                 // session_user is Manager, let him choose the teamMember he wants to manage
                 $this->smartyHelper->assign('users', $teamMembers);
                 $this->smartyHelper->assign('selectedUser', $managed_userid);
                 $this->smartyHelper->assign("isManager", true);
             }
             // display AddTrack Page
             $year = Tools::getSecurePOSTIntValue('year', date('Y'));
             $managed_user = UserCache::getInstance()->getUser($managed_userid);
             // Need to be Manager to handle other users
             if ($managed_userid != $this->session_userid) {
                 if (!$this->session_user->isTeamManager($this->teamid) || !array_key_exists($managed_userid, $teamMembers)) {
                     self::$logger->error(' SECURITY ALERT changeManagedUser: session_user ' . $this->session_userid . " is not allowed to manage user {$managed_userid}");
                     Tools::sendForbiddenAccess();
                 }
             }
             // developper & manager can add timeTracks
             $mTeamList = $managed_user->getDevTeamList();
             $managedTeamList = $managed_user->getManagedTeamList();
             $teamList = $mTeamList + $managedTeamList;
             $action = Tools::getSecurePOSTStringValue('action', '');
             $weekid = Tools::getSecurePOSTIntValue('weekid', date('W'));
             $defaultDate = Tools::getSecurePOSTStringValue('date', date("Y-m-d", time()));
             $defaultBugid = Tools::getSecurePOSTIntValue('bugid', 0);
             $defaultProjectid = Tools::getSecurePOSTIntValue('projectid', 0);
             $job = Tools::getSecurePOSTIntValue('job', 0);
             $duration = Tools::getSecurePOSTNumberValue('duree', 0);
             if ("addTrack" == $action) {
                 self::$logger->debug("addTrack: called from form1");
                 // TODO merge addTrack & addTimetrack actions !
                 // called by form1 when no backlog has to be set.
                 // updateBacklogDialogBox must not raise up,
                 // track must be added, backlog & status must NOT be updated
                 $timestamp = Tools::date2timestamp($defaultDate);
                 $defaultBugid = Tools::getSecurePOSTIntValue('bugid');
                 $job = Tools::getSecurePOSTStringValue('job');
                 $duration = Tools::getSecurePOSTNumberValue('duree');
                 // dialogBox is not called, then track must be saved to DB
                 $trackid = TimeTrack::create($managed_userid, $defaultBugid, $job, $timestamp, $duration, $this->session_userid);
                 if (self::$logger->isDebugEnabled()) {
                     self::$logger->debug("Track {$trackid} added  : userid={$managed_userid} bugid={$defaultBugid} job={$job} duration={$duration} timestamp={$timestamp}");
                 }
                 // Don't show job and duration after add track
                 $job = 0;
                 $duration = 0;
                 $defaultProjectid = Tools::getSecurePOSTIntValue('projectid');
             } elseif ("addTimetrack" == $action) {
                 // updateBacklogDialogbox with 'addTimetrack' action
                 // add track AND update backlog & status & handlerId
                 // TODO merge addTrack & addTimetrack actions !
                 self::$logger->debug("addTimetrack: called from the updateBacklogDialogBox");
                 // add timetrack (all values mandatory)
                 $defaultDate = Tools::getSecurePOSTStringValue('trackDate');
                 $defaultBugid = Tools::getSecurePOSTIntValue('bugid');
                 $job = Tools::getSecurePOSTIntValue('trackJobid');
                 $duration = Tools::getSecurePOSTNumberValue('timeToAdd');
                 $handlerId = Tools::getSecurePOSTNumberValue('handlerid');
                 // check jobid (bug happens sometime...
                 if (0 == $job) {
                     $this->smartyHelper->assign('error', T_("Timetrack not added: Job has not specified."));
                     self::$logger->error("Add track : FAILED. issue={$defaultBugid}, jobid={$job}, duration={$duration} date={$defaultDate}");
                 }
                 // check bug_id (this happens when user uses the 'back' button of the browser ?)
                 if (0 == $defaultBugid) {
                     self::$logger->error("Add track : FAILED. issue=0, jobid={$job}, duration={$duration} date={$defaultDate}");
                 } else {
                     $timestamp = 0 !== $defaultDate ? Tools::date2timestamp($defaultDate) : 0;
                     $trackid = TimeTrack::create($managed_userid, $defaultBugid, $job, $timestamp, $duration, $this->session_userid);
                     if (self::$logger->isDebugEnabled()) {
                         self::$logger->debug("Track {$trackid} added  : userid={$managed_userid} bugid={$defaultBugid} job={$job} duration={$duration} timestamp={$timestamp}");
                     }
                     $issue = IssueCache::getInstance()->getIssue($defaultBugid);
                     // setBacklog
                     $formattedBacklog = Tools::getSecurePOSTNumberValue('backlog');
                     $issue->setBacklog($formattedBacklog);
                     // setStatus
                     $newStatus = Tools::getSecurePOSTIntValue('statusid');
                     $issue->setStatus($newStatus);
                     // set handlerId
                     if ($handlerId != $issue->getHandlerId()) {
                         // TODO security check (userid exists/valid ?)
                         $issue->setHandler($handlerId);
                     }
                     $defaultProjectid = $issue->getProjectId();
                 }
                 // Don't show job and duration after add track
                 $job = 0;
                 $duration = 0;
             } elseif ("deleteTrack" == $action) {
                 $trackid = Tools::getSecurePOSTIntValue('trackid');
                 $timeTrack = TimeTrackCache::getInstance()->getTimeTrack($trackid);
                 $defaultBugid = $timeTrack->getIssueId();
                 $duration = $timeTrack->getDuration();
                 $job = $timeTrack->getJobId();
                 $defaultDate = date("Y-m-d", $timeTrack->getDate());
                 // delete track
                 if (!$timeTrack->remove()) {
                     $this->smartyHelper->assign('error', T_("Failed to delete the timetrack !"));
                     self::$logger->error("Delete track {$trackid}  : FAILED.");
                 }
                 if (0 == $defaultBugid) {
                     self::$logger->error("Delete track : bug_id=0");
                     $defaultProjectid = 0;
                 } else {
                     try {
                         // pre-set form fields
                         $issue = IssueCache::getInstance()->getIssue($defaultBugid);
                         $defaultProjectid = $issue->getProjectId();
                         // if project not defined for current team, do not pre-set form fields.
                         if (!in_array($defaultProjectid, array_keys($team->getProjects()))) {
                             $defaultProjectid = 0;
                             $defaultBugid = 0;
                         }
                     } catch (Exception $e) {
                         $defaultProjectid = 0;
                         $defaultBugid = 0;
                     }
                 }
             } elseif ("setBugId" == $action) {
                 // pre-set form fields
                 // find ProjectId to update categories
                 $defaultBugid = Tools::getSecurePOSTIntValue('bugid');
                 $issue = IssueCache::getInstance()->getIssue($defaultBugid);
                 $defaultProjectid = $issue->getProjectId();
             } elseif ("setFiltersAction" == $action) {
                 $isFilter_onlyAssignedTo = isset($_POST["cb_onlyAssignedTo"]) ? '1' : '0';
                 $isFilter_hideResolved = isset($_POST["cb_hideResolved"]) ? '1' : '0';
                 $managed_user->setTimetrackingFilter('onlyAssignedTo', $isFilter_onlyAssignedTo);
                 $managed_user->setTimetrackingFilter('hideResolved', $isFilter_hideResolved);
                 if ($defaultBugid != 0) {
                     $issue = IssueCache::getInstance()->getIssue($defaultBugid);
                     $defaultProjectid = $issue->getProjectId();
                 }
             }
             // Display user name
             $this->smartyHelper->assign('managedUser_realname', $managed_user->getRealname());
             $this->smartyHelper->assign('userid', $managed_userid);
             // display Track Form
             $this->smartyHelper->assign('date', $defaultDate);
             // All projects except disabled
             $projList = $team->getProjects(true, false);
             $this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($projList, $defaultProjectid));
             $this->smartyHelper->assign('defaultProjectid', $defaultProjectid);
             $this->smartyHelper->assign('defaultBugid', $defaultBugid);
             $this->smartyHelper->assign('weekid', $weekid);
             $this->smartyHelper->assign('year', $year);
             $isOnlyAssignedTo = '0' == $managed_user->getTimetrackingFilter('onlyAssignedTo') ? false : true;
             $this->smartyHelper->assign('isOnlyAssignedTo', $isOnlyAssignedTo);
             $isHideResolved = '0' == $managed_user->getTimetrackingFilter('hideResolved') ? false : true;
             $this->smartyHelper->assign('isHideResolved', $isHideResolved);
             $availableIssues = TimeTrackingTools::getIssues($this->teamid, $defaultProjectid, $isOnlyAssignedTo, $managed_user->getId(), $projList, $isHideResolved, $defaultBugid);
             $this->smartyHelper->assign('issues', $availableIssues);
             $this->smartyHelper->assign('jobs', SmartyTools::getSmartyArray(TimeTrackingTools::getJobs($defaultProjectid, $this->teamid), $job));
             $this->smartyHelper->assign('duration', SmartyTools::getSmartyArray(TimeTrackingTools::getDurationList($this->teamid), $duration));
             $this->smartyHelper->assign('weeks', SmartyTools::getWeeks($weekid, $year));
             $this->smartyHelper->assign('years', SmartyTools::getYears($year, 1));
             $weekDates = Tools::week_dates($weekid, $year);
             $startTimestamp = $weekDates[1];
             $endTimestamp = mktime(23, 59, 59, date("m", $weekDates[7]), date("d", $weekDates[7]), date("Y", $weekDates[7]));
             $timeTracking = new TimeTracking($startTimestamp, $endTimestamp, $this->teamid);
             $incompleteDays = array_keys($timeTracking->checkCompleteDays($managed_userid, TRUE));
             $missingDays = $timeTracking->checkMissingDays($managed_userid);
             $errorDays = array_merge($incompleteDays, $missingDays);
             $smartyWeekDates = TimeTrackingTools::getSmartyWeekDates($weekDates, $errorDays);
             // UTF8 problems in smarty, date encoding needs to be done in PHP
             $this->smartyHelper->assign('weekDates', array($smartyWeekDates[1], $smartyWeekDates[2], $smartyWeekDates[3], $smartyWeekDates[4], $smartyWeekDates[5]));
             $this->smartyHelper->assign('weekEndDates', array($smartyWeekDates[6], $smartyWeekDates[7]));
             $weekTasks = TimeTrackingTools::getWeekTask($weekDates, $this->teamid, $managed_userid, $timeTracking, $errorDays);
             $this->smartyHelper->assign('weekTasks', $weekTasks["weekTasks"]);
             $this->smartyHelper->assign('dayTotalElapsed', $weekTasks["totalElapsed"]);
             $timeTrackingTuples = $this->getTimetrackingTuples($managed_userid, $timeTracking);
             $this->smartyHelper->assign('weekTimetrackingTuples', $timeTrackingTuples['current']);
             $this->smartyHelper->assign('timetrackingTuples', $timeTrackingTuples['future']);
             // ConsistencyCheck
             $consistencyErrors = $this->getConsistencyErrors($managed_userid, $this->teamid);
             if (count($consistencyErrors) > 0) {
                 $this->smartyHelper->assign('ccheckErrList', $consistencyErrors);
                 $this->smartyHelper->assign('ccheckButtonTitle', count($consistencyErrors) . ' ' . T_("Errors"));
                 $this->smartyHelper->assign('ccheckBoxTitle', count($consistencyErrors) . ' ' . T_("days are incomplete or undefined"));
             }
             $this->smartyHelper->assign('isForbidAddTimetracksOnClosed', 1 == $team->getGeneralPreference('forbidAddTimetracksOnClosed') ? true : false);
         }
     }
 }