Esempio n. 1
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     // Check if this view is used for module editing page.
     $moduleEdit = JRequest::getCmd('moduleedit', '');
     $active_positions = array();
     $model = $this->getModel('changeposition');
     if (!$moduleEdit) {
         $moduleid = $app->getUserState('com_poweradmin.changeposition.moduleid');
     } else {
         $moduleid = array(JRequest::getCmd('moduleid', ''));
     }
     for ($i = 0; $i < count($moduleid); $i++) {
         $active_positions[] = "\$('#" . $model->getModulePosition($moduleid[$i]) . "-jsnposition').addClass('active-position').attr('title', 'Active position');";
     }
     JSNHtmlAsset::addScript(JURI::root(true) . '/media/jui/js/jquery.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.jquery.noconflict.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.functions.js');
     //$document->addScript(JSN_POWERADMIN_LIB_JSNJS_URI. 'jsn.filter.visualmode.js');
     //Enable position filter.
     $this->setFilterable(true);
     $customScript = "\n\t\t\tvar baseUrl  = '" . JURI::root() . "';\n\t\t\tvar moduleid = new Array();\n\t\t\tmoduleid = [" . @implode(",", $moduleid) . "];\n\t\t\t(function (\$){\n\t\t\t\t\$(document).ready(function (){\n\t\t\t\t\t" . implode(PHP_EOL, $active_positions) . "\n\t\t\t\t});\n\t\t\t})(JoomlaShine.jQuery);\n \t\t";
     $this->addCustomScripts($customScript);
     //Callback after position clicked.
     if (!$moduleEdit) {
         $onPostionClick = "\n \t\t\tif ( !\$(this).hasClass('active-position') ){\n\t\t\t\tJoomlaShine.jQuery.setPosition(moduleid, \$(this).attr('id').replace('-jsnposition', ''));\n \t\t\t\tparent.JoomlaShine.jQuery('.ui-dialog-content').dialog('close');\n \t\t\t}\n \t\t\t";
     } else {
         $onPostionClick = "\n \t\t\tif ( !\$(this).hasClass('active-position') ){\n \t\t\t\tvar posName = \$(this).attr('id').replace('-jsnposition', '');\n \t\t\t\tparent.JoomlaShine.jQuery('#jform_position').val(posName);\n \t\t\t\tparent.modal.close();\n \t\t\t}\n \t\t\t";
     }
     $this->addPositionClickCallBack($onPostionClick);
     parent::display($tpl);
 }
Esempio n. 2
0
 public function display($tpl = null)
 {
     $this->setFilterable(true);
     /**
      * When position clicked
      * object returned after this event fired is
      * clicked position
      * Use $(this)
      */
     $onPostionClick = "\n\t\t\tif ( !\$(this).hasClass('active-position') ){\n\t\t\t\twindow.parent.jQuery.jSelectPosition(\$(this).find('p').text());\t\t\t\t\n\t\t\t}\n\t\t";
     $this->addPositionClickCallBack($onPostionClick);
     parent::display($tpl);
 }
Esempio n. 3
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $positionName = JRequest::getVar('positionname', '');
     JSNHtmlAsset::addScript(JURI::root(true) . '/media/jui/js/jquery.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.jquery.noconflict.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.functions.js');
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.filter.visualmode.js');
     //Enable position filter.
     $this->setFilterable(true);
     $customScript = "\n\t\t\tvar baseUrl  = '" . JURI::root() . "';\n\t\t\t(function (\$){\n\t\t\t\t\$(document).ready(function (){\n\t\t\t\t\t\$('#" . $positionName . "-jsnposition').addClass('active-position').attr('title', 'Active position');\n\t\t\t\t});\n\t\t\t})(JoomlaShine.jQuery);\n \t\t";
     $this->addCustomScripts($customScript);
     parent::display($tpl);
 }
Esempio n. 4
0
 public function display($tpl = null)
 {
     if (!function_exists('curl_version')) {
         $contr = new JControllerLegacy();
         $contr->setRedirect('index.php?option=com_mobilize&task=position.selectPosition');
         $contr->redirect();
     }
     $this->setFilterable(false);
     $document = JFactory::getDocument();
     $document->addScript(JURI::root(true) . '/media/jui/js/jquery.js');
     if (isset($this->filterEnabled) and $this->filterEnabled) {
         JSNHtmlAsset::addScript(JSN_MOBILIZE_ASSETS_URL . '/js/jsn.jquery.noconflict.js');
     }
     /**
      * When position clicked
      * object returned after this event fired is
      * clicked position
      * Use $(this)
      */
     $onPostionClick = "\n\t\t\tif ( !\$(this).hasClass('active-position') ){\n\t\t\t\twindow.parent.jQuery.jSelectPosition(\$(this).find('p').text());\t\t\t\t\n\t\t\t}\n\t\t";
     $this->addPositionClickCallBack($onPostionClick);
     parent::display($tpl);
 }