예제 #1
0
파일: form.php 프로젝트: prox91/joomla-dev
 public function __construct($config = array())
 {
     parent::__construct($config);
     // Set the view list as Joomla pluralize is buggy
     $this->view_list = RInflector::pluralize($this->view_item);
     if (!property_exists($this, 'input') || empty($this->input)) {
         $this->input = JFactory::getApplication()->input;
     }
 }
예제 #2
0
파일: base.php 프로젝트: 810/redCORE
 /**
  * Method to get a model object, loading it if required.
  *
  * @param   string  $name    The model name. Optional.
  * @param   string  $prefix  The class prefix. Optional.
  * @param   array   $config  Configuration array for model. Optional.
  *
  * @return  object  The model.
  */
 public function getModel($name = '', $prefix = '', $config = array('ignore_request' => true))
 {
     $class = get_class($this);
     if (empty($name)) {
         $name = strstr($class, 'Controller');
         $name = str_replace('Controller', '', $name);
         $name = RInflector::singularize($name);
     }
     if (empty($prefix)) {
         $prefix = strstr($class, 'Controller', true) . 'Model';
     }
     return parent::getModel($name, $prefix, $config);
 }
예제 #3
0
파일: list.php 프로젝트: prox91/joomla-dev
 /**
  * Get and instance of the model
  *
  * @param   array  $config  Configuration array for model. Optional.
  *
  * @return  object          An instance of the model
  */
 public static function getModel($config = array('ignore_request' => true))
 {
     // Find the model for this helper
     $class = str_replace('Helper', 'Model', get_called_class());
     $class = RInflector::pluralize($class);
     if (!class_exists($class)) {
         if (method_exists(get_class(), 'getModelPath')) {
             $path = static::getModelPath();
             if (!empty($path) && file_exists($path)) {
                 require_once $path;
             }
         }
     }
     // Get the name and prefix of the model
     $prefix = strstr($class, 'Model', true) . 'Model';
     $name = str_replace($prefix, '', $class);
     return JModelLegacy::getInstance($name, $prefix, $config);
 }
예제 #4
0
 /**
  * Clears Inflectors inflected value caches, and resets the inflection
  * rules to the initial values.
  *
  * @return void
  */
 public static function reset()
 {
     if (empty(self::$initialState)) {
         self::$initialState = get_class_vars('Inflector');
         return;
     }
     foreach (self::$initialState as $key => $val) {
         if ($key != 'initialState') {
             self::${$key} = $val;
         }
     }
 }
예제 #5
0
<?php

/**
 * @package     Redcore.Admin
 * @subpackage  Layouts
 *
 * @copyright   Copyright (C) 2008 - 2015 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
$option = JFactory::getApplication()->input->getString('component', '');
$view = RInflector::pluralize(JFactory::getApplication()->input->getString('view', ''));
$return = JFactory::getApplication()->input->getString('return', '');
$contentElement = JFactory::getApplication()->input->getString('contentelement', '');
$components = RedcoreHelpersView::getExtensionsRedcore();
$translationTables = RTranslationHelper::getInstalledTranslationTables();
if (empty($return)) {
    $return = base64_encode('index.php?option=com_redcore&view=dashboard');
}
?>
<ul class="nav nav-list">
	<?php 
if ($view === 'dashboards') {
    ?>
		<li class="nav-header"><?php 
    echo JText::_('COM_REDCORE_DASHBOARD');
    ?>
</li>
	<?php 
} else {
    ?>
예제 #6
0
파일: form.php 프로젝트: prox91/joomla-dev
 /**
  * Constructor.
  *
  * @param   array  $config  An optional associative array of configuration settings.
  *                          Recognized key values include 'name', 'default_task', 'model_path', and
  *                          'view_path' (this list is not meant to be comprehensive).
  *
  * @throws  Exception
  */
 public function __construct($config = array())
 {
     /** JControllerLegacy */
     $this->methods = array();
     $this->message = null;
     $this->messageType = 'message';
     $this->paths = array();
     $this->redirect = null;
     $this->taskMap = array();
     if (defined('JDEBUG') && JDEBUG) {
         JLog::addLogger(array('text_file' => 'jcontroller.log.php'), JLog::ALL, array('controller'));
     }
     $this->input = JFactory::getApplication()->input;
     // Determine the methods to exclude from the base class.
     $xMethods = get_class_methods('JControllerLegacy');
     // Get the public methods in this class using reflection.
     $r = new ReflectionClass($this);
     $rMethods = $r->getMethods(ReflectionMethod::IS_PUBLIC);
     foreach ($rMethods as $rMethod) {
         $mName = $rMethod->getName();
         // Add default display method if not explicitly declared.
         if (!in_array($mName, $xMethods) || $mName == 'display') {
             $this->methods[] = strtolower($mName);
             // Auto register the methods as tasks.
             $this->taskMap[strtolower($mName)] = $mName;
         }
     }
     // Set the view name
     if (empty($this->name)) {
         if (array_key_exists('name', $config)) {
             $this->name = $config['name'];
         } else {
             $this->name = $this->getName();
         }
     }
     // Set a base path for use by the controller
     if (array_key_exists('base_path', $config)) {
         $this->basePath = $config['base_path'];
     } else {
         $this->basePath = JPATH_COMPONENT;
     }
     // If the default task is set, register it as such
     if (array_key_exists('default_task', $config)) {
         $this->registerDefaultTask($config['default_task']);
     } else {
         $this->registerDefaultTask('display');
     }
     // Set the models prefix
     if (empty($this->model_prefix)) {
         if (array_key_exists('model_prefix', $config)) {
             // User-defined prefix
             $this->model_prefix = $config['model_prefix'];
         } else {
             $this->model_prefix = $this->name . 'Model';
         }
     }
     // Set the default model search path
     if (array_key_exists('model_path', $config)) {
         // User-defined dirs
         $this->addModelPath($config['model_path'], $this->model_prefix);
     } else {
         $this->addModelPath($this->basePath . '/models', $this->model_prefix);
     }
     // Set the default view search path
     if (array_key_exists('view_path', $config)) {
         // User-defined dirs
         $this->setPath('view', $config['view_path']);
     } else {
         $this->setPath('view', $this->basePath . '/views');
     }
     // Set the default view.
     if (array_key_exists('default_view', $config)) {
         $this->default_view = $config['default_view'];
     } elseif (empty($this->default_view)) {
         $this->default_view = $this->getName();
     }
     /** JControllerForm */
     // Guess the option as com_NameOfController
     if (empty($this->option)) {
         $this->option = 'com_' . strtolower($this->getName());
     }
     // Guess the JText message prefix. Defaults to the option.
     if (empty($this->text_prefix)) {
         $this->text_prefix = strtoupper($this->option);
     }
     // Guess the context as the suffix, eg: OptionControllerContent.
     if (empty($this->context)) {
         $r = null;
         if (!preg_match('/(.*)Controller(.*)/i', get_class($this), $r)) {
             throw new Exception(JText::_('JLIB_APPLICATION_ERROR_CONTROLLER_GET_NAME'), 500);
         }
         $this->context = strtolower($r[2]);
     }
     // Apply, Save & New, and Save As copy should be standard on forms.
     $this->registerTask('apply', 'save');
     $this->registerTask('save2new', 'save');
     $this->registerTask('save2copy', 'save');
     /** Custom */
     // Guess the item view as the context.
     if (empty($this->view_item)) {
         $this->view_item = $this->context;
     }
     if (empty($this->view_list)) {
         $this->view_list = RInflector::pluralize($this->view_item);
     }
     if (!property_exists($this, 'input') || empty($this->input)) {
         $this->input = JFactory::getApplication()->input;
     }
 }