Experimental main course page UI changes see CT#826 (partial)

skala
Julio Montoya 15 years ago
parent 7fb0379e6b
commit b5c0e9c7c7
  1. 35
      main/course_home/course_home.php
  2. 189
      main/course_home/vertical_activity.php
  3. 20
      main/css/chamilo/default.css
  4. 86
      main/inc/lib/course_home.lib.php

@ -127,19 +127,20 @@ require_once api_get_path(LIBRARY_PATH).'course.lib.php';
/* Constants */
define('TOOL_PUBLIC', 'Public');
define('TOOL_PUBLIC_BUT_HIDDEN', 'PublicButHide');
define('TOOL_COURSE_ADMIN', 'courseAdmin');
define('TOOL_PLATFORM_ADMIN', 'platformAdmin');
define('TOOL_AUTHORING', 'toolauthoring');
define('TOOL_INTERACTION', 'toolinteraction');
define('TOOL_ADMIN', 'tooladmin');
define('TOOL_ADMIN_PLATEFORM', 'tooladminplatform');
define('TOOL_PUBLIC', 'Public');
define('TOOL_PUBLIC_BUT_HIDDEN', 'PublicButHide');
define('TOOL_COURSE_ADMIN', 'courseAdmin');
define('TOOL_PLATFORM_ADMIN', 'platformAdmin');
define('TOOL_AUTHORING', 'toolauthoring');
define('TOOL_INTERACTION', 'toolinteraction');
define('TOOL_ADMIN', 'tooladmin');
define('TOOL_ADMIN_PLATEFORM', 'tooladminplatform');
//define('TOOL_ADMIN_PLATFORM_VISIBLE', 'tooladminplatformvisible');
//define('TOOL_ADMIN_PLATFORM_INVISIBLE', 'tooladminplatforminvisible');
//define('TOOL_ADMIN_COURS_INVISIBLE', 'tooladmincoursinvisible');
define('TOOL_STUDENT_VIEW', 'toolstudentview');
define('TOOL_ADMIN_VISIBLE', 'tooladminvisible');
define('TOOL_STUDENT_VIEW', 'toolstudentview');
define('TOOL_ADMIN_VISIBLE', 'tooladminvisible');
/* Virtual course support code */
@ -209,16 +210,20 @@ Display::display_introduction_section(TOOL_COURSE_HOMEPAGE, array(
the setting homepage_view is adjustable through
the platform administration section */
//@todo add vertical_activity to the api_get_setting('homepage_view') variable
//require 'vertical_activity.php';
if (api_get_setting('homepage_view') == 'activity') {
require 'activity.php';
}
elseif (api_get_setting('homepage_view') == '2column') {
} elseif (api_get_setting('homepage_view') == '2column') {
require '2column.php';
}
elseif (api_get_setting('homepage_view') == '3column') {
} elseif (api_get_setting('homepage_view') == '3column') {
require '3column.php';
} elseif (api_get_setting('homepage_view') == 'vertical_activity') {
require 'vertical_activity.php';
}
/* FOOTER */
Display::display_footer();
Display::display_footer();

@ -0,0 +1,189 @@
<?php
/* For licensing terms, see /license.txt */
/**
* HOME PAGE FOR EACH COURSE
*
* This page, included in every course's index.php is the home
* page. To make administration simple, the teacher edits his
* course from the home page. Only the login detects that the
* visitor is allowed to activate, deactivate home page links,
* access to the teachers tools (statistics, edit forums...).
*
* @package chamilo.course_home
*/
require_once api_get_path(LIBRARY_PATH).'course_home.lib.php';
// MAIN CODE
if (api_is_allowed_to_edit(null, true)) {
// HIDE
if (!empty($_GET['hide'])) { // visibility 1 -> 0
/* -- session condition for visibility
if (!empty($session_id)) {
$sql = "select session_id FROM $tool_table WHERE id='".intval($_GET["id"])."' AND session_id = '".intval($session_id)."'";
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
$sql="UPDATE $tool_table SET visibility=0 WHERE id='".intval($_GET["id"])."' AND session_id = '".intval($session_id)."'";
} else {
$sql_select = "select * FROM $tool_table WHERE id='".$_GET["id"]."'";
$res_select = Database::query($sql_select);
$row_select = Database::fetch_array($res_select);
$sql = "INSERT INTO $tool_table(name,link,image,visibility,admin,address,added_tool,target,category,session_id)
VALUES('{$row_select['name']}','{$row_select['link']}','{$row_select['image']}','0','{$row_select['admin']}','{$row_select['address']}','{$row_select['added_tool']}','{$row_select['target']}','{$row_select['category']}','$session_id')";
}
} else {
$sql="UPDATE $tool_table SET visibility=0 WHERE id='".intval($_GET["id"])."'";
}*/
$sql = "UPDATE $tool_table SET visibility=0 WHERE id='".intval($_GET["id"])."'";
Database::query($sql);
Display::display_confirmation_message(get_lang('ToolIsNowHidden'));
} elseif (!empty($_GET['restore'])) {
// visibility 0,2 -> 1
// REACTIVATE
$sql = "UPDATE $tool_table SET visibility=1 WHERE id='".intval($_GET["id"])."'";
Database::query($sql);
Display::display_confirmation_message(get_lang('ToolIsNowVisible'));
}
}
// Work with data post askable by admin of course
if (api_is_platform_admin()) {
// Show message to confirm that a tool it to be hidden from available tools
// visibility 0,1->2
if (!empty($_GET['askDelete'])) {
?>
<div id="toolhide"><?php echo get_lang('DelLk'); ?><br />&nbsp;&nbsp;&nbsp;
<a href="<?php echo api_get_self(); ?>"><?php echo get_lang('No'); ?></a>&nbsp;|&nbsp;
<a href="<?php echo api_get_self(); ?>?delete=yes&id=<?php echo Security::remove_XSS($_GET['id']); ?>"><?php echo get_lang('Yes'); ?></a>
</div>
<?php
}
/*
* Process hiding a tools from available tools.
*/
elseif (isset($_GET['delete']) && $_GET['delete']) {
//where $id is set?
$id = intval($id);
Database::query("DELETE FROM $tool_table WHERE id='$id' AND added_tool=1");
}
}
// COURSE ADMIN ONLY VIEW
// Start of tools for CourseAdmins (teachers/tutors)
if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
$current_protocol = $_SERVER['SERVER_PROTOCOL'];
$current_host = $_SERVER['HTTP_HOST'];
$server_protocol = substr($current_protocol, 0, strrpos($current_protocol, '/'));
$server_protocol = $server_protocol.'://';
if ($current_host == 'localhost') {
// Get information of path
$info = explode('courses', api_get_self());
$path_work = substr($info[0], 1);
} else {
$path_work = '';
}
?>
<div class="courseadminview" style="border:0px; margin-top: 0px;padding:5px 0px;">
<div class="normal-message" id="id_normal_message" style="display:none">
<?php
echo '<img src="'.$server_protocol.$current_host.'/'.$path_work.'main/inc/lib/javascript/indicator.gif"/>&nbsp;&nbsp;';
echo get_lang('PleaseStandBy');
?>
</div>
<div class="confirmation-message" id="id_confirmation_message" style="display:none"></div>
</div>
<div id="activity-3col">
<?php
if (api_get_setting('show_session_data') == 'true' && $id_session > 0) {
?>
<div class="courseadminview-activity-3col">
<span class="viewcaption"><?php echo get_lang('SessionData'); ?></span>
<table width="100%">
<?php
echo show_session_data($id_session);
?>
</table>
</div>
<?php
}
?>
<div class="courseadminview-activity-3col">
<span class="viewcaption"><?php echo get_lang('Authoring'); ?></span>
<?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>
<?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>
<?php
$my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATEFORM);
CourseHome::show_tools_category($my_list, 'vertical_activity');
?>
</div>
<?php
} elseif (api_is_coach()) {
if (api_get_setting('show_session_data') == 'true' && $id_session > 0) {
?>
<div class="courseadminview-activity-3col">
<span class="viewcaption"><?php echo get_lang('SessionData'); ?></span>
<table width="100%">
<?php
echo CourseHome::show_session_data($id_session);
?>
</table>
</div>
<?php
}
?>
<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
// TOOLS AUTHORING
} else {
$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
if (count($my_list) > 0) {
?>
<div class="Authoringview">
<table width="100%">
<?php
CourseHome::show_tools_category($my_list, 'vertical_activity');
?>
</table>
</div>
<?php
}
}
?>
</div>

@ -4082,20 +4082,30 @@ span.form_required {
padding:5px 10px 5px 10px;
}
.courseadminview, .platformadminview {
.courseadminview-activity-3col, .platformadminview-activity-3col {
-moz-border-radius:5px 5px 5px 5px;
border:1px solid #E1E1E0;
float:left;
margin:10px 20px 10px 10px;
padding:11px;
width:210px;
height:330px;
}
.courseadminview ul {
padding-left:5px;
padding:20px;
.courseadminview-activity-3col ul {
padding:10px 20px 10px 20px;
list-style-type:none;
height:250px;
height:240px;
margin-left:0px;
margin: 0px 0px 0px 0px ;
}
.courseadminview-activity-3col ul li {
padding:4px 0px 4px 0px;
}
#activity-3col {
width: 800px ;
margin-left: auto ;
margin-right: auto ;
}

@ -545,37 +545,71 @@ class CourseHome {
}
return $all_tools_list;
}
public static function order_tool_list($a, $b) {
/* echo $name_a = ($a['name']);
echo '--';
echo $name_b = ($b['name']);
echo '<br>';
if ($name_a == $name_b) {
return 0;
}
return ($name_a < $name_b) ? -1 : 1;*/
}
/**
* Displays the tools of a certain category.
* @param array List of tools as returned by get_tools_category()
* @return void
*/
public static function show_tools_category($all_tools_list) {
public static function show_tools_category($all_tools_list, $theme = 'activity') {
//@todo order list
//var_dump($all_tools_list);
/* usort($all_tools_list, array( 'CourseHome' , 'order_tool_list' ));
$order_tool_list = array();
foreach($all_tools_list as $new_tool) {
$order_tool_list []= $new_tool['name'];
}
natsort($order_tool_list);
foreach($order_tool_list as $key=>$new_tool) {
$all_tools_list[]
}
var_dump($all_tools_list);
var_dump($order_tool_list);
//var_dump($all_tools_list);
*/
global $_user;
$web_code_path = api_get_path(WEB_CODE_PATH);
$course_tool_table = Database::get_course_table(TABLE_TOOL_LIST);
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$is_platform_admin = api_is_platform_admin();
//var_dump($all_tools_list);
$i = 0;
if (isset($all_tools_list)) {
$lnk = '';
if ($theme == 'vertical_activity') echo '<ul>';
foreach ($all_tools_list as & $tool) {
if (api_get_session_id() != 0 && in_array($tool['name'], array('course_maintenance', 'course_setting'))) {
continue;
}
if (!($i % 2)) {
echo "<tr valign=\"top\">\n";
}
if ($theme == 'activity') {
if (!($i % 2)) {
echo "<tr valign=\"top\">\n";
}
} 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);
echo '<td width="50%">'."\n";
if ($theme == 'activity') {
echo '<td width="50%">'."\n";
}
if ($is_allowed_to_edit && !api_is_coach()) {
if ($tool['visibility'] == '1' && $tool['admin'] != '1') {
@ -641,9 +675,7 @@ class CourseHome {
} elseif (strpos($tool['name'], 'chat') !== false && api_get_course_setting('allow_open_chat_window')) {
$toollink = "\t" . '<a id="tooldesc_'.$tool["id"].'" ' . $class . ' href="javascript: void(0);" onclick="javascript: window.open(\'' . htmlspecialchars($tool['link']) . '\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '">';
$my_tool_link="\t" . '<a id="istooldesc_'.$tool["id"].'" ' . $class . ' href="javascript: void(0);" onclick="javascript: window.open(\'' . htmlspecialchars($tool['link']) . '\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '">';
} else {
if (count(explode('type=classroom',$tool['link'])) == 2 || count(explode('type=conference', $tool['link'])) == 2) {
$toollink = "\t" . '<a id="tooldesc_'.$tool["id"].'" ' . $class . ' href="' . $tool['link'] . '" target="_blank">';
$my_tool_link = "\t" . '<a id="istooldesc_'.$tool["id"].'" ' . $class . ' href="' . $tool['link'] . '" target="_blank">';
@ -651,12 +683,9 @@ class CourseHome {
} else {
$toollink = "\t" . '<a id="tooldesc_'.$tool["id"].'" ' . $class . ' href="' . htmlspecialchars($tool['link']) . '" target="' . $tool['target'] . '">';
$my_tool_link = "\t" . '<a id="istooldesc_'.$tool["id"].'" ' . $class . ' href="' . htmlspecialchars($tool['link']) . '" target="' . $tool['target'] . '">';
}
}
echo $toollink;
$tool_name = self::translate_tool_name($tool);
Display::display_icon($tool['image'], $tool_name, array('class' => 'tool-icon', 'id' => 'toolimage_'.$tool['id']));
@ -666,20 +695,33 @@ class CourseHome {
echo '</a> ';
echo $my_tool_link;
echo "{$tool_name}$session_img";
echo "\t".'</a></td>';
if ($i % 2) {
echo '</tr>';
echo '</a>';
if ($theme == 'activity') {
echo '</td>';
if ($i % 2) {
echo '</tr>';
}
} elseif($theme == 'vertical_activity') {
echo '</li>';
}
$i++;
}
}
if ($i % 2) {
echo "<td width=\"50%\">&nbsp;</td>\n", "</tr>\n";
if ($theme == 'activity') {
if ($i % 2) {
echo "<td width=\"50%\">&nbsp;</td>\n", "</tr>\n";
}
} elseif($theme == 'vertical_activity') {
echo '</ul>';
}
}
/**
* Shows the general data for a particular meeting

Loading…
Cancel
Save