diff --git a/main/calendar/agenda.inc.php b/main/calendar/agenda.inc.php index 2b4b9a7dd4..76510bbdf4 100755 --- a/main/calendar/agenda.inc.php +++ b/main/calendar/agenda.inc.php @@ -1188,12 +1188,8 @@ function separate_users_groups($to) { * @author: Patrick Cool , Ghent University * @return array */ -function sent_to($tool, $id) -{ - global $_course; - +function sent_to($tool, $id) { $TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY); - $tool=Database::escape_string($tool); $id=Database::escape_string($id); @@ -1236,77 +1232,53 @@ function sent_to($tool, $id) * groups (resp. users) who have received this message. * @return html */ -function sent_to_form($sent_to_array) -{ +function sent_to_form($sent_to_array) { // we find all the names of the groups $group_names=get_course_groups(); - count($sent_to_array); - // we count the number of users and the number of groups - if (isset($sent_to_array['users'])) - { + if (isset($sent_to_array['users'])) { $number_users=count($sent_to_array['users']); - } - else - { + } else { $number_users=0; } - if (isset($sent_to_array['groups'])) - { + if (isset($sent_to_array['groups'])) { $number_groups=count($sent_to_array['groups']); - } - else - { + } else { $number_groups=0; } $total_numbers=$number_users+$number_groups; // starting the form if there is more than one user/group - if ($total_numbers >1) - { - $output=""; - } - else // there is only one user/group - { - if (is_array($sent_to_array['users'])) - { + if ($total_numbers >1) { + //$output.=""; + // outputting the name of the groups + if (is_array($sent_to_array['groups'])) { + foreach ($sent_to_array['groups'] as $group_id) { + $output.="G: ".$group_names[$group_id]['name']."
"; + } + } + if (isset($sent_to_array['users'])) { + if (is_array($sent_to_array['users'])) { + foreach ($sent_to_array['users'] as $user_id) { + $user_info=api_get_user_info($user_id); + $output.=" ".api_get_person_name($user_info['firstName'], $user_info['lastName'])."
"; + } + } + } + } else { + // there is only one user/group + if (is_array($sent_to_array['users'])) { $user_info=api_get_user_info($sent_to_array['users'][0]); echo api_get_person_name($user_info['firstName'], $user_info['lastName']); } - if (is_array($sent_to_array['groups']) and $sent_to_array['groups'][0]!==0) - { + if (is_array($sent_to_array['groups']) and $sent_to_array['groups'][0]!==0) { $group_id=$sent_to_array['groups'][0]; echo $group_names[$group_id]['name']; } - if (is_array($sent_to_array['groups']) and $sent_to_array['groups'][0]==0) - { + if (is_array($sent_to_array['groups']) and $sent_to_array['groups'][0]==0) { echo get_lang("Everybody"); } - //.$sent_to_array['groups'][0]; } echo $output; @@ -1396,9 +1368,6 @@ function show_user_group_filter_form() $option.= ""; echo $option; - - global $_course; - // Users echo ""; $user_list=get_course_users(); @@ -1417,9 +1386,7 @@ function show_user_group_filter_form() * This tools loads all the users and all the groups who have received a specific item (in this case an agenda item) * @author: Patrick Cool , Ghent University */ -function load_edit_users($tool, $id) -{ - global $_course; +function load_edit_users($tool, $id) { $tool=Database::escape_string($tool); $id=Database::escape_string($id); $TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY); @@ -1996,6 +1963,7 @@ function display_agenda_items($select_month, $select_year) { } } // you are a student + //echo "
".$sql."
"; $result = Database::query($sql); $number_items = Database::num_rows($result); @@ -2032,7 +2000,7 @@ function display_agenda_items($select_month, $select_year) { if (empty($_SESSION['user']) && empty($_SESSION['group'])) { - //Check global agenda events */ + //Check global agenda events $table_agenda_system = Database :: get_main_table(TABLE_MAIN_SYSTEM_CALENDAR); $current_access_url_id = api_get_current_access_url_id(); @@ -2066,8 +2034,7 @@ function display_agenda_items($select_month, $select_year) { } } - echo Display::tag('tr', $th); - + echo Display::tag('tr', $th); foreach ($my_events as $myrow) { $is_repeated = !empty($myrow['parent_event_id']); // Make the month bar appear only once. @@ -2079,9 +2046,13 @@ function display_agenda_items($select_month, $select_year) { echo '

'.api_format_date($myrow["start_date"], "%B %Y").'

'; echo '';*/ } - + + $class = 'row_even'; + if ($counter % 2) { + $class = 'row_odd'; + } /* display: the icon, title, destinees of the item */ - echo ''; + echo ''; // highlight: if a date in the small calendar is clicked we highlight the relevant items $db_date = (int)api_format_date($myrow["start_date"], "%d").intval(api_format_date($myrow["start_date"], "%m")).api_format_date($myrow["start_date"], "%Y"); @@ -2135,22 +2106,21 @@ function display_agenda_items($select_month, $select_year) { $full_file_name = 'download.php?file='.$realname; echo Display::return_icon('attachment.gif',get_lang('Attachment')); echo ' '.$user_filename.''; - echo ''.$attachment_list['comment'].''; - if (api_is_allowed_to_edit()) { + if (api_is_allowed_to_edit()) { echo '  '.Display::return_icon('delete.png',get_lang('Delete'),'',22).'
'; } + echo '
'.$attachment_list['comment'].''; } echo ''; if ($myrow['calendar_type'] == 'course') { // the message has been sent to echo ""; - $sent_to=sent_to(TOOL_CALENDAR_EVENT, $myrow["ref"]); + $sent_to=sent_to(TOOL_CALENDAR_EVENT, $myrow["ref"]); $sent_to_form = sent_to_form($sent_to); if ($myrow['to_group_id']!=='0') { echo ' '.Display::return_icon('group.png', get_lang('ItemForUserSelection'),'',22); - } - + } echo $sent_to_form; echo ''; } elseif ($myrow['calendar_type'] == 'personal') { @@ -2210,12 +2180,8 @@ function display_agenda_items($select_month, $select_year) { echo ''.Display::return_icon('printer.png', get_lang('Print'),'',22).' '; echo ''; } - - - - - /* display: the added resources */ + //Display: the added resources if (check_added_resources("Agenda", $myrow["id"])) { echo ''; echo ''; diff --git a/main/calendar/myagenda.inc.php b/main/calendar/myagenda.inc.php index e4328e2a7f..2581a275d8 100755 --- a/main/calendar/myagenda.inc.php +++ b/main/calendar/myagenda.inc.php @@ -722,6 +722,7 @@ function show_personal_agenda() { echo Display::tag('tr', $th); if (Database::num_rows($result) > 0) { + $counter = 0; while ($myrow = Database::fetch_array($result)) { /* display: the month bar */ if ($month_bar != date("m", strtotime($myrow["date"])).date("Y", strtotime($myrow["date"]))) { @@ -738,8 +739,12 @@ function show_personal_agenda() { $text_style = "text"; } - - echo ""; + $class = 'row_even'; + if ($counter % 2) { + $class = 'row_odd'; + } + + echo ''; echo ''; /* display: the title */ @@ -777,6 +782,7 @@ function show_personal_agenda() { echo "".Display::return_icon('edit.png', get_lang('Edit'), array(), 22)." "; echo "".Display::return_icon('delete.png', get_lang('Delete'), array(), 22).""; echo ""; + $counter++; } } else { echo ''.get_lang('NoAgendaItems').''; diff --git a/main/document/document.php b/main/document/document.php index 60716789f6..2c1ac00ef7 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -97,12 +97,10 @@ $document_id = DocumentManager::get_document_id($_course, $curdirpath); if (!$document_id) { $document_id = DocumentManager::get_document_id(api_get_course_info(), $curdirpath); - $curdirpath = '/'; - // Urlencoded version - $curdirpathurl = '%2F'; } + $document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id()); -$parent_id = DocumentManager::get_document_id(api_get_course_info(), dirname($document_data['path'])); +$parent_id = DocumentManager::get_document_id(api_get_course_info(), dirname($document_data['path'])); if (!$parent_id) { $parent_id = 0; }