예제 #1
0
 /**
  *
  * @param SmartyHelper $smartyHelper
  * @param Command $prj
  * @param int $userid
  */
 public static function dashboardSettings(SmartyHelper $smartyHelper, Project $prj, $userid, $teamid)
 {
     $pluginDataProvider = PluginDataProvider::getInstance();
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_ISSUE_SELECTION, $prj->getIssueSelection());
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_TEAM_ID, $teamid);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_SESSION_USER_ID, $userid);
     $team = TeamCache::getInstance()->getTeam($teamid);
     $startT = $team->getDate();
     $now = time();
     $endT = mktime(23, 59, 59, date('m', $now), date('d', $now), date('Y', $now));
     if ($startT > $endT) {
         $startT = strtotime('today midnight');
     }
     //echo "start $startT end $endT<br>";
     // Calculate a nice day interval
     $nbWeeks = ($endT - $startT) / 60 / 60 / 24;
     $interval = ceil($nbWeeks / 20);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $startT);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $endT);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_INTERVAL, $interval);
     // save the DataProvider for Ajax calls
     $_SESSION[PluginDataProviderInterface::SESSION_ID] = serialize($pluginDataProvider);
     // create the Dashboard
     $dashboard = new Dashboard('Project' . $prj->getId());
     $dashboard->setDomain(IndicatorPluginInterface::DOMAIN_PROJECT);
     $dashboard->setCategories(array(IndicatorPluginInterface::CATEGORY_QUALITY, IndicatorPluginInterface::CATEGORY_ACTIVITY, IndicatorPluginInterface::CATEGORY_ROADMAP, IndicatorPluginInterface::CATEGORY_PLANNING, IndicatorPluginInterface::CATEGORY_RISK));
     $dashboard->setTeamid($teamid);
     $dashboard->setUserid($userid);
     $data = $dashboard->getSmartyVariables($smartyHelper);
     foreach ($data as $smartyKey => $smartyVariable) {
         $smartyHelper->assign($smartyKey, $smartyVariable);
     }
 }
예제 #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.'));
     }
 }
예제 #3
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.'));
     }
 }
예제 #4
0
파일: plugin.php 프로젝트: fg-ok/codev
 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.'));
     }
 }
예제 #5
0
 /**
  *
  * @param SmartyHelper $smartyHelper
  * @param Command $cmd
  * @param int $userid
  */
 public static function dashboardSettings(SmartyHelper $smartyHelper, Command $cmd, $userid)
 {
     $pluginDataProvider = PluginDataProvider::getInstance();
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_ISSUE_SELECTION, $cmd->getIssueSelection());
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_TEAM_ID, $cmd->getTeamid());
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_PROVISION_DAYS, $cmd->getProvisionDays());
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_SESSION_USER_ID, $userid);
     $params = self::computeTimestampsAndInterval($cmd);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $params['startTimestamp']);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $params['endTimestamp']);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_INTERVAL, $params['interval']);
     $dashboardName = 'Command' . $cmd->getId();
     // save the DataProvider for Ajax calls
     $_SESSION[PluginDataProviderInterface::SESSION_ID . $dashboardName] = serialize($pluginDataProvider);
     // create the Dashboard
     $dashboard = new Dashboard($dashboardName);
     $dashboard->setDomain(IndicatorPluginInterface::DOMAIN_COMMAND);
     $dashboard->setCategories(array(IndicatorPluginInterface::CATEGORY_QUALITY, IndicatorPluginInterface::CATEGORY_ACTIVITY, IndicatorPluginInterface::CATEGORY_ROADMAP, IndicatorPluginInterface::CATEGORY_PLANNING, IndicatorPluginInterface::CATEGORY_RISK));
     $dashboard->setTeamid($cmd->getTeamid());
     $dashboard->setUserid($userid);
     $data = $dashboard->getSmartyVariables($smartyHelper);
     foreach ($data as $smartyKey => $smartyVariable) {
         $smartyHelper->assign($smartyKey, $smartyVariable);
     }
 }
예제 #6
0
 /**
  *
  * @param SmartyHelper $smartyHelper
  * @param Issue $issue
  * @param int $userid
  * @param int $teamid
  */
 public static function dashboardSettings(SmartyHelper $smartyHelper, Issue $issue, $userid, $teamid)
 {
     $isel = new IssueSelection();
     $isel->addIssue($issue->getId());
     $pluginDataProvider = PluginDataProvider::getInstance();
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_ISSUE_SELECTION, $isel);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_TEAM_ID, $teamid);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_SESSION_USER_ID, $userid);
     // start date is min(1st_timetrack, issue_creation_date)
     $startT = $issue->getDateSubmission();
     $firstTT = $issue->getFirstTimetrack();
     if (NULL != $firstTT) {
         $startT = min(array($issue->getDateSubmission(), $firstTT->getDate()));
     }
     // end date is last_timetrack or now if none
     $eTs = NULL == $firstTT ? time() : $issue->getLatestTimetrack()->getDate();
     $endT = mktime(23, 59, 59, date('m', $eTs), date('d', $eTs), date('Y', $eTs));
     //echo "start $startT end $endT<br>";
     // Calculate a nice day interval
     $nbWeeks = ($endT - $startT) / 60 / 60 / 24;
     $interval = ceil($nbWeeks / 20);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $startT);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $endT);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_INTERVAL, $interval);
     $dashboardName = 'Tasks_prj' . $issue->getProjectId();
     // save the DataProvider for Ajax calls
     $_SESSION[PluginDataProviderInterface::SESSION_ID . $dashboardName] = serialize($pluginDataProvider);
     // create the Dashboard
     $dashboard = new Dashboard($dashboardName);
     // settings are common all tasks of a project
     $dashboard->setDomain(IndicatorPluginInterface::DOMAIN_TASK);
     $dashboard->setCategories(array(IndicatorPluginInterface::CATEGORY_QUALITY, IndicatorPluginInterface::CATEGORY_ACTIVITY, IndicatorPluginInterface::CATEGORY_ROADMAP, IndicatorPluginInterface::CATEGORY_PLANNING, IndicatorPluginInterface::CATEGORY_RISK));
     $dashboard->setTeamid($teamid);
     $dashboard->setUserid($userid);
     $data = $dashboard->getSmartyVariables($smartyHelper);
     foreach ($data as $smartyKey => $smartyVariable) {
         $smartyHelper->assign($smartyKey, $smartyVariable);
     }
 }