/**
  * @param SQL_TABLE $table
  * @param integer $action
  * @param STORABLE $obj
  * @access private
  */
 protected function _commit_table($table, $action, $obj)
 {
     if ($table->name == $obj->secondary_table_name() && $action == Storage_action_create) {
         $table->update('entry_id', $obj->entry_id);
     }
     parent::_commit_table($table, $action, $obj);
     if ($table->name == $obj->table_name() && $action == Storage_action_create) {
         $obj->entry_id = $obj->id;
     }
 }
예제 #2
0
 /**
  * Copy permissions from another user.
  * @param USER_PERMISSIONS $other
  */
 public function copy_from($other)
 {
     parent::copy_from($other);
     $this->global_privileges = $other->global_privileges;
     $this->allow_privileges = $other->allow_privileges;
     $this->deny_privileges = $other->deny_privileges;
 }
 /**
  * Update an existing object.
  * @access private
  */
 protected function _update()
 {
     if ($this->_stores_data) {
         parent::_update();
     }
 }
예제 #4
0
 /**
  * Execute the form.
  * The form has been validated and can be executed.
  * @param STORABLE $obj
  * @access private
  */
 public function commit($obj)
 {
     $obj->store();
 }
예제 #5
0
 /**
  * Called internally to commit the storage action.
  * @param STORABLE $obj
  * @param integer $action
  * @access private
  */
 protected function _commit($obj, $action)
 {
     $obj->store_to($this);
     if (sizeof($this->_tables)) {
         /* Validate all tables before committing. Validate may changes 
          * values (e.g. setting defaults), so we have to make a validated tables
          * array because foreach doesn't use references.
          */
         foreach ($this->_tables as $table) {
             $table->validate($action);
             $validated_tables[] = $table;
         }
         foreach ($validated_tables as $table) {
             $this->_commit_table($table, $action, $obj);
         }
     }
 }
 /**
  * Executes the form for an object.
  * @param STORABLE $obj
  * @param string $load_action
  * @access private
  */
 protected function _process($obj, $load_action)
 {
     if ($this->previewing()) {
         if ($load_action != Form_load_action_default && $obj->exists()) {
             $this->_set_object($obj, $load_action);
         }
         $this->validate($obj);
         if (sizeof($this->_errors) == 0) {
             /* Store the data loaded from the request to the object and add it as a preview. */
             $this->_store_to_object($obj);
             $this->add_preview($obj, $this->_preview_title($obj));
         }
         $this->_apply_all_data($obj, $load_action);
     } else {
         parent::_process($obj, $load_action);
     }
 }