skala
Julio Montoya 13 years ago
commit e253c8ce34
  1. 73
      main/calendar/agenda.lib.php
  2. 9
      main/calendar/agenda_js.php
  3. 7
      main/css/base.css
  4. 2
      main/exercice/exercise.lib.php
  5. 7
      main/inc/lib/course.lib.php
  6. 4
      main/inc/lib/database.lib.php
  7. 2
      main/inc/lib/usermanager.lib.php
  8. 2
      main/template/default/agenda/month.tpl

@ -28,7 +28,7 @@ class Agenda {
$this->event_platform_color = 'red';//red
$this->event_course_color = '#458B00'; //green
$this->event_group_color = '#A0522D'; //siena
$this->event_session_color = '#000080'; // blue
$this->event_session_color = '#00496D'; // kind of green
$this->event_personal_color = 'steel blue'; //steel blue
}
@ -264,8 +264,6 @@ class Agenda {
* Get agenda events
* @param int start tms
* @param int end tms
* @param string agenda type (personal, admin or course)
* @param int user id
* @param int course id *integer* not the course code
*
*/
@ -276,11 +274,12 @@ class Agenda {
$this->get_platform_events($start, $end);
break;
case 'course':
$course_info = api_get_course_info_by_id($course_id);
$this->get_course_events($start, $end, $course_info, $group_id);
$session_id = api_get_session_id();
$course_info = api_get_course_info_by_id($course_id);
$this->get_course_events($start, $end, $course_info, $group_id, $session_id);
break;
case 'personal':
default:
default:
//Getting personal events
$this->get_personal_events($start, $end);
@ -291,12 +290,27 @@ class Agenda {
$my_course_list = array();
if (!api_is_anonymous()) {
$session_list = SessionManager::get_sessions_by_user(api_get_user_id());
$my_course_list = CourseManager::get_courses_list_by_user_id(api_get_user_id(), true);
}
if (!empty($session_list)) {
foreach ($session_list as $session_item) {
$my_courses = $session_item['courses'];
$my_session_id = $session_item['session_id'];
if (!empty($my_courses)) {
foreach ($my_courses as $course_item) {
$course_info = api_get_course_info($course_item['code']);
$this->get_course_events($start, $end, $course_info, 0, $my_session_id);
}
}
}
}
if (!empty($my_course_list)) {
foreach($my_course_list as $course_info_item) {
foreach ($my_course_list as $course_info_item) {
if (isset($course_id) && !empty($course_id)) {
if ($course_info_item['course_id'] == $course_id) {
if ($course_info_item['real_id'] == $course_id) {
$this->get_course_events($start, $end, $course_info_item);
}
} else {
@ -461,12 +475,11 @@ class Agenda {
return $my_events;
}
function get_course_events($start, $end, $course_info, $group_id = 0) {
function get_course_events($start, $end, $course_info, $group_id = 0, $session_id = 0) {
$course_id = $course_info['real_id'];
$group_list = GroupManager::get_group_list(null, $course_info['code']);
$group_name_list = array();
$group_name_list = array();
if (!empty($group_list)) {
foreach($group_list as $group) {
$group_name_list[$group['id']]= $group['name'];
@ -478,7 +491,7 @@ class Agenda {
} else {
$group_memberships = array_keys($group_name_list);
}
$tlb_course_agenda = Database::get_course_table(TABLE_AGENDA);
$tbl_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
@ -488,6 +501,8 @@ class Agenda {
$group_memberships = array($group_id);
}
$session_id = intval($session_id);
if (is_array($group_memberships) && count($group_memberships) > 0) {
if (api_is_allowed_to_edit()) {
$where_condition = "( ip.to_group_id is null OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).") ) ";
@ -510,15 +525,19 @@ class Agenda {
$where_condition = "";
} else {
$where_condition = "( ip.to_user_id=$user_id OR ip.to_group_id='0') AND ";
}
}
$sql = "SELECT DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref, to_user_id
FROM ".$tlb_course_agenda." agenda, ".$tbl_property." ip
WHERE agenda.id = ip.ref AND
ip.tool='".TOOL_CALENDAR_EVENT."' AND
$where_condition
ip.visibility='1' AND
agenda.c_id = $course_id AND
ip.c_id = $course_id";
WHERE agenda.id = ip.ref AND
ip.tool='".TOOL_CALENDAR_EVENT."' AND
$where_condition
ip.visibility='1' AND
agenda.c_id = $course_id AND
ip.c_id = $course_id AND
agenda.session_id = $session_id AND
ip.id_session = $session_id
";
}
@ -547,11 +566,11 @@ class Agenda {
}
//Only show events from the session
if (api_get_course_int_id()) {
/*if (api_get_course_int_id()) {
if ($row['session_id'] != api_get_session_id()) {
continue;
}
}
}*/
$event = array();
@ -562,7 +581,7 @@ class Agenda {
continue;
}
$events_added[] = $row['id'];
$events_added[] = $row['id'];
$attachment = get_attachment($row['id'], $course_id);
@ -606,7 +625,11 @@ class Agenda {
}
$event['sent_to'] = '';
$event['type'] = $this->type;
//$event['type'] = $this->type;
$event['type'] = 'course';
if ($row['session_id'] != 0) {
$event['type'] = 'session';
}
//Event Sent to a group?
if (isset($row['to_group_id']) && !empty($row['to_group_id'])) {
@ -622,8 +645,7 @@ class Agenda {
$event['type'] = 'group';
}
//Event sent to a user?
//var_dump($row);
//Event sent to a user?
if (isset($row['to_user_id'])) {
$sent_to = array();
if (!empty($user_to_array)) {
@ -637,7 +659,6 @@ class Agenda {
$sent_to = implode('@@', $sent_to);
$sent_to = str_replace('@@', '</div><div class="label_tag notice">', $sent_to);
$event['sent_to'] = '<div class="label_tag notice">'.$sent_to.'</div>';
}
//Event sent to everyone!

@ -47,8 +47,9 @@ if (isset($_REQUEST['cidReq']) && !empty($_REQUEST['cidReq'])) {
$is_group_tutor = false;
$session_id = api_get_session_id();
$group_id = api_get_group_id();
if (!empty($group_id)) {
$is_group_tutor = GroupManager::is_tutor_of_group(api_get_user_id(), $group_id);
$group_properties = GroupManager :: get_group_properties($group_id);
@ -148,6 +149,12 @@ if ($type == 'course' && !empty($group_id)) {
$type_event_class = 'group_event';
$type_label = get_lang('GroupCalendar');
}
if ($type == 'course' && !empty($session_id)) {
$type_event_class = 'session_event';
$type_label = get_lang('SessionCalendar');
}
$tpl->assign('type_label', $type_label);
$tpl->assign('type_event_class', $type_event_class);

@ -2896,16 +2896,15 @@ form .formw .freeze {
.label_tag.admin_event {
background:red;
}
.label_tag.course_event {
background:#458B00;
}
.label_tag.group_event {
background:#A0522D;
}
.label_tag.session_event {
background:#00496D;
}
.label_tag.important {

@ -1095,7 +1095,7 @@ function get_exam_results_data($from, $number_of_items, $column, $direction, $ex
$group_list = GroupManager::get_group_ids(api_get_course_int_id(), $results[$i]['user_id']);
foreach ($group_list as $id) {
$group_name_list .= $clean_group_list[$id].' ';
$group_name_list .= $clean_group_list[$id].'<br/>';
}
$results[$i]['group_name'] = $group_name_list;
}

@ -2157,14 +2157,15 @@ class CourseManager {
if (Database::num_rows($result)) {
while ($row = Database::fetch_array($result, 'ASSOC')) {
$course_list[] = $row;
$codes[] = $row['code'];
$codes[] = $row['real_id'];
}
}
if ($include_sessions === true) {
$r = Database::query("SELECT DISTINCT(c.code), c.id as real_id
$sql = "SELECT DISTINCT(c.code), c.id as real_id
FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." s, ".Database::get_main_table(TABLE_MAIN_COURSE)." c
WHERE id_user = $user_id AND s.course_code=c.code");
WHERE id_user = $user_id AND s.course_code=c.code";
$r = Database::query($sql);
while ($row = Database::fetch_array($r, 'ASSOC')) {
if (!in_array($row['real_id'], $codes)) {
$course_list[] = $row;

@ -1387,6 +1387,4 @@ class Database {
public static function get_last_insert_id() {
return mysql_insert_id();
}
}
//end class Database
}

@ -2143,7 +2143,7 @@ class UserManager {
$courses = array();
// this query is very similar to the above query, but it will check the session_rel_course_user table if there are courses registered to our user or not
$personal_course_list_sql = "SELECT DISTINCT scu.course_code as code
$personal_course_list_sql = "SELECT DISTINCT scu.course_code as code
FROM $tbl_session_course_user as scu $join_access_url
WHERE scu.id_user = $user_id AND scu.id_session = $session_id $where_access_url
ORDER BY code";

@ -171,7 +171,7 @@ $(document).ready(function() {
$("#dialog-form").dialog({
buttons: {
{{ "Add"|get_lang }}: function() {
'{{ "Add"|get_lang}}' : function() {
var bValid = true;
bValid = bValid && checkLength( title, "title", 1, 255 );
//bValid = bValid && checkLength( content, "content", 1, 255 );

Loading…
Cancel
Save