/** * Tag the entry * * @return boolean */ public function tag($tags = null, $user_id = 0, $admin = 0) { $cloud = new Tags($this->get('id')); return $cloud->setTags($tags, $user_id, $admin); }
/** * Removes a ticket and all associated records (tags, comments, etc.) * * @return void */ public function deleteTask() { // Incoming $id = Request::getInt('id', 0); // Check for an ID if (!$id) { App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=tickets')); return; } // Delete tags $tags = new Tags($id); $tags->removeAll(); // Load the record $ticket = new Ticket($id); // Delete ticket if (!$ticket->delete()) { Notify::error($ticket->getError()); } // Log the activity $recipients = array(['support.tickets', 1]); $creator = User::getInstance($ticket->get('login')); if ($creator && $creator->get('id')) { $recipients[] = ['user', $creator->get('id')]; } if ($ticket->get('owner')) { $recipients[] = ['user', $ticket->owner('id')]; } Event::trigger('system.logActivity', ['activity' => ['action' => 'deleted', 'scope' => 'support.ticket', 'scope_id' => $id, 'description' => Lang::txt('COM_SUPPORT_ACTIVITY_TICKET_DELETED', '<a href="' . Route::url($ticket->link()) . '">#' . $ticket->get('id') . ' - ' . $ticket->get('summary') . '</a>'), 'details' => array('id' => $id)], 'recipients' => $recipients]); // Output messsage and redirect App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=tickets')); }
/** * Removes a ticket and all associated records (tags, comments, etc.) * * @return void */ public function removeTask() { // Check for request forgeries Request::checkToken(); // Incoming $ids = Request::getVar('id', array()); // Check for an ID if (count($ids) < 1) { App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_SUPPORT_ERROR_SELECT_TICKET_TO_DELETE'), 'error'); return; } foreach ($ids as $id) { $id = intval($id); // Delete tags $tags = new Tags($id); $tags->removeAll(); // Delete comments $comment = new Tables\Comment($this->database); $comment->deleteComments($id); // Delete attachments $attach = new Tables\Attachment($this->database); $attach->deleteAllForTicket($id); // Delete ticket $ticket = new Tables\Ticket($this->database); $ticket->delete($id); } // Output messsage and redirect App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_SUPPORT_TICKET_SUCCESSFULLY_DELETED', count($ids))); }
/** * Removes a ticket and all associated records (tags, comments, etc.) * * @return void */ public function deleteTask() { // Incoming $id = Request::getInt('id', 0); // Check for an ID if (!$id) { App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=tickets')); return; } // Delete tags $tags = new Tags($id); $tags->removeAll(); // Delete comments $comment = new Tables\Comment($this->database); $comment->deleteComments($id); $attach = new Tables\Attachment($this->database); if (!$attach->deleteAllForTicket($id)) { App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=tickets'), $attach->getError(), 'error'); return; } // Delete ticket $ticket = new Tables\Ticket($this->database); $ticket->delete($id); // Output messsage and redirect App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=tickets')); }