public function executeWrite(AgaviParameterHolder $rd)
 {
     if ($rd->getParameter('xaction', false) == 'create' || $rd->getParameter('xaction', false) == 'update' || $rd->getParameter('xaction', false) == 'destroy') {
         $rows = json_decode($rd->getParameter('rows', array()));
         if (!is_array($rows)) {
             $rows = array($rows);
         }
         $c = array();
         foreach ($rows as $category) {
             try {
                 if ($rd->getParameter('xaction', false) == 'destroy') {
                     if (isset($category->catid)) {
                         $this->categories->deleteCategoryRecord($category->catid);
                     }
                 } else {
                     $this->categories->createCategory((array) $category);
                     $c[] = (array) $category;
                 }
             } catch (Doctrine_Exception $e) {
             }
         }
         $this->setAttributeByRef('categories', $c);
         return $this->getDefaultViewName();
     }
     return $this->executeRead($rd);
 }
 /**
  * (non-PHPdoc)
  * @see CronksBaseModel::initialize()
  */
 public function initialize(AgaviContext $context, array $parameters = array())
 {
     parent::initialize($context, $parameters);
     // Init cronk categgory configurtion
     $tmp = (include AgaviConfigCache::checkConfig(AgaviConfig::get('core.config_dir') . '/cronks.xml'));
     self::$xml_categories = (array) $tmp[1];
     // Init user objects
     $this->refreshUser();
 }