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(); } } } else { Tools::sendUnauthorizedAccess(); }
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 // All projects from teams where I'm a Developper or Manager AND Observer $allProject[0] = T_('(all)'); $dTeamList = $user->getDevTeamList(); $devProjList = count($dTeamList) > 0 ? $user->getProjectList($dTeamList, true, $withDisabled) : array(); $managedTeamList = $user->getManagedTeamList();
$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 { if ('removeFromCmd' == $action) { $cmdid = Tools::getSecureGETIntValue('cmdid'); $bugid = Tools::getSecureGETIntValue('bugid'); $userid = $_SESSION['userid']; try { // cmd,user,issue must exist // user must be manager in the cmd's team $user = UserCache::getInstance()->getUser($userid); $cmd = CommandCache::getInstance()->getCommand($cmdid); $cmdTeamid = $cmd->getTeamid(); if ($user->isTeamManager($cmdTeamid)) { $cmd->removeIssue($bugid); $jsonData = json_encode(array('statusMsg' => 'SUCCESS', 'cmdid' => $cmdid)); } else {