Esempio n. 1
0
 /**
  * function that loads the necessary javascript & css files for jqgrid
  */
 public static function add_head_elements()
 {
     if (self::$_head_elements_added) {
         return;
     }
     $version = midcom_baseclasses_components_configuration::get('org.openpsa.widgets', 'config')->get('jqgrid_version');
     $jqgrid_path = '/org.openpsa.widgets/jquery.jqGrid-' . $version . '/';
     $head = midcom::get('head');
     //first enable jquery - just in case it isn't loaded
     $head->enable_jquery();
     $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/ui/jquery.ui.core.min.js');
     //needed js/css-files for jqgrid
     $lang = "en";
     $language = midcom::get('i18n')->get_current_language();
     if (file_exists(MIDCOM_STATIC_ROOT . $jqgrid_path . 'js/i18n/grid.locale-' . $language . '.js')) {
         $lang = $language;
     }
     $head->add_jsfile(MIDCOM_STATIC_URL . $jqgrid_path . 'js/i18n/grid.locale-' . $lang . '.js');
     $head->add_jsfile(MIDCOM_STATIC_URL . $jqgrid_path . 'js/jquery.jqGrid.min.js');
     org_openpsa_widgets_ui::add_head_elements();
     $head->add_jsfile(MIDCOM_STATIC_URL . '/org.openpsa.widgets/jqGrid.custom.js');
     $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/ui/jquery.ui.widget.min.js');
     $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/ui/jquery.ui.mouse.min.js');
     $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/ui/jquery.ui.resizable.min.js');
     $head->add_stylesheet(MIDCOM_STATIC_URL . $jqgrid_path . 'css/ui.jqgrid.css');
     $head->add_stylesheet(MIDCOM_STATIC_URL . '/org.openpsa.widgets/jqGrid.custom.css');
     $head->add_jquery_ui_theme();
     self::$_head_elements_added = true;
 }