More - Improving UI in agenda an announcements

skala
Julio Montoya 15 years ago
parent a712f4dab6
commit 4e7e39674f
  1. 50
      main/announcements/announcements.inc.php
  2. 55
      main/calendar/agenda.inc.php

@ -142,9 +142,33 @@ class AnnouncementManager {
$content = make_clickable($content);
$content = text_filter($content);
echo "<table height=\"100\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" id=\"agenda_list\">";
echo "<tr><td><h2>".$title."</h2></td></tr>";
echo "<tr class=\"text\"><td>$content</td></tr>";
echo "<table height=\"100\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" class=\"data_table\">";
echo "<tr><td><h2>".$title."</h2></td></tr>";
if (api_is_allowed_to_edit(false,true) || (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
$modify_icons = "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=modify&id=".$announcement_id."\">".Display::return_icon('edit.png', get_lang('Edit'),'',22)."</a>";
if ($myrow['visibility']==1) {
$image_visibility="visible";
$alt_visibility=get_lang('Hide');
} else {
$image_visibility="invisible";
$alt_visibility=get_lang('Visible');
}
global $stok;
$modify_icons .= "<a href=\"".api_get_self()."?".api_get_cidreq()."&origin=".(!empty($_GET['origin'])?Security::remove_XSS($_GET['origin']):'')."&action=showhide&id=".$announcement_id."&sec_token=".$stok."\">".
Display::return_icon($image_visibility.'.png', $alt_visibility,'',22)."</a>";
if (api_is_allowed_to_edit(false,true)) {
$modify_icons .= "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=delete&id=".$announcement_id."&sec_token=".$stok."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset))."')) return false;\">".
Display::return_icon('delete.png', get_lang('Delete'),'',22).
"</a>";
}
echo "<tr><th style='text-align:right'>$modify_icons</th></tr>";
}
echo "<tr><td>$content</td></tr>";
//echo "<tr><td class=\"announcements_datum\">" . get_lang('AnnouncementPublishedOn') . " : " .api_convert_and_format_date($result['end_date'], DATE_FORMAT_LONG). "</td></tr>";
echo "<tr><td class=\"announcements_datum\">" . get_lang('LastUpdateDate') . " : " .api_convert_and_format_date($result['insert_date'], DATE_TIME_FORMAT_LONG). "</td></tr>";
@ -157,10 +181,11 @@ class AnnouncementManager {
$sent_to_form = self::sent_to_form($sent_to);
echo Display::tag('td', get_lang('SentTo').' : '.$sent_to_form, array('class'=>'announcements_datum'));
echo "<tr><td>";
$attachment_list = self::get_attachment($announcement_id);
if (count($attachment_list)>0) {
echo "<tr><td>";
$realname=$attachment_list['path'];
$user_filename=$attachment_list['filename'];
$full_file_name = 'download.php?file='.$realname;
@ -168,9 +193,8 @@ class AnnouncementManager {
echo Display::return_icon('attachment.gif',get_lang('Attachment'));
echo '<a href="'.$full_file_name.' "> '.$user_filename.' </a>';
echo '<span class="forum_attach_comment" >'.$attachment_list['comment'].'</span>';
}
echo '</td></tr>';
echo '</td></tr>';
}
echo "</table>";
} else {
api_not_allowed();
@ -923,10 +947,14 @@ class AnnouncementManager {
$output[]= "&nbsp;".get_lang('Everybody');
}
}
if (!empty($output)) {
$output = implode(', ', $output);
return $output;
}
if (!empty($output)) {
$output = array_filter($output);
if (count($output) > 0) {
$output = implode(', ', $output);
}
return $output;
}
}

@ -1246,7 +1246,7 @@ function sent_to_form($sent_to_array) {
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);
$user_info= api_get_user_info($user_id);
$output[] = api_get_person_name($user_info['firstName'], $user_info['lastName']);
}
}
@ -1254,11 +1254,11 @@ function sent_to_form($sent_to_array) {
} 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]);
$user_info = api_get_user_info($sent_to_array['users'][0]);
$output[]= api_get_person_name($user_info['firstName'], $user_info['lastName']);
}
if (is_array($sent_to_array['groups']) and $sent_to_array['groups'][0]!==0) {
$group_id=$sent_to_array['groups'][0];
$group_id = $sent_to_array['groups'][0];
$output[]= $group_names[$group_id]['name'];
}
if (is_array($sent_to_array['groups']) and $sent_to_array['groups'][0]==0) {
@ -1266,8 +1266,11 @@ function sent_to_form($sent_to_array) {
}
}
if (!empty($output)) {
$output = implode(', ', $output);
if (!empty($output)) {
$output = array_filter($output);
if (count($output) > 0) {
$output = implode(', ', $output);
}
return $output;
}
}
@ -2287,8 +2290,6 @@ function display_one_agenda_item($agenda_id) {
echo "<table id=\"data_table\" class=\"data_table\">";
// DISPLAY : the icon, title, destinees of the item
$myrow["start_date"] = api_get_local_time($myrow["start_date"]);
// highlight: if a date in the small calendar is clicked we highlight the relevant items
@ -2320,19 +2321,10 @@ function display_one_agenda_item($agenda_id) {
if ($myrow['to_group_id']!=='0') {
echo Display::return_icon('group.png','&nbsp;','',22);
}
//if ($myrow['visibility']==1) {
echo ' '.$myrow['title'];
echo "</h2>";
echo "</h2>";
echo "<tr>";
// the message has been sent to
echo "<th>".get_lang("SentTo").": ";
$sent_to=sent_to(TOOL_CALENDAR_EVENT, $myrow["ref"]);
$sent_to_form=sent_to_form($sent_to);
echo $sent_to_form;
echo "</th>";
if (api_is_allowed_to_edit(false,true)) {
if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $myrow['id']))) {
@ -2342,7 +2334,7 @@ function display_one_agenda_item($agenda_id) {
$export_icon_low = '../img/export_low_fade.png';
$export_icon_high = '../img/export_high_fade.png';
echo '<th>';
echo '<th style="text-align:right">';
if (!$repeat && api_is_allowed_to_edit(false,true)) {
// edit
$mylink = api_get_self()."?".api_get_cidreq()."&amp;origin=".Security::remove_XSS($_GET['origin'])."&amp;id=".$myrow['id'];
@ -2403,10 +2395,11 @@ function display_one_agenda_item($agenda_id) {
echo $content;
echo '</td></tr>';
echo '<tr class="row_even" ><td colspan="2">';
$attachment_list = get_attachment($agenda_id);
if (!empty($attachment_list)) {
echo '<tr class="row_even"><td colspan="2">';
$realname=$attachment_list['path'];
$user_filename=$attachment_list['filename'];
$full_file_name = 'download.php?file='.$realname;
@ -2415,24 +2408,30 @@ function display_one_agenda_item($agenda_id) {
if (api_is_allowed_to_edit()) {
echo '&nbsp;&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;origin='.Security::remove_XSS($_GET['origin']).'&amp;action=delete_attach&amp;id_attach='.$attachment_list['id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.png',get_lang('Delete'),'',22).'</a><br />';
}
echo '<br /><span class="forum_attach_comment" >'.$attachment_list['comment'].'</span>';
echo '<br /><span class="forum_attach_comment" >'.$attachment_list['comment'].'</span>';
echo '</td></tr>';
}
echo '</td></tr>';
// the message has been sent to
echo '<tr>';
echo "<td class='announcements_datum'>".get_lang("SentTo").": ";
$sent_to=sent_to(TOOL_CALENDAR_EVENT, $myrow["ref"]);
$sent_to_form=sent_to_form($sent_to);
echo $sent_to_form;
echo "</td></tr>";
if ($repeat) {
echo '<tr>';
echo '<td colspan="2">';
echo get_lang('RepeatedEvent').' <a href="',api_get_self(),'?',api_get_cidreq(),'&agenda_id=',$repeat_id,'" alt="',get_lang('RepeatedEventViewOriginalEvent'),'">',get_lang('RepeatedEventViewOriginalEvent'),'</a>';
echo '</td>';
echo '</tr>';
}
}
/*--------------------------------------------------
DISPLAY: the added resources
--------------------------------------------------*/
/* DISPLAY: the added resources */
if (check_added_resources("Agenda", $myrow["id"])) {
echo "<tr><td colspan='3'>";
echo "<i>".get_lang("AddedResources")."</i><br/>";
@ -2451,8 +2450,6 @@ function display_one_agenda_item($agenda_id) {
}
/**
* Show the form for adding a new agenda item. This is the same function that is used whenever we are editing an
* agenda item. When the id parameter is empty (default behaviour), then we show an empty form, else we are editing and

Loading…
Cancel
Save