Beispiel #1
0
 function onAfterRoute()
 {
     include_once dirname(__FILE__) . '/includes/core/defines.php';
     include_once dirname(__FILE__) . '/includes/core/t3.php';
     include_once dirname(__FILE__) . '/includes/core/bot.php';
     T3Bot::preload();
     $template = T3::detect();
     if ($template) {
         T3Bot::beforeInit();
         T3::init($template);
         T3Bot::afterInit();
         //check and execute the t3action
         T3::checkAction();
         //check and change template for ajax
         T3::checkAjax();
     }
 }
Beispiel #2
0
 /**
  * function loadParam
  * load and re-render parameters
  *
  * @return render success or not
  */
 function renderAdmin()
 {
     $frwXml = T3_ADMIN_PATH . '/' . T3_ADMIN . '.xml';
     $tplXml = T3_TEMPLATE_PATH . '/templateDetails.xml';
     $cusXml = T3Path::getPath('etc/assets.xml');
     $jtpl = T3_ADMIN_PATH . '/admin/tpls/default.php';
     if (file_exists($tplXml) && file_exists($jtpl)) {
         T3::import('depend/t3form');
         //get the current joomla default instance
         $form = JForm::getInstance('com_templates.style', 'style', array('control' => 'jform', 'load_data' => true));
         //wrap
         $form = new T3Form($form);
         //remove all fields from group 'params' and reload them again in right other base on template.xml
         $form->removeGroup('params');
         //load the template
         $form->loadFile(T3_PATH . '/params/template.xml');
         //overwrite / extend with params of template
         $form->loadFile($tplXml, true, '//config');
         //overwrite / extend with custom config in custom/etc/assets.xml
         if ($cusXml && file_exists($cusXml)) {
             $form->loadFile($cusXml, true, '//config');
         }
         // extend parameters
         T3Bot::prepareForm($form);
         $xml = JFactory::getXML($tplXml);
         $fxml = JFactory::getXML($frwXml);
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('id, title')->from('#__template_styles')->where('template=' . $db->quote(T3_TEMPLATE));
         $db->setQuery($query);
         $styles = $db->loadObjectList();
         foreach ($styles as $key => &$style) {
             $style->title = ucwords(str_replace('_', ' ', $style->title));
         }
         $session = JFactory::getSession();
         $t3lock = $session->get('T3.t3lock', 'overview_params');
         $session->set('T3.t3lock', null);
         $input = JFactory::getApplication()->input;
         include $jtpl;
         /*
         //search for global parameters
         $japp = JFactory::getApplication();
         $pglobals = array();
         foreach($form->getGroup('params') as $param){
         	if($form->getFieldAttribute($param->fieldname, 'global', 0, 'params')){
         		$pglobals[] = array('name' => $param->fieldname, 'value' => $form->getValue($param->fieldname, 'params')); 
         	}
         }
         $japp->setUserState('oparams', $pglobals);
         */
         return true;
     }
     return false;
 }
Beispiel #3
0
Datei: t3.php Projekt: lazarch/t3
 /**
  * Add JA Extended menu parameter in administrator
  *
  * @param   JForm $form   The form to be altered.
  * @param   array $data   The associated data for the form
  *
  * @return  null
  */
 function onContentPrepareForm($form, $data)
 {
     if (defined('T3_PLUGIN')) {
         $form_name = $form->getName();
         // make it compatible with AMM
         if ($form_name == 'com_advancedmodules.module') {
             $form_name = 'com_modules.module';
         }
         if (T3::detect() && ($form_name == 'com_templates.style' || $form_name == 'com_config.templates')) {
             $_form = clone $form;
             $_form->loadFile(T3_PATH . '/params/template.xml', false);
             //custom config in custom/etc/assets.xml
             $cusXml = T3Path::getPath('etc/assets.xml');
             if ($cusXml && file_exists($cusXml)) {
                 $_form->loadFile($cusXml, true, '//config');
             }
             // extend parameters
             T3Bot::prepareForm($form);
             //search for global parameters and store in user state
             $app = JFactory::getApplication();
             $gparams = array();
             foreach ($_form->getGroup('params') as $param) {
                 if ($_form->getFieldAttribute($param->fieldname, 'global', 0, 'params')) {
                     $gparams[] = $param->fieldname;
                 }
             }
             $this->gparams = $gparams;
         }
         $tmpl = T3::detect() ? T3::detect() : (T3::getDefaultTemplate(true) ? T3::getDefaultTemplate(true) : false);
         if ($tmpl) {
             $tplpath = JPATH_ROOT . '/templates/' . (is_object($tmpl) && !empty($tmpl->tplname) ? $tmpl->tplname : $tmpl);
             $formpath = $tplpath . '/etc/form/';
             JForm::addFormPath($formpath);
             $extended = $formpath . $form_name . '.xml';
             if (is_file($extended)) {
                 JFactory::getLanguage()->load('tpl_' . $tmpl, JPATH_SITE);
                 $form->loadFile($form_name, false);
             }
             // load extra fields for specified module in format com_modules.module.module_name.xml
             if ($form_name == 'com_modules.module') {
                 $module = isset($data->module) ? $data->module : '';
                 if (!$module) {
                     $jform = JFactory::getApplication()->input->get("jform", null, 'array');
                     $module = $jform['module'];
                 }
                 $extended = $formpath . $module . '.xml';
                 if (is_file($extended)) {
                     JFactory::getLanguage()->load('tpl_' . $tmpl, JPATH_SITE);
                     $form->loadFile($module, false);
                 }
             }
             //extend extra fields
             T3Bot::extraFields($form, $data, $tplpath);
         }
         // Extended by T3
         $extended = T3_ADMIN_PATH . '/admin/form/' . $form_name . '.xml';
         if (is_file($extended)) {
             $form->loadFile($extended, false);
         }
     }
 }
Beispiel #4
0
 /**
  * Add JA Extended menu parameter in administrator
  *
  * @param   JForm $form   The form to be altered.
  * @param   array $data   The associated data for the form
  *
  * @return  null
  */
 function onContentPrepareForm($form, $data)
 {
     if (defined('T3_PLUGIN')) {
         if (T3::detect() && ($form->getName() == 'com_templates.style' || $form->getName() == 'com_config.templates')) {
             JForm::addFormPath(T3_PATH . '/params');
             $form->loadFile('template', false);
             // extend parameters
             T3Bot::prepareForm($form);
             //search for global parameters and store in user state
             if (is_object($data)) {
                 $app = JFactory::getApplication();
                 $fdata = $data->getProperties();
                 $pglobals = array();
                 foreach ($form->getGroup('params') as $param) {
                     if ($form->getFieldAttribute($param->fieldname, 'global', 0, 'params')) {
                         $pglobals[] = array('name' => $param->fieldname, 'value' => isset($fdata['params'][$param->fieldname]) ? $fdata['params'][$param->fieldname] : '');
                     }
                 }
                 $app->setUserState('oparams', $pglobals);
             }
         }
         $tmpl = T3::detect() ? T3::detect() : (T3::getDefaultTemplate(true) ? T3::getDefaultTemplate(true) : false);
         if ($tmpl) {
             $tplpath = JPATH_ROOT . '/templates/' . (is_object($tmpl) && !empty($tmpl->tplname) ? $tmpl->tplname : $tmpl);
             $formpath = $tplpath . '/etc/form/';
             JForm::addFormPath($formpath);
             $extended = $formpath . $form->getName() . '.xml';
             if (is_file($extended)) {
                 JFactory::getLanguage()->load('tpl_' . $tmpl, JPATH_SITE);
                 $form->loadFile($form->getName(), false);
             }
             // load extra fields for specified module in format com_modules.module.module_name.xml
             if ($form->getName() == 'com_modules.module') {
                 $module = isset($data->module) ? $data->module : '';
                 if (!$module) {
                     $jform = JFactory::getApplication()->input->get("jform", null, 'array');
                     $module = $jform['module'];
                 }
                 $extended = $formpath . $module . '.xml';
                 if (is_file($extended)) {
                     JFactory::getLanguage()->load('tpl_' . $tmpl, JPATH_SITE);
                     $form->loadFile($module, false);
                 }
             }
             //extend extra fields
             T3Bot::extraFields($form, $data, $tplpath);
         }
     }
 }