コード例 #1
0
ファイル: dependencies.php プロジェクト: ppantilla/bbninja
 /**
  * Sets a variable to the theme object.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function set()
 {
     if (!$this->theme) {
         $this->theme = FD::get('Themes');
     }
     $args = func_get_args();
     if (count($args) === 1 && is_array($args[0])) {
         $vars = $args[0];
         foreach ($vars as $key => $var) {
             $this->theme->set($key, $var);
         }
     }
     if (count($args) === 2) {
         $this->theme->set($args[0], $args[1]);
     }
 }
コード例 #2
0
ファイル: controller.php プロジェクト: knigherrant/decopatio
 /**
  * Override parent controller's display behavior.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($params = array(), $urlparams = false)
 {
     $type = $this->doc->getType();
     $name = $this->input->get('view', 'dashboard', 'cmd');
     $view = $this->getView($name, $type, '');
     // @task: Once we have the view, set the appropriate layout.
     $layout = $this->input->get('layout', 'default', 'cmd');
     $view->setLayout($layout);
     // Check and see if this view should be displayed
     // If private mode is enabled and user isn't logged in.
     if ($this->config->get('general.site.lockdown.enabled') && $this->my->guest && $view->lockdown()) {
         $url = FRoute::login(array(), false);
         return $this->app->redirect($url);
     }
     // For ajax methods, we just load the view methods.
     if ($type == 'ajax') {
         if (!method_exists($view, $layout)) {
             $view->display();
         } else {
             $params = $this->input->get('params', '', 'default');
             $params = json_decode($params);
             call_user_func_array(array($view, $layout), $params);
         }
     } else {
         // Disable inline scripts in templates.
         SocialThemes::$_inlineScript = false;
         if ($layout != 'default') {
             if (!method_exists($view, $layout)) {
                 $view->display();
             } else {
                 call_user_func_array(array($view, $layout), $params);
             }
         } else {
             $view->display();
         }
         // Restore inline script in templates.
         SocialThemes::$_inlineScript = true;
     }
 }
コード例 #3
0
ファイル: controller.php プロジェクト: ppantilla/bbninja
 /**
  * Override parent controller's display behavior.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($params = array(), $urlparams = false)
 {
     $doc = JFactory::getDocument();
     // @task: Get the view from Joomla.
     $type = $doc->getType();
     $name = JRequest::getCmd('view', 'dashboard');
     $view = $this->getView($name, $type, '');
     // @task: Once we have the view, set the appropriate layout.
     $layout = JRequest::getCmd('layout', 'default');
     $view->setLayout($layout);
     $config = FD::config();
     // Check and see if this view should be displayed
     // If private mode is enabled and user isn't logged in.
     if ($config->get('general.site.lockdown.enabled') && !JFactory::getUser()->id) {
         if ($view->lockdown()) {
             JFactory::getApplication()->redirect(FRoute::login(array(), false));
         }
     }
     // For ajax methods, we just load the view methods.
     if ($type == 'ajax') {
         if (!method_exists($view, $layout)) {
             $view->display();
         } else {
             $json = FD::json();
             call_user_func_array(array($view, $viewLayout), $json->decode(JRequest::getVar('params')));
         }
     } else {
         // Disable inline scripts in templates.
         SocialThemes::$_inlineScript = false;
         if ($layout != 'default') {
             if (!method_exists($view, $layout)) {
                 $view->display();
             } else {
                 call_user_func_array(array($view, $layout), $params);
             }
         } else {
             $view->display();
         }
         // Restore inline script in templates.
         SocialThemes::$_inlineScript = true;
     }
 }