Exemplo n.º 1
0
 /**
  * Method to set a view object attached to the controller.
  *
  * @param  mixed                    $view An object that implements KObjectIdentifiable, an object that
  *                                        implements KIndentifierInterface or valid identifier string
  *
  * @throws KDatabaseRowsetException If the identifier is not a view identifier
  *
  * @return KControllerAbstract
  */
 public function setView($view)
 {
     parent::setView($view);
     if (!$this->_view instanceof LibBaseViewAbstract) {
         unregister_default($this->_view);
     }
 }
Exemplo n.º 2
0
 /**
  * After getting the access token store the token in the session and redirect 
  *
  * @param KCommandContext $context Context parameter
  * @param void
  */
 protected function _actionGetaccesstoken($context)
 {
     parent::_actionGetaccesstoken($context);
     $token = $this->getAPI()->getToken();
     if (empty($token)) {
         $context->response->setRedirect(JRoute::_('index.php?'));
         return false;
     }
     $context->response->setRedirect(JRoute::_('option=com_connect&view=login'));
 }
Exemplo n.º 3
0
 /**
  * Set the request information.
  *
  * @param array An associative array of request information
  *
  * @return LibBaseControllerAbstract
  */
 public function setRequest(array $request)
 {
     parent::setRequest($request);
     if (isset($this->_request->term)) {
         $term = $this->getService('anahita:filter.term')->sanitize($this->_request->term);
         $this->_request->term = $term;
         $this->term = $term;
     }
     return $this;
 }
Exemplo n.º 4
0
 /**
  * Initializes the default configuration for the object.
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param KConfig $config An optional KConfig object with configuration options.
  */
 protected function _initialize(KConfig $config)
 {
     $config->append(array('behaviors' => array('ownable')));
     parent::_initialize($config);
 }
Exemplo n.º 5
0
 /**
  * Initializes the default configuration for the object.
  *
  * you can set the redirect url for when a user is logged in
  * as follow
  *
  * <code>
  * KService::setConfig('com://site/people.controller.session', array(
  *  'redirect_to_after_login'  => 'mynewurl'
  *  'redirect_to_after_logout' => 'mynewurl'
  * ));
  * </code>
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param KConfig $config An optional KConfig object with configuration options.
  */
 protected function _initialize(KConfig $config)
 {
     $config->append(array('redirect_to_after_login' => '', 'redirect_to_after_logout' => '', 'request' => array('format' => 'json')));
     parent::_initialize($config);
 }
Exemplo n.º 6
0
 /**
  * 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('base_path' => get_config_value('com_html.content_path'), 'request' => array('layout' => 'default')));
     parent::_initialize($config);
 }
Exemplo n.º 7
0
 /**
  * Initializes the default configuration for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param KConfig $config An optional KConfig object with configuration options.
  *
  * @return void
  */
 protected function _initialize(KConfig $config)
 {
     $config->append(array('toolbars' => array('menubar', $this->getIdentifier()->name), 'behaviors' => to_hash(array('serviceable', 'persistable')), 'request' => array('limit' => 20, 'sort' => 'id', 'direction' => 'ASC')));
     parent::_initialize($config);
 }
Exemplo n.º 8
0
 /**
  * Initializes the default configuration for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param KConfig $config An optional KConfig object with configuration options.
  *
  * @return void
  */
 protected function _initialize(KConfig $config)
 {
     $config->append(array('behaviors' => array('com://site/mailer.controller.behavior.mailer')));
     parent::_initialize($config);
 }
Exemplo n.º 9
0
 /**
  * Initializes the default configuration for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param KConfig $config An optional KConfig object with configuration options.
  *
  * @return void
  */
 protected function _initialize(KConfig $config)
 {
     $config->append(array('parser' => 'com://site/notifications.template.helper.parser', 'behaviors' => array('com://site/mailer.controller.behavior.mailer' => $config->toArray())));
     parent::_initialize($config);
 }
Exemplo n.º 10
0
 /**
  * Dispatches a call to the oauth handler.
  *
  * @return
  */
 protected function _actionGet(KCommandContext $context)
 {
     if ($context->request->getFormat() == 'html') {
         $context->response->setRedirect(JRoute::_('format=json&option=com_connect&view=' . $this->view));
         return;
     }
     if ($this->get) {
         $url = ltrim($this->get, '/');
         $data = KConfig::unbox($this->api->get($url));
         $data = json_encode($data);
     } else {
         $data = (array) $this->api->getUser();
     }
     $this->getView()->data($data);
     return parent::_actionGet($context);
 }
Exemplo n.º 11
0
 /**
  * Override context     
  */
 public function execute($name, KCommandContext $context)
 {
     $data = $context->data;
     $data->append(KRequest::get('session.signup', 'raw', array()));
     KRequest::set('session.signup', $data->toArray());
     $result = parent::execute($name, $context);
     return $result;
 }
Exemplo n.º 12
0
 /**
  * Set the request information.
  *
  * @param array An associative array of request information
  *
  * @return LibBaseControllerAbstract
  */
 public function setRequest(array $request)
 {
     parent::setRequest($request);
     if (isset($this->_request->term)) {
         $value = $this->getService('anahita:filter.term')->sanitize($this->_request->term);
         $this->_request->term = $value;
         $this->term = $value;
     }
     if (isset($this->_request->search_range)) {
         $value = (int) $this->_request->search_range;
         $this->_request->search_range = $value;
         $this->search_range = $value;
     }
     if ($this->_request->search_comments == 1 || $this->_request->search_comments == 'true') {
         $value = true;
     } else {
         $value = false;
     }
     $this->_request->search_comments = $value;
     $this->search_comments = $value;
     return $this;
 }
Exemplo n.º 13
0
 /**
  * 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)
 {
     parent::_initialize($config);
     $config->append(array('behaviors' => to_hash('serviceable'), 'toolbars' => array($this->getIdentifier()->name, 'menubar', 'actorbar'), 'request' => array('limit' => 20, 'offset' => 0, 'sort' => 'recent', 'scope' => '')));
 }
Exemplo n.º 14
0
 /**
  * Initializes the default configuration for the object.
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param KConfig $config An optional KConfig object with configuration options.
  */
 protected function _initialize(KConfig $config)
 {
     $config->append(array('behaviors' => array('ownable'), 'toolbars' => array('actorbar', ' setting')));
     parent::_initialize($config);
 }
Exemplo n.º 15
0
 /**
  * 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('toolbars' => array($this->getIdentifier()->name, 'menubar', 'actorbar')));
     parent::_initialize($config);
 }
Exemplo n.º 16
0
 /**
  * Set the request information
  *
  * @param array An associative array of request information
  * 
  * @return LibBaseControllerAbstract
  */
 public function setRequest(array $request)
 {
     parent::setRequest($request);
     if (isset($this->_request->return)) {
         $return = $this->getService('com://site/people.filter.return')->sanitize($this->_request->return);
         $this->_request->return = $return;
         $this->return = $return;
     }
     return $this;
 }