示例#1
0
 public function display($tpl = null)
 {
     $JSNMedia = JSNFactory::getMedia();
     JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.filter.js');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $language = JFactory::getLanguage();
     $language->load('com_menus');
     $model = $this->getModel();
     $this->assign('model', $model);
     $menutype = '';
     $menutypeid = JRequest::getVar("menutypeid", '');
     if ($menutypeid) {
         JSNFactory::localimport('models.menuitem');
         $paMenuModel = new PoweradminModelMenuitem();
         $menutype = $paMenuModel->getMenuType($menutypeid);
     }
     $parentid = JRequest::getVar("parentid", '');
     $customScript = "\n\t\t\tvar selectMenuType;\n            (function(\$){\n\t\t\t\t\$(window).ready(function(){\n\t\t\t\t  \t  selectMenuType =  \$.jsnFilter(\n\t\t\t\t  \t  {\n\t\t\t  \t  \t\t  frameElement: \$('.jsn-menu-type'),\n\t\t\t  \t  \t\t  category    : true,\n\t\t\t\t\t  \t  itemClass   : '.jsn-item-type',\n\t\t\t\t\t  \t  totalColumn : 3,\n\t\t\t\t\t  \t  itemWidth   : 220,\n\t\t\t\t\t  \t  itemHeight  : 30,\n\t\t\t\t\t  \t  mPosLeft    : 0,\n\t\t\t\t\t  \t  mPosTop     : 15,\n\t\t\t\t\t  \t  marginOffset: {\n\t\t\t\t\t  \t  \t  right : 15,\n\t\t\t\t\t  \t  \t  bottom: 20\n\t\t\t\t\t  \t  },\n\t\t\t\t\t  \t  eventClick: function(){\n\t\t\t\t\t  \t  \t var params = \$(this).attr('params');\n\t\t\t\t\t  \t  \t window.parent.JoomlaShine.jQuery.addNewMenuItem(params, '" . $menutype . "', '" . $menutypeid . "', '" . $parentid . "');\n\t\t\t\t\t  \t  }\n\t\t\t\t  \t  \t}\n\t\t\t\t  \t  );\n\t\t\t\t  });\n\t\t\t  })(JoomlaShine.jQuery);\n\t\t";
     $JSNMedia->addScriptDeclaration($customScript);
     return parent::display();
 }