/** * Get default values for all columns * * This method is specialized in order to set the default module position * and published state * * @return array */ public function getDefaults() { $defaults = parent::getDefaults(); $defaults['position'] = 'left'; $defaults['published'] = 1; $defaults['description'] = ''; return $defaults; }
/** * Insert a new row into the table * * Takes care of automatically incrementing the revision number * * @param Library\DatabaseRowInterface $row */ public function insert(Library\DatabaseRowInterface $row) { $query = $this->getObject('lib:database.query.select')->where('table', '=', $row->table)->where('row', '=', $row->row)->order('revision', 'desc')->limit(1); $latest = $this->select($query, Library\Database::FETCH_ROW); if (!$latest->isNew()) { $row->revision = $latest->revision + 1; } return parent::insert($row); }
/** * Insert a new revision * * @param string $status The row status * @return void */ protected function _insertRevision() { $table = $this->getTable(); // Get the row data if ($this->getStatus() == Library\Database::STATUS_UPDATED) { $data = $this->getData(true); } else { $data = $this->getData(); } //Get the row status $status = $this->getStatus(); if ($status == Library\Database::STATUS_LOADED) { $status = Library\Database::STATUS_CREATED; } // Create the new revision $revision = $this->_table->getRow(); $revision->table = $table->getBase(); $revision->row = $this->id; $revision->status = $status; $revision->data = (object) $table->filter($data); // Set the created_on and created_by information based on the creatable or modifiable data in the row if ($this->isCreatable()) { if (isset($this->created_by) && !empty($this->created_by)) { $revision->created_by = $this->created_by; } if (isset($this->created_on) && $this->created_on != $table->getDefault('created_on')) { $revision->created_on = $this->created_on; } } if ($this->isModifiable()) { if (isset($this->modified_by) && !empty($this->modified_by)) { $revision->created_by = $this->modified_by; } if (isset($this->modified_on) && $this->modified_on != $table->getDefault('modified_on')) { $revision->created_on = $this->modified_on; } } // Set revision number. if ($status == Library\Database::STATUS_UPDATED || $status == Library\Database::STATUS_DELETED) { $query = $this->getObject('lib:database.query.select')->where('table = :table')->where('row = :row')->order('revision', 'DESC')->bind(array('table' => $table->getBase(), 'row' => $this->id)); $revision->revision = $this->_table->select($query, Library\Database::FETCH_ROW)->revision + 1; } // Store the revision return $revision->save(); }
protected function _initialize(Library\ObjectConfig $config) { $config->append(array('name' => 'attachments', 'behaviors' => array('creatable', 'modifiable', 'lockable'), 'filters' => array('description' => array('html', 'tidy')))); parent::_initialize($config); }
public function _initialize(Library\ObjectConfig $config) { $config->append(array('name' => 'extensions', 'filters' => array('params' => 'ini'))); parent::_initialize($config); }
protected function _initialize(Library\ObjectConfig $config) { $config->append(array('name' => 'users', 'behaviors' => array('modifiable', 'creatable', 'lockable', 'identifiable', 'authenticatable'), 'column_map' => array('role_id' => 'users_role_id', 'group_id' => 'users_group_id'))); parent::_initialize($config); }
protected function _initialize(Library\ObjectConfig $config) { $config->append(array('name' => 'tags', 'behaviors' => array('creatable', 'modifiable', 'lockable', 'sluggable'))); parent::_initialize($config); }
protected function _initialize(Library\ObjectConfig $config) { $config->append(array('name' => 'contacts', 'behaviors' => array('creatable', 'modifiable', 'lockable', 'orderable' => array('strategy' => 'flat'), 'sluggable' => array('columns' => array('name')), 'com:attachments.database.behavior.attachable'), 'filters' => array('misc' => array('html', 'tidy'), 'params' => 'ini'))); parent::_initialize($config); }
public function _initialize(Library\ObjectConfig $config) { $config->append(array('name' => 'categories', 'behaviors' => array('creatable', 'modifiable', 'lockable', 'sluggable', 'cascadable', 'nestable', 'orderable' => array('parent_column' => 'parent_id'), 'com:attachments.database.behavior.attachable'))); parent::_initialize($config); }
protected function _initialize(Library\ObjectConfig $config) { $config->append(array('column_map' => array('group_id' => 'users_group_id', 'user_id' => 'users_user_id'))); parent::_initialize($config); }
protected function _initialize(Library\ObjectConfig $config) { $config->append(array('identity_column' => 'users_session_id')); parent::_initialize($config); }
protected function _initialize(Library\ObjectConfig $config) { $config->append(array('name' => 'clients_clients')); parent::_initialize($config); }
protected function _initialize(Library\ObjectConfig $config) { $config->append(array('behaviors' => array('expirable'))); parent::_initialize($config); }
protected function _initialize(Library\ObjectConfig $config) { $config->append(array('name' => 'pages', 'behaviors' => array('creatable', 'lockable', 'sluggable', 'assignable', 'typable', 'com:pages.database.behavior.orderable' => array('strategy' => 'closure', 'table' => 'com:pages.database.table.orderings', 'columns' => array('title', 'custom')), 'com:pages.database.behavior.closurable' => array('table' => 'com:pages.database.table.closures')), 'filters' => array('params' => 'ini'))); parent::_initialize($config); }
protected function _initialize(Library\ObjectConfig $config) { $config->append(array('filters' => array('slug' => 'cmd', 'path' => 'com:files.filter.path', 'parameters' => 'json'), 'behaviors' => array('sluggable' => array('columns' => array('id', 'title'))))); parent::_initialize($config); }
protected function _initialize(Library\ObjectConfig $config) { $config->append(array('name' => 'activities', 'behaviors' => array('creatable', 'identifiable'))); parent::_initialize($config); }
protected function _initialize(Library\ObjectConfig $config) { $config->append(array('name' => 'articles', 'behaviors' => array('creatable', 'modifiable', 'lockable', 'sluggable', 'revisable', 'publishable', 'orderable' => array('strategy' => 'flat'), 'com:languages.database.behavior.translatable', 'com:attachments.database.behavior.attachable', 'com:tags.database.behavior.taggable'), 'filters' => array('introtext' => array('html', 'tidy'), 'fulltext' => array('html', 'tidy')))); parent::_initialize($config); }