コード例 #1
0
 /**
  * Get cached data by id and group
  *
  * @param   string   $key        The cache data id
  * @param   string   $group      The cache data group
  * @param   boolean  $checkTime  True to verify cache time expiration threshold
  *
  * @return  mixed  Boolean  false on failure or a cached data object
  */
 public function get($key, $group, $checkTime = true)
 {
     $value = $this->session->get('cache.' . $group . '.' . $key);
     if (!$value) {
         return false;
     }
     return $value;
 }
コード例 #2
0
ファイル: history.php プロジェクト: prox91/joomla-dev
 /**
  * Get the inner queue.
  *
  * @return  array  The queue.
  */
 public function getQueue()
 {
     $queue = $this->session->get($this->sessionVariable, null, 'rbrowser');
     if (is_array($queue)) {
         end($queue);
         return $queue;
     }
     $queue = array();
     $this->setQueue($queue);
     return $queue;
 }
コード例 #3
0
 /**
  * Sends message if possible
  * 
  * @param type $context
  * @param type $article
  * @param type $isNew
  * @return type
  */
 public function onContentAfterSave($context, &$article, $isNew)
 {
     if (0 !== strpos($context, 'com_content')) {
         return;
     }
     $message = $this->session->get('asar.message');
     if (!empty($message)) {
         $this->app->enqueueMessage($message);
         $this->session->clear('asar.message');
     }
 }
コード例 #4
0
ファイル: Session.php プロジェクト: JBZoo/CrossCMS
 /**
  * {@inheritdoc}
  */
 public function getGroup($group = self::GROUP_DFAULT, $default = array())
 {
     $data = $this->_session->get($group, $default, $this->_namespace);
     return $data;
 }
コード例 #5
0
ファイル: list.php プロジェクト: pascal26/fabrik
 /**
  * Returns the table headings, separated from writable function as
  * when group_by is selected multiple tables are written
  * 09/07/2011 moved headingClass into array rather than string
  *
  * @return  array  (table headings, array columns, $aLinkElements)
  */
 public function getHeadings()
 {
     $package = $this->app->getUserState('com_fabrik.package', 'fabrik');
     $item = $this->getTable();
     $item->order_dir = JString::strtolower($item->order_dir);
     $aTableHeadings = array();
     $headingClass = array();
     $cellClass = array();
     $params = $this->getParams();
     $w = new FabrikWorker();
     $formModel = $this->getFormModel();
     $oldLinksToForms = $this->getLinksToThisKey();
     $linksToForms = array();
     foreach ($oldLinksToForms as $join) {
         // $$$ hugh - another issue with getLinksToThisKey() now returning false for some joins.
         if ($join) {
             $k = $join->list_id . '-' . $join->form_id . '-' . $join->element_id;
             $linksToForms[$k] = $join;
         }
     }
     $groups = $formModel->getGroupsHiarachy();
     $groupHeadings = array();
     $orderBys = json_decode($item->order_by, true);
     if (!isset($orderBys)) {
         $orderBys = array();
     }
     // Responsive element classes
     $listClasses = json_decode($params->get('list_responsive_elements'));
     if (!isset($listClasses->responsive_elements)) {
         $listClasses = new stdClass();
         $listClasses->responsive_elements = array();
     }
     $showInList = $this->showInList();
     if (!in_array($this->outputFormat, array('pdf', 'csv'))) {
         if ($this->canSelectRows() && $params->get('checkboxLocation', 'end') !== 'end') {
             $this->addCheckBox($aTableHeadings, $headingClass, $cellClass);
         }
         if ($params->get('checkboxLocation', 'end') !== 'end') {
             $this->actionHeading($aTableHeadings, $headingClass, $cellClass);
         }
     }
     foreach ($groups as $groupModel) {
         $groupHeadingKey = $w->parseMessageForPlaceHolder($groupModel->getGroup()->label, array(), false);
         $groupHeadings[$groupHeadingKey] = 0;
         $elementModels = $groupModel->getPublishedListElements();
         if ($groupModel->canView('list') === false) {
             continue;
         }
         foreach ($elementModels as $key => $elementModel) {
             $element = $elementModel->getElement();
             // If we define the elements to show in the list - e.g in admin list module then only show those elements
             if (!empty($showInList) && !in_array($element->id, $showInList)) {
                 continue;
             }
             $groupHeadings[$groupHeadingKey]++;
             $key = $elementModel->getFullName(true, false);
             $compositeKey = !empty($showInList) ? array_search($element->id, $showInList) . ':' . $key : $key;
             $orderKey = $elementModel->getOrderbyFullName(false);
             $elementParams = $elementModel->getParams();
             $label = $elementModel->getListHeading();
             $label = $w->parseMessageForPlaceHolder($label, array());
             $elementId = $elementModel->getId();
             if ($elementParams->get('can_order') == '1' && $this->outputFormat != 'csv') {
                 $context = 'com_' . $package . '.list' . $this->getRenderContext() . '.order.' . $elementId;
                 $orderDir = $this->session->get($context);
                 //  No user set order so get it from the list properties
                 if (is_null($orderDir)) {
                     $orderDirs = (array) json_decode($item->order_dir);
                     $orderEls = (array) json_decode($item->order_by);
                     $ix = array_search($elementId, $orderEls);
                     if ($ix !== false) {
                         $orderDir = FArrayHelper::getValue($orderDirs, $ix, '');
                     } else {
                         // nothing set, make an executive decision!
                         $orderDir = '';
                     }
                 }
                 $displayData = new stdClass();
                 $displayData->tmpl = $this->getTmpl();
                 $displayData->orderDir = $orderDir;
                 $displayData->class = '';
                 $displayData->key = $key;
                 $displayData->orderBys = $orderBys;
                 $displayData->item = $item;
                 $displayData->elementParams = $elementParams;
                 $displayData->label = $label;
                 $layout = $this->getLayout('list.fabrik-order-heading');
                 $heading = $layout->render($displayData);
             } else {
                 $heading = $label;
             }
             $aTableHeadings[$compositeKey] = $heading;
             // Check responsive class
             $responsiveKey = array_search($element->id, $listClasses->responsive_elements);
             $responsiveClass = $responsiveKey !== false ? FArrayHelper::getValue($listClasses->responsive_class, $responsiveKey, '') : '';
             if ($responsiveClass !== '') {
                 $responsiveClass .= ' ';
             }
             $headingClass[$compositeKey] = array('class' => $responsiveClass . $elementModel->getHeadingClass(), 'style' => $elementParams->get('tablecss_header'));
             $cellClass[$compositeKey] = array('class' => $responsiveClass . $elementModel->getCellClass(), 'style' => $elementParams->get('tablecss_cell'));
             // Add in classes for repeat/merge data
             if ($groupModel->canRepeat()) {
                 $cellClass[$compositeKey]['class'] .= ' repeat';
                 $dis = $params->get('join-display');
                 if ($dis != 'default') {
                     $cellClass[$compositeKey]['class'] .= '-' . $dis;
                 }
             }
         }
         if ($groupHeadings[$groupHeadingKey] == 0) {
             unset($groupHeadings[$groupHeadingKey]);
         }
     }
     if (!empty($showInList)) {
         $aTableHeadings = $this->removeHeadingCompositKey($aTableHeadings);
         $headingClass = $this->removeHeadingCompositKey($headingClass);
         $cellClass = $this->removeHeadingCompositKey($cellClass);
     }
     if (!in_array($this->outputFormat, array('pdf', 'csv'))) {
         // @TODO check if any plugins need to use the selector as well!
         if ($this->canSelectRows() && $params->get('checkboxLocation', 'end') === 'end') {
             $this->addCheckBox($aTableHeadings, $headingClass, $cellClass);
         }
         // If no elements linking to the edit form add in a edit column (only if we have the right to edit/view of course!)
         if ($params->get('checkboxLocation', 'end') === 'end') {
             $this->actionHeading($aTableHeadings, $headingClass, $cellClass);
         }
         // Create columns containing links which point to lists associated with this list
         $faceted = $params->get('facetedlinks');
         $joinsToThisKey = $this->getJoinsToThisKey();
         $listOrder = json_decode($params->get('faceted_list_order'));
         $formOrder = json_decode($params->get('faceted_form_order'));
         if (is_null($listOrder)) {
             // Not yet saved with order
             $listOrder = is_object($faceted) && is_object($faceted->linkedlist) ? array_keys(ArrayHelper::fromObject($faceted->linkedlist)) : array();
         }
         if (is_null($formOrder)) {
             // Not yet saved with order
             $formOrder = is_object($faceted) && is_object($faceted->linkedform) ? array_keys(ArrayHelper::fromObject($faceted->linkedform)) : array();
         }
         foreach ($listOrder as $key) {
             $join = $this->facetedJoin($key);
             if ($join === false) {
                 continue;
             }
             if (is_object($join) && isset($faceted->linkedlist->{$key})) {
                 $linkedTable = $faceted->linkedlist->{$key};
                 $heading = $faceted->linkedlistheader->{$key};
                 if ($linkedTable != '0') {
                     $prefix = $join->element_id . '___' . $linkedTable . '_list_heading';
                     $aTableHeadings[$prefix] = empty($heading) ? $join->listlabel . ' ' . FText::_('COM_FABRIK_LIST') : FText::_($heading);
                     $headingClass[$prefix] = array('class' => 'fabrik_ordercell related ' . $prefix, 'style' => '');
                     $cellClass[$prefix] = array('class' => $prefix . ' fabrik_element related');
                 }
             }
         }
         foreach ($formOrder as $key) {
             $join = $this->facetedJoin($key);
             if ($join === false || !isset($faceted->linkedform->{$key})) {
                 continue;
             }
             $linkedForm = $faceted->linkedform->{$key};
             if ($linkedForm != '0') {
                 $heading = $faceted->linkedformheader->{$key};
                 $prefix = $join->db_table_name . '___' . $join->name . '_form_heading';
                 $aTableHeadings[$prefix] = empty($heading) ? $join->listlabel . ' ' . FText::_('COM_FABRIK_FORM') : FText::_($heading);
                 $headingClass[$prefix] = array('class' => 'fabrik_ordercell related ' . $prefix, 'style' => '');
                 $cellClass[$prefix] = array('class' => $prefix . ' fabrik_element related');
             }
         }
     }
     if ($this->canSelectRows()) {
         $groupHeadings[''] = '';
     }
     $args['tableHeadings'] =& $aTableHeadings;
     $args['groupHeadings'] =& $groupHeadings;
     $args['headingClass'] =& $headingClass;
     $args['cellClass'] =& $cellClass;
     $args['data'] = $this->data;
     FabrikWorker::getPluginManager()->runPlugins('onGetPluginRowHeadings', $this, 'list', $args);
     FabrikWorker::getPluginManager()->runPlugins('onGetPluginRowHeadings', $this->getFormModel(), 'form', $args);
     return array($aTableHeadings, $groupHeadings, $headingClass, $cellClass);
 }
コード例 #6
0
ファイル: jbsession.php プロジェクト: alexmixaylov/real
 /**
  * Get group data from session
  * @param string $group
  * @param mixed $default
  * @return JSONData
  */
 public function getGroup($group = 'default', $default = array())
 {
     $data = $this->_session->get($group, $default, $this->_namespace);
     return $data;
 }
コード例 #7
0
ファイル: history.php プロジェクト: NallelyFlores89/basvec
 /**
  * Save history that associated with form data
  * 
  * @param JSession $session
  * @param mixed $post
  * @param string $pageKey
  * @param string $title
  * 
  * @return int ID of saved history
  */
 private function saveByPost($session, $post, $pageKey, $title)
 {
     if (!$session->has($post['postSessionKey'])) {
         return;
     }
     $formData = $session->get($post['postSessionKey']);
     $formHash = md5($formData);
     $form = json_decode($formData);
     $id = $form->cid;
     if (is_array($id)) {
         $id = array_shift($id);
     }
     $userId = JFactory::getUser()->id;
     $history = JTable::getInstance('History', 'PowerAdminTable');
     $history->load(array('user_id' => $userId, 'object_key' => $pageKey, 'object_id' => $id));
     if ($history->id == null) {
         $history->bind(array('user_id' => $userId, 'object_key' => $pageKey, 'object_id' => $id));
     }
     $history->bind(array('title' => $title, 'visited' => time(), 'form' => $formData, 'form_hash' => $formHash, 'component' => empty($history->component) && !empty($post['parent']) ? $post['parent'] : $history->component, 'list_page' => empty($history->list_page) && !empty($post['name']) ? $post['name'] : $history->list_page, 'list_page_params' => empty($history->list_page_params) && !empty($post['params']) ? $post['params'] : $history->list_page_params, 'icon' => empty($history->icon) && !empty($post['iconPath']) ? $post['iconPath'] : $history->icon, 'css' => empty($history->css) && !empty($post['iconCss']) ? $post['iconCss'] : $history->css));
     $history->description = $post['description'];
     $history->store();
     return $history->id;
 }