/** * Display a form for adding/editing a record * * @return void */ public function editTask() { $this->view->setLayout('edit'); $this->view->lists = array(); // Get resolutions $sr = new Resolution($this->database); $this->view->lists['resolutions'] = $sr->getResolutions(); $this->view->lists['severities'] = Utilities::getSeverities($this->config->get('severities')); $id = Request::getInt('id', 0); $this->view->row = new Query($this->database); $this->view->row->load($id); if (!$this->view->row->sort) { $this->view->row->sort = 'created'; } if (!$this->view->row->sort_dir) { $this->view->row->sort_dir = 'desc'; } include_once dirname(dirname(__DIR__)) . DS . 'models' . DS . 'conditions.php'; $con = new Conditions(); $this->view->conditions = $con->getConditions(); // Set any errors foreach ($this->getErrors() as $error) { $this->view->setError($error); } // Output the HTML $this->view->display(); }
/** * Display a form for processing tickets in a batch * * @return void */ public function batchTask() { Request::setVar('hidemainmenu', 1); // Incoming $this->view->ids = Request::getVar('id', array()); $this->view->tmpl = Request::getVar('tmpl', ''); $this->view->filters = Utilities::getFilters(); $this->view->lists = array(); // Get resolutions $sr = new Tables\Resolution($this->database); $this->view->lists['resolutions'] = $sr->getResolutions(); // Get categories $sa = new Tables\Category($this->database); $this->view->lists['categories'] = $sa->find('list'); // Get severities $this->view->lists['severities'] = Utilities::getSeverities($this->config->get('severities')); $this->view->lists['owner'] = $this->_userSelect('owner', '', 1); // Output the HTML $this->view->display(); }
/** * Display a ticket and associated comments * * @param mixed $comment * @return void */ public function ticketTask($comment = null) { // Get the ticket ID $id = Request::getInt('id', 0); if (!$id) { App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->controller . '&task=tickets'), Lang::txt('COM_SUPPORT_ERROR_MISSING_TICKET_ID'), 'error'); return; } // Initiate database class and load info $this->view->row = Ticket::getInstance($id); if (!$this->view->row->exists()) { App::abort(404, Lang::txt('COM_SUPPORT_ERROR_TICKET_NOT_FOUND')); return; } // Check authorization if (User::isGuest()) { $return = base64_encode(Route::url($this->view->row->link(), false, true)); App::redirect(Route::url('index.php?option=com_users&view=login&return=' . $return, false)); return; } // Ensure the user is authorized to view this ticket if (!$this->view->row->access('read', 'tickets')) { App::abort(403, Lang::txt('COM_SUPPORT_ERROR_NOT_AUTH')); return; } $this->view->filters = array('limit' => Request::getState($this->_option . '.' . $this->_controller . '.limit', 'limit', Config::get('list_limit'), 'int'), 'start' => Request::getState($this->_option . '.' . $this->_controller . '.limitstart', 'limitstart', 0, 'int'), 'show' => Request::getState($this->_option . '.' . $this->_controller . '.show', 'show', 0, 'int'), 'search' => urldecode(Request::getState($this->_option . '.' . $this->_controller . '.search', 'search', ''))); if ($watch = Request::getWord('watch', '')) { // Already watching if ($this->view->row->isWatching(User::getRoot())) { // Stop watching? if ($watch == 'stop') { $this->view->row->stopWatching(User::getRoot()); } } else { // Start watching? if ($watch == 'start') { $this->view->row->watch(User::getRoot()); if (!$this->view->row->isWatching(User::getRoot(), true)) { $this->setError(Lang::txt('COM_SUPPORT_ERROR_FAILED_TO_WATCH')); } } } } $this->view->lists = array(); // Get resolutions $sr = new Tables\Resolution($this->database); $this->view->lists['resolutions'] = $sr->getResolutions(); $sc = new Tables\Category($this->database); $this->view->lists['categories'] = $sc->find('list'); // Get messages $sm = new Tables\Message($this->database); $this->view->lists['messages'] = $sm->getMessages(); // Get severities $this->view->lists['severities'] = Utilities::getSeverities($this->config->get('severities')); // Populate the list of assignees based on if the ticket belongs to a group or not if (trim($this->view->row->get('group'))) { $this->view->lists['owner'] = $this->_userSelectGroup('ticket[owner]', $this->view->row->get('owner'), 1, '', trim($this->view->row->get('group'))); } elseif (trim($this->config->get('group'))) { $this->view->lists['owner'] = $this->_userSelectGroup('ticket[owner]', $this->view->row->get('owner'), 1, '', trim($this->config->get('group'))); } else { $this->view->lists['owner'] = $this->_userSelect('ticket[owner]', $this->view->row->get('owner'), 1); } // Set the pathway $this->_buildPathway($this->view->row); // Set the page title $this->_buildTitle($this->view->row); $this->view->title = $this->_title; $this->view->database = $this->database; if (\Notify::any('support')) { foreach (\Notify::messages('support') as $error) { if ($error['type'] == 'error') { $this->view->setError($error['message']); } } } if (!$comment) { $comment = new Comment(); } $this->view->comment = $comment; // Output HTML foreach ($this->getErrors() as $error) { $this->view->setError($error); } $this->view->setLayout('ticket')->display(); }