public function preSaveDataHook(array $rowData, $rowExistsInDatabase = false) { $log = Bootstrap::get('log'); if (isset($rowData['id'])) { $logger = Bootstrap::get('log'); $TableGateway = new AclAwareTableGateway($this->acl, $this->table, $this->sql->getAdapter()); $dbRecord = $TableGateway->find($rowData['id']); if (false === $dbRecord) { // @todo is it better to throw an exception here? $rowExistsInDatabase = false; } } // User is updating themselves. // Corresponds to a ping indicating their last activity. // Updated their "last_access" value. if (AuthProvider::loggedIn()) { $currentUser = AuthProvider::getUserInfo(); if (isset($rowData['id']) && $rowData['id'] == $currentUser['id']) { $rowData['last_access'] = new Expression("NOW()"); } } return $rowData; }
public function __construct(Acl $acl, AdapterInterface $adapter) { parent::__construct($acl, self::$tableName, $adapter); }
public function getCmsOwnerIdsByTableGatewayAndPredicate(AclAwareTableGateway $TableGateway, PredicateSet $predicate) { $ownerIds = []; $table = $TableGateway->getTable(); $cmsOwnerColumn = $this->getCmsOwnerColumnByTable($table); $select = new Select($table); $select->columns([$TableGateway->primaryKeyFieldName, $cmsOwnerColumn]); $select->where($predicate); $results = $TableGateway->selectWith($select); foreach ($results as $row) { $ownerIds[] = $row[$cmsOwnerColumn]; } return [count($results), $ownerIds]; }
public function __construct(Acl $acl, AdapterInterface $adapter) { parent::__construct($acl, self::$_tableName, $adapter); $this->_defaults['global'] = ['cms_user_auto_sign_out' => 60, 'project_name' => 'Directus', 'project_url' => 'http://localhost/', 'rows_per_page' => 200, 'cms_thumbnail_url' => '']; $this->_defaults['files'] = ['allowed_thumbnails' => '', 'thumbnail_quality' => 100, 'thumbnail_size' => 200, 'file_naming' => 'file_id', 'thumbnail_crop_enabled' => 1, 'youtube_api_key' => '']; }
public function __construct(Acl $acl, AdapterInterface $adapter) { parent::__construct($acl, self::$_tableName, $adapter); $this->_defaults['global'] = array('cms_user_auto_sign_out' => 60, 'site_name' => 'Directus', 'site_url' => 'http://localhost/', 'cms_color' => '#7ac943', 'rows_per_page' => 200, 'cms_thumbnail_url' => ''); $this->_defaults['files'] = array('storage_adapter' => 'FileSystemAdapter', 'storage_destination' => '', 'thumbnail_storage_destination' => '', 'allowed_thumbnails' => '', 'thumbnail_quality' => 100, 'thumbnail_size' => 200, 'file_file_naming' => 'file_id', 'file_title_naming' => 'file_name', 'thumbnail_crop_enabled' => 1, 'thumbnail_storage_adapter' => 'FileSystemAdapter'); }