Example #1
0
 public function getEvents(JRegistry &$params)
 {
     $conf = JFactory::getConfig();
     if ($conf->get('caching') && $params->get('module_cache')) {
         $user = JFactory::getUser();
         $cache = JFactory::getCache('mod_rokminievents3');
         $cache->setCaching(true);
         $args = array($params);
         $checksum = md5($params->__toString());
         $events = $cache->get(array($this, '_getEvents'), $args, 'mod_rokminievents3-' . $user->get('aid', 0) . '-' . $checksum);
     } else {
         $events = $this->_getEvents($params);
     }
     $events = $this->setTimezone($params, $events);
     $events = $this->trimDescription($params, $events);
     return $events;
 }
Example #2
0
 /**
  * Save method is diff here because we're writing to a file
  * (non-PHPdoc)
  * @see Citruscart/admin/CitruscartController::save()
  */
 function save()
 {
     $app = JFactory::getApplication();
     $id = $app->input->get('id', 'en-GB');
     $temp_values = $app->input->getArray($_POST);
     $model = $this->getModel('Emails', 'CitruscartModel');
     // Filter values
     $prefix = $model->email_prefix;
     $values = array();
     foreach ($temp_values as $k => $v) {
         if (stripos($k, $prefix) === 0) {
             $values[$k] = $v;
         }
     }
     $lang = $model->getItem($id);
     $path = $lang->path;
     $msg = JText::_('COM_CITRUSCART_SAVED');
     jimport('joomla.filesystem.file');
     if (JFile::exists($path)) {
         $original = new JRegistry();
         $original->loadFile($path);
         $registry = new JRegistry();
         $registry->loadArray($values);
         $original->merge($registry);
         $txt = $original->__toString('INI');
         $success = JFile::write($path, $txt);
         if (!$success) {
             $msg = JText::_('COM_CITRUSCART_ERROR_SAVING_NEW_LANGUAGE_FILE');
         }
     }
     $model->clearCache();
     //$task = JRequest::getVar('task');
     $task = $app->input->getString('task');
     $redirect = "index.php?option=com_citruscart";
     switch ($task) {
         case "apply":
             $redirect .= '&view=' . $this->get('suffix') . '&task=edit&id=' . $id;
             break;
         case "save":
         default:
             $redirect .= "&view=" . $this->get('suffix');
             break;
     }
     $redirect = JRoute::_($redirect, false);
     $this->setRedirect($redirect, $this->message, $this->messagetype);
 }