/** * Delete Page Category * * @return void */ public function deleteTask() { // get request vars $categoryid = Request::getInt('categoryid', 0); // load category object $category = new Page\Category($categoryid); // make sure this is our groups cat if ($category->get('gidNumber') != $this->group->get('gidNumber')) { $this->setNotification(Lang::txt('COM_GROUPS_PAGES_CATEGORY_DELETE_ERROR'), 'error'); App::redirect(Route::url('index.php?option=' . $this->_option . '&cn=' . $this->group->get('cn') . '&controller=pages#categories')); return; } // delete row if (!$category->delete()) { $this->setNotification($category->getError(), 'error'); App::redirect(Route::url('index.php?option=' . $this->_option . '&cn=' . $this->group->get('cn') . '&controller=pages#categories')); return; } //inform user & redirect $this->setNotification(Lang::txt('COM_GROUPS_PAGES_CATEGORY_DELETED'), 'passed'); App::redirect(Route::url('index.php?option=' . $this->_option . '&cn=' . $this->group->get('cn') . '&controller=pages#categories')); }
/** * Delete Page Category * * @return void */ public function deleteTask() { // get request vars $categoryid = Request::getInt('categoryid', 0); // load category object $category = new Page\Category($categoryid); $url = Route::url('index.php?option=' . $this->_option . '&cn=' . $this->group->get('cn') . '&controller=pages#categories'); // make sure this is our groups cat if ($category->get('gidNumber') != $this->group->get('gidNumber')) { $this->setNotification(Lang::txt('COM_GROUPS_PAGES_CATEGORY_DELETE_ERROR'), 'error'); App::redirect($url); } // delete row if (!$category->delete()) { $this->setNotification($category->getError(), 'error'); App::redirect($url); } // Log activity $recipients = array(['group', $this->group->get('gidNumber')], ['user', User::get('id')]); foreach ($this->group->get('managers') as $recipient) { $recipients[] = ['user', $recipient]; } Event::trigger('system.logActivity', ['activity' => ['action' => 'deleted', 'scope' => 'group.category', 'scope_id' => $category->get('id'), 'description' => Lang::txt('COM_GROUPS_ACTIVITY_CATEGORY_DELETED', $category->get('title'), '<a href="' . $url . '">' . $this->group->get('description') . '</a>'), 'details' => array('title' => $category->get('title'), 'url' => $url, 'gidNumber' => $this->group->get('gidNumber'))], 'recipients' => $recipients]); //inform user & redirect $this->setNotification(Lang::txt('COM_GROUPS_PAGES_CATEGORY_DELETED'), 'passed'); App::redirect($url); }
/** * Delete Page Category * * @return void */ public function deleteTask() { // get request vars $ids = Request::getVar('id', array()); $deleted = array(); // delete each category foreach ($ids as $categoryid) { // load category object $category = new Page\Category($categoryid); // make sure this is our groups cat if ($category->get('gidNumber') != $this->group->get('gidNumber')) { App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&gid=' . $this->gid, false), Lang::txt('COM_GROUPS_PAGES_CATEGORY_DELETE_FAILED'), 'error'); return; } // delete row if (!$category->delete()) { App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&gid=' . $this->gid, false), $category->getError(), 'error'); return; } $deleted[] = $category->get('id'); } // log change Log::log(array('gidNumber' => $this->group->get('gidNumber'), 'action' => 'group_pagecategory_deleted', 'comments' => $deleted)); //inform user & redirect App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&gid=' . $this->gid, false), Lang::txt('COM_GROUPS_PAGES_CATEGORY_DELETE_SUCCESS'), 'passed'); }