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(); } }
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(); } }
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'); } } } } }
$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(); $data = $indicator->getSmartyVariablesForAjax(); // construct the html table foreach ($data as $smartyKey => $smartyVariable) { $smartyHelper->assign($smartyKey, $smartyVariable); #$logger->debug("key $smartyKey = ".var_export($smartyVariable, true));
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 { // use the servicecontractid set in the form, if not defined (first page call) use session servicecontractid $servicecontractid = 0; if (isset($_POST['servicecontractid'])) { $servicecontractid = Tools::getSecurePOSTIntValue('servicecontractid'); $_SESSION['servicecontractid'] = $servicecontractid; } else { if (isset($_GET['servicecontractid'])) { $servicecontractid = Tools::getSecureGETIntValue('servicecontractid'); $_SESSION['servicecontractid'] = $servicecontractid; } else { if (isset($_SESSION['servicecontractid'])) { $servicecontractid = $_SESSION['servicecontractid']; } } } // set TeamList (including observed teams) $oTeamList = $this->session_user->getObservedTeamList(); $mTeamList = $this->session_user->getManagedTeamList(); $teamList = $oTeamList + $mTeamList; // array_merge does not work ?! if (empty($teamList) || !array_key_exists($this->teamid, $teamList)) { // only managers (and observers) can access this page. return; } $isManager = $this->session_user->isTeamManager($this->teamid); $isObserver = $this->session_user->isTeamObserver($this->teamid); if ($isManager || $isObserver) { $this->smartyHelper->assign('isManager', true); } $this->smartyHelper->assign('servicecontracts', ServiceContractTools::getServiceContracts($this->teamid, $servicecontractid)); if (0 != $servicecontractid) { $servicecontract = ServiceContractCache::getInstance()->getServiceContract($servicecontractid); if ($this->teamid == $servicecontract->getTeamid()) { $this->smartyHelper->assign('servicecontractid', $servicecontractid); // get selected filters $selectedFilters = ""; if (isset($_GET['selectedFilters'])) { $selectedFilters = Tools::getSecureGETStringValue('selectedFilters'); } else { $selectedFilters = $this->session_user->getServiceContractFilters($servicecontractid); } ServiceContractTools::displayServiceContract($this->smartyHelper, $servicecontract, $isManager || $isObserver, $selectedFilters); // ConsistencyCheck $consistencyErrors = $this->getConsistencyErrors($servicecontract); if (0 != $consistencyErrors) { $this->smartyHelper->assign('ccheckButtonTitle', count($consistencyErrors) . ' ' . T_("Errors")); $this->smartyHelper->assign('ccheckBoxTitle', count($consistencyErrors) . ' ' . T_("Errors")); $this->smartyHelper->assign('ccheckErrList', $consistencyErrors); } // access rights if ($isManager || $this->session_user->isTeamLeader($servicecontract->getTeamid())) { $this->smartyHelper->assign('isEditGranted', true); } // old-style plugins (deprecated) $this->smartyHelper->assign('detailedChargesIndicatorFile', DetailedChargesIndicator::getSmartyFilename()); // Dashboard ServiceContractTools::dashboardSettings($this->smartyHelper, $servicecontract, $this->session_userid); } } else { unset($_SESSION['cmdid']); unset($_SESSION['commandsetid']); $action = filter_input(INPUT_POST, 'action'); if ('displayServiceContract' == $action) { header('Location:servicecontract_edit.php?servicecontractid=0'); } } } } }
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 { Tools::sendNotFoundAccess(); } }
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'])) { $teamid = isset($_SESSION['teamid']) ? $_SESSION['teamid'] : 0; $logger = Logger::getLogger("LoadPerProjectIndicator_ajax"); $action = Tools::getSecureGETStringValue('action', ''); if (!empty($action)) { $smartyHelper = new SmartyHelper(); if ($action == 'getLoadPerProjectIndicator') { if (isset($_SESSION[PluginDataProviderInterface::SESSION_ID])) { $pluginDataProvider = unserialize($_SESSION[PluginDataProviderInterface::SESSION_ID]); if (FALSE != $pluginDataProvider) { // TODO do not log exception if date = 01-01-1970 $startTimestamp = Tools::date2timestamp(Tools::getSecureGETStringValue("loadPerProject_startdate")); $endTimestamp = Tools::date2timestamp(Tools::getSecureGETStringValue("loadPerProject_enddate")); // update dataProvider $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $startTimestamp); $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $endTimestamp); $indicator = new LoadPerProjectIndicator($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(LoadPerProjectIndicator::getSmartySubFilename()); $data['loadPerProject_htmlContent'] = $html; // return html & chart data $jsonData = json_encode($data);
protected function display() { if (Tools::isConnectedUser()) { $user = UserCache::getInstance()->getUser($_SESSION['userid']); $teamList = $user->getTeamList(); if (0 != count($teamList)) { // ---- select project // define the list of tasks the user can display // All projects from teams where I'm a Developper or Manager AND Observers $dTeamList = $user->getDevTeamList(); $devProjList = 0 == count($dTeamList) ? array() : $user->getProjectList($dTeamList); $managedTeamList = $user->getManagedTeamList(); $managedProjList = 0 == count($managedTeamList) ? array() : $user->getProjectList($managedTeamList); $oTeamList = $user->getObservedTeamList(); $observedProjList = 0 == count($oTeamList) ? array() : $user->getProjectList($oTeamList); $projList = $devProjList + $managedProjList + $observedProjList; if (isset($_GET['projectid'])) { $projectid = Tools::getSecureGETIntValue('projectid'); $_SESSION['projectid'] = $projectid; } else { if (isset($_SESSION['projectid'])) { $projectid = $_SESSION['projectid']; } else { $projectsid = array_keys($projList); $projectid = $projectsid[0]; } } // get selected filters if (isset($_GET['selectedFilters']) && NULL != $_GET['selectedFilters']) { $selectedFilters = Tools::getSecureGETStringValue('selectedFilters'); #echo "last = ".$selectedFilters[strlen($selectedFilters)-1]; if (',' == $selectedFilters[strlen($selectedFilters) - 1]) { $selectedFilters = substr($selectedFilters, 0, -1); // last char is a ',' } $filterList = explode(',', $selectedFilters); } else { $selectedFilters = ""; $filterList = array(); } $this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($projList, $projectid)); $project = ProjectCache::getInstance()->getProject($projectid); // ---- $availFilterList = array("ProjectVersionFilter" => "Project Version", "ProjectCategoryFilter" => "Project Category", "IssueExtIdFilter" => "Issue External ID", "IssuePublicPrivateFilter" => "Issue Public / Private", "IssueTagFilter" => "Issue Tags"); $selectedFilterList = array(); foreach ($filterList as $id) { $selectedFilterList[$id] = $availFilterList[$id]; unset($availFilterList[$id]); } // do the work ... $projectIssueSel = $project->getIssueSelection(); $filterMgr = new FilterManager($projectIssueSel, $filterList); $resultList = $filterMgr->execute(); $issueSelList = $filterMgr->explodeResults($resultList); $smatyObj = $this->getDetailedMgr($issueSelList, $filterList); $totalLine = array_shift($smatyObj); // first line is rootElem (TOTAL) $titleLine = array_pop($smatyObj); // last line is the table titles $this->smartyHelper->assign('availFilterList', $availFilterList); $this->smartyHelper->assign('selectedFilterList', $selectedFilterList); $this->smartyHelper->assign('selectedFilters', $selectedFilters); $this->smartyHelper->assign('nbFilters', count($filterList)); $this->smartyHelper->assign('filterResultsTitles', $titleLine); $this->smartyHelper->assign('filterResults', $smatyObj); $this->smartyHelper->assign('filterResultsTotal', $totalLine); } } }
protected function display() { if (Tools::isConnectedUser()) { // only teamMembers & observers can access this page if (0 == $this->teamid || $this->session_user->isTeamCustomer($this->teamid)) { $this->smartyHelper->assign('accessDenied', TRUE); } else { $tmpTeamList = array($this->teamid => $this->teamList[$this->teamid]); $projList = $this->session_user->getProjectList($tmpTeamList, true, false); if (isset($_GET['projectid'])) { $projectid = Tools::getSecureGETIntValue('projectid'); $_SESSION['projectid'] = $projectid; } else { if (isset($_SESSION['projectid'])) { $projectid = $_SESSION['projectid']; } else { $projectsid = array_keys($projList); $projectid = $projectsid[0]; } } $this->smartyHelper->assign('projects', SmartyTools::getSmartyArray($projList, $projectid)); // if display project allowed if (in_array($projectid, array_keys($projList))) { $this->smartyHelper->assign('projectid', $projectid); // Managers can see detailed view $isManager = $this->session_user->isTeamManager($this->teamid); $isObserver = $this->session_user->isTeamObserver($this->teamid); $this->smartyHelper->assign("isManager", $isManager || $isObserver); $project = ProjectCache::getInstance()->getProject($projectid); $projectIssueSel = $project->getIssueSelection(); // --- FILTER TABS ------------- // get selected filters if (isset($_GET['selectedFilters'])) { $selectedFilters = Tools::getSecureGETStringValue('selectedFilters'); } else { $selectedFilters = $this->session_user->getProjectFilters($projectid); } // cleanup filters (remove empty lines) $filterList = explode(',', $selectedFilters); $filterList = array_filter($filterList, create_function('$a', 'return $a!="";')); $selectedFilters = implode(',', $filterList); // save user preferances $this->session_user->setProjectFilters($selectedFilters, $projectid); // TODO: get allFilters from config.ini $data = ProjectInfoTools::getDetailedCharges($projectid, $isManager || $isObserver, $selectedFilters); foreach ($data as $smartyKey => $smartyVariable) { $this->smartyHelper->assign($smartyKey, $smartyVariable); } // --- DRIFT TABS ------------------- $currentIssuesInDrift = NULL; $resolvedIssuesInDrift = NULL; foreach ($projectIssueSel->getIssuesInDrift($isManager || $isObserver) as $issue) { $smartyIssue = $this->getSmartyDirftedIssue($issue, $isManager || $isObserver); if (NULL != $smartyIssue) { if ($issue->isResolved()) { $resolvedIssuesInDrift[] = $smartyIssue; } else { $currentIssuesInDrift[] = $smartyIssue; } } } $this->smartyHelper->assign("currentIssuesInDrift", $currentIssuesInDrift); $this->smartyHelper->assign("resolvedIssuesInDrift", $resolvedIssuesInDrift); // indicator_plugins (old style plugins - deprecated) $this->smartyHelper->assign('detailedChargesIndicatorFile', DetailedChargesIndicator::getSmartyFilename()); // Dashboard ProjectInfoTools::dashboardSettings($this->smartyHelper, $project, $this->session_userid, $this->teamid); } } } }
This file is part of CodevTT. CodevTT 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. CodevTT 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 CodevTT. If not, see <http://www.gnu.org/licenses/>. */ require '../path.inc.php'; if (Tools::isConnectedUser()) { // this will log CLIENT Javascript errors in CodevTT Server logs. // see js/jsErrorCatch.js (which will return the error via Ajax) $logger = Logger::getLogger("JsErrorCatch"); if ($logger->isDebugEnabled()) { $desc = Tools::getSecureGETStringValue('desc'); $line = Tools::getSecureGETStringValue('line'); $useragent = Tools::getSecureGETStringValue('useragent'); $os = Tools::getSecureGETStringValue('os'); $url = Tools::getSecureGETStringValue('url'); $file = Tools::getSecureGETStringValue('file'); $userid = $_SESSION['userid']; $logger->debug("JS_CLIENT_ERROR: {$desc} --- user={$userid}, URL={$url}, file={$file}, line={$line}, OS={$os}, USERAGENT={$useragent}"); } }
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')) { $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));
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 $jsonData = json_encode($data); echo $jsonData;
$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); } $html = $smartyHelper->fetch(TimetrackDetailsIndicator::getSmartySubFilename()); $data['timetrackDetails_htmlContent'] = $html;
$response['selectedItemList'] = $selectedItemList; $response['selectedItems'] = $selectedItems; // json encode $jsonResponse = Tools::array2json($response); echo "{$jsonResponse}"; } catch (Exception $e) { Tools::sendBadRequest($e->getMessage()); } } else { if ($_GET['action'] == 'processPostSelectionAction') { try { $selectedTooltips = Tools::getSecureGETStringValue('selectedItems', NULL); if (strlen($selectedTooltips) == 0) { $selectedTooltips = null; } $implodedSrcRef = Tools::getSecureGETStringValue('itemSelection_srcRef'); $srcRefList = Tools::doubleExplode(':', ',', $implodedSrcRef); $projectid = $srcRefList['projectid']; $teamid = $srcRefList['teamid']; // save user preferances $tooltips = NULL; if ($selectedTooltips != NULL) { $tooltips = explode(',', $selectedTooltips); } $project = ProjectCache::getInstance()->getProject($projectid); $project->setIssueTooltipFields($tooltips, $teamid); $formattedFields = array(); if ($tooltips != NULL) { foreach ($tooltips as $f) { $formattedFields[] = Tools::getTooltipFieldDisplayName($f); }