/** * $params object should be a json like * <code> * { * "id": 1 // this is the slice ID displayed * } * @throws Exception|RokCommon_Ajax_Exception * @param $params * @return RokCommon_Ajax_Result */ public function remove($params) { try { $result = new RokCommon_Ajax_Result(); $slice = RokGallery_Model_SliceTable::getSingle($params->id); if ($slice === false) { throw new RokCommon_Ajax_Exception('No Slice Found'); } if (RokCommon_Session::get(self::CONTEXT_ROOT . $slice->file_id, false)) { $slice->decrementLoves(); RokCommon_Session::clear(self::CONTEXT_ROOT . $slice->file_id); } $result->setPayload(array('loves' => $slice->File->Loves->count, 'new_action' => 'love', 'text' => rc__(RokGallery_Config::getOption(RokGallery_Config::OPTION_LOVE_TEXT)))); } catch (Exception $e) { throw $e; } return $result; }
/** * Method to display a view. * * @param bool $cachable * @param bool $urlparams * * @internal param \If $boolean true, the view output will be cached * @internal param \An $array array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return JController This object to support chaining. * @since 1.5 */ public function display($cachable = false, $urlparams = false) { require_once JPATH_ADMINISTRATOR . '/components/com_modules/helpers/modules.php'; // Load the submenu. ModulesHelper::addSubmenu(JFactory::getApplication()->input->getCmd('view', 'modules')); $view = JFactory::getApplication()->input->getCmd('view', 'modules'); $layout = JFactory::getApplication()->input->getCmd('layout', 'default'); $id = JFactory::getApplication()->input->getInt('id', null); // Check for edit form. if ($view == 'module' && $layout == 'edit' && !$this->checkEditId('com_roksprocket.edit.module', $id)) { // Somehow the person just went to the form - we don't allow that. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_(sprintf('index.php?option=%s&view=modules', RokSprocket_Helper::getRedirectionOption()), false)); return false; } if (RokCommon_Session::get('roksprocket.' . $id, false)) { RokCommon_Session::clear('roksprocket.' . $id); } parent::display(); }
public function postSave($id) { RokCommon_Session::clear('roksprocket.module_' . $id); }