Example #1
0
 public function execute()
 {
     // set variables: session_userid, session_user, teamid, teamList and update teamSelector
     $this->updateTeamSelector();
     $this->display();
     $this->smartyHelper->displayTemplate();
 }
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) {
        // TODO do not log exception if date = 01-01-1970
        $startTimestamp = Tools::date2timestamp(Tools::getSecureGETStringValue("loadPerUser_startdate"));
        $endTimestamp = Tools::date2timestamp(Tools::getSecureGETStringValue("loadPerUser_enddate"));
        $attributesJsonStr = Tools::getSecureGETStringValue('attributesJsonStr');
        $attributesArray = json_decode(stripslashes($attributesJsonStr), true);
        $showSidetasks = 'on' != $attributesArray[LoadPerUserIndicator::OPTION_SHOW_SIDETASKS] ? false : true;
        //$logger->error("showSidetasks = ".var_export($showSidetasks, true).' attr '.$attributesArray[LoadPerUserIndicator::OPTION_SHOW_SIDETASKS]);
        // update dataProvider
        $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $startTimestamp);
        $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $endTimestamp);
        $indicator = new LoadPerUserIndicator($pluginDataProvider);
        // override plugin settings with current attributes
        $indicator->setPluginSettings(array(LoadPerUserIndicator::OPTION_SHOW_SIDETASKS => $showSidetasks));
        $indicator->execute();
Example #3
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';
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']);
            $withDisabled = '1' == Tools::getSecureGETIntValue('withDisabledProjects', 1) ? true : false;
            // --- define the list of tasks the user can display
Example #4
0
 /**
  * @param SmartyHelper $smartyHelper
  * @param Command $cmd
  */
 public static function displayCommand(SmartyHelper $smartyHelper, Command $cmd, $isManager, $selectedFilters = '')
 {
     if ($isManager) {
         $smartyHelper->assign('isManager', true);
     }
     $smartyHelper->assign('cmdid', $cmd->getId());
     $smartyHelper->assign('cmdName', $cmd->getName());
     $smartyHelper->assign('cmdReference', $cmd->getReference());
     $smartyHelper->assign('cmdVersion', $cmd->getVersion());
     $smartyHelper->assign('cmdReporter', $cmd->getReporter());
     $smartyHelper->assign('cmdStateList', self::getCommandStateList($cmd));
     $smartyHelper->assign('cmdState', Command::$stateNames[$cmd->getState()]);
     $smartyHelper->assign('cmdAverageDailyRate', $cmd->getAverageDailyRate());
     $smartyHelper->assign('cmdCurrency', $cmd->getCurrency());
     if (!is_null($cmd->getStartDate())) {
         $smartyHelper->assign('cmdStartDate', date("Y-m-d", $cmd->getStartDate()));
     }
     if (!is_null($cmd->getDeadline())) {
         $smartyHelper->assign('cmdDeadline', date("Y-m-d", $cmd->getDeadline()));
     }
     $smartyHelper->assign('cmdDesc', $cmd->getDesc());
     $smartyHelper->assign('cmdProvisionList', self::getProvisionList($cmd));
     $smartyHelper->assign('cmdProvisionTypeMngt', CommandProvision::provision_mngt);
     $smartyHelper->assign('cmdProvisionTotalList', self::getProvisionTotalList($cmd));
     $cmdTotalSoldDays = $cmd->getTotalSoldDays();
     $smartyHelper->assign('cmdTotalSoldDays', $cmdTotalSoldDays);
     // --------------
     // TODO math should not be in here !
     $mgrEE = $cmd->getIssueSelection()->mgrEffortEstim;
     $cmdProvAndMeeCost = $mgrEE * $cmd->getAverageDailyRate() + $cmd->getProvisionBudget(TRUE);
     $smartyHelper->assign('cmdProvAndMeeCost', round($cmdProvAndMeeCost, 2));
     $cmdProvAndMeeDays = $mgrEE + $cmd->getProvisionDays(TRUE);
     $smartyHelper->assign('cmdProvAndMeeDays', round($cmdProvAndMeeDays, 2));
     // TODO math should not be in here !
     $cmdTotalReestimated = $cmd->getIssueSelection()->getReestimated();
     $smartyHelper->assign('cmdTotalReestimated', $cmdTotalReestimated);
     $cmdTotalReestimatedCost = $cmdTotalReestimated * $cmd->getAverageDailyRate();
     $smartyHelper->assign('cmdTotalReestimatedCost', $cmdTotalReestimatedCost);
     // TODO math should not be in here !
     #$cmdTotalElapsed = $cmd->getIssueSelection()->getElapsed();
     #$cmdOutlayCost = $cmdTotalElapsed * $cmd->getAverageDailyRate();
     #$smartyHelper->assign('cmdOutlayCost',$cmdOutlayCost);
     #$smartyHelper->assign('cmdTotalElapsed',$cmdTotalElapsed);
     // TODO math should not be in here !
     $cmdTotalDrift = round($cmdTotalReestimated - $cmdProvAndMeeDays, 2);
     $cmdTotalDriftCost = round($cmdTotalReestimatedCost - $cmdProvAndMeeCost, 2);
     $cmdTotalDriftPercent = 0 == $cmdProvAndMeeDays ? 0 : round($cmdTotalDrift * 100 / $cmdProvAndMeeDays, 2);
     $smartyHelper->assign('cmdTotalDrift', $cmdTotalDrift);
     $smartyHelper->assign('cmdTotalDriftCost', $cmdTotalDriftCost);
     $smartyHelper->assign('cmdTotalDriftPercent', $cmdTotalDriftPercent);
     #$color1 = ($cmdOutlayCost > $cmdProvAndMeeCost) ? "fcbdbd" : "bdfcbd";
     #$smartyHelper->assign('cmdOutlayCostColor', $color1);
     #$color2 = ($cmdTotalElapsed > $cmdProvAndMeeDays) ? "fcbdbd" : "bdfcbd";
     #$smartyHelper->assign('cmdTotalElapsedColor',$color2);
     $color3 = $cmdTotalReestimated > $cmdProvAndMeeDays ? "fcbdbd" : "bdfcbd";
     $smartyHelper->assign('cmdTotalReestimatedColor', $color3);
     $color4 = $cmdTotalReestimatedCost > $cmdProvAndMeeCost ? "fcbdbd" : "bdfcbd";
     $smartyHelper->assign('cmdTotalReestimatedCostColor', $color4);
     $color5 = $cmdTotalDrift >= 0 ? "fcbdbd" : "bdfcbd";
     $smartyHelper->assign('cmdTotalDriftColor', $color5);
     // --------------
     // set CommandSets I belong to
     $smartyHelper->assign('parentCmdSets', self::getParentCommandSets($cmd));
     // set task list
     $cmdIssueSel = $cmd->getIssueSelection();
     $smartyHelper->assign('cmdNbIssues', $cmdIssueSel->getNbIssues());
     $smartyHelper->assign('cmdIssues', self::getCommandIssues($cmd));
     // used to create mantis link to view_all_bug_page.php:
     // view_all_set.php?type=1&temporary=y&FilterBugList_list=5079,5073,5108,5107,49396,5006
     $mantisFilterBugList = implode(',', array_keys($cmdIssueSel->getIssueList()));
     $smartyHelper->assign('mantisFilterBugList', $mantisFilterBugList);
     // --------------
     // Indicators & statistics
     // DetailedChargesIndicator
     $data = self::getDetailedCharges($cmd, $isManager, $selectedFilters);
     foreach ($data as $smartyKey => $smartyVariable) {
         $smartyHelper->assign($smartyKey, $smartyVariable);
     }
 }
Example #5
0
 * this files allows to save dashboard settings
 */
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_POST, 'action')) {
    $logger = Logger::getLogger("dashboardAjax");
    $action = filter_input(INPUT_POST, 'action');
    if ($action == 'getPluginConfigInfo') {
        $pluginClassName = Tools::getSecurePOSTStringValue('pluginClassName');
        try {
            $reflectionMethod = new ReflectionMethod($pluginClassName, 'getDesc');
            $pDesc = $reflectionMethod->invoke(NULL);
            $reflectionMethod2 = new ReflectionMethod($pluginClassName, 'getCfgFilemame');
            $cfgFilename = $reflectionMethod2->invoke(NULL);
            $smartyHelper = new SmartyHelper();
            $html = $smartyHelper->fetch($cfgFilename);
            $data = array('description' => htmlspecialchars($pDesc), 'attributesHtml' => $html, 'statusMsg' => 'SUCCESS');
            // return html & description string
            $jsonData = json_encode($data);
        } catch (Exception $e) {
            $logger->error("addDashboardPlugin error: " . $e->getMessage());
            $jsonData = json_encode(array('statusMsg' => T_('ERROR: could not get plugin configuration info')));
        }
        echo $jsonData;
    } else {
        if ($action == 'addDashboardPlugin') {
            $pluginAttributesJsonStr = Tools::getSecurePOSTStringValue('pluginAttributesJsonStr');
            $pluginAttributesJsonArray = json_decode(stripslashes($pluginAttributesJsonStr), true);
            //$logger->error("pluginAttributes = " . var_export($pluginAttributesJsonArray, true));
            // convert to a Dashboard compatible format
Example #6
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);
     }
 }
Example #7
0
 /**
  * 
  * @param PluginDataProvider $pluginDataProvider
  * @param SmartyHelper $smartyHelper
  * @param array $pluginAttributes
  * @param int $idx
  * @return array
  */
 public static function getWidget($pluginDataProvider, $smartyHelper, $pluginAttributes, $idx)
 {
     $pluginClassName = $pluginAttributes['pluginClassName'];
     // Plugin may not exist...
     if (!class_exists($pluginClassName)) {
         $e = new Exception('getWidget: class ' . $pluginClassName . ' not found !');
         throw $e;
     }
     $r = new ReflectionClass($pluginClassName);
     $indicator = $r->newInstanceArgs(array($pluginDataProvider));
     // examples: isGraphOnly, dateRange(defaultRange|currentWeek|currentMonth|noDateLimit), ...
     $indicator->setPluginSettings($pluginAttributes);
     $indicator->execute();
     $data = $indicator->getSmartyVariables();
     foreach ($data as $smartyKey => $smartyVariable) {
         $smartyHelper->assign($smartyKey, $smartyVariable);
     }
     //self::$logger->error("Indic classname: ".$pluginClassName);
     //self::$logger->error("Indic SmartyFilename: ".$pluginClassName::getSmartyFilename());
     $indicatorHtmlContent = $smartyHelper->fetch($pluginClassName::getSmartyFilename());
     // update inettuts attributes from pluginAttributes
     $widgetTitle = array_key_exists('widgetTitle', $pluginAttributes) ? $pluginAttributes['widgetTitle'] : $pluginClassName::getName();
     $color = array_key_exists('color', $pluginAttributes) ? $pluginAttributes['color'] : 'color-white';
     unset($pluginAttributes['widgetTitle']);
     unset($pluginAttributes['color']);
     // set indicator result in a dashboard widget
     $widget = array('id' => 'w_' . $idx, 'color' => $color, 'title' => $widgetTitle, 'desc' => $pluginClassName::getDesc(), 'category' => implode(',', $pluginClassName::getCategories()), 'pClassName' => $pluginClassName, 'attributesJsonStr' => json_encode($pluginAttributes), 'jsFiles' => $pluginClassName::getJsFiles(), 'cssFiles' => $pluginClassName::getCssFiles(), 'content' => $indicatorHtmlContent);
     return $widget;
 }
Example #8
0
 /**
  * @param SmartyHelper $smartyHelper
  * @param CommandSet $commandset
  */
 public static function displayCommandSet(SmartyHelper $smartyHelper, CommandSet $commandset, $isManager, $selectedFilters = '')
 {
     #$smartyHelper->assign('commandsetId', $commandset->getId());
     $smartyHelper->assign('teamid', $commandset->getTeamid());
     $smartyHelper->assign('commandsetName', $commandset->getName());
     $smartyHelper->assign('commandsetReference', $commandset->getReference());
     $smartyHelper->assign('commandsetDesc', $commandset->getDesc());
     $smartyHelper->assign('commandsetBudget', $commandset->getBudgetDays());
     $smartyHelper->assign('commandsetCost', $commandset->getCost());
     $smartyHelper->assign('commandsetCurrency', $commandset->getCurrency());
     if (!is_null($commandset->getDate())) {
         $smartyHelper->assign('commandsetDate', Tools::formatDate("%Y-%m-%d", $commandset->getDate()));
     }
     $smartyHelper->assign('cmdList', self::getCommandSetCommands($commandset->getId(), Command::type_general));
     $smartyHelper->assign('cmdsetDetailedMgr', self::getCommandSetDetailedMgr($commandset->getId(), Command::type_general));
     // Budget
     $cmdList = $commandset->getCommands(Command::type_general);
     $cmdsProvAndMeeCost = 0;
     foreach ($cmdList as $cmd) {
         // TODO math should not be in here !
         $mgrEE = $cmd->getIssueSelection()->mgrEffortEstim;
         $cmdProvAndMeeCost = $mgrEE * $cmd->getAverageDailyRate() + $cmd->getProvisionBudget(TRUE);
         $cmdsProvAndMeeCost += $cmdProvAndMeeCost;
     }
     $smartyHelper->assign('cmdsProvAndMeeCost', $cmdsProvAndMeeCost);
     $color1 = $cmdProvAndMeeCost > $commandset->getCost() ? "fcbdbd" : "bdfcbd";
     $smartyHelper->assign('cmdsProvAndMeeCostColor', $color1);
     //$cmdTotalElapsed = $commandset->getIssueSelection()->getElapsed($cmd->$commandset(), $commandset->getDeadline());
     $csetTotalElapsed = $commandset->getIssueSelection(Command::type_general)->getElapsed();
     $smartyHelper->assign('commandsetTotalElapsed', $csetTotalElapsed);
     $smartyHelper->assign('cmdProvisionList', self::getProvisionList($commandset));
     $smartyHelper->assign('cmdProvisionTotalList', self::getProvisionTotalList($commandset));
     // DetailedChargesIndicator
     $data = self::getDetailedCharges($commandset, $isManager, $selectedFilters);
     foreach ($data as $smartyKey => $smartyVariable) {
         $smartyHelper->assign($smartyKey, $smartyVariable);
     }
 }
   (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() && (isset($_GET['action']) || isset($_POST['action']))) {
    if (isset($_GET['action'])) {
        $smartyHelper = new SmartyHelper();
        if ($_GET['action'] == 'updateDetailedCharges') {
            $servicecontractid = Tools::getSecureGETIntValue('selectFiltersSrcId');
            $selectedFilters = Tools::getSecureGETStringValue('selectedFilters', '');
            $session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
            $session_user->setServiceContractFilters($selectedFilters, $servicecontractid);
            $servicecontract = ServiceContractCache::getInstance()->getServiceContract($servicecontractid);
            $isManager = $session_user->isTeamManager($servicecontract->getTeamid());
            $isObserver = $session_user->isTeamObserver($servicecontract->getTeamid());
            // DetailedChargesIndicator
            $data = ServiceContractTools::getDetailedCharges($servicecontract, $isManager || $isObserver, $selectedFilters);
            foreach ($data as $smartyKey => $smartyVariable) {
                $smartyHelper->assign($smartyKey, $smartyVariable);
            }
            $smartyHelper->display(DetailedChargesIndicator::getSmartySubFilename());
        } else {
Example #10
0
   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')) {
    $action = Tools::getSecureGETStringValue('action', 'none');
    $logger = Logger::getLogger("IssueInfo_ajax");
    $smartyHelper = new SmartyHelper();
    if ('getGeneralInfo' == $action) {
        $issue = IssueCache::getInstance()->getIssue(Tools::getSecureGETIntValue('bugid'));
        $user = UserCache::getInstance()->getUser($_SESSION['userid']);
        $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();
        $teamid = $_SESSION['teamid'];
        $smartyHelper->assign('isManager', $user->isTeamManager($teamid));
        $smartyHelper->assign('isObserver', $user->isTeamObserver($teamid));
        $isManagerView = array_key_exists($issue->getProjectId(), $managedProjList) ? true : false;
        $isObserverView = array_key_exists($issue->getProjectId(), $observedProjList) ? true : false;
        $smartyHelper->assign('issueGeneralInfo', IssueInfoTools::getIssueGeneralInfo($issue, $isManagerView || $isObserverView));
        $smartyHelper->display('ajax/issueGeneralInfo');
    } else {
// 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')) {
    $logger = Logger::getLogger("HelloWorldIndicator_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 ('getHelloWorldIndicator' == $action) {
        $startTimestamp = Tools::date2timestamp(Tools::getSecureGETStringValue("helloWorld_startdate"));
        // update dataProvider
        $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $startTimestamp);
        $indicator = new HelloWorldIndicator($pluginDataProvider);
        $indicator->execute();
        $data = $indicator->getSmartyVariablesForAjax();
        // construct the html table
        foreach ($data as $smartyKey => $smartyVariable) {
            $smartyHelper->assign($smartyKey, $smartyVariable);
            #$logger->debug("key $smartyKey = ".var_export($smartyVariable, true));
        }
        $html = $smartyHelper->fetch(HelloWorldIndicator::getSmartySubFilename());
        $data['helloWorld_htmlContent'] = $html;
        // return html & chart data
// 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')) {
    $logger = Logger::getLogger("TimetrackDetailsIndicator_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 ('getTimetrackDetailsIndicator' == $action) {
        $startTimestamp = Tools::date2timestamp(Tools::getSecureGETStringValue("timetrackDetails_startdate"));
        $endTimestamp = Tools::date2timestamp(Tools::getSecureGETStringValue("timetrackDetails_enddate"));
        $displayedTeam = Tools::getSecureGETIntValue("timetrackDetails_displayedTeam", 0);
        // update dataProvider
        $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $startTimestamp);
        $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $endTimestamp);
        $indicator = new TimetrackDetailsIndicator($pluginDataProvider);
        // override plugin settings with current attributes
        $indicator->setPluginSettings(array(TimetrackDetailsIndicator::OPTION_DISPLAYED_TEAM => $displayedTeam));
        $indicator->execute();
        $data = $indicator->getSmartyVariablesForAjax();
        // construct the html table
        foreach ($data as $smartyKey => $smartyVariable) {
            $smartyHelper->assign($smartyKey, $smartyVariable);
Example #13
0
   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')) {
    $action = Tools::getSecureGETStringValue('action', 'none');
    $logger = Logger::getLogger("IssueInfo_ajax");
    $smartyHelper = new SmartyHelper();
    if ('getGeneralInfo' == $action) {
        $issue = IssueCache::getInstance()->getIssue(Tools::getSecureGETIntValue('bugid'));
        $user = UserCache::getInstance()->getUser($_SESSION['userid']);
        $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();
        $isManager = array_key_exists($issue->getProjectId(), $managedProjList) ? true : false;
        $isObserver = array_key_exists($issue->getProjectId(), $observedProjList) ? true : false;
        $smartyHelper->assign('issueGeneralInfo', IssueInfoTools::getIssueGeneralInfo($issue, $isManager || $isObserver));
        $smartyHelper->display('ajax/issueGeneralInfo');
    } else {
        if ('removeFromCmd' == $action) {
            $cmdid = Tools::getSecureGETIntValue('cmdid');
            $bugid = Tools::getSecureGETIntValue('bugid');
Example #14
0
 /**
  * Initialize complex static variables
  * @static
  */
 public static function staticInit()
 {
     self::$logger = Logger::getLogger(__CLASS__);
 }