|
|
|
@ -28,7 +28,7 @@ class Agenda { |
|
|
|
$this->event_platform_color = 'red';//red |
|
|
|
$this->event_platform_color = 'red';//red |
|
|
|
$this->event_course_color = '#458B00'; //green |
|
|
|
$this->event_course_color = '#458B00'; //green |
|
|
|
$this->event_group_color = '#A0522D'; //siena |
|
|
|
$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 |
|
|
|
$this->event_personal_color = 'steel blue'; //steel blue |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -264,8 +264,6 @@ class Agenda { |
|
|
|
* Get agenda events |
|
|
|
* Get agenda events |
|
|
|
* @param int start tms |
|
|
|
* @param int start tms |
|
|
|
* @param int end 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 |
|
|
|
* @param int course id *integer* not the course code |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -276,8 +274,9 @@ class Agenda { |
|
|
|
$this->get_platform_events($start, $end); |
|
|
|
$this->get_platform_events($start, $end); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'course': |
|
|
|
case 'course': |
|
|
|
|
|
|
|
$session_id = api_get_session_id(); |
|
|
|
$course_info = api_get_course_info_by_id($course_id); |
|
|
|
$course_info = api_get_course_info_by_id($course_id); |
|
|
|
$this->get_course_events($start, $end, $course_info, $group_id); |
|
|
|
$this->get_course_events($start, $end, $course_info, $group_id, $session_id); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'personal': |
|
|
|
case 'personal': |
|
|
|
default: |
|
|
|
default: |
|
|
|
@ -291,12 +290,27 @@ class Agenda { |
|
|
|
$my_course_list = array(); |
|
|
|
$my_course_list = array(); |
|
|
|
|
|
|
|
|
|
|
|
if (!api_is_anonymous()) { |
|
|
|
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); |
|
|
|
$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)) { |
|
|
|
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 (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); |
|
|
|
$this->get_course_events($start, $end, $course_info_item); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
@ -461,12 +475,11 @@ class Agenda { |
|
|
|
return $my_events; |
|
|
|
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']; |
|
|
|
$course_id = $course_info['real_id']; |
|
|
|
$group_list = GroupManager::get_group_list(null, $course_info['code']); |
|
|
|
$group_list = GroupManager::get_group_list(null, $course_info['code']); |
|
|
|
$group_name_list = array(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$group_name_list = array(); |
|
|
|
if (!empty($group_list)) { |
|
|
|
if (!empty($group_list)) { |
|
|
|
foreach($group_list as $group) { |
|
|
|
foreach($group_list as $group) { |
|
|
|
$group_name_list[$group['id']]= $group['name']; |
|
|
|
$group_name_list[$group['id']]= $group['name']; |
|
|
|
@ -488,6 +501,8 @@ class Agenda { |
|
|
|
$group_memberships = array($group_id); |
|
|
|
$group_memberships = array($group_id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$session_id = intval($session_id); |
|
|
|
|
|
|
|
|
|
|
|
if (is_array($group_memberships) && count($group_memberships) > 0) { |
|
|
|
if (is_array($group_memberships) && count($group_memberships) > 0) { |
|
|
|
if (api_is_allowed_to_edit()) { |
|
|
|
if (api_is_allowed_to_edit()) { |
|
|
|
$where_condition = "( ip.to_group_id is null OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).") ) "; |
|
|
|
$where_condition = "( ip.to_group_id is null OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).") ) "; |
|
|
|
@ -511,6 +526,7 @@ class Agenda { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$where_condition = "( ip.to_user_id=$user_id OR ip.to_group_id='0') AND "; |
|
|
|
$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 |
|
|
|
$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 |
|
|
|
FROM ".$tlb_course_agenda." agenda, ".$tbl_property." ip |
|
|
|
WHERE agenda.id = ip.ref AND |
|
|
|
WHERE agenda.id = ip.ref AND |
|
|
|
@ -518,7 +534,10 @@ class Agenda { |
|
|
|
$where_condition |
|
|
|
$where_condition |
|
|
|
ip.visibility='1' AND |
|
|
|
ip.visibility='1' AND |
|
|
|
agenda.c_id = $course_id AND |
|
|
|
agenda.c_id = $course_id AND |
|
|
|
ip.c_id = $course_id"; |
|
|
|
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 |
|
|
|
//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()) { |
|
|
|
if ($row['session_id'] != api_get_session_id()) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
$event = array(); |
|
|
|
$event = array(); |
|
|
|
|
|
|
|
|
|
|
|
@ -606,7 +625,11 @@ class Agenda { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$event['sent_to'] = ''; |
|
|
|
$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? |
|
|
|
//Event Sent to a group? |
|
|
|
if (isset($row['to_group_id']) && !empty($row['to_group_id'])) { |
|
|
|
if (isset($row['to_group_id']) && !empty($row['to_group_id'])) { |
|
|
|
@ -623,7 +646,6 @@ class Agenda { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Event sent to a user? |
|
|
|
//Event sent to a user? |
|
|
|
//var_dump($row); |
|
|
|
|
|
|
|
if (isset($row['to_user_id'])) { |
|
|
|
if (isset($row['to_user_id'])) { |
|
|
|
$sent_to = array(); |
|
|
|
$sent_to = array(); |
|
|
|
if (!empty($user_to_array)) { |
|
|
|
if (!empty($user_to_array)) { |
|
|
|
@ -637,7 +659,6 @@ class Agenda { |
|
|
|
$sent_to = implode('@@', $sent_to); |
|
|
|
$sent_to = implode('@@', $sent_to); |
|
|
|
$sent_to = str_replace('@@', '</div><div class="label_tag notice">', $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'] = '<div class="label_tag notice">'.$sent_to.'</div>'; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Event sent to everyone! |
|
|
|
//Event sent to everyone! |
|
|
|
|