Example #1
0
 /**
  * Create the View. 
  * This is an overloaded function of JController::getView 
  * and includes addition of the JDocument Object with required scripts and styles
  * @return object
  */
 public function getView($name = '', $type = '', $prefix = '', $config = array())
 {
     $language = JFactory::getLanguage();
     $language->load('com_jce', JPATH_ADMINISTRATOR);
     $document = JFactory::getDocument();
     if (!$name) {
         $name = JRequest::getWord('view', 'cpanel');
     }
     if (!$type) {
         $type = $document->getType();
     }
     if (empty($config)) {
         $config = array('base_path' => dirname(__FILE__));
     }
     $model = $this->getModel($name);
     $view = parent::getView($name, $type, $prefix, $config);
     $document = JFactory::getDocument();
     $bootstrap = class_exists('JHtmlBootstrap');
     $jquery = class_exists('JHtmlJquery');
     $view->addStyleSheet(JURI::root(true) . '/administrator/components/com_jce/media/css/global.css?version=' . $model->getVersion());
     // using JUI...
     if (!$bootstrap || !$jquery) {
         // set device-width meta
         $document->setMetaData('meta', 'width=device-width, initial-scale=1.0');
         $view->addStyleSheet(JURI::root(true) . '/administrator/components/com_jce/media/css/styles-ui.css?version=' . $model->getVersion());
         // JQuery UI
         $view->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/jquery/js/jquery-' . WF_JQUERY . '.min.js?version=' . $model->getVersion());
         // jQuery noConflict
         $view->addScriptDeclaration('jQuery.noConflict();');
     }
     // JQuery UI
     $view->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/jquery/js/jquery-ui-' . WF_JQUERYUI . '.custom.min.js?version=' . $model->getVersion());
     // JQuery Touch Punch
     $view->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/jquery/js/jquery.ui.touch-punch.min.js?version=' . $model->getVersion());
     $scripts = array();
     switch ($name) {
         case 'help':
             $view->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/js/help.js?version=' . $model->getVersion());
             break;
         default:
             // load Joomla! core javascript
             if (method_exists('JHtml', 'core')) {
                 JHtml::core();
             }
             require_once JPATH_ADMINISTRATOR . '/includes/toolbar.php';
             JToolBarHelper::title(WFText::_('WF_ADMINISTRATION') . ' ›› ' . WFText::_('WF_' . strtoupper($name)), 'logo.png');
             $params = WFParameterHelper::getComponentParams();
             $theme = $params->get('preferences.theme', 'jce');
             $view->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/js/tips.js');
             $view->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/js/html5.js');
             $view->addScript(JURI::root(true) . '/administrator/components/com_jce/media/js/jce.js');
             $options = array('labels' => array('ok' => WFText::_('WF_LABEL_OK'), 'cancel' => WFText::_('WF_LABEL_CANCEL'), 'select' => WFText::_('WF_LABEL_SELECT'), 'save' => WFText::_('WF_LABEL_SAVE'), 'saveclose' => WFText::_('WF_LABEL_SAVECLOSE'), 'alert' => WFText::_('WF_LABEL_ALERT'), 'required' => WFText::_('WF_MESSAGE_REQUIRED')), 'bootstrap' => $bootstrap);
             $view->addScriptDeclaration('jQuery(document).ready(function($){$.jce.init(' . json_encode($options) . ');});');
             //$document->addCustomTag('<script type="text/javascript">jQuery(document).ready(function($){$.jce.init(' . json_encode($options) . ');});</script>');
             $view->addHelperPath(dirname(__FILE__) . '/helpers');
             $this->addModelPath(dirname(__FILE__) . '/models');
             $view->loadHelper('toolbar');
             $view->loadHelper('tools');
             $view->loadHelper('xml');
             $view->loadHelper($name);
             $this->loadMenu();
             break;
     }
     if ($model = $this->getModel($name)) {
         $view->setModel($model, true);
     }
     $view->assignRef('document', $document);
     return $view;
 }
Example #2
0
 /**
  * Constructor
  *
  * @params	array	Controller configuration array
  */
 function __construct($config = array())
 {
     parent::__construct($config);
 }
Example #3
0
 /**
  * Create the View. 
  * This is an overloaded function of JController::getView 
  * and includes addition of the JDocument Object with required scripts and styles
  * @return object
  */
 public function getView($name = '', $type = '', $prefix = '', $config = array())
 {
     $language = JFactory::getLanguage();
     $language->load('com_jce', JPATH_ADMINISTRATOR);
     $document = JFactory::getDocument();
     if (!$name) {
         $name = JRequest::getWord('view', 'cpanel');
     }
     if (!$type) {
         $type = $document->getType();
     }
     if (empty($config)) {
         $config = array('base_path' => dirname(__FILE__));
     }
     $model = $this->getModel($name);
     $view = parent::getView($name, $type, $prefix, $config);
     $document = JFactory::getDocument();
     // set device-width meta
     $document->setMetaData('meta', 'width=device-width, initial-scale=1.0');
     $version = new JVersion();
     if ($version->isCompatible('3.0')) {
         // Include jQuery
         JHtml::_('jquery.framework');
     } else {
         // JQuery
         $view->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/jquery/js/jquery.min.js');
         // jQuery noConflict
         $view->addScriptDeclaration('jQuery.noConflict();');
     }
     // JQuery UI
     $view->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/jquery/js/jquery-ui.min.js');
     $scripts = array();
     switch ($name) {
         case 'help':
             $view->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/js/help.js');
             break;
         default:
             $view->addStyleSheet(JURI::root(true) . '/administrator/components/com_jce/media/css/global.css');
             // load Joomla! core javascript
             if (method_exists('JHtml', 'core')) {
                 JHtml::core();
             }
             require_once JPATH_ADMINISTRATOR . '/includes/toolbar.php';
             JToolBarHelper::title(WFText::_('WF_ADMINISTRATION') . ' :: ' . WFText::_('WF_' . strtoupper($name)), 'logo.png');
             $params = WFParameterHelper::getComponentParams();
             $theme = $params->get('preferences.theme', 'jce');
             $view->addScript(JURI::root(true) . '/administrator/components/com_jce/media/js/core.js');
             $options = array('labels' => array('ok' => WFText::_('WF_LABEL_OK'), 'cancel' => WFText::_('WF_LABEL_CANCEL'), 'select' => WFText::_('WF_LABEL_SELECT'), 'save' => WFText::_('WF_LABEL_SAVE'), 'saveclose' => WFText::_('WF_LABEL_SAVECLOSE'), 'alert' => WFText::_('WF_LABEL_ALERT'), 'required' => WFText::_('WF_MESSAGE_REQUIRED')));
             $view->addScriptDeclaration('jQuery.jce.options = ' . json_encode($options) . ';');
             $view->addHelperPath(dirname(__FILE__) . '/helpers');
             $this->addModelPath(dirname(__FILE__) . '/models');
             $view->loadHelper('toolbar');
             $view->loadHelper('xml');
             $view->loadHelper($name);
             $this->loadMenu();
             break;
     }
     if ($model = $this->getModel($name)) {
         $view->setModel($model, true);
     }
     $view->assignRef('document', $document);
     return $view;
 }