Esempio n. 1
0
 public function getMixableMethods(Library\ObjectMixable $mixer = null)
 {
     $methods = parent::getMixableMethods($mixer);
     if (!is_null($mixer)) {
         // If table is not enabled, don't mix the methods.
         $table = $mixer instanceof Library\DatabaseTableInterface ? $mixer : $mixer->getTable();
         $needle = array('name' => $table->getBase(), 'extension_name' => 'com_' . $table->getIdentifier()->package);
         if (!count($this->_tables->find($needle))) {
             $methods['isTranslatable'] = function () {
                 return false;
             };
             unset($methods['getLanguages']);
             unset($methods['getTranslations']);
         }
     }
     return $methods;
 }
Esempio n. 2
0
 public function __call($method, $arguments)
 {
     if (in_array($method, $this->getStrategy()->getMixableMethods())) {
         switch (count($arguments)) {
             case 0:
                 $return = $this->getStrategy()->{$method}();
                 break;
             case 1:
                 $return = $this->getStrategy()->{$method}($arguments[0]);
                 break;
             default:
                 $return = call_user_func_array(array($this->getStrategy(), $method), $arguments);
                 break;
         }
     } else {
         $return = parent::__call($method, $arguments);
     }
     return $return;
 }
Esempio n. 3
0
 /**
  * Initializes the options for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param   Library\ObjectConfig  $config An optional Library\ObjectConfig object with configuration options
  * @return  void
  */
 protected function _initialize(Library\ObjectConfig $config)
 {
     $config->append(array('table' => $this->getObject('com:revisions.database.table.revisions')));
     parent::_initialize($config);
 }
Esempio n. 4
0
 protected function _initialize(Library\ObjectConfig $config)
 {
     $config->append(array('table' => null));
     parent::_initialize($config);
 }
Esempio n. 5
0
 public function getMixableMethods(Library\ObjectMixable $mixer = null)
 {
     $methods = array_merge(parent::getMixableMethods($mixer), $this->getStrategy()->getMixableMethods($mixer));
     unset($methods['getStrategy']);
     return $methods;
 }
 protected function _initialize(Library\ObjectConfig $config)
 {
     $config->append(array('auto_mixin' => true));
     parent::_initialize($config);
 }
 /**
  * Initializes the options for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param  object   A Library\ObjectConfig object with configuration options.
  * @return void
  */
 protected function _initialize(Library\ObjectConfig $config)
 {
     $config->append(array('priority' => self::PRIORITY_HIGH, 'auto_mixin' => true, 'table' => null));
     parent::_initialize($config);
 }
Esempio n. 8
0
 public function getMixableMethods(Library\ObjectMixable $mixer = null)
 {
     $methods = parent::getMixableMethods($mixer);
     unset($methods['is' . ucfirst($this->getIdentifier()->name)]);
     return $methods;
 }
Esempio n. 9
0
 public function __call($method, $arguments)
 {
     if (in_array($method, $this->_mixable_methods)) {
         if (is_array($this->getType())) {
             $type = $this->getType();
             $type = $type['name'];
         } else {
             $type = $this->type;
         }
         $this->setStrategy($type);
         $this->getStrategy()->setMixer($this->getMixer());
         switch (count($arguments)) {
             case 0:
                 $return = $this->getStrategy()->{$method}();
                 break;
             case 1:
                 $return = $this->getStrategy()->{$method}($arguments[0]);
                 break;
             default:
                 $return = call_user_func_array(array($this->getStrategy(), $method), $arguments);
                 break;
         }
     } else {
         $return = parent::__call($method, $arguments);
     }
     return $return;
 }
Esempio n. 10
0
 public function __construct(Library\ObjectConfig $config)
 {
     parent::__construct($config);
     $this->_user = $this->getObject('com:users.model.users')->id($config->user)->getRow();
 }
Esempio n. 11
0
 protected function _initialize(Library\ObjectConfig $config)
 {
     $params = $this->getObject('application.extensions')->users->params;
     $config->append(array('expirable' => $params->get('password_expire', 0), 'expiration' => 6, 'auto_mixin' => true));
     parent::_initialize($config);
 }