/** * Constructor * * @param array An optional associative array of configuration settings. */ public function __construct(array $options = array()) { parent::__construct($options); // Register extra tasks $this->registerTask('disable', 'enable'); $this->registerTask('apply', 'save'); $this->registerTask('add', 'edit'); }
/** * Initializes the options for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param object An optional KConfig object with configuration options. * @return void */ protected function _initialize(KConfig $config) { $config->append(array( 'controller' => $this->_identifier->package, 'request' => KRequest::get('get', 'string'), ))->append(array( 'request' => array('format' => KRequest::format() ? KRequest::format() : 'html') )); parent::_initialize($config); }
/** * Initializes the options for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param object An optional KConfig object with configuration options. * @return void */ protected function _initialize(KConfig $config) { $config->append(array('controller' => null, 'controller_default' => $this->_identifier->package, 'request' => KRequest::get('get', 'string'), 'request_persistent' => false)); parent::_initialize($config); }
/** * Supports a simple form Fluent Interfaces. Allows you to set the request * properties by using the request property name as the method name. * * For example : $controller->view('name')->limit(10)->browse(); * * @param string Method name * @param array Array containing all the arguments for the original call * @return KControllerBread * * @see http://martinfowler.com/bliki/FluentInterface.html */ public function __call($method, $args) { //Check first if we are calling a mixed in method. //This prevents the model being loaded durig object instantiation. if (!isset($this->_mixed_methods[$method])) { //Check if the method is a state property $state = $this->getModel()->getState(); if (isset($state->{$method}) || in_array($method, array('layout', 'view', 'format'))) { $this->{$method} = $args[0]; if ($method == 'view') { $this->_view = $args[0]; } return $this; } } return parent::__call($method, $args); }
/** * Initializes the options for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param KObjectConfig $config Configuration options * @return void */ protected function _initialize(KObjectConfig $config) { $config->append(array('controller' => $this->getIdentifier()->package, 'request' => 'lib:dispatcher.request', 'response' => 'lib:dispatcher.response', 'authenticators' => array())); parent::_initialize($config); }
/** * Initializes the default configuration for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param KObjectConfig $config Configuration options * @return void */ protected function _initialize(KObjectConfig $config) { $config->append(array('model' => 'com:scheduler.model.jobs', 'jobs' => array())); parent::_initialize($config); }
/** * Get a behavior by identifier. * * @param mixed $behavior Behavior name * @param array $config An array of options to configure the behavior with * * @see KMixinBehavior::getBehavior() * * @return AnDomainBehaviorAbstract */ public function getBehavior($behavior, $config = array()) { if (is_string($behavior)) { if (strpos($behavior, '.') === false) { $identifier = clone $this->getIdentifier(); $identifier->path = array('controller', 'behavior'); $identifier->name = $behavior; register_default(array('identifier' => $identifier, 'prefix' => $this)); $behavior = $identifier; } } return parent::getBehavior($behavior, $config); }
/** * Supports a simple form Fluent Interfaces. Allows you to set the request * properties by using the request property name as the method name. * * For example : $controller->view('name')->layout('form')->display(); * * @param string Method name * @param array Array containing all the arguments for the original call * @return KControllerBread * * @see http://martinfowler.com/bliki/FluentInterface.html */ public function __call($method, $args) { //Check first if we are calling a mixed in method. if (!isset($this->_mixed_methods[$method])) { if (in_array($method, array('layout', 'view', 'format'))) { $this->{$method} = $args[0]; return $this; } } return parent::__call($method, $args); }
/** * Supports a simple form Fluent Interfaces. Allows you to set the request properties by using the request property * name as the method name. * * For example : $controller->view('name')->layout('name')->format('html')->render(); * * @param string $method Method name * @param array $args Array containing all the arguments for the original call * @return KControllerView * * @see http://martinfowler.com/bliki/FluentInterface.html */ public function __call($method, $args) { if (!isset($this->_mixed_methods[$method])) { if (in_array($method, array('layout', 'view', 'format'))) { if ($method == 'view') { $this->setView($args[0]); } if ($method == 'format') { $this->getRequest()->setFormat($args[0]); } if ($method == 'layout') { $this->getRequest()->getQuery()->set($method, $args[0]); } return $this; } } return parent::__call($method, $args); }