/** * * @param array $viewParams * @param boolean|string $persist * @return Ajde_Collection_View */ public function getCollectionView($viewParams = array(), $persist = 'auto') { if (!$this->getCollection()->hasView()) { $viewSession = new Session('AC.Crud.View'); $sessionName = $this->getSessionName(); if ($viewSession->has($sessionName)) { $crudView = $viewSession->get($sessionName); } else { $crudView = new View($sessionName, $this->getOption('list.view', array())); $crudView->setColumns($this->getOption('list.show', $this->getFieldNames())); } // somehow, when altering crudView, the instance in the session gets updated as well, and we don't want that $crudView = clone $crudView; if (empty($viewParams)) { $viewParams = Ajde::app()->getRequest()->getParam('view', array()); // if we have params, but no columns, assume a reset if (!empty($viewParams) && !isset($viewParams['columns'])) { $viewParams['columns'] = $this->getOption('list.show', $this->getFieldNames()); } } $crudView->setOptions($viewParams); if ($persist == 'auto' && $this->getOperation() == 'list' || $persist === true) { $viewSession->set($sessionName, $crudView); } $this->getCollection()->setView($crudView); } return $this->getCollection()->getView(); }
public function getAuthenticationURL($returnto = '') { $connection = $this->getProvider(); // set returnto in session, google is very strict with callback urls $returntoSession = new Session('returnto'); $returntoSession->set("url", $returnto); return $connection->createAuthUrl(); }
public static function markFormTime() { $time = time(); $session = new Session('AC.Form'); $session->set('formTime', $time); return $time; }