diff --git a/main/exercice/exercice_submit.php b/main/exercice/exercice_submit.php index 8ddb46ff8b..d1dc6eead8 100755 --- a/main/exercice/exercice_submit.php +++ b/main/exercice/exercice_submit.php @@ -59,10 +59,6 @@ if (api_get_setting('show_glossary_in_extra_tools') == 'true') { $htmlHeadXtra[] = ''; } -$htmlHeadXtra[] = ''; -$htmlHeadXtra[] = ''; //jQuery -$htmlHeadXtra[] = ''; //jQuery - //@todo we should only enable this when there is a time control //This library is necessary for the time control feature diff --git a/main/inc/lib/main_api.lib.php b/main/inc/lib/main_api.lib.php index c2f8ed45fe..7fc80d66ee 100755 --- a/main/inc/lib/main_api.lib.php +++ b/main/inc/lib/main_api.lib.php @@ -4752,30 +4752,56 @@ function api_check_browscap(){ } } +/** + * Returns the js header to include the jquery library + */ +function api_get_jquery_js() { + return ''; +} + + /** * Returns the jquery-ui library js headers * @param bool add the jqgrid library + * @return string html tags + * + */ +function api_get_jquery_ui_js($include_jqgrid = false) { + $libraries[]='jquery-ui'; + if ($include_jqgrid) { + $libraries[]='jqgrid'; + } + return api_get_jquery_libraries_js($libraries, true); +} + +/** + * Returns the jquery library js headers + * @param array list of jquery libraries supported jquery-ui, jqgrid * @param bool add the jquery library * @return string html tags * */ -function api_get_jquery_ui_js($include_jqgrid = false, $include_jquery = true) { - $js = ''; - $theme = 'smoothness'; // Current themes: cupertino, smoothness, ui-lightness. Find the themes folder in main/inc/lib/javascript/jquery-ui - $languaje = 'en'; - $platform_isocode = strtolower(api_get_language_isocode()); - +function api_get_jquery_libraries_js($libraries, $include_jquery = true) { + $js = ''; + $js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/'; if ($include_jquery) { //Jquery - $js .= ''; //jQuery + $js .= api_get_jquery_js(); + } + + if (in_array('jquery-ui',$libraries)) { + //Jquery ui + $theme = 'smoothness'; // Current themes: cupertino, smoothness, ui-lightness. Find the themes folder in main/inc/lib/javascript/jquery-ui + $js .= ''; + $js .= ''; } - //Jquery ui - $js .= ''; - $js .= ''; //Grid js - if ($include_jqgrid) { + if (in_array('jqgrid',$libraries)) { + $languaje = 'en'; + $platform_isocode = strtolower(api_get_language_isocode()); + //languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n $jqgrid_langs = array('bg', 'bg1251', 'cat','cn','cs','da','de','el','en','es','fa','fi','fr','gl','he','hu','is','it','ja','nl','no','pl','pt-br','pt','ro','ru','sk','sr','sv','tr','ua'); @@ -4783,13 +4809,16 @@ function api_get_jquery_ui_js($include_jqgrid = false, $include_jquery = true) { $languaje = $platform_isocode; } - $js .= ''; - $js .= ''; - $js .= ''; + $js .= ''; + $js .= ''; + $js .= ''; } - //Adding default CSS changes for Chamilo in order to preserve the neutral layout - $js .= ''; + + if (in_array('jquery-ui',$libraries)) { + //Adding default CSS changes of the jquery-ui themes for Chamilo in order to preserve the original jquery-ui css + $js .= ''; + } return $js; } \ No newline at end of file diff --git a/main/session/index.php b/main/session/index.php index 05b6c16035..991f097fd6 100644 --- a/main/session/index.php +++ b/main/session/index.php @@ -19,27 +19,15 @@ require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php'; api_block_anonymous_users(); // Only users who are logged in can proceed. - $this_section = SECTION_COURSES; -//Tab js -$htmlHeadXtra[] = ''; -$htmlHeadXtra[] = ''; //jQuery -$htmlHeadXtra[] = ''; -//Grid js -$htmlHeadXtra[] = ''; -$htmlHeadXtra[] = ''; -$htmlHeadXtra[] = ''; - +$htmlHeadXtra[] = api_get_jquery_ui_js(true); Display :: display_header($nameTools); - - $session_id = intval($_GET['session_id']); $session_info = SessionManager::fetch($session_id); $session_list = SessionManager::get_sessions_by_coach(api_get_user_id()); - $course_list = SessionManager::get_course_list_by_session_id($session_id); $course_select = array(); @@ -47,10 +35,7 @@ $session_select = array(); foreach ($session_list as $item) { $session_select[$item['id']] = $item['name']; } -/* -foreach ($course_list as $course_item) { - $course_select[$course_item['id']] = $course_item['title']; -}*/ + // Session list form if (count($session_select) > 1) { @@ -59,34 +44,28 @@ if (count($session_select) > 1) { $defaults['session_id'] = $session_id; $form->setDefaults($defaults); $form->display(); - - - if ($form->validate()) { - - } + //if ($form->validate()) {} } echo Display::tag('h1', $session_info['name']); - //Listing LPs from all courses +/* $lps = array(); - -foreach ($course_list as $item) { - $list = new LearnpathList(api_get_user_id(),$item['code']); - $flat_list = $list->get_flat_list(); - $lps[$item['code']] = $flat_list; - foreach ($flat_list as $item) { - //var_dump(get_week_from_day($item['publicated_on'])); - } -} - +if (!empty($course_list)) { + foreach ($course_list as $item) { + $list = new LearnpathList(api_get_user_id(),$item['code']); + $flat_list = $list->get_flat_list(); + $lps[$item['code']] = $flat_list; + foreach ($flat_list as $item) { + //var_dump(get_week_from_day($item['publicated_on'])); + } + } +}*/ //Getting all sessions where I'm subscribed $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id()); -//echo '
';
-
 $my_session_list = array();
 $final_array = array();
 
@@ -209,17 +188,14 @@ $column_model   = array(array('name'=>'date',   'index'=>'date',  'width'=>'80',
                         
 $extra_params['autowidth'] = 'true'; //use the width of the parent
 //$extra_params['forceFit'] = 'true'; //use the width of the parent
-
-
 //$extra_params['altRows'] = 'true'; //zebra style
-
                         
 //Per course grid settings
 $url_course             = api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=session_courses_lp_by_course&session_id='.$session_id;
 $extra_params_course['grouping'] = 'true';
-$extra_params_course['groupingView'] = array('groupField'=>array('course'),
-                                            'groupColumnShow'=>array('false'),
-                                            'groupText' => array('Course {0} - {1} Item(s)'));
+$extra_params_course['groupingView'] = array('groupField'       => array('course'),
+                                             'groupColumnShow'  => array('false'),
+                                             'groupText'        => array('Course {0} - {1} Item(s)'));
 $extra_params_course['autowidth'] = 'true'; //use the width of the parent                                          
                               
 //Per Week grid
@@ -266,10 +242,10 @@ $(function() {
     $( "#sub_tab" ).tabs();     
          
 
 
 });