Minor - Cleaning the file that generates the course home page. No big changes. see #2963

skala
Julio Montoya 14 years ago
parent 10cf2e64c3
commit c1a8c0d326
  1. 20
      main/course_home/activity.php
  2. 1
      main/course_home/course_home.php
  3. 73
      main/course_home/vertical_activity.php
  4. 116
      main/inc/lib/course_home.lib.php

@ -113,35 +113,28 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
}
?>
<div class="courseadminview">
<span class="viewcaption"><?php echo get_lang('Authoring'); ?></span>
<table width="100%">
<span class="viewcaption"><?php echo get_lang('Authoring'); ?></span>
<?php
$my_list = CourseHome::get_tools_category(TOOL_AUTHORING);
CourseHome::show_tools_category($my_list);
?>
</table>
</div>
<div class="courseadminview">
<span class="viewcaption"><?php echo get_lang('Interaction'); ?></span>
<table width="100%">
<?php
$my_list = CourseHome::get_tools_category(TOOL_INTERACTION);
$list2 = CourseHome::get_tools_category(TOOL_COURSE_PLUGIN);
$my_list = array_merge($my_list,$list2);
CourseHome::show_tools_category($my_list);
?>
</table>
</div>
<div class="courseadminview">
<span class="viewcaption"><?php echo get_lang('Administration'); ?></span>
<table width="100%">
<span class="viewcaption"><?php echo get_lang('Administration'); ?></span>
<?php
$my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATEFORM);
CourseHome::show_tools_category($my_list);
?>
</table>
?>
</div>
<?php
} elseif (api_is_coach()) {
@ -159,12 +152,10 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
}
?>
<div class="Authoringview">
<table width="100%">
<?php
$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
CourseHome::show_tools_category($my_list);
?>
</table>
</div>
<?php
@ -175,13 +166,10 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
if (count($my_list) > 0) {
?>
<div class="Authoringview">
<table width="100%">
<?php
CourseHome::show_tools_category($my_list);
?>
</table>
</div>
<?php
}
}
}

@ -271,6 +271,7 @@ if ($show_autolunch_lp_warning) {
Display::display_warning_message(get_lang('TheLPAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificLP'));
}
if (api_get_setting('homepage_view') == 'activity') {
//require 'activity_big.php';
require 'activity.php';
} elseif (api_get_setting('homepage_view') == '2column') {
require '2column.php';

@ -120,28 +120,22 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
<?php
$my_list = CourseHome::get_tools_category(TOOL_AUTHORING);
CourseHome::show_tools_category($my_list, 'vertical_activity');
?>
?>
</div>
<div class="courseadminview-activity-3col">
<span class="viewcaption"><?php echo get_lang('Interaction'); ?></span>
<span class="viewcaption"><?php echo get_lang('Interaction'); ?></span>
<?php
$my_list = CourseHome::get_tools_category(TOOL_INTERACTION);
CourseHome::show_tools_category($my_list, 'vertical_activity');
?>
?>
</div>
<div class="courseadminview-activity-3col">
<span class="viewcaption"><?php echo get_lang('Administration'); ?></span>
<span class="viewcaption"><?php echo get_lang('Administration'); ?></span>
<?php
$my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATEFORM);
CourseHome::show_tools_category($my_list, 'vertical_activity');
?>
</div>
<?php
} elseif (api_is_coach()) {
@ -159,12 +153,10 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
}
?>
<div class="Authoringview">
<table width="100%">
<?php
$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
CourseHome::show_tools_category($my_list, 'vertical_activity');
?>
</table>
</div>
<?php
@ -173,39 +165,32 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
} else {
$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
if (count($my_list) > 0) {
?>
<div class="course-student-view-activity-3col">
<?php
//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;
}
$i++;
echo '<div class="course-student-view-activity-3col">';
//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');
?>
</div>
<?php
$i++;
}
CourseHome::show_tools_category($my_list1, 'vertical_activity');
CourseHome::show_tools_category($my_list2, 'vertical_activity');
echo '</div>';
}
}
?>

@ -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 '<ul>';
$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 '<tr valign="top">';
}
} elseif ($theme == 'vertical_activity') {
echo '<li>';
}
}
// 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 '<td width="50%">';
}
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 '<a href="'.$tool['adminlink'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
$item['extra'] = '<a href="'.$tool['adminlink'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
}
}
@ -677,11 +667,11 @@ class CourseHome {
if (isset($lnk) && is_array($lnk)) {
foreach ($lnk as $this_link) {
if (empty($tool['adminlink'])) {
echo '<a class="make_visible_and_invisible" href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$tool['id'].'&amp;'.$this_link['cmd'].'">'.$this_link['name'].'</a>';
$item['visibility'] .= '<a class="make_visible_and_invisible" href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$tool['id'].'&amp;'.$this_link['cmd'].'">'.$this_link['name'].'</a>';
}
}
} else {
echo '&nbsp;&nbsp;&nbsp;&nbsp;';
$item['visibility'] .= '&nbsp;&nbsp;&nbsp;&nbsp;';
}
// NOTE : Table contains only the image file name, not full path
@ -721,40 +711,88 @@ class CourseHome {
$toollink = '<a id="tooldesc_'.$tool["id"].'" ' . $class . ' href="' . htmlspecialchars($tool['link']) . '" target="' . $tool['target'] . '">';
$my_tool_link = '<a id="istooldesc_'.$tool["id"].'" ' . $class . ' href="' . htmlspecialchars($tool['link']) . '" target="' . $tool['target'] . '">';
}
}
}
$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; //<a>
echo $icon;
echo '</a> ';
$item['icon'] = $toollink.$icon.'</a>';
$item['link'] = $my_tool_link.$tool_name.$session_img.'</a>';
$item['id'] = $tool['image'];
echo $my_tool_link; //<a>
echo $tool_name.$session_img;
echo '</a>';
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 '<table width="100%">';
}
if ($i % 3 == 0) {
echo '<tr valign="top">';
}
echo '<td width="33%">';
echo $item['extra'];
echo $item['visibility'];
echo $item['icon'];
echo $item['link'];
echo '</td>';
if ($i % 3 == 2) {
echo '</tr>';
}
if ($i == count($items) -1) {
echo '</table>';
}
break;
case 'activity':
if ($i == 0) {
echo '<table width="100%">';
}
if (!($i % 2)) {
echo '<tr valign="top">';
}
echo '<td width="50%">';
echo $item['extra'];
echo $item['visibility'];
echo $item['icon'];
echo $item['link'];
echo '</td>';
if ($i % 2) {
echo '</tr>';
}
} elseif($theme == 'vertical_activity') {
if ($i == count($items) -1) {
echo '</table>';
}
break;
case 'vertical_activity':
if ($i == 0) {
echo '<ul>';
}
echo '<li>';
echo $item['extra'];
echo $item['visibility'];
echo $item['icon'];
echo $item['link'];
echo '</li>';
}
$i++;
} // end of foreach
}
if ($theme == 'activity') {
if ($i % 2) {
echo '<td width=\"50%\">&nbsp;</td></tr>';
}
} elseif($theme == 'vertical_activity') {
echo '</ul>';
}
if ($i == count($items) -1) {
echo '</ul>';
}
break;
}
$i++;
}
}
/**

Loading…
Cancel
Save