Example #1
0
File: blog.php Project: fg-ok/codev
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         $session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
         $blogManager = new BlogManager();
         $src_user_id = $session_user->getId();
         $severity = BlogPost::severity_normal;
         $category = 0;
         $summary = 'Welcome to the real world';
         $content = 'Hello world !<br>The quick brown fox jumps over the lazy dog<br>Casse toi pauv\' con !';
         $dest_team_id = 4;
         $dest_user_id = 0;
         $dest_project_id = 0;
         $date_expire = 0;
         $color = 0;
         $blogPost_id = BlogPost::create($src_user_id, $severity, $category, $summary, $content, $dest_user_id, $dest_project_id, $dest_team_id, $date_expire, $color);
         $postList = $blogManager->getPosts($session_user->getId());
         $blogPosts = $this->getBlogPosts($postList);
         $this->smartyHelper->assign('blogPosts', $blogPosts);
         $categories = $blogManager->getCategoryList();
         $this->smartyHelper->assign('categoryList', $categories);
         $severities = $blogManager->getSeverityList();
         $this->smartyHelper->assign('severityList', $severities);
     }
 }
Example #2
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         $team = TeamCache::getInstance()->getTeam($this->teamid);
         $action = filter_input(INPUT_GET, 'action');
         // feed the PluginDataProvider
         $pluginDataProvider = PluginDataProvider::getInstance();
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_SESSION_USER_ID, $this->session_userid);
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_TEAM_ID, $this->teamid);
         $weekDates = Tools::week_dates(date('W'), date('Y'));
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $weekDates[1]);
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $weekDates[5]);
         $dashboardName = 'Admin' . $this->teamid;
         // save the DataProvider for Ajax calls
         $_SESSION[PluginDataProviderInterface::SESSION_ID . $dashboardName] = serialize($pluginDataProvider);
         // create the Dashboard
         $dashboard = new Dashboard($dashboardName);
         $dashboard->setDomain(IndicatorPluginInterface::DOMAIN_ADMIN);
         $dashboard->setCategories(array(IndicatorPluginInterface::CATEGORY_QUALITY, IndicatorPluginInterface::CATEGORY_ACTIVITY, IndicatorPluginInterface::CATEGORY_ROADMAP, IndicatorPluginInterface::CATEGORY_PLANNING, IndicatorPluginInterface::CATEGORY_RISK, IndicatorPluginInterface::CATEGORY_ADMIN));
         $dashboard->setTeamid($this->teamid);
         $dashboard->setUserid($this->session_userid);
         $data = $dashboard->getSmartyVariables($this->smartyHelper);
         foreach ($data as $smartyKey => $smartyVariable) {
             $this->smartyHelper->assign($smartyKey, $smartyVariable);
         }
     } else {
         $this->smartyHelper->assign('error', T_('Sorry, you need to be identified.'));
     }
 }
Example #3
0
 public function execute()
 {
     if (Tools::isConnectedUser()) {
         $teamid = Tools::getSecureGETIntValue('teamid');
         $startTimestamp = Tools::getSecureGETStringValue('startT');
         $endTimestamp = Tools::getSecureGETStringValue('endT');
         $projectIds = Tools::getSecureGETIntValue('projects', 0);
         if (0 != $projectIds) {
             $projectIds = explode(':', $projectIds);
             if (self::$logger->isDebugEnabled()) {
                 self::$logger->debug("team <{$teamid}> projects = <{$projectIds}>");
             }
         } else {
             if (self::$logger->isDebugEnabled()) {
                 self::$logger->debug("team <{$teamid}> display all projects");
             }
             $projectIds = array();
         }
         /* INFO: the following 1 line are MANDATORY and fix the following error:
          * “The image <name> cannot be displayed because it contains errors”
          * Can't call ob_end_clean() if zlib.output_compression is ON
          */
         if (!ini_get('zlib.output_compression')) {
             ob_end_clean();
         }
         $graph = $this->getGanttGraph($teamid, $startTimestamp, $endTimestamp, $projectIds);
         // display graph
         $graph->Stroke();
         SqlWrapper::getInstance()->logStats();
     } else {
         Tools::sendForbiddenAccess();
     }
 }
Example #4
0
File: logs.php Project: fg-ok/codev
 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))) {
             if (NULL != Constants::$codevtt_logfile && file_exists(Constants::$codevtt_logfile)) {
                 $nbLinesToDisplay = 1500;
                 $lines = file(Constants::$codevtt_logfile);
                 if (count($lines) > $nbLinesToDisplay) {
                     $offset = count($lines) - $nbLinesToDisplay;
                 } else {
                     $offset = 0;
                 }
                 $logs = array();
                 for ($i = $offset; $i <= $offset + $nbLinesToDisplay, $i < count($lines); $i++) {
                     $logs[$i + 1] = htmlspecialchars($lines[$i], ENT_QUOTES, "UTF-8");
                     #echo "DEBUG $line_num - ".$logs[$line_num]."<br>";
                 }
                 $this->smartyHelper->assign('logs', $logs);
             } else {
                 $this->smartyHelper->assign('error', T_('Sorry, logfile not found:') . ' [' . Constants::$codevtt_logfile . ']');
             }
         } else {
             $this->smartyHelper->assign('error', T_('Sorry, you need to be in the admin-team to access this page.'));
         }
     } else {
         $this->smartyHelper->assign('error', T_('Sorry, you need to be in the admin-team to access this page.'));
     }
 }
Example #5
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         $threshold = 0.5;
         // for Deviation filters
         // only teamMembers & observers can access this page
         if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) {
             $this->smartyHelper->assign('accessDenied', TRUE);
         } else {
             $withSupport = TRUE;
             $weekDates = Tools::week_dates(date('W'), date('Y'));
             // The first day of the current week
             $startDate = date("Y-m-d", $weekDates[1]);
             $startTimestamp = Tools::date2timestamp($startDate);
             #echo "DEBUG startTimestamp ".date("Y-m-d H:i:s", $startTimestamp)."<br/>";
             // The last day of the current week
             $endDate = date("Y-m-d", $weekDates[5]);
             $endTimestamp = Tools::date2timestamp($endDate);
             $endTimestamp += 24 * 60 * 60 - 1;
             // + 1 day -1 sec.
             #echo "DEBUG endTimestamp   ".date("Y-m-d H:i:s", $endTimestamp)."<br/>";
             #$managedTeamList = $this->session_user->getManagedTeamList();
             #$isManager = array_key_exists($this->teamid, $managedTeamList);
             $isManager = $this->session_user->isTeamManager($this->teamid);
             $isObserver = $this->session_user->isTeamObserver($this->teamid);
             $this->smartyHelper->assign('manager', $isManager || $isObserver);
             $this->smartyHelper->assign('threshold', $threshold);
             $this->smartyHelper->assign('currentDeviationStats', $this->getCurrentDeviationStats($this->teamid, $threshold));
             $this->smartyHelper->assign('issuesInDrift', $this->getIssuesInDrift($this->teamid, $withSupport));
         }
     }
 }
Example #6
0
 protected function display()
 {
     // Admins only
     if (Tools::isConnectedUser()) {
         $session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
         if ($session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
             $this->smartyHelper->assign('defaultColor', Holidays::$defaultColor);
             if (isset($_POST['hol_color'])) {
                 $formatedDate = Tools::getSecurePOSTStringValue('date');
                 $timestamp = Tools::date2timestamp($formatedDate);
                 $hol_desc = Tools::getSecurePOSTStringValue('hol_desc');
                 $hol_color = Tools::getSecurePOSTStringValue('hol_color');
                 if (!Holidays::save($timestamp, $hol_desc, $hol_color)) {
                     $this->smartyHelper->assign('error', T_("Couldn't add the holiday"));
                 }
             } elseif (isset($_POST['hol_id'])) {
                 $hol_id = Tools::getSecurePOSTIntValue('hol_id');
                 if (!Holidays::delete($hol_id)) {
                     $this->smartyHelper->assign('error', T_("Couldn't remove the holiday"));
                 }
             }
             $this->smartyHelper->assign('holidays', Holidays::getHolidays());
         }
     }
 }
Example #7
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         // TODO SECURITY check array_key_exists($this->teamid, $this->teamList)
         // only teamMembers & observers can access this page
         if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) {
             $this->smartyHelper->assign('accessDenied', TRUE);
         } else {
             $year = Tools::getSecurePOSTIntValue('year', date('Y'));
             $weekid = Tools::getSecurePOSTIntValue('weekid', date('W'));
             $this->smartyHelper->assign('weeks', SmartyTools::getWeeks($weekid, $year));
             $this->smartyHelper->assign('years', SmartyTools::getYears($year, 1));
             $isDetailed = isset($_POST['cb_detailed']) ? TRUE : FALSE;
             $this->smartyHelper->assign('isChecked', $isDetailed);
             $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);
             $this->smartyHelper->assign('weekDetails', $this->getWeekDetails($timeTracking, $isDetailed, $weekDates, $this->session_user->getId()));
             // ConsistencyCheck
             $consistencyErrors = $this->getConsistencyErrors($timeTracking);
             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"));
             }
             // IssueNotes
             $timeTracks = $timeTracking->getTimeTracks();
             $issueNotes = array();
             foreach ($timeTracks as $tt) {
                 $bug_id = $tt->getIssueId();
                 if (!array_key_exists($bug_id, $issueNotes)) {
                     $issueNote = IssueNote::getTimesheetNote($bug_id);
                     if (!is_null($issueNote)) {
                         $issue = IssueCache::getInstance()->getIssue($bug_id);
                         $user = UserCache::getInstance()->getUser($issueNote->getReporterId());
                         $issueNoteText = trim(IssueNote::removeAllReadByTags($issueNote->getText()));
                         $isManager = $this->session_user->isTeamManager($this->teamid);
                         // only Managers can markAsRead
                         $isRead = TRUE;
                         if ($isManager) {
                             $isRead = 0 != $issueNote->isReadBy($this->session_userid);
                         }
                         // Delete allowed by owner & managers
                         if ($this->session_userid == $issueNote->getReporterId() || $isManager) {
                             $isDeleteGranted = TRUE;
                         } else {
                             $isDeleteGranted = FALSE;
                         }
                         $issueNoteInfo = array('taskDesc' => SmartyTools::getIssueDescription($bug_id, $issue->getTcId(), htmlspecialchars($issue->getSummary())), 'note' => nl2br(htmlspecialchars($issueNoteText)), 'reporter' => $user->getRealname(), 'date' => date('Y-m-d H:i', $issueNote->getLastModified()), 'readBy' => implode(',<br>', array_keys($issueNote->getReadByList(TRUE))), 'issueNoteId' => $issueNote->getId(), 'isRead' => $isRead, 'isDeleteGranted' => $isDeleteGranted);
                         $issueNotes[$bug_id] = $issueNoteInfo;
                     }
                 }
             }
             if (count($issueNotes) > 0) {
                 $this->smartyHelper->assign('issueNotes', $issueNotes);
             }
         }
     }
 }
Example #8
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);
             }
         }
     }
 }
Example #9
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         $session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
         // Admins only
         if ($session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
             $this->smartyHelper->assign('access', true);
             $is_modified = Tools::getSecurePOSTStringValue('is_modified', 'false');
             // init
             // 'is_modified' is used because it's not possible to make a difference
             // between an unchecked checkBox and an unset checkbox variable
             if ("false" == $is_modified) {
                 $isBackup = true;
             } else {
                 $isBackup = $_POST['cb_backup'];
             }
             $filename = Tools::getSecurePOSTStringValue('backup_filename', "codevtt_backup_" . date("Ymd") . ".sql");
             $this->smartyHelper->assign('isBackup', $isBackup);
             $this->smartyHelper->assign('filename', $filename);
             if (isset($_POST['cb_backup'])) {
                 $result = true;
                 if ($isBackup) {
                     $result = SqlWrapper::getInstance()->sql_dump($filename) && $this->saveConfigFiles();
                     $this->smartyHelper->assign('backupResult', $result);
                 }
                 $this->smartyHelper->assign('stepOneResult', $result);
                 if ($result) {
                     $prjList = $this->displayProjectsToRemove();
                     $this->smartyHelper->assign('projects', $prjList);
                 }
                 $this->smartyHelper->assign('stepTwoResult', $result);
                 if ($result) {
                     $result = $this->removeCustomFields();
                 }
                 $this->smartyHelper->assign('stepThreeResult', $result);
                 if ($result) {
                     $result = Tools::execSQLscript2("uninstall.sql");
                 }
                 $this->smartyHelper->assign('stepFourResult', $result);
                 if ($result) {
                     $result = $this->deleteConfigFiles();
                 }
                 $this->smartyHelper->assign('stepFiveResult', $result);
                 if ($result) {
                     $result = $this->removeCustomMenuItem('CodevTT');
                 }
                 $this->smartyHelper->assign('stepSixResult', $result);
             } else {
                 Config::setQuiet(true);
                 $this->smartyHelper->assign('codevReportsDir', Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports');
                 Config::setQuiet(false);
                 $this->smartyHelper->assign('is_modified', $is_modified);
             }
         }
     }
 }
Example #10
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 {
             $action = filter_input(INPUT_POST, 'action');
             if (empty($action)) {
                 $action = 'display';
             }
             $pm = PluginManager::getInstance();
             // === ACTIONS =====================================================
             if ('enablePlugin' == $action) {
                 $pluginName = Tools::getSecurePOSTStringValue('pluginName');
                 $pm->enablePlugin($pluginName);
             } else {
                 if ('disablePlugin' == $action) {
                     $pluginName = Tools::getSecurePOSTStringValue('pluginName');
                     $pm->disablePlugin($pluginName);
                 } else {
                     if ('discoverNewPlugins' == $action) {
                         try {
                             Tools::createClassMap();
                             $pm->discoverNewPlugins();
                             //$this->smartyHelper->assign('infoMsg', T_('Found xx new plugins !'));
                         } catch (Exception $e) {
                             $this->smartyHelper->assign('errorMsg', T_('Could not create classmap: ') . $e->getMessage());
                         }
                     }
                 }
             }
             // === DISPLAY =====================================================
             // set values to display plugin table
             $plugins = $pm->getPlugins();
             $formattedPlugins = array();
             foreach ($plugins as $plugin) {
                 $className = $plugin['className'];
                 $formated_domains = array();
                 foreach ($plugin['domains'] as $domName) {
                     array_push($formated_domains, T_($domName));
                 }
                 //sort($formated_domains);
                 $formated_categories = array();
                 foreach ($plugin['categories'] as $catName) {
                     array_push($formated_categories, T_($catName));
                 }
                 //sort($formated_categories);
                 $formattedPlugins[$className] = array('name' => $plugin['displayedName'], 'status' => $plugin['status'], 'statusName' => pluginManager::getStatusName($plugin['status']), 'domains' => implode(',<br>', $formated_domains), 'categories' => implode(',<br>', $formated_categories), 'version' => $plugin['version'], 'description' => $plugin['description']);
             }
             $this->smartyHelper->assign('availablePlugins', $formattedPlugins);
         }
     }
 }
Example #11
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         if (0 != $this->teamid) {
             $team = TeamCache::getInstance()->getTeam($this->teamid);
             $action = filter_input(INPUT_GET, 'action');
             if ('setDateRange' === $action) {
                 $startdate = filter_input(INPUT_GET, 'startdate');
                 $startTimestamp = Tools::date2timestamp($startdate);
                 $enddate = filter_input(INPUT_GET, 'enddate');
                 $endTimestamp = Tools::date2timestamp($enddate);
                 $endTimestamp += 24 * 60 * 60 - 1;
                 // + 1 day -1 sec.
             } else {
                 //$startTimestamp = $team->getDate(); // creationDate
                 //$endTimestamp = time();
                 $startTimestamp = strtotime("first day of this month");
                 $endTimestamp = strtotime("last day of this month");
             }
             $this->smartyHelper->assign('startDate', date("Y-m-d", $startTimestamp));
             $this->smartyHelper->assign('endDate', date("Y-m-d", $endTimestamp));
             // create issueSelection with issues from team projects
             $teamIssues = $team->getTeamIssueList(true, true);
             // with disabledProjects ?
             $teamIssueSelection = new IssueSelection('Team' . $this->teamid . 'ISel');
             $teamIssueSelection->addIssueList($teamIssues);
             // feed the PluginDataProvider
             $pluginDataProvider = PluginDataProvider::getInstance();
             $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_ISSUE_SELECTION, $teamIssueSelection);
             $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_TEAM_ID, $this->teamid);
             $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $startTimestamp);
             $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $endTimestamp);
             $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_SESSION_USER_ID, $this->session_userid);
             $dashboardName = 'Team' . $this->teamid;
             // save the DataProvider for Ajax calls
             $_SESSION[PluginDataProviderInterface::SESSION_ID . $dashboardName] = serialize($pluginDataProvider);
             // create the Dashboard
             $dashboard = new Dashboard($dashboardName);
             $dashboard->setDomain(IndicatorPluginInterface::DOMAIN_TEAM);
             $dashboard->setCategories(array(IndicatorPluginInterface::CATEGORY_QUALITY, IndicatorPluginInterface::CATEGORY_ACTIVITY, IndicatorPluginInterface::CATEGORY_ROADMAP, IndicatorPluginInterface::CATEGORY_PLANNING, IndicatorPluginInterface::CATEGORY_RISK, IndicatorPluginInterface::CATEGORY_TEAM));
             $dashboard->setTeamid($this->teamid);
             $dashboard->setUserid($this->session_userid);
             $data = $dashboard->getSmartyVariables($this->smartyHelper);
             foreach ($data as $smartyKey => $smartyVariable) {
                 $this->smartyHelper->assign($smartyKey, $smartyVariable);
             }
         } else {
             $this->smartyHelper->assign('error', T_('Please select a team to access this page.'));
         }
     } else {
         $this->smartyHelper->assign('error', T_('Sorry, you need to be identified.'));
     }
 }
Example #12
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);
     }
 }
Example #13
0
File: bvi.php Project: fg-ok/codev
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         $isel = $this->getResolvedIssues($this->teamid, $this->session_userid);
         #$isel = $this->getResolvedIssues($this->teamid, $this->session_userid, array(18));
         #$isel = $this->getResolvedIssues($this->teamid, 17, array(18));
         #$isel = new IssueSelection('testSel');
         #$isel->addIssue(565);
         #$isel->addIssue(567);
         #$isel->addIssue(377);
         $indic = new BacklogVariationIndicator();
         $indic->execute($isel);
         $data = $indic->getSmartyObject();
         foreach ($data as $smartyKey => $smartyVariable) {
             $this->smartyHelper->assign($smartyKey, $smartyVariable);
         }
     }
 }
Example #14
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');
             }
         }
     }
 }
Example #15
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'));
                 }
             }
         }
     }
 }
Example #16
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);
             $formatedteamName = str_replace(" ", "_", $team->getName());
             // dates
             $month = date('m');
             $year = date('Y');
             // The first day of the current month
             $startdate = Tools::getSecurePOSTStringValue("startdate", Tools::formatDate("%Y-%m-%d", mktime(0, 0, 0, $month, 1, $year)));
             $this->smartyHelper->assign('startDate', $startdate);
             $startTimestamp = Tools::date2timestamp($startdate);
             // The current date plus one year
             $nbDaysInMonth = date("t", mktime(0, 0, 0, $month, 1, $year));
             $enddate = Tools::getSecurePOSTStringValue("enddate", Tools::formatDate("%Y-%m-%d", mktime(23, 59, 59, $month, $nbDaysInMonth, $year)));
             $this->smartyHelper->assign('endDate', $enddate);
             $endTimestamp = Tools::date2timestamp($enddate);
             $endTimestamp += 24 * 60 * 60 - 1;
             // + 1 day -1 sec.
             if ('computeCsvMonthly' == $_POST['action']) {
                 $timeTracking = new TimeTracking($startTimestamp, $endTimestamp, $this->teamid);
                 $myFile = Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports' . DIRECTORY_SEPARATOR . $formatedteamName . "_Mantis_" . date("Ymd") . ".csv";
                 ExportCsvTools::exportManagedIssuesToCSV($this->teamid, $startTimestamp, $endTimestamp, $myFile);
                 $this->smartyHelper->assign('managedIssuesToCSV', basename($myFile));
                 $myFile = Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports' . DIRECTORY_SEPARATOR . $formatedteamName . "_Projects_" . date("Ymd", $timeTracking->getStartTimestamp()) . "-" . date("Ymd", $timeTracking->getEndTimestamp()) . ".csv";
                 $this->exportProjectMonthlyActivityToCSV($timeTracking, $myFile);
                 $this->smartyHelper->assign('projectMonthlyActivityToCSV', basename($myFile));
                 // reduce scope to enhance speed
                 $reports = array();
                 for ($i = 1; $i <= 12; $i++) {
                     $reports[] = basename(ExportCsvTools::exportHolidaystoCSV($i, $year, $this->teamid, $formatedteamName, Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports'));
                 }
                 $this->smartyHelper->assign('reports', $reports);
                 $this->smartyHelper->assign('reportsDir', Constants::$codevOutputDir . DIRECTORY_SEPARATOR . 'reports');
             }
         }
     }
 }
Example #17
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         // Admins only
         $userid = $_SESSION['userid'];
         //$session_user = UserCache::getInstance()->getUser($userid);
         $teamid = 9;
         // ASF_OVA_Internet
         $cmdid = 16;
         // ASF Commande Internet
         $cmd = CommandCache::getInstance()->getCommand($cmdid);
         $startTimestamp = Tools::date2timestamp('2013-11-22');
         $endTimestamp = Tools::date2timestamp('2014-06-22');
         // ------ START TESTS
         //if (FALSE == Tools::createClassMap()) { echo "ERROR createClassMap";}
         //$pm = PluginManager::getInstance();
         //$pm->discoverNewPlugins();
         // ------ END TESTS
         // feed the PluginDataProvider
         $pluginDataProvider = PluginDataProvider::getInstance();
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_ISSUE_SELECTION, $cmd->getIssueSelection());
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_TEAM_ID, $teamid);
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $startTimestamp);
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $endTimestamp);
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_PROVISION_DAYS, $cmd->getProvisionDays());
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_SESSION_USER_ID, $userid);
         // save the DataProvider for Ajax calls
         $_SESSION[PluginDataProviderInterface::SESSION_ID] = serialize($pluginDataProvider);
         // create the Dashboard
         $dashboard = new Dashboard('myDashboardId');
         $dashboard->setDomain(IndicatorPluginInterface::DOMAIN_COMMAND);
         $dashboard->setCategories(array(IndicatorPluginInterface::CATEGORY_QUALITY, IndicatorPluginInterface::CATEGORY_ACTIVITY, IndicatorPluginInterface::CATEGORY_ROADMAP, IndicatorPluginInterface::CATEGORY_PLANNING, IndicatorPluginInterface::CATEGORY_RISK, IndicatorPluginInterface::CATEGORY_TEAM));
         $dashboard->setTeamid($teamid);
         $dashboard->setUserid($userid);
         $data = $dashboard->getSmartyVariables($this->smartyHelper);
         foreach ($data as $smartyKey => $smartyVariable) {
             $this->smartyHelper->assign($smartyKey, $smartyVariable);
         }
     } else {
         $this->smartyHelper->assign('error', T_('Sorry, you need to be in the admin-team to access this page.'));
     }
 }
Example #18
0
 protected function display()
 {
     // Consistency errors
     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 {
             $consistencyErrors = $this->getTeamConsistencyErrors($this->teamid);
             $this->smartyHelper->assign('teamid', $this->teamid);
             $this->smartyHelper->assign('count', count($consistencyErrors));
             if (isset($consistencyErrors)) {
                 $this->smartyHelper->assign('consistencyErrors', $consistencyErrors);
             }
         }
     }
     // log stats
     IssueCache::getInstance()->logStats();
     ProjectCache::getInstance()->logStats();
 }
Example #19
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))) {
             if (isset($_POST['projects']) && !empty($_POST['projects'])) {
                 $selectedProjects = $_POST['projects'];
                 $result = array();
                 foreach ($selectedProjects as $projectid) {
                     $project = ProjectCache::getInstance()->getProject($projectid);
                     $result[$projectid] = $project->getName();
                     Project::prepareProjectToCodev($projectid);
                 }
                 $this->smartyHelper->assign('result', $result);
             }
             $this->smartyHelper->assign('projects', $this->getProjectList());
         }
     }
 }
 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);
             $isObserver = $this->session_user->isTeamObserver($this->teamid);
             if ($isManager || $isObserver) {
                 // observers have access to the same info
                 $this->smartyHelper->assign('isManager', true);
             }
             // dates
             $month = date('m');
             $year = date('Y');
             $startdate = Tools::getSecurePOSTStringValue("startdate", Tools::formatDate("%Y-%m-%d", mktime(0, 0, 0, $month, 1, $year)));
             $this->smartyHelper->assign('startDate', $startdate);
             $startTimestamp = Tools::date2timestamp($startdate);
             $nbDaysInMonth = date("t", $startTimestamp);
             $enddate = Tools::getSecurePOSTStringValue("enddate", Tools::formatDate("%Y-%m-%d", mktime(0, 0, 0, $month, $nbDaysInMonth, $year)));
             $this->smartyHelper->assign('endDate', $enddate);
             $endTimestamp = Tools::date2timestamp($enddate);
             #$isDetailed = Tools::getSecurePOSTStringValue('cb_detailed','');
             #$this->smartyHelper->assign('isDetailed', $isDetailed);
             if ('computeMonthlyActivityReport' == $_POST['action']) {
                 $timeTracking = new TimeTracking($startTimestamp, $endTimestamp, $this->teamid);
                 $tracks = $timeTracking->getTimeTracks();
                 $this->smartyHelper->assign('monthlyActivityReport', $this->getMonthlyActivityReport($tracks));
                 // ConsistencyCheck
                 $consistencyErrors = $this->getConsistencyErrors($timeTracking);
                 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"));
                 }
             }
         }
     }
 }
Example #21
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 {
             // dates
             $weekDates = Tools::week_dates(date('W'), date('Y'));
             $startdate = Tools::getSecurePOSTStringValue("startdate", Tools::formatDate("%Y-%m-%d", $weekDates[1]));
             $this->smartyHelper->assign('startDate', $startdate);
             $enddate = Tools::getSecurePOSTStringValue("enddate", Tools::formatDate("%Y-%m-%d", $weekDates[5]));
             $this->smartyHelper->assign('endDate', $enddate);
             $isDetailed = Tools::getSecurePOSTIntValue('withJobDetails', 0);
             $this->smartyHelper->assign('isJobDetails', $isDetailed);
             $isExtTasksPrj = Tools::getSecurePOSTIntValue('withExtTasksPrj', 0);
             $this->smartyHelper->assign('isExtTasksPrj', $isExtTasksPrj);
             $isSideTasksPrj = Tools::getSecurePOSTIntValue('withSideTasksPrj', 1);
             $this->smartyHelper->assign('isSideTasksPrj', $isSideTasksPrj);
             if ('computeProjectActivityReport' == $_POST['action']) {
                 $startTimestamp = Tools::date2timestamp($startdate);
                 $endTimestamp = Tools::date2timestamp($enddate);
                 $endTimestamp = mktime(23, 59, 59, date('m', $endTimestamp), date('d', $endTimestamp), date('Y', $endTimestamp));
                 $timeTracking = new TimeTracking($startTimestamp, $endTimestamp, $this->teamid);
                 $this->smartyHelper->assign('projectActivityReport', $this->getProjectActivityReport($timeTracking->getProjectTracks(true), $this->teamid, $isDetailed));
                 // WorkingDaysPerProjectPerUser
                 $data = $timeTracking->getWorkingDaysPerProjectPerUser($isExtTasksPrj, true, $isSideTasksPrj);
                 foreach ($data as $smartyKey => $smartyVariable) {
                     $this->smartyHelper->assign($smartyKey, $smartyVariable);
                 }
                 $data = $this->getWorkingDaysPerProjectPerUser($startTimestamp, $endTimestamp, $isExtTasksPrj, $isSideTasksPrj);
                 foreach ($data as $smartyKey => $smartyVariable) {
                     $this->smartyHelper->assign($smartyKey, $smartyVariable);
                 }
             }
         }
     }
 }
Example #22
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);
         }
     }
 }
Example #23
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);
         }
     }
 }
Example #24
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);
             }
         }
     }
 }
Example #25
0
 public function execute()
 {
     if (Tools::isConnectedUser()) {
         header("Content-type: image/png");
         $height = Tools::getSecureGETIntValue('height');
         $width = Tools::getSecureGETIntValue('width');
         $color = Tools::getSecureGETStringValue('color');
         $strike = isset($_GET['strike']) ? TRUE : FALSE;
         // barrer le texte
         $text = isset($_GET['text']) ? $_GET['text'] : NULL;
         // image color
         $img = self::createGradiantImage($width, $height, $color);
         if ($strike) {
             self::createStrikeImage($img, $width, $height);
         }
         if ($text) {
             self::createText($img, $width, $height, $text);
         }
         imagepng($img);
         imagedestroy($img);
     } else {
         Tools::sendUnauthorizedAccess();
     }
 }
Example #26
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 cmdid set in URL, use it. else:
             // use the commandsetid set in the form, if not defined (first page call) use session commandsetid
             $cmdid = 0;
             if (isset($_POST['cmdid'])) {
                 $cmdid = Tools::getSecurePOSTIntValue('cmdid');
                 $_SESSION['cmdid'] = $cmdid;
             } else {
                 if (isset($_GET['cmdid'])) {
                     $cmdid = Tools::getSecureGETIntValue('cmdid');
                     $_SESSION['cmdid'] = $cmdid;
                 } else {
                     if (isset($_SESSION['cmdid'])) {
                         $cmdid = $_SESSION['cmdid'];
                     }
                 }
             }
             if (!array_key_exists($this->teamid, $this->teamList)) {
                 $this->teamid = 0;
                 $cmdid = 0;
             } else {
                 $isManager = $this->session_user->isTeamManager($this->teamid);
                 $isObserver = $this->session_user->isTeamObserver($this->teamid);
                 if ($isManager || $isObserver) {
                     // observers have access to the same info
                     $this->smartyHelper->assign('isManager', true);
                 }
             }
             $action = Tools::getSecurePOSTStringValue('action', '');
             // --- CmdStateFilters
             if ('setCmdStateFilters' == $action) {
                 $cmdStateFiltersStr = Tools::getSecurePOSTStringValue('checkedCmdStateFilters');
                 $this->session_user->setCmdStateFilters($cmdStateFiltersStr, $this->teamid);
             } else {
                 $cmdStateFiltersStr = $this->session_user->getCmdStateFilters($this->teamid);
             }
             if (!empty($cmdStateFiltersStr)) {
                 $cmdStateFilters = Tools::doubleExplode(':', ',', $cmdStateFiltersStr);
                 $this->smartyHelper->assign('isCmdStateFilter', true);
             } else {
                 $cmdStateFilters = array();
             }
             $cmdStateFilterInfo = array();
             foreach (Command::$stateNames as $stateId => $stateName) {
                 $cmdStateFilterInfo[$stateId] = array('stateId' => $stateId, 'stateName' => $stateName, 'isChecked' => array_key_exists($stateId, $cmdStateFilters) ? $cmdStateFilters[$stateId] : 1);
             }
             $this->smartyHelper->assign('cmdStateFilterInfo', $cmdStateFilterInfo);
             // --- commands combobox
             $commands = $this->getCommands($this->teamid, $cmdid, $cmdStateFilters);
             $this->smartyHelper->assign('commands', $commands);
             // check if current cmd should be hidden
             if (!array_key_exists($cmdid, $commands)) {
                 $cmdid = 0;
             }
             // ------ Display Command
             if (0 != $cmdid) {
                 $cmd = CommandCache::getInstance()->getCommand($cmdid);
                 if ($cmd->getTeamid() == $this->teamid) {
                     $this->smartyHelper->assign('commandid', $cmdid);
                     // get selected filters
                     if (isset($_GET['selectedFilters'])) {
                         $selectedFilters = Tools::getSecureGETStringValue('selectedFilters');
                     } else {
                         $selectedFilters = $this->session_user->getCommandFilters($cmdid);
                     }
                     // cleanup filters (remove empty lines)
                     $filterList = explode(',', $selectedFilters);
                     $filterList = array_filter($filterList, create_function('$a', 'return $a!="";'));
                     $selectedFilters = implode(',', $filterList);
                     CommandTools::displayCommand($this->smartyHelper, $cmd, $isManager || $isObserver, $selectedFilters);
                     // ConsistencyCheck
                     $consistencyErrors = $this->getConsistencyErrors($cmd);
                     if (count($consistencyErrors) > 0) {
                         $this->smartyHelper->assign('ccheckButtonTitle', count($consistencyErrors) . ' ' . T_("Errors"));
                         $this->smartyHelper->assign('ccheckBoxTitle', count($consistencyErrors) . ' ' . T_("Errors"));
                         $this->smartyHelper->assign('ccheckErrList', $consistencyErrors);
                     }
                     // check if sold days warning should be displayed
                     if (0 != $cmd->getTotalSoldDays()) {
                         $checkTotalSoldDays = $cmd->getTotalSoldDays() - $cmd->getIssueSelection()->mgrEffortEstim - $cmd->getProvisionDays();
                         $checkTotalSoldDays = round($checkTotalSoldDays, 2);
                         if (0 !== checkTotalSoldDays) {
                             $this->smartyHelper->assign('checkTotalSoldDays', $checkTotalSoldDays);
                         }
                     }
                     // access rights
                     if ($isManager || $this->session_user->isTeamLeader($cmd->getTeamid())) {
                         $this->smartyHelper->assign('isEditGranted', true);
                     }
                     // WBS
                     $this->smartyHelper->assign('wbsRootId', $cmd->getWbsid());
                     // indicator_plugins (old style plugins - deprecated)
                     $this->smartyHelper->assign('detailedChargesIndicatorFile', DetailedChargesIndicator::getSmartyFilename());
                     // Dashboard
                     CommandTools::dashboardSettings($this->smartyHelper, $cmd, $this->session_userid);
                 }
             } else {
                 unset($_SESSION['commandsetid']);
                 unset($_SESSION['servicecontractid']);
                 if ('displayCommand' == $action) {
                     header('Location:command_edit.php?cmdid=0');
                 }
             }
         }
     }
 }
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   CoDev-Timetracking is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with CoDev-Timetracking.  If not, see <http://www.gnu.org/licenses/>.
*/
require '../../path.inc.php';
// Note: i18n is included by the Controler class, but Ajax dos not use it...
require_once 'i18n/i18n.inc.php';
if (Tools::isConnectedUser() && filter_input(INPUT_GET, 'action')) {
    $teamid = isset($_SESSION['teamid']) ? $_SESSION['teamid'] : 0;
    $logger = Logger::getLogger("LoadPerUserIndicator_ajax");
    $action = Tools::getSecureGETStringValue('action');
    $dashboardId = Tools::getSecureGETStringValue('dashboardId');
    if (!isset($_SESSION[PluginDataProviderInterface::SESSION_ID . $dashboardId])) {
        $logger->error("PluginDataProvider not set (dashboardId = {$dashboardId}");
        Tools::sendBadRequest("PluginDataProvider not set");
    }
    $pluginDataProvider = unserialize($_SESSION[PluginDataProviderInterface::SESSION_ID . $dashboardId]);
    if (FALSE == $pluginDataProvider) {
        $logger->error("PluginDataProvider unserialize error (dashboardId = {$dashboardId}");
        Tools::sendBadRequest("PluginDataProvider unserialize error");
    }
    $smartyHelper = new SmartyHelper();
    if ('getLoadPerUserIndicator' == $action) {
Example #28
0
   CoDev-Timetracking is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   CoDev-Timetracking is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with CoDev-Timetracking.  If not, see <http://www.gnu.org/licenses/>.
*/
require 'path.inc.php';
if (Tools::isConnectedUser() && (isset($_GET['action']) || isset($_POST['action']))) {
    if (isset($_GET['action'])) {
        $smartyHelper = new SmartyHelper();
        if ($_GET['action'] == 'getTeamProjects') {
            $withDisabled = '1' == Tools::getSecureGETIntValue('withDisabledProjects', 1) ? true : false;
            $projects = TeamCache::getInstance()->getTeam(Tools::getSecureGETIntValue('teamid'))->getProjects(false, $withDisabled);
            $smartyHelper->assign('projects', SmartyTools::getSmartyArray($projects, 0));
            $smartyHelper->display('form/projectSelector');
        } elseif ($_GET['action'] == 'getTeamAllProjects') {
            $withDisabled = '1' == Tools::getSecureGETIntValue('withDisabledProjects', 1) ? true : false;
            $projects[0] = T_('All projects');
            $projects += $projects = TeamCache::getInstance()->getTeam(Tools::getSecureGETIntValue('teamid'))->getProjects(false, $withDisabled);
            $smartyHelper->assign('projects', SmartyTools::getSmartyArray($projects, 0));
            $smartyHelper->display('form/projectSelector');
        } elseif ($_GET['action'] == 'getProjectIssues') {
            $user = UserCache::getInstance()->getUser($_SESSION['userid']);
Example #29
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));
             }
         }
     }
 }
Example #30
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))) {
             $this->smartyHelper->assign('jobType', Job::$typeNames);
             $action = Tools::getSecurePOSTStringValue('action', 'none');
             if ('addJob' == $action) {
                 $job_name = Tools::getSecurePOSTStringValue('job_name');
                 $job_type = Tools::getSecurePOSTStringValue('job_type');
                 $job_color = Tools::getSecurePOSTStringValue('job_color');
                 // TODO check if not already in table !
                 // save to DB
                 Jobs::create($job_name, $job_type, $job_color);
             } elseif ('addAssociationProject' == $action) {
                 // Add Job to selected projects
                 $job_id = Tools::getSecurePOSTIntValue('job_id');
                 $proj = explode(",", Tools::getSecurePOSTStringValue('formattedProjects'));
                 foreach ($proj as $project_id) {
                     // TODO check if not already in table !
                     // save to DB
                     $query = "INSERT INTO `codev_project_job_table`  (`project_id`, `job_id`) VALUES ('" . $project_id . "','" . $job_id . "');";
                     $result = SqlWrapper::getInstance()->sql_query($query);
                     if (!$result) {
                         $this->smartyHelper->assign('error', T_("Couldn't add the job association"));
                     }
                 }
             } elseif ('deleteJob' == $action) {
                 $job_id = Tools::getSecurePOSTIntValue('job_id');
                 if (Jobs::JOB_NA == $job_id || Jobs::JOB_SUPPORT == $job_id) {
                     $this->smartyHelper->assign('error', T_("This job must not be deleted."));
                 } else {
                     $query = "DELETE FROM `codev_project_job_table` WHERE job_id = " . $job_id . ';';
                     $result = SqlWrapper::getInstance()->sql_query($query);
                     if (!$result) {
                         $this->smartyHelper->assign('error', T_("Couldn't remove the job association"));
                     }
                     $query = "DELETE FROM `codev_job_table` WHERE id = {$job_id};";
                     $result = SqlWrapper::getInstance()->sql_query($query);
                     if (!$result) {
                         $this->smartyHelper->assign('error', T_("Couldn't delete the job"));
                     }
                 }
             } elseif ('deleteJobProjectAssociation' == $action) {
                 $asso_id = Tools::getSecurePOSTIntValue('asso_id');
                 $query = "DELETE FROM `codev_project_job_table` WHERE id = " . $asso_id . ';';
                 $result = SqlWrapper::getInstance()->sql_query($query);
                 if (!$result) {
                     $this->smartyHelper->assign('error', T_("Couldn't remove the job association"));
                 }
             }
             $jobs = $this->getJobs();
             $this->smartyHelper->assign('jobs', $jobs);
             //$this->smartyHelper->assign('assignedJobs', $this->getAssignedJobs($jobs));
             $this->smartyHelper->assign('assignedJobs', $jobs);
             $projects = Project::getProjects();
             $this->smartyHelper->assign('projects', $projects);
             $this->smartyHelper->assign('tuples', $this->getAssignedJobTuples($projects));
         }
     }
 }