/** * */ protected function init() { $userName = ""; $userEmails = array(); if (isset($_SESSION['user'])) { try { $userName = $_SESSION['user']->getName(); $userEmails = $_SESSION['user']->getEmail(); } catch (Exception $e) { } } $this->tpl->assign("userName", $userName); $this->tpl->assign("userEmails", $userEmails); }
/** * Displays smarty template to show test project info to users. * * @param type $smarty [ref] smarty object * @param type $id test project * @param type $sqlResult [default = ''] * @param type $action [default = 'update'] * @param type $modded_item_id [default = 0] * * @todo havlatm (20100214): smarty should not be in this class - move code to appropariate page **/ function show(&$smarty, $guiObj, $template_dir, $id, $sqlResult = '', $action = 'update', $modded_item_id = 0) { $gui = $guiObj; $gui->modify_tc_rights = has_rights($this->db, "mgt_modify_tc"); $gui->mgt_modify_product = has_rights($this->db, "mgt_modify_product"); $gui->sqlResult = ''; $gui->sqlAction = ''; if ($sqlResult) { $gui->sqlResult = $sqlResult; } $gui->container_data = $this->get_by_id($id); $gui->moddedItem = $gui->container_data; $gui->level = 'testproject'; $gui->page_title = lang_get('testproject'); $gui->refreshTree = property_exists($gui, 'refreshTree') ? $gui->refreshTree : false; $gui->attachmentInfos = getAttachmentInfosFrom($this, $id); if ($modded_item_id) { $gui->moddedItem = $this->get_by_id($modded_item_id); } $smarty->assign('gui', $gui); $smarty->display($template_dir . 'containerView.tpl'); }
/** * set smarty variables needed to display the WeekTaskDetails table * * @param type $smartyHelper * @param type $weekid * @param type $year * @param type $managed_userid * @param type $teamid */ function setWeekTaskDetails($smartyHelper, $weekid, $year, $managed_userid, $teamid) { $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, $teamid); $incompleteDays = array_keys($timeTracking->checkCompleteDays($managed_userid, TRUE)); $missingDays = $timeTracking->checkMissingDays($managed_userid); $errorDays = array_merge($incompleteDays, $missingDays); $smartyWeekDates = TimeTrackingTools::getSmartyWeekDates($weekDates, $errorDays); // UTF8 problems in smarty, date encoding needs to be done in PHP $smartyHelper->assign('weekDates', array($smartyWeekDates[1], $smartyWeekDates[2], $smartyWeekDates[3], $smartyWeekDates[4], $smartyWeekDates[5])); $smartyHelper->assign('weekEndDates', array($smartyWeekDates[6], $smartyWeekDates[7])); $weekTasks = TimeTrackingTools::getWeekTask($weekDates, $teamid, $managed_userid, $timeTracking, $errorDays); $smartyHelper->assign('weekTasks', $weekTasks["weekTasks"]); $smartyHelper->assign('dayTotalElapsed', $weekTasks["totalElapsed"]); // weekTaskDetails.html includes edit_issueNote.html & update_issueBacklog.html // these files need userid,weekid,year to be set. $smartyHelper->assign('userid', $managed_userid); $smartyHelper->assign('weekid', $weekid); $smartyHelper->assign('year', $year); }
/** * Displays smarty template to show test project info to users. * * @param type $smarty [ref] smarty object * @param type $id test project * @param type $sqlResult [default = ''] * @param type $action [default = 'update'] * @param type $modded_item_id [default = 0] * * @internal revisions * **/ function show(&$smarty, $guiObj, $template_dir, $id, $sqlResult = '', $action = 'update', $modded_item_id = 0) { $gui = $guiObj; $gui->modify_tc_rights = has_rights($this->db, "mgt_modify_tc"); $gui->mgt_modify_product = has_rights($this->db, "mgt_modify_product"); $gui->sqlResult = ''; $gui->sqlAction = ''; if ($sqlResult) { $gui->sqlResult = $sqlResult; } $p2ow = array('refreshTree' => false, 'user_feedback' => ''); foreach ($p2ow as $prop => $value) { if (!property_exists($gui, $prop)) { $gui->{$prop} = $value; } } $safeID = intval($id); $gui->container_data = $this->get_by_id($safeID); $gui->moddedItem = $gui->container_data; $gui->level = 'testproject'; $gui->page_title = lang_get('testproject'); $gui->refreshTree = property_exists($gui, 'refreshTree') ? $gui->refreshTree : false; $gui->attachmentInfos = getAttachmentInfosFrom($this, $safeID); // attachments management on page $gui->fileUploadURL = $_SESSION['basehref'] . $this->getFileUploadRelativeURL($safeID); $gui->delAttachmentURL = $_SESSION['basehref'] . $this->getDeleteAttachmentRelativeURL($safeID); $gui->import_limit = TL_REPOSITORY_MAXFILESIZE; $gui->fileUploadMsg = ''; $exclusion = array('testcase', 'me', 'testplan' => 'me', 'requirement_spec' => 'me'); $gui->canDoExport = count($this->tree_manager->get_children($safeID, $exclusion)) > 0; if ($modded_item_id) { $gui->moddedItem = $this->get_by_id(intval($modded_item_id)); } $smarty->assign('gui', $gui); $smarty->display($template_dir . 'containerView.tpl'); }
/** * Handle error (print msg, die) * * @param type $smarty * @param type $response */ function onError($smarty, $response) { $smarty->assign('STATUS_ERROR', $response['error']); $smarty->display('../templates/problem.edit.tpl'); die; }