diff --git a/main/course_home/activity.php b/main/course_home/activity.php
index bb35e2dc75..2e4f7d21ec 100755
--- a/main/course_home/activity.php
+++ b/main/course_home/activity.php
@@ -113,35 +113,28 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
}
?>
-$new_tool) {
- $tool_name = CourseHome::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) {
- $my_temp_tool_array[] = $my_list[$key];
- }
- $my_list = $my_temp_tool_array;
-
- $i = 0;
- foreach($my_list as $new_tool) {
- if ($i >= 10) {
- $my_list2[] = $new_tool;
- } else {
- $my_list1[] = $new_tool;
- }
- $i++;
+ echo '
';
+ //ordering by get_lang name
+ $order_tool_list = array();
+ foreach($my_list as $key=>$new_tool) {
+ $tool_name = CourseHome::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) {
+ $my_temp_tool_array[] = $my_list[$key];
+ }
+ $my_list = $my_temp_tool_array;
+
+ $i = 0;
+ foreach($my_list as $new_tool) {
+ if ($i >= 10) {
+ $my_list2[] = $new_tool;
+ } else {
+ $my_list1[] = $new_tool;
}
- CourseHome::show_tools_category($my_list1, 'vertical_activity');
- CourseHome::show_tools_category($my_list2, 'vertical_activity');
-
-
-?>
-
-';
}
}
?>
diff --git a/main/inc/lib/course_home.lib.php b/main/inc/lib/course_home.lib.php
index 1b506f9672..983b2ff244 100755
--- a/main/inc/lib/course_home.lib.php
+++ b/main/inc/lib/course_home.lib.php
@@ -614,10 +614,11 @@ class CourseHome {
$is_platform_admin = api_is_platform_admin();
$i = 0;
+ $items = array();
if (isset($all_tools_list)) {
- $lnk = '';
- if ($theme == 'vertical_activity') echo '
';
+ $lnk = '';
foreach ($all_tools_list as & $tool) {
+ $item = array();
if ($tool['image'] == 'scormbuilder.gif') {
// display links to lp only for current session
@@ -633,23 +634,12 @@ class CourseHome {
if (api_get_session_id() != 0 && in_array($tool['name'], array('course_maintenance', 'course_setting'))) {
continue;
- }
- if ($theme == 'activity') {
- if (!($i % 2)) {
- echo '';
- }
- } elseif ($theme == 'vertical_activity') {
- echo '- ';
- }
+ }
// This part displays the links to hide or remove a tool.
// These links are only visible by the course manager.
unset($lnk);
- if ($theme == 'activity') {
- echo '
';
- }
-
if ($is_allowed_to_edit && !api_is_coach()) {
if ($tool['visibility'] == '1' && $tool['admin'] != '1') {
@@ -663,7 +653,7 @@ class CourseHome {
$lnk[] = $link;
}
if (!empty($tool['adminlink'])) {
- echo ''.Display::return_icon('edit.gif', get_lang('Edit')).'';
+ $item['extra'] = ''.Display::return_icon('edit.gif', get_lang('Edit')).'';
}
}
@@ -677,11 +667,11 @@ class CourseHome {
if (isset($lnk) && is_array($lnk)) {
foreach ($lnk as $this_link) {
if (empty($tool['adminlink'])) {
- echo ''.$this_link['name'].'';
+ $item['visibility'] .= ''.$this_link['name'].'';
}
}
} else {
- echo ' ';
+ $item['visibility'] .= ' ';
}
// NOTE : Table contains only the image file name, not full path
@@ -721,40 +711,88 @@ class CourseHome {
$toollink = '';
$my_tool_link = '';
}
- }
-
+ }
$tool_name = self::translate_tool_name($tool);
$icon = Display::return_icon($tool['image'], $tool_name, array('class' => 'tool-icon', 'id' => 'toolimage_'.$tool['id']));
// Validacion when belongs to a session
$session_img = api_get_session_image($tool['session_id'], $_user['status']);
- echo $toollink; //
- echo $icon;
- echo ' ';
+ $item['icon'] = $toollink.$icon.'';
+ $item['link'] = $my_tool_link.$tool_name.$session_img.'';
+ $item['id'] = $tool['image'];
- echo $my_tool_link; //
- echo $tool_name.$session_img;
- echo '';
-
- if ($theme == 'activity') {
+ $items[] = $item;
+
+ $i++;
+ } // end of foreach
+ }
+
+ $i = 0;
+
+ //$theme = 'activity_big';
+ if (!empty($items))
+ foreach($items as $item) {
+ switch($theme) {
+ case 'activity_big':
+ if ($i == 0) {
+ echo '';
+ }
+ if ($i % 3 == 0) {
+ echo '';
+ }
+ echo '';
+ echo $item['extra'];
+ echo $item['visibility'];
+ echo $item['icon'];
+ echo $item['link'];
echo ' | ';
+
+ if ($i % 3 == 2) {
+ echo ' ';
+ }
+ if ($i == count($items) -1) {
+ echo ' ';
+ }
+ break;
+ case 'activity':
+ if ($i == 0) {
+ echo '';
+ }
+ if (!($i % 2)) {
+ echo '';
+ }
+ echo '';
+ echo $item['extra'];
+ echo $item['visibility'];
+ echo $item['icon'];
+ echo $item['link'];
+ echo ' | ';
if ($i % 2) {
echo ' ';
}
- } elseif($theme == 'vertical_activity') {
+ if ($i == count($items) -1) {
+ echo ' ';
+ }
+ break;
+ case 'vertical_activity':
+ if ($i == 0) {
+ echo '';
+ }
+ echo '- ';
+ echo $item['extra'];
+ echo $item['visibility'];
+ echo $item['icon'];
+ echo $item['link'];
echo '
';
- }
- $i++;
- } // end of foreach
- }
- if ($theme == 'activity') {
- if ($i % 2) {
- echo ' | |
';
- }
- } elseif($theme == 'vertical_activity') {
- echo '
';
- }
+
+ if ($i == count($items) -1) {
+ echo '';
+ }
+ break;
+ }
+ $i++;
+ }
}
/**