public function executeWrite(AgaviParameterHolder $rd) { try { if ($rd->getParameter('xaction') == 'write') { $cronk_record = $this->cronks->createCronkRecord($rd->getParameters()); $cronk_record->save(); } elseif ($rd->getParameter('xaction') == 'delete') { try { $this->cronks->deleteCronkRecord($rd->getParameter('cid'), $rd->getParameter('name')); } catch (Exception $e) { $this->appendAttribute('errors', $e->getMessage()); } } else { $cronks = $this->cronks->getCronks(); $this->setAttributeByRef('cronks', $cronks); } } catch (AppKitModelException $e) { $this->setAttribute('errors', $e->getMessage()); } return $this->getDefaultViewName(); }
/** * Setter for cronkuid * * Resets collected data and prepare for fetching * * @param string $cronkuid * @throws AppKitModelException */ public function setCronkUid($cronkuid) { $this->cronkuid = $cronkuid; // Reset collected data $this->roles = null; $this->principals = null; $this->role_uids = null; $this->role_names = null; $this->cronk = null; if ($this->getParameter('security_only', false) !== true) { if (!$this->cronks->hasCronk($cronkuid)) { throw new AppKitModelException("Cronk {$cronkuid} does not exist!"); } $this->cronk = $this->cronks->getCronk($cronkuid); } }
public function executeRead(AgaviRequestDataHolder $rd) { $this->setAttribute('data', $this->cronks->combinedData()); return $this->getDefaultViewName(); }
/** * Fills the static xml cache variables with agavi config cache data of * cronks and categories. This method is called only if the first instance * of this model is initiated * @throws AgaviParseException If XML parsin fails * @return boolean If cache is parsed */ private function initializeXmlData() { if (self::$xml_ready === true) { return true; } $tmp = (include AgaviConfigCache::checkConfig(AgaviConfig::get('core.config_dir') . '/cronks.xml')); self::$xml_cronk_data = (array) $tmp[0] + self::$xml_cronk_data; return self::$xml_ready = true; }