Beispiel #1
0
 /**
  * singleton method used to access the object
  * @access public
  * @return
  */
 public static function singleton()
 {
     if (!isset(self::$instance)) {
         $obj = __CLASS__;
         self::$instance = new $obj();
     }
     return self::$instance;
 }
 function getRenderedLayout($layout, $tag, $topic)
 {
     //Get layout Markup and its tokens
     $layoutMarkup = $this->getLayoutSource($layout);
     // Get layout HTML content (default:layout_default.ctp)
     $matches = $this->getMatchElements($layoutMarkup);
     // Get matching elements
     $layoutTokens = $this->getLayoutModuleTokens($matches);
     // return arrays of token values
     App::import("Controller", "Modules");
     $Modules = new ModulesController();
     $Modules->constructClasses();
     $dataModuleResult = $Modules->getModules($layoutTokens);
     //Get Modules content
     App::import("Controller", "Datarows");
     $Datarows = new DatarowsController();
     $Datarows->constructClasses();
     $Content = $Datarows->getDatarows($layoutTokens, $tag, $topic);
     //Get final layout Markup
     $layoutMarkup = $this->getlayoutMarkup($layoutMarkup, $layoutTokens, $dataModuleResult, $Content, $matches, $topic);
     return $layoutMarkup;
 }
Beispiel #3
0
 function _renderJSON($module, $tag, $topic = "", $options = array())
 {
     //create an output array
     $json = array();
     //include Modules
     App::import("Controller", "Modules");
     $Modules = new ModulesController();
     $Modules->constructClasses();
     //get modules
     $modules = $module == "all" ? $this->Module->find('list') : array($module);
     //traverse
     foreach ($modules as $module) {
         $name = $Modules->getModuleAlias($module);
         $json[$name] = array();
         $json = $Modules->getModuleJSON($module, $tag, $this->Topic->getTopicName($topic), $json, $options);
     }
     $this->set("json", $json);
     $this->layout = "json";
     $this->render('index');
 }
Beispiel #4
0
<?php

/**
 * @version		$Id: admin.modules.php 10381 2008-06-01 03:35:53Z pasamio $
 * @package		Joomla
 * @subpackage	Modules
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
 * Joomla! is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */
// no direct access
defined('_JEXEC') or die('Restricted access');
// Make sure the user is authorized to view this page
$user =& JFactory::getUser();
if (!$user->authorize('com_modules', 'manage')) {
    $mainframe->redirect('index.php', JText::_('ALERTNOTAUTH'));
}
// Require the base controller
require_once JPATH_COMPONENT . DS . 'controller.php';
// Create the controller
$controller = new ModulesController(array('default_task' => 'view'));
// Perform the Request task
$controller->execute(JRequest::getCmd('task', 'view'));
// Redirect if set by the controller
$controller->redirect();
Beispiel #5
0
include $config_urls['CLASS_URL'] . 'settings.class.php';
include $config_urls['CLASS_URL'] . 'combos.class.php';
// Include Error Class
include Settings::getSettingsVars('CLASS_URL') . 'error.class.php';
// Include Basic Functions
include Settings::getSettingsVars('LIB_URL') . 'uptosave/php/functions.php';
// Include Smarty Class smarty.php.
//include(Settings::getSettingsVars('CLASS_URL').'smarty.class.php');
// Include Tools Class
include Settings::getSettingsVars('CLASS_URL') . 'tools.class.php';
// require our registry
require_once $config_urls['CONTROLLER_URL'] . 'jphpController.php';
$registry = JPHPController::singleton();
// require our module objects
require_once Settings::getSettingsVars('CONTROLLER_URL') . 'modulesController.php';
$registry_objects = ModulesController::singleton();
// Setting path of model db
$registry->setDataBaseObject('database', 'db');
$oBD = $registry->getObject('db')->newConnection(DATABASE_GESTOR, BD_SERVER, BD_USER, BD_PASSWORD, BD_DATABASE, DATABASE_CHARSET);
// Include Language Class
include Settings::getSettingsVars('CLASS_URL') . 'localizer.class.php';
// Include Smarty Class smarty.php.
require_once 'smarty.class.php';
$oSesion->inicioSesion();
$datos_usuario = $oSesion->getSesion('datos_usuario');
if (isset($datos_usuario['id_usuario'])) {
    Settings::setSettingsVars('DEFAULT_LANG', $datos_usuario['codigo_idioma']);
    Settings::setSettingsVars('ID_ZONE', $datos_usuario['id_zone']);
    $name_zone = Combos::getNameTimeZone($datos_usuario['id_zone']);
    Settings::setSettingsVars('NAME_ZONE', $name_zone);
    date_default_timezone_set($name_zone);
Beispiel #6
0
 /**
  * Method to display module editing.
  *
  * @return  bool	True on success, false on failure.
  *
  * @since   3.2
  */
 public function execute()
 {
     // Get the application
     $app = $this->getApplication();
     // Get the document object.
     $document = JFactory::getDocument();
     $viewName = $this->input->getWord('view', 'modules');
     $viewFormat = $document->getType();
     $layoutName = $this->input->getWord('layout', 'default');
     $returnUri = $this->input->get->get('return', null, 'base64');
     // Construct redirect URI
     if (!empty($returnUri)) {
         $redirect = base64_decode(urldecode($returnUri));
         // Don't redirect to an external URL.
         if (!JUri::isInternal($redirect)) {
             $redirect = JUri::base();
         }
     } else {
         $redirect = JUri::base();
     }
     // Access back-end com_module
     JLoader::register('ModulesController', JPATH_ADMINISTRATOR . '/components/com_modules/controller.php');
     JLoader::register('ModulesViewModule', JPATH_ADMINISTRATOR . '/components/com_modules/views/module/view.json.php');
     JLoader::register('ModulesModelModule', JPATH_ADMINISTRATOR . '/components/com_modules/models/module.php');
     $displayClass = new ModulesController();
     // Get the parameters of the module with Id
     $document->setType('json');
     // Execute back-end controller
     if (!($serviceData = json_decode($displayClass->display(), true))) {
         $app->redirect($redirect);
     }
     // Reset params back after requesting from service
     $document->setType('html');
     $app->input->set('view', $viewName);
     // Register the layout paths for the view
     $paths = new SplPriorityQueue();
     $paths->insert(JPATH_COMPONENT . '/view/' . $viewName . '/tmpl', 'normal');
     $viewClass = 'ConfigView' . ucfirst($viewName) . ucfirst($viewFormat);
     $modelClass = 'ConfigModel' . ucfirst($viewName);
     if (class_exists($viewClass)) {
         $model = new $modelClass();
         // Access check.
         $user = JFactory::getUser();
         if (!$user->authorise('module.edit.frontend', 'com_modules.module.' . $serviceData['id']) && !$user->authorise('module.edit.frontend', 'com_modules')) {
             $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             $app->redirect($redirect);
         }
         // Need to add module name to the state of model
         $model->getState()->set('module.name', $serviceData['module']);
         $view = new $viewClass($model, $paths);
         $view->setLayout($layoutName);
         // Push document object into the view.
         $view->document = $document;
         // Load form and bind data
         $form = $model->getForm();
         if ($form) {
             $form->bind($serviceData);
         }
         // Set form and data to the view
         $view->form =& $form;
         $view->item =& $serviceData;
         // Render view.
         echo $view->render();
     }
     return true;
 }
 /**
  * Gets a setting from the registry
  * @param String $key the key in the array
  * @return void
  */
 public function getSettingModule($key)
 {
     return parent::getSettingModule($key);
 }
Beispiel #8
0
<?php

require_once "./config/config_include.php";
$db = null;
$ModulesController = new ModulesController($smarty, $db);
$ModulesController->instanceModuleList();
$hookData = $ModulesController->catchAllHook();
$FrontController = new FrontController($smarty, $db, $templateList, $hookData);
$FrontController->catchGlobData();
$FrontController->displayTpl();