Example #1
0
 public function __construct()
 {
     parent::__construct();
     $this->_user = User::getInstance();
 }
Example #2
0
 protected function _checkCanPublish()
 {
     if ($this->_acl && !$this->_acl->canPublish($this)) {
         throw new Exception('You do not have permission to publish object [' . $this->getName() . '].');
     }
 }
Example #3
0
 /**
  * Prepare config, load system properties
  * @throws Exception
  */
 protected function _loadProperties()
 {
     $dataLink =& $this->_config->dataLink();
     $pKeyName = $this->getPrimaryKey();
     /*
      * System field init
      */
     $dataLink['fields'][$pKeyName] = array('title' => 'PRIMARY_KEY', 'system' => true, 'db_type' => 'bigint', 'db_isNull' => false, 'db_unsigned' => true, 'db_auto_increment' => true, 'unique' => 'PRIMARY', 'is_search' => true, 'lazyLang' => true);
     /*
      * System index init
      */
     $dataLink['indexes']['PRIMARY'] = array('columns' => array($pKeyName), 'fulltext' => false, 'unique' => true, 'primary' => true);
     /*
      * Backward compatibility
      */
     if (!isset($dataLink['connection'])) {
         $dataLink['connection'] = self::DEFAULT_CONNECTION;
     }
     if (!isset($dataLink['locked'])) {
         $dataLink['locked'] = false;
     }
     if (!isset($dataLink['readonly'])) {
         $dataLink['readonly'] = false;
     }
     if (!isset($dataLink['primary_key'])) {
         $dataLink['primary_key'] = $pKeyName;
     }
     if (!isset($dataLink['use_db_prefix'])) {
         $dataLink['use_db_prefix'] = true;
     }
     if (!isset($dataLink['acl']) || empty($dataLink['acl'])) {
         $dataLink['acl'] = false;
     }
     if (!isset($dataLink['slave_connection']) || empty($dataLink['slave_connection'])) {
         $dataLink['slave_connection'] = $dataLink['connection'];
     }
     /*
      * Load additional fields for object under revision control
      */
     if (isset($dataLink['rev_control']) && $dataLink['rev_control']) {
         $dataLink['fields'] = array_merge($dataLink['fields'], $this->_getVcFields());
     }
     if ($this->hasEncrypted()) {
         $dataLink['fields'] = array_merge($dataLink['fields'], $this->_getEncryptionFields());
     }
     /*
      * Init ACL adapter
      */
     if (!empty($dataLink['acl'])) {
         $this->_acl = Db_Object_Acl::factory($dataLink['acl']);
     }
 }