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. 12
      main/course_home/activity.php
  2. 1
      main/course_home/course_home.php
  3. 19
      main/course_home/vertical_activity.php
  4. 100
      main/inc/lib/course_home.lib.php

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

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

@ -121,27 +121,21 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
$my_list = CourseHome::get_tools_category(TOOL_AUTHORING); $my_list = CourseHome::get_tools_category(TOOL_AUTHORING);
CourseHome::show_tools_category($my_list, 'vertical_activity'); CourseHome::show_tools_category($my_list, 'vertical_activity');
?> ?>
</div> </div>
<div class="courseadminview-activity-3col"> <div class="courseadminview-activity-3col">
<span class="viewcaption"><?php echo get_lang('Interaction'); ?></span> <span class="viewcaption"><?php echo get_lang('Interaction'); ?></span>
<?php <?php
$my_list = CourseHome::get_tools_category(TOOL_INTERACTION); $my_list = CourseHome::get_tools_category(TOOL_INTERACTION);
CourseHome::show_tools_category($my_list, 'vertical_activity'); CourseHome::show_tools_category($my_list, 'vertical_activity');
?> ?>
</div> </div>
<div class="courseadminview-activity-3col"> <div class="courseadminview-activity-3col">
<span class="viewcaption"><?php echo get_lang('Administration'); ?></span> <span class="viewcaption"><?php echo get_lang('Administration'); ?></span>
<?php <?php
$my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATEFORM); $my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATEFORM);
CourseHome::show_tools_category($my_list, 'vertical_activity'); CourseHome::show_tools_category($my_list, 'vertical_activity');
?> ?>
</div> </div>
<?php <?php
} elseif (api_is_coach()) { } elseif (api_is_coach()) {
@ -159,12 +153,10 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
} }
?> ?>
<div class="Authoringview"> <div class="Authoringview">
<table width="100%">
<?php <?php
$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW); $my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
CourseHome::show_tools_category($my_list, 'vertical_activity'); CourseHome::show_tools_category($my_list, 'vertical_activity');
?> ?>
</table>
</div> </div>
<?php <?php
@ -173,10 +165,7 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
} else { } else {
$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW); $my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
if (count($my_list) > 0) { if (count($my_list) > 0) {
?> echo '<div class="course-student-view-activity-3col">';
<div class="course-student-view-activity-3col">
<?php
//ordering by get_lang name //ordering by get_lang name
$order_tool_list = array(); $order_tool_list = array();
foreach($my_list as $key=>$new_tool) { foreach($my_list as $key=>$new_tool) {
@ -201,11 +190,7 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
} }
CourseHome::show_tools_category($my_list1, 'vertical_activity'); CourseHome::show_tools_category($my_list1, 'vertical_activity');
CourseHome::show_tools_category($my_list2, 'vertical_activity'); CourseHome::show_tools_category($my_list2, 'vertical_activity');
echo '</div>';
?>
</div>
<?php
} }
} }
?> ?>

@ -614,10 +614,11 @@ class CourseHome {
$is_platform_admin = api_is_platform_admin(); $is_platform_admin = api_is_platform_admin();
$i = 0; $i = 0;
$items = array();
if (isset($all_tools_list)) { if (isset($all_tools_list)) {
$lnk = ''; $lnk = '';
if ($theme == 'vertical_activity') echo '<ul>';
foreach ($all_tools_list as & $tool) { foreach ($all_tools_list as & $tool) {
$item = array();
if ($tool['image'] == 'scormbuilder.gif') { if ($tool['image'] == 'scormbuilder.gif') {
// display links to lp only for current session // display links to lp only for current session
@ -634,22 +635,11 @@ class CourseHome {
if (api_get_session_id() != 0 && in_array($tool['name'], array('course_maintenance', 'course_setting'))) { if (api_get_session_id() != 0 && in_array($tool['name'], array('course_maintenance', 'course_setting'))) {
continue; 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. // This part displays the links to hide or remove a tool.
// These links are only visible by the course manager. // These links are only visible by the course manager.
unset($lnk); unset($lnk);
if ($theme == 'activity') {
echo '<td width="50%">';
}
if ($is_allowed_to_edit && !api_is_coach()) { if ($is_allowed_to_edit && !api_is_coach()) {
if ($tool['visibility'] == '1' && $tool['admin'] != '1') { if ($tool['visibility'] == '1' && $tool['admin'] != '1') {
@ -663,7 +653,7 @@ class CourseHome {
$lnk[] = $link; $lnk[] = $link;
} }
if (!empty($tool['adminlink'])) { 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)) { if (isset($lnk) && is_array($lnk)) {
foreach ($lnk as $this_link) { foreach ($lnk as $this_link) {
if (empty($tool['adminlink'])) { 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 { } else {
echo '&nbsp;&nbsp;&nbsp;&nbsp;'; $item['visibility'] .= '&nbsp;&nbsp;&nbsp;&nbsp;';
} }
// NOTE : Table contains only the image file name, not full path // NOTE : Table contains only the image file name, not full path
@ -722,39 +712,87 @@ class CourseHome {
$my_tool_link = '<a id="istooldesc_'.$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); $tool_name = self::translate_tool_name($tool);
$icon = Display::return_icon($tool['image'], $tool_name, array('class' => 'tool-icon', 'id' => 'toolimage_'.$tool['id'])); $icon = Display::return_icon($tool['image'], $tool_name, array('class' => 'tool-icon', 'id' => 'toolimage_'.$tool['id']));
// Validacion when belongs to a session // Validacion when belongs to a session
$session_img = api_get_session_image($tool['session_id'], $_user['status']); $session_img = api_get_session_image($tool['session_id'], $_user['status']);
echo $toollink; //<a> $item['icon'] = $toollink.$icon.'</a>';
echo $icon; $item['link'] = $my_tool_link.$tool_name.$session_img.'</a>';
echo '</a> '; $item['id'] = $tool['image'];
echo $my_tool_link; //<a> $items[] = $item;
echo $tool_name.$session_img;
echo '</a>';
if ($theme == 'activity') { $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>'; echo '</td>';
if ($i % 2) {
if ($i % 3 == 2) {
echo '</tr>'; echo '</tr>';
} }
} elseif($theme == 'vertical_activity') { if ($i == count($items) -1) {
echo '</li>'; echo '</table>';
} }
$i++; break;
} // end of foreach case 'activity':
if ($i == 0) {
echo '<table width="100%">';
}
if (!($i % 2)) {
echo '<tr valign="top">';
} }
if ($theme == 'activity') { echo '<td width="50%">';
echo $item['extra'];
echo $item['visibility'];
echo $item['icon'];
echo $item['link'];
echo '</td>';
if ($i % 2) { if ($i % 2) {
echo '<td width=\"50%\">&nbsp;</td></tr>'; 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>';
if ($i == count($items) -1) {
echo '</ul>'; echo '</ul>';
} }
break;
}
$i++;
}
} }
/** /**

Loading…
Cancel
Save