예제 #1
0
 public function onContentPrepareForm($form, $data)
 {
     $app = JFactory::getApplication();
     if (!$app->isAdmin()) {
         return;
     }
     $option = JRequest::getWord('option');
     $layout = JRequest::getWord('layout');
     $task = JRequest::getWord('task');
     $module = $this->getModuleType($data);
     if ($option == 'com_modules' && $layout == 'edit' && $module == 'mod_roknavmenu') {
         require_once JPATH_ROOT . '/modules/mod_roknavmenu/lib/RokNavMenu.php';
         require_once JPATH_ROOT . '/modules/mod_roknavmenu/lib/RokSubfieldForm.php';
         JForm::addFieldPath(JPATH_ROOT . '/modules/mod_roknavmenu/fields');
         RokNavMenu::loadCatalogs();
         foreach (RokNavMenu::$themes as $theme_name => $theme_info) {
             $params_file = $theme_info['path'] . "/parameters.xml";
             if (JFile::exists($params_file)) {
                 $form->loadFile($params_file, false);
             }
             $fields_folder = $theme_info['path'] . "/fields";
             if (JFolder::exists($fields_folder)) {
                 JForm::addFieldPath($fields_folder);
             }
             $language_path = $theme_info['path'] . "/language";
             if (JFolder::exists($language_path)) {
                 $language =& JFactory::getLanguage();
                 $language->load($theme_name, $theme_info['path'], $language->getTag(), true);
             }
         }
         $subfieldform = RokSubfieldForm::getInstance($form);
         if (!empty($data) && isset($data->params)) {
             $subfieldform->setOriginalParams($data->params);
         }
         if ($task == 'save' || $task == 'apply') {
             $subfieldform->makeSubfieldsVisable();
         }
     } else {
         if ($option == 'com_menus' && $layout == 'edit') {
             JForm::addFieldPath(JPATH_ROOT . '/modules/mod_roknavmenu/fields');
             // Load 2x Catalog Themes
             require_once JPATH_ROOT . "/modules/mod_roknavmenu/lib/RokNavMenu.php";
             RokNavMenu::loadCatalogs();
             foreach (RokNavMenu::$themes as $theme_name => $theme_info) {
                 $item_file = $theme_info['path'] . "/item.xml";
                 if (JFile::exists($item_file)) {
                     $form->loadFile($item_file, true);
                 }
                 $fields_folder = $theme_info['path'] . "/fields";
                 if (JFolder::exists($fields_folder)) {
                     JForm::addFieldPath($fields_folder);
                 }
             }
         }
     }
 }
예제 #2
0
 /**
  * Method to get the field options.
  *
  * @return    array    The field option objects.
  * @since    1.6
  */
 protected function getOptions()
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $options = array();
     // Load 2x Catalog Themes
     require_once JPATH_ROOT . "/modules/mod_roknavmenu/lib/RokNavMenu.php";
     RokNavMenu::loadCatalogs();
     foreach (RokNavMenu::$themes as $theme_name => $theme_info) {
         $options[] = JHTML::_('select.option', $theme_name, $theme_info['fullname']);
     }
     return $options;
 }
예제 #3
0
 public static function loadCatalogs()
 {
     if (!self::$catalogs_loaded) {
         // load the module themes catalog
         require_once JPATH_ROOT . '/modules/mod_roknavmenu/themes/catalog.php';
         foreach (self::getTemplates() as $template) {
             $template_theme_catalog = JPATH_ROOT . '/templates/' . $template . "/html/mod_roknavmenu/themes/catalog.php";
             if (JFile::exists($template_theme_catalog)) {
                 //load the templates themes
                 include_once $template_theme_catalog;
             }
         }
         self::$catalogs_loaded = true;
     }
 }
예제 #4
0
    /**
     * Method to get the field input markup.
     *
     * @return    string    The field input markup.
     * @since    1.6
     */
    protected function getLabel()
    {
        $doc = JFactory::getDocument();
        $css = "\n            .rok-break {border-bottom:1px solid #eee;font-size:16px;color:#0088CC;margin-top:15px;padding:2px 0;width:100%;}\n            div.themeset > div.control-label {margin-bottom:18px}\n            div.themeset > div.controls {margin-bottom:18px}\n         ";
        $doc->addStyleDeclaration($css);
        // Load SubfieldForm Class
        require_once JPATH_ROOT . "/modules/mod_roknavmenu/lib/RokSubfieldForm.php";
        // Load 2x Catalog Themes
        require_once JPATH_ROOT . "/modules/mod_roknavmenu/lib/RokNavMenu.php";
        RokNavMenu::loadCatalogs();
        $label = JText::_((string) $this->element['label']);
        $css = (string) $this->element['class'];
        $buffer = '';
        $form = RokSubfieldForm::getInstanceFromForm($this->form);
        JForm::addFieldPath(dirname(__FILE__) . '/fields');
        $themesets = $form->getSubFieldsets('roknavmenu-themes');
        foreach ($themesets as $themeset => $themeset_val) {
            $themeset_fields = $form->getSubFieldset('roknavmenu-themes', $themeset, 'params');
            ob_start();
            ?>
                <div class="control-group themeset" id="themeset-<?php 
            echo $themeset;
            ?>
">
                    <?php 
            foreach ($themeset_fields as $themeset_field) {
                ?>
                <div class="control-label">
                    <?php 
                echo $themeset_field->getLabel();
                ?>
                </div>
                <div class="controls">
                     <?php 
                echo $themeset_field->getInput();
                ?>
                </div>
                <?php 
            }
            ?>
            </div>
            <?php 
            $buffer .= ob_get_clean();
        }
        return $buffer;
    }
예제 #5
0
 /**
  * Method to get the field options.
  *
  * @return    array    The field option objects.
  * @since    1.6
  */
 protected function getOptions()
 {
     $doc = JFactory::getDocument();
     $version = new JVersion();
     if (version_compare($version->getShortVersion(), '3.0', '<')) {
         $js = "window.addEvent('load', function() {\n                \$('" . $this->id . "').addEvent('change', function(){\n                    var sel = this.getSelected().get('value');\n                    \$\$('.themeset').setStyle('display','none');\n                    \$\$('#themeset-'+sel).setStyle('display','block');\n                }).fireEvent('change');\n            });";
     } else {
         $js = "\n            window.addEvent('load', function() {\n            var chzn = \$('" . $this->id . "_chzn');\n                if(chzn!=null){\n                    \$\$('.themeset').setStyle('display','none');\n                    \$\$('#themeset-" . $this->value . "').setStyle('display','block');\n                    \$('" . $this->id . "_chzn').addEvent('click', function(){\n                        \$\$('.themeset').setStyle('display','none');\n                        var text = \$('" . $this->id . "_chzn').getElement('span').get('text');\n                        var options = \$('" . $this->id . "').getElements('option');\n                        options.each(function(option) {\n                        var optText = String(option.get('text'));\n                        var optValue = String(option.get('value'));\n                            if(text == optText){\n                                var sel = '#themeset-'+optValue;\n                            }\n                            \$\$(sel).setStyle('display','block');\n                        });\n                    }).fireEvent('click');\n                }\n            });";
     }
     $doc->addScriptDeclaration($js);
     $options = array();
     // Load 2x Catalog Themes
     require_once JPATH_ROOT . "/modules/mod_roknavmenu/lib/RokNavMenu.php";
     RokNavMenu::loadCatalogs();
     foreach (RokNavMenu::$themes as $theme_name => $theme_info) {
         $options[] = JHtml::_('select.option', $theme_name, $theme_info['fullname']);
     }
     return $options;
 }
예제 #6
0
    /**
     * Method to get the field input markup.
     *
     * @return    string    The field input markup.
     * @since    1.6
     */
    protected function getInput()
    {
        jimport('joomla.filesystem.folder');
        jimport('joomla.filesystem.file');
        // Load 2x Catalog Themes
        require_once JPATH_ROOT . "/modules/mod_roknavmenu/lib/RokNavMenu.php";
        RokNavMenu::loadCatalogs();
        $buffer = '';
        $form = RokSubfieldForm::getInstance($this->form);
        JForm::addFieldPath(dirname(__FILE__) . '/fields');
        $this->load_js_switcher();
        $themesets = $form->getSubFieldsets('roknavmenu-themes');
        foreach ($themesets as $themeset => $themeset_val) {
            $themeset_fields = $form->getSubFieldset('roknavmenu-themes', $themeset, 'params');
            ob_start();
            ?>
            <div class="themeset" id="themeset-<?php 
            echo $themeset;
            ?>
">
                <ul class="themeset">
                <?php 
            foreach ($themeset_fields as $themeset_field) {
                ?>
                    <li>
                        <?php 
                echo $themeset_field->getLabel();
                ?>
                        <?php 
                echo $themeset_field->getInput();
                ?>
                    </li>
                <?php 
            }
            ?>
                </ul>
            </div>
            <?php 
            $buffer .= ob_get_clean();
        }
        return $buffer;
    }
예제 #7
0
<?php
/**
 * @version $Id$
 * @package RocketWerx
 * @subpackage	RokNavMenu
 * @copyright Copyright (C) 2009 RocketWerx. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

$params->def('menutype', 			'mainmenu');
$params->def('class_sfx', 			'');
$params->def('menu_images', 		0);
$params->def('startLevel', 		0);
$params->def('endLevel', 			0);
$params->def('showAllChildren', 	0);

require_once(dirname(__FILE__)."/lib/includes.php");
$rnm = new RokNavMenu($params->toArray());
$rnm->initialize();
echo $rnm->render();
$foo="bar";
예제 #8
0
	function fetchElement($name, $value, &$node, $control_name)
	{
		jimport( 'joomla.filesystem.folder' );
		jimport( 'joomla.filesystem.file' );

		$filter		= $node->attributes('filter');
		$exclude	= $node->attributes('exclude');

        $options = array ();


        // Load 2x Catalog Themes
        require_once(dirname(__FILE__) . "/../RokNavMenu.php");
        RokNavMenu::setFrontSideTemplate();
        RokNavMenu::loadCatalogs();



        foreach(RokNavMenu::$themes as $theme_name => $theme_info){
            $options[] = JHTML::_('select.option', $theme_name, $theme_info['fullname']);
        }
			
		// path to directory
		$template_themes_path = '/templates/'.$this->_getFrontSideTemplate().'/html/mod_roknavmenu/themes';
		$template_themes_full_path = JPath::clean(JPATH_ROOT.$template_themes_path);
		$template_theme_text = JText::_("Template theme");
		
		$module_themes_path = '/modules/mod_roknavmenu/themes'; 
		$module_themes_full_path = JPath::clean(JPATH_ROOT.$module_themes_path);
		$module_theme_text = JText::_("Default theme");
		
		/**
		 * check for old school formatter and layout
		 */
		 if ($this->_getOldFormatter() || $this->_getOldLayout()) {
			return JText::sprintf("ROKNAVMENU.MSG.USING_OLD_FORMATTERS_AND_LAYOUTS", ($this->_getOldFormatter())? '<br/>'.$this->_getOldFormatter():'', ($this->_getOldLayout())?'<br/>'.$this->_getOldLayout():'');		 	
		 }

		if (!$node->attributes('hide_none'))
		{
			$options[] = JHTML::_('select.option', '-1', '- '.JText::_('Do not use').' -');
		}
	
		if (!$node->attributes('hide_default'))
		{
			$options[] = JHTML::_('select.option', '', '- '.JText::_('Use default').' -');
		}
		
		 /** Get the Template Themes **/
		if (JFolder::exists($template_themes_full_path) && !JFile::exists($template_themes_full_path."/catalog.php") ) {
			$folders = JFolder::folders($template_themes_full_path, $filter);
			if ( is_array($folders) )
			{
				reset($folders);
				while (list($key, $val) = each($folders)) {
					$folder =& $folders[$key]; 
					if ($exclude)
					{
						if (preg_match( chr( 1 ) . $exclude . chr( 1 ), $folder ))
						{
							continue;
						}
					}
					$options[] = JHTML::_('select.option', $template_themes_path.DS.$folder, $template_theme_text." - ".$folder);
				}
			}
		}
		 /** Get the Default Themes **/
		if (JFolder::exists($module_themes_full_path) && !JFile::exists($module_themes_full_path."/catalog.php")) { 
			$folders = JFolder::folders($module_themes_full_path, $filter);
			if ( is_array($folders) )
			{
				reset($folders);
				while (list($key, $val) = each($folders)) {
					$folder =& $folders[$key]; 
					if ($exclude)
					{
						if (preg_match( chr( 1 ) . $exclude . chr( 1 ), $folder ))
						{
							continue;
						}
					}
					$options[] = JHTML::_('select.option', $module_themes_path.DS.$folder, $module_theme_text. " - ". $folder);
				}
			}
		}
		return JHTML::_('select.genericlist',  $options, ''.$control_name.'['.$name.']', 'class="inputbox"', 'value', 'text', $value, "param$name");

	}
예제 #9
0
 function getModule($id = 0, $name = '')
 {
     $modules =& RokNavMenu::loadModules();
     $total = count($modules);
     for ($i = 0; $i < $total; $i++) {
         // Match the name of the module
         if ($modules[$i]->id == $id || $modules[$i]->name == $name) {
             return $modules[$i];
         }
     }
     return null;
 }
예제 #10
0
파일: catalog.php 프로젝트: Rikisha/proj
<?php

/**
 * @version   1.16 September 14, 2012
 * @author    RocketTheme http://www.rockettheme.com
 * @copyright Copyright (C) 2007 - 2012 RocketTheme, LLC
 * @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
 */
require_once dirname(__FILE__) . '/default/theme.php';
RokNavMenu::registerTheme(dirname(__FILE__) . '/default', 'default', 'Default', 'RokNavMenuDefaultTheme');
require_once dirname(__FILE__) . '/fusion/theme.php';
RokNavMenu::registerTheme(dirname(__FILE__) . '/fusion', 'fusion', 'Default Fusion', 'RokNavMenuFusionTheme');
예제 #11
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $doc = JFactory::getDocument();
     $lang = JFactory::getLanguage();
     $parameter_sets = array();
     $filter = $node->attributes('filter');
     $exclude = $node->attributes('exclude');
     // Load 2x Catalog Themes
     require_once dirname(__FILE__) . "/../RokNavMenu.php";
     RokNavMenu::setFrontSideTemplate();
     RokNavMenu::loadCatalogs();
     foreach (RokNavMenu::$themes as $theme_name => $theme_info) {
         $lang_file_path = JPath::clean($theme_info['path'] . '/language/' . $lang->_lang . '.ini');
         $this->loadLangFile($lang_file_path, $theme_info['fullname']);
         $parms_file_path = JPath::clean($theme_info['path'] . '/parameters.xml');
         if (JFile::exists($parms_file_path)) {
             $parameters = new JForm($this->_parent->_raw, JPath::clean($parms_file_path));
             $parameter_sets[$theme_name] = $parameters->getParams();
         }
     }
     // path to directory
     $template_themes_path = '/templates/' . $this->_getFrontSideTemplate() . '/html/mod_roknavmenu/themes';
     $template_themes_full_path = JPath::clean(JPATH_ROOT . $template_themes_path);
     $template_theme_text = JText::_("Template theme");
     $module_themes_path = '/modules/mod_roknavmenu/themes';
     $module_themes_full_path = JPath::clean(JPATH_ROOT . $module_themes_path);
     $module_theme_text = JText::_("Default theme");
     $module_js_path = JURI::root(true) . '/modules/mod_roknavmenu/lib/js';
     $doc->addScript($module_js_path . "/switcher" . $this->_getJSVersion() . ".js");
     $doc->addScriptDeclaration("window.addEvent('domready', function() {new NavMenuSwitcher('paramtheme');});");
     /** Get the Template Themes parameters **/
     if (JFolder::exists($template_themes_full_path) && !JFile::exists($template_themes_full_path . "/catalog.php")) {
         $folders = JFolder::folders($template_themes_full_path, $filter);
         if (is_array($folders)) {
             reset($folders);
             while (list($key, $val) = each($folders)) {
                 $folder =& $folders[$key];
                 if ($exclude) {
                     if (preg_match(chr(1) . $exclude . chr(1), $folder)) {
                         continue;
                     }
                 }
                 $theme_path = $template_themes_path . '/' . $folder;
                 $langfile = JPath::clean(JPATH_ROOT . $theme_path . '/language/' . $lang->_lang . '.ini');
                 if (JFile::exists($langfile)) {
                     $lang->_load($langfile, 'roknavmenu_theme_template_' . $folder);
                 }
                 $param_file_path = $theme_path . '/parameters.xml';
                 if (JFile::exists(JPath::clean(JPATH_ROOT . $param_file_path))) {
                     $parameters = new JForm($this->_parent->_raw, JPath::clean(JPATH_ROOT . $param_file_path));
                     $parameter_sets[$theme_path] = $parameters->getParams();
                 }
             }
         }
     }
     /** Get the Default Themes parameters **/
     if (JFolder::exists($module_themes_full_path) && !JFile::exists($module_themes_full_path . "/catalog.php")) {
         $folders = JFolder::folders($module_themes_full_path, $filter);
         if (is_array($folders)) {
             reset($folders);
             while (list($key, $val) = each($folders)) {
                 $folder =& $folders[$key];
                 if ($exclude) {
                     if (preg_match(chr(1) . $exclude . chr(1), $folder)) {
                         continue;
                     }
                 }
                 $theme_path = $module_themes_path . '/' . $folder;
                 $langfile = JPath::clean(JPATH_ROOT . $theme_path . '/language/' . $lang->_lang . '.ini');
                 if (JFile::exists($langfile)) {
                     $lang->_load($langfile, 'roknavmenu_theme_module_' . $folder);
                 }
                 $param_file_path = $theme_path . '/parameters.xml';
                 $parameter_sets[$theme_path] = array();
                 if (JFile::exists(JPath::clean(JPATH_ROOT . $param_file_path))) {
                     $parameters = new JForm($this->_parent->_raw, JPath::clean(JPATH_ROOT . $param_file_path));
                     $parameter_sets[$theme_path] = $parameters->getParams();
                 }
             }
         }
     }
     $parameter_renders = array();
     reset($parameter_sets);
     $html = '';
     // render a parameter set
     while (list($key, $val) = each($parameter_sets)) {
         $params =& $parameter_sets[$key];
         $cls = basename($key);
         if (empty($params)) {
             $html .= '<p class="' . $cls . '"><span>' . JText::_('ROKNAVMENU_MSG_NO_THEME_OPTIONS_AVAILABLE') . ' </span></p>';
         } else {
             //render an individual parameter
             for ($i = 0; $i < count($params); $i++) {
                 $param =& $params[$i];
                 $html .= '<p class="' . $cls . '"><span>' . $param[0] . ':</span>' . $param[1] . '</p>';
             }
         }
     }
     return $html;
 }
예제 #12
0
 function registerOldThemes()
 {
     $filter = '.';
     $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX');
     // path to directory
     $template_themes_path = '/templates/' . $this->_getFrontSideTemplate() . '/html/mod_roknavmenu/themes';
     $template_themes_full_path = JPath::clean(JPATH_ROOT . $template_themes_path);
     $module_themes_path = '/modules/mod_roknavmenu/themes';
     $module_themes_full_path = JPath::clean(JPATH_ROOT . $module_themes_path);
     /** Get the Template Themes parameters **/
     if (JFolder::exists($template_themes_full_path) && !JFile::exists($template_themes_full_path . "/catalog.php")) {
         $folders = JFolder::folders($template_themes_full_path, $filter);
         if (is_array($folders)) {
             while (list($key, $val) = each($folders)) {
                 $folder =& $folders[$key];
                 if ($exclude) {
                     if (preg_match(chr(1) . $exclude . chr(1), $folder)) {
                         continue;
                     }
                 }
                 $theme_full_path = $template_themes_full_path . '/' . $folder;
                 $fullname = 'Template theme - ' . $folder;
                 $class = 'RokNavMenuFormatterTemplate' . str_replace('-', '', $folder);
                 $name = $folder;
                 RokNavMenu::registerTheme($theme_full_path, $name, $fullname, $class);
             }
         }
     }
     /** Get the Default Themes parameters **/
     if (JFolder::exists($module_themes_full_path) && !JFile::exists($module_themes_full_path . "/catalog.php")) {
         $folders = JFolder::folders($module_themes_full_path, $filter);
         if (is_array($folders)) {
             while (list($key, $val) = each($folders)) {
                 $folder =& $folders[$key];
                 if ($exclude) {
                     if (preg_match(chr(1) . $exclude . chr(1), $folder)) {
                         continue;
                     }
                 }
                 $theme_full_path = $module_themes_full_path . '/' . $folder;
                 $fullname = 'Template theme - ' . $folder;
                 $class = 'RokNavMenuFormatterTemplate' . str_replace('-', '', $folder);
                 $name = $folder;
                 RokNavMenu::registerTheme($theme_full_path, $name, $fullname, $class);
             }
         }
     }
 }
예제 #13
0
<?php

/**
 * @version   1.6 August 1, 2011
 * @author    RocketTheme http://www.rockettheme.com
 * @copyright Copyright (C) 2007 - 2011 RocketTheme, LLC
 * @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
 */
// no direct access
defined('_JEXEC') or die('Restricted access');
$params->def('menutype', 'mainmenu');
$params->def('class_sfx', '');
$params->def('menu_images', 0);
$params->def('startLevel', 0);
$params->def('endLevel', 0);
$params->def('showAllChildren', 0);
require_once dirname(__FILE__) . "/lib/includes.php";
$rnm = new RokNavMenu($params->toArray());
$rnm->initialize();
$output = $rnm->render();
$output = trim($output);
echo $output;
예제 #14
0
<?php

require_once dirname(__FILE__) . '/gantry-dropdown/theme.php';
RokNavMenu::registerTheme(dirname(__FILE__) . '/gantry-dropdown', 'gantry-dropdown', 'gantry-dropdown', 'GantryDropdownTheme');
예제 #15
0
<?php

require_once dirname(__FILE__) . '/gantry-fusion/theme.php';
RokNavMenu::registerTheme(dirname(__FILE__) . '/gantry-fusion', 'gantry-fusion', 'gantry-fusion', 'GantryFusionTheme');
require_once dirname(__FILE__) . '/gantry-splitmenu/theme.php';
RokNavMenu::registerTheme(dirname(__FILE__) . '/gantry-splitmenu', 'gantry-splitmenu', 'gantry-splitmenu', 'GantrySplitmenuTheme');
require_once dirname(__FILE__) . '/gantry-suckerfish/theme.php';
RokNavMenu::registerTheme(dirname(__FILE__) . '/gantry-suckerfish', 'gantry-suckerfish', 'gantry-suckerfish', 'GantrySuckerfishTheme');
예제 #16
0
 public static function setFrontSideTemplate()
 {
     $app = &JApplication::getInstance('site', array(), 'J');
     self::$current_template = $app->getTemplate();
 }
예제 #17
0
<?php

require_once dirname(__FILE__) . '/gantry-dropdown/theme.php';
RokNavMenu::registerTheme(dirname(__FILE__) . '/gantry-dropdown', 'gantry-dropdown', 'gantry-dropdown', 'GantryDropdownTheme');
require_once dirname(__FILE__) . '/gantry-splitmenu/theme.php';
RokNavMenu::registerTheme(dirname(__FILE__) . '/gantry-splitmenu', 'gantry-splitmenu', 'gantry-splitmenu', 'GantrySplitmenuTheme');