Exemple #1
0
 /**
  * Сохранение раздела
  * 
  * @param array $values
  * @throws Validation_Exception
  * @return boolean
  */
 public function values(array $values = array())
 {
     parent::values($values);
     $this->template = Arr::get($values, 'template');
     $this->search_intro_field = Arr::get($values, 'search_intro_field');
     unset($values['search_intro_field']);
     $this->search_index_fields = (array) Arr::get($values, 'search_index_fields', array());
     unset($values['search_index_fields']);
     $this->search_index_doc_id_fields = (array) Arr::get($values, 'search_index_doc_id_fields', array());
     unset($values['search_index_doc_id_fields']);
 }
Exemple #2
0
 /**
  * 
  * @param Datasource_Section $ds
  */
 private function _edit($ds)
 {
     $data = $this->request->post();
     try {
         $ds->values($data);
         $ds->update();
     } catch (Validation_Exception $e) {
         Messages::errors($e->errors('validation'));
         $this->go_back();
     } catch (DataSource_Exception_Section $e) {
         Messages::errors($e->getMessage());
         $this->go_back();
     }
     Messages::success(__('Datasource has been saved!'));
     // save and quit or save and continue editing?
     if ($this->request->post('commit') !== NULL) {
         $this->go(Route::get('datasources')->uri(array('directory' => 'datasources', 'controller' => 'data')) . URL::query(array('ds_id' => $ds->id()), FALSE));
     } else {
         $this->go_back();
     }
 }