diff --git a/config/routing.yml b/config/routing.yml new file mode 100644 index 0000000000..9f76e4dac9 --- /dev/null +++ b/config/routing.yml @@ -0,0 +1,13 @@ +admin_login_check: + pattern: /admin/login_check +admin_logout: + pattern: /admin/logout + +homepage: + path: /homepage + defaults: { _controller: index.controller:indexAction, culture: en } + +example: + resource: "src/ChamiloLMS/Resources/config/route_example.yml" + prefix: /example-route + diff --git a/main/css/base.css b/main/css/base.css index 228a672570..5d01e56844 100644 --- a/main/css/base.css +++ b/main/css/base.css @@ -5390,15 +5390,21 @@ i.size-32.icon-new-work { list-style-type: none; } .trajectory .control-group { - margin-left: 25px; + /* margin-left: 25px; */ } .trajectory .control-group label { } +.trajectory .btn-group { + margin-top: -50px; + margin-right: -10px; + float: right; +} #saveQuestionBar { width:150px; bottom:140px; position:fixed; } + diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index 0ecebc7377..ff9695b30b 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -127,6 +127,7 @@ define('TOOL_GRADEBOOK', 'gradebook'); define('TOOL_NOTEBOOK', 'notebook'); define('TOOL_ATTENDANCE', 'attendance'); define('TOOL_COURSE_PROGRESS', 'course_progress'); +define('TOOL_CURRICULUM', 'curriculum'); // CONSTANTS defining Chamilo interface sections define('SECTION_CAMPUS', 'mycampus'); diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index 61c11b98c6..df27474e46 100644 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -4279,6 +4279,7 @@ class CourseManager Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_NOTEBOOK."','notebook/index.php','notebook.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'notebook'))."','0','squaregrey.gif','NO','_self','interaction','0')"); Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_ATTENDANCE."','attendance/index.php','attendance.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'attendances'))."','0','squaregrey.gif','NO','_self','authoring','0')"); Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_COURSE_PROGRESS."','course_progress/index.php','course_progress.gif','".Text::string2binary(api_get_setting('course_create_active_tools', 'course_progress'))."','0','squaregrey.gif','NO','_self','authoring','0')"); + Database::query("INSERT INTO $tbl_course_homepage VALUES ($course_id, NULL, '" . TOOL_CURRICULUM."','curriculum','cv.png','".Text::string2binary(api_get_setting('course_create_active_tools', 'curriculum'))."','0','squaregrey.gif','NO','_self','authoring','0')"); if (api_get_setting('service_visio', 'active') == 'true') { $mycheck = api_get_setting('service_visio', 'visio_host'); diff --git a/main/inc/lib/course_home.lib.php b/main/inc/lib/course_home.lib.php index 149ce97b9d..fd92643a70 100644 --- a/main/inc/lib/course_home.lib.php +++ b/main/inc/lib/course_home.lib.php @@ -1,7 +1,8 @@ '; $theme = api_get_setting('homepage_view'); if ($theme == 'vertical_activity') { //ordering by get_lang name $order_tool_list = array(); if (is_array($all_tools_list) && count($all_tools_list)>0) { - foreach($all_tools_list as $key=>$new_tool) { + foreach ($all_tools_list as $key => $new_tool) { $tool_name = self::translate_tool_name($new_tool); $order_tool_list [$key]= $tool_name; } natsort($order_tool_list); $my_temp_tool_array = array(); - foreach($order_tool_list as $key=>$new_tool) { + foreach ($order_tool_list as $key => $new_tool) { $my_temp_tool_array[] = $all_tools_list[$key]; } $all_tools_list = $my_temp_tool_array; @@ -596,6 +600,7 @@ class CourseHome { $all_tools_list = array(); } } + $courseInfo = api_get_course_info(); $web_code_path = api_get_path(WEB_CODE_PATH); $is_allowed_to_edit = api_is_allowed_to_edit(null, true); $is_platform_admin = api_is_platform_admin(); @@ -613,6 +618,14 @@ class CourseHome { $tool['original_link'] = $tool['link']; + // Re-writing URL for new tools + $newTools = array(TOOL_CURRICULUM); + + $toolName = isset($tool['name']) ? $tool['name'] : null; + if (in_array($toolName, $newTools)) { + $tool['link'] = $courseInfo['course_web_public_url'].$tool['name'].'/'; + } + if ($tool['image'] == 'scormbuilder.gif') { // display links to lp only for current session /*if ($session_id != $tool['session_id']) { @@ -620,7 +633,7 @@ class CourseHome { }*/ // check if the published learnpath is visible for student $published_lp_id = self::get_published_lp_id_from_link($tool['link']); - if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($published_lp_id,api_get_user_id())) { + if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($published_lp_id, api_get_user_id())) { continue; } } @@ -678,9 +691,9 @@ class CourseHome { $tool['link'] = $web_code_path.$tool['link']; } if ($tool['visibility'] == '0' && $tool['admin'] != '1') { - $class = 'invisible'; - $info = pathinfo($tool['image']); - $basename = basename($tool['image'], '.'.$info['extension']); // $file is set to "index" + $class = 'invisible'; + $info = pathinfo($tool['image']); + $basename = basename($tool['image'], '.'.$info['extension']); // $file is set to "index" $tool['image'] = $basename.'_na.'.$info['extension']; } else { $class = ''; @@ -698,7 +711,7 @@ class CourseHome { //$tool['link'] = htmlspecialchars($tool['link']) ; //@todo this visio stuff should be removed - if (strpos($tool['name'],'visio_') !== false) { + if (strpos($tool['name'], 'visio_') !== false) { $tool_link_params = array( 'id' => 'tooldesc_'.$tool["id"], 'href' => '"javascript: void(0);"', @@ -720,6 +733,8 @@ class CourseHome { 'class' => $class, 'target' => '_blank'); } else { + + $tool_link_params = array( 'id' => 'tooldesc_'.$tool["id"], 'href' => $tool['link'], @@ -800,7 +815,7 @@ class CourseHome { $image = $original_image; } - $data .= Display::url($image , $item['url_params']['href'], $item['url_params']); + $data .= Display::url($image, $item['url_params']['href'], $item['url_params']); $html .= Display::div($data, array('class'=>'big_icon')); //box-image reflection $html .= Display::div('

'.$item['visibility'].$item['extra'].$item['link'].'

', array('class'=>'content')); $html .= ''; @@ -813,7 +828,6 @@ class CourseHome { break; case 'activity': - if ($counter == 0) { $html .= $rowDiv; } @@ -860,7 +874,8 @@ class CourseHome { * @param id session id * @return string session data */ - public static function show_session_data($id_session) { + public static function show_session_data($id_session) + { if ($id_session != strval(intval($id_session))) { return ''; @@ -884,7 +899,7 @@ class CourseHome { $output = ''; if (!empty($session_category)) { - $output .= ''. get_lang('SessionCategory') . ': ' . '' . $session_category_name .''; + $output .= ''. get_lang('SessionCategory').': '.''.$session_category_name.''; } $output .= ' '. get_lang('SessionName') . ': ' . '' . $session_info['name'] .' @@ -900,7 +915,8 @@ class CourseHome { * @param array $tool The input record. * @return string Returns the name of the corresponding tool. */ - public static function translate_tool_name(& $tool) { + public static function translate_tool_name(& $tool) + { static $already_translated_icons = array( 'file_html.gif', 'file_html_na.gif', diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php index 13e60dca63..bc7dc0997a 100644 --- a/main/inc/lib/social.lib.php +++ b/main/inc/lib/social.lib.php @@ -928,13 +928,13 @@ class SocialManager extends UserManager { } if (!empty($courseCode)) { - //return api_get_path(WEB_PUBLIC_PATH).'users/online-in-course/'.$courseCode; return api_get_path(WEB_PATH).'whoisonline.php?cidReq='.$courseCode; + //return api_get_path(WEB_PUBLIC_PATH).'users/online/course/'.$courseCode; } if (!empty($sessionId)) { - //return api_get_path(WEB_PUBLIC_PATH).'users/online-in-session/'.$courseCode; return api_get_path(WEB_PATH).'whoisonlinesession.php?session_id='.$sessionId; + //return api_get_path(WEB_PUBLIC_PATH).'users/online/session/'.$sessionId; } } } diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index d5a007fa41..0ef280d652 100644 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -635,10 +635,6 @@ class Template // Preparing values for the menu - // Logout link. - // See the SecurityServiceProvider definition - $this->assign('logout_link', $this->app['url_generator']->generate('admin_logout')); - // Profile link. $this->assign('is_profile_editable', api_is_profile_readable()); diff --git a/main/template/default/crud_macros/course_crud.tpl b/main/template/default/crud_macros/course_crud.tpl new file mode 100644 index 0000000000..f1957ef2ce --- /dev/null +++ b/main/template/default/crud_macros/course_crud.tpl @@ -0,0 +1,51 @@ +{% macro list(items, links, courseCode) %} + + {{ 'Add' |trans }} + + + {% for item in items %} + + + + + {% endfor %} +
+ + {{ item.name }} + + + {{ 'Edit' |trans }} + {{ 'Delete' |trans }} +
+{% endmacro %} + +{% macro add(form, links, courseCode) %} + + {{ 'List' |trans }} + +
+
+ {{ form_widget(form) }} +
+{% endmacro %} + +{% macro edit(form, links, courseCode) %} + + {{ 'List' |trans }} + +
+ {{ form_widget(form) }} +
+{% endmacro %} + +{% macro read(item, links, courseCode) %} + + {{ 'List' |trans }} + + + {{ 'Edit' |trans }} + +

{{ item.id }}

+

{{ item.name }}

+{% endmacro %} + diff --git a/main/template/default/default_actions/settings.tpl b/main/template/default/crud_macros/simple_crud.tpl similarity index 100% rename from main/template/default/default_actions/settings.tpl rename to main/template/default/crud_macros/simple_crud.tpl diff --git a/main/template/default/tool/curriculum/category/add.tpl b/main/template/default/tool/curriculum/category/add.tpl index eb3dc396db..2731f9cce2 100644 --- a/main/template/default/tool/curriculum/category/add.tpl +++ b/main/template/default/tool/curriculum/category/add.tpl @@ -1,5 +1,5 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - {% import app.template_style ~ "/default_actions/settings.tpl" as actions %} - {{ actions.add(form, links) }} + {% import app.template_style ~ "/crud_macros/course_crud.tpl" as actions %} + {{ actions.add(form, links, app.request.get('courseCode')) }} {% endblock %} diff --git a/main/template/default/tool/curriculum/category/add_from_parent.tpl b/main/template/default/tool/curriculum/category/add_from_parent.tpl index 1d0de69757..09e66e8427 100644 --- a/main/template/default/tool/curriculum/category/add_from_parent.tpl +++ b/main/template/default/tool/curriculum/category/add_from_parent.tpl @@ -1,10 +1,10 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - + List
-
+ {{ form_widget(form) }}
{% endblock %} diff --git a/main/template/default/tool/curriculum/category/edit.tpl b/main/template/default/tool/curriculum/category/edit.tpl index 25ebcf70b6..66ed4c6eb0 100644 --- a/main/template/default/tool/curriculum/category/edit.tpl +++ b/main/template/default/tool/curriculum/category/edit.tpl @@ -1,5 +1,5 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - {% import app.template_style ~ "/default_actions/settings.tpl" as actions %} - {{ actions.edit(form, links) }} + {% import app.template_style ~ "/crud_macros/course_crud.tpl" as actions %} + {{ actions.edit(form, links, app.request.get('courseCode')) }} {% endblock %} diff --git a/main/template/default/tool/curriculum/category/list.tpl b/main/template/default/tool/curriculum/category/list.tpl index 0b10789bb4..290601a7c1 100644 --- a/main/template/default/tool/curriculum/category/list.tpl +++ b/main/template/default/tool/curriculum/category/list.tpl @@ -1,6 +1,6 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - + Add {{ tree }} diff --git a/main/template/default/tool/curriculum/category/read.tpl b/main/template/default/tool/curriculum/category/read.tpl index 2fd11abe30..ff196288ac 100644 --- a/main/template/default/tool/curriculum/category/read.tpl +++ b/main/template/default/tool/curriculum/category/read.tpl @@ -1,11 +1,13 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - {{ item.id }} {{ item.name }} + {{ item.id }} {{ item.name }}
diff --git a/main/template/default/tool/curriculum/item/add.tpl b/main/template/default/tool/curriculum/item/add.tpl index eb3dc396db..2731f9cce2 100644 --- a/main/template/default/tool/curriculum/item/add.tpl +++ b/main/template/default/tool/curriculum/item/add.tpl @@ -1,5 +1,5 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - {% import app.template_style ~ "/default_actions/settings.tpl" as actions %} - {{ actions.add(form, links) }} + {% import app.template_style ~ "/crud_macros/course_crud.tpl" as actions %} + {{ actions.add(form, links, app.request.get('courseCode')) }} {% endblock %} diff --git a/main/template/default/tool/curriculum/item/add_from_category.tpl b/main/template/default/tool/curriculum/item/add_from_category.tpl index 7c7a238907..6dca17bb86 100644 --- a/main/template/default/tool/curriculum/item/add_from_category.tpl +++ b/main/template/default/tool/curriculum/item/add_from_category.tpl @@ -1,10 +1,10 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - + List
-
+ {{ form_widget(form) }}
{% endblock %} diff --git a/main/template/default/tool/curriculum/item/edit.tpl b/main/template/default/tool/curriculum/item/edit.tpl index 25ebcf70b6..66ed4c6eb0 100644 --- a/main/template/default/tool/curriculum/item/edit.tpl +++ b/main/template/default/tool/curriculum/item/edit.tpl @@ -1,5 +1,5 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - {% import app.template_style ~ "/default_actions/settings.tpl" as actions %} - {{ actions.edit(form, links) }} + {% import app.template_style ~ "/crud_macros/course_crud.tpl" as actions %} + {{ actions.edit(form, links, app.request.get('courseCode')) }} {% endblock %} diff --git a/main/template/default/tool/curriculum/item/list.tpl b/main/template/default/tool/curriculum/item/list.tpl index 031150ddad..d3b003f4e9 100644 --- a/main/template/default/tool/curriculum/item/list.tpl +++ b/main/template/default/tool/curriculum/item/list.tpl @@ -1,19 +1,19 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - + {{ 'Add' |trans }} {% for item in items %} {% endfor %} diff --git a/main/template/default/tool/curriculum/item/read.tpl b/main/template/default/tool/curriculum/item/read.tpl index 2fd11abe30..ff196288ac 100644 --- a/main/template/default/tool/curriculum/item/read.tpl +++ b/main/template/default/tool/curriculum/item/read.tpl @@ -1,11 +1,13 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - {{ item.id }} {{ item.name }} + {{ item.id }} {{ item.name }}
diff --git a/main/template/default/tool/curriculum/user/add.tpl b/main/template/default/tool/curriculum/user/add.tpl index eb3dc396db..2731f9cce2 100644 --- a/main/template/default/tool/curriculum/user/add.tpl +++ b/main/template/default/tool/curriculum/user/add.tpl @@ -1,5 +1,5 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - {% import app.template_style ~ "/default_actions/settings.tpl" as actions %} - {{ actions.add(form, links) }} + {% import app.template_style ~ "/crud_macros/course_crud.tpl" as actions %} + {{ actions.add(form, links, app.request.get('courseCode')) }} {% endblock %} diff --git a/main/template/default/tool/curriculum/user/add_from_category.tpl b/main/template/default/tool/curriculum/user/add_from_category.tpl index 7c7a238907..b809e0a48d 100644 --- a/main/template/default/tool/curriculum/user/add_from_category.tpl +++ b/main/template/default/tool/curriculum/user/add_from_category.tpl @@ -1,10 +1,10 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - + List
- + {{ form_widget(form) }} {% endblock %} diff --git a/main/template/default/tool/curriculum/user/edit.tpl b/main/template/default/tool/curriculum/user/edit.tpl index 25ebcf70b6..6f54182294 100644 --- a/main/template/default/tool/curriculum/user/edit.tpl +++ b/main/template/default/tool/curriculum/user/edit.tpl @@ -1,5 +1,5 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - {% import app.template_style ~ "/default_actions/settings.tpl" as actions %} - {{ actions.edit(form, links) }} + {% import app.template_style ~ "/crud_macros/course_crud.tpl" as actions %} + {{ actions.edit(form, links, {'courseCode' : app.request.get('courseCode'))} }} {% endblock %} diff --git a/main/template/default/tool/curriculum/user/list.tpl b/main/template/default/tool/curriculum/user/list.tpl index 03a7532b46..d6c3c91b0e 100644 --- a/main/template/default/tool/curriculum/user/list.tpl +++ b/main/template/default/tool/curriculum/user/list.tpl @@ -83,7 +83,7 @@ function addTagFormDeleteLink($tagFormLi) { function save(itemId) { var form = $("#"+itemId).parent(); var serializedForm = form.serialize(); - $.post('{{ url('curriculum_user.controller:saveUserItemAction') }}', serializedForm); + $.post('{{ url('curriculum_user.controller:saveUserItemAction', {'courseCode' : app.request.get('courseCode')) }}', serializedForm); return false; } @@ -113,9 +113,10 @@ function saveAll() { {% for item in subcategory.items %}
{{ item.title }} (item) - Max {{ item.maxRepeat }}
- +
{{ form_start(form_list[item.id]) }} -
+ +
{% for widget in form_list[item.id].userItems.children %} {{ _self.widget_prototype(widget, 'Remove item') }} {% endfor %} @@ -124,16 +125,19 @@ function saveAll() {
-
- {# form_widget(form_list[item.id].submit) #} - - {% if item.maxRepeat > 1 %} - - {% endif %} +
+
+ {# form_widget(form_list[item.id].submit) #} + + {% if item.maxRepeat > 1 %} + + {% endif %} +
- {{ form_end(form_list[item.id]) }} +
{% endfor %} + {% endfor %}
diff --git a/main/template/default/tool/curriculum/user/read.tpl b/main/template/default/tool/curriculum/user/read.tpl index 2fd11abe30..ff196288ac 100644 --- a/main/template/default/tool/curriculum/user/read.tpl +++ b/main/template/default/tool/curriculum/user/read.tpl @@ -1,11 +1,13 @@ {% extends app.template_style ~ "/layout/layout_1_col.tpl" %} {% block content %} - {{ item.id }} {{ item.name }} + {{ item.id }} {{ item.name }}
- + {{ item.title }} - {{ 'Edit' |trans }} - {{ 'Delete' |trans }} + {{ 'Edit' |trans }} + {{ 'Delete' |trans }}