Exemple #1
0
 /**
  * Execute the controller.
  *
  * @return  string  The rendered view.
  *
  * @since   1.0
  */
 public function execute()
 {
     $group = $this->getContainer()->get('app')->input->get('group', array(), 'array');
     $table = new GroupsTable($this->getContainer()->get('db'));
     $table->save($group);
     return parent::execute();
 }
 /**
  * Method to store a row in the database from the AbstractDatabaseTable instance properties.
  * If a primary key value is set the row with that primary key value will be
  * updated with the instance property values.  If no primary key value is set
  * a new row will be inserted into the database with the properties from the
  * AbstractDatabaseTable instance.
  *
  * @param   boolean  $updateNulls  True to update fields even if they are null.
  *
  * @return  $this  Method allows chaining
  *
  * @since   1.0
  */
 public function store($updateNulls = false)
 {
     $oldId = $this->{$this->getKeyName()};
     parent::store($updateNulls);
     if (!$oldId) {
         // New item - Create default access groups.
         $newId = $this->{$this->getKeyName()};
         if ($newId) {
             $data = array();
             $data['project_id'] = $newId;
             $data['title'] = 'Public';
             $data['can_view'] = 1;
             $data['can_create'] = 0;
             $data['can_edit'] = 0;
             $data['can_manage'] = 0;
             $data['system'] = 1;
             $group = new GroupsTable($this->db);
             $group->save($data);
             $data['title'] = 'User';
             $data['can_create'] = 1;
             $group = new GroupsTable($this->db);
             $group->save($data);
         }
     }
     return $this;
 }