Minor - UI + query fixes in announcements and groups

skala
Julio Montoya 13 years ago
parent f4dbc099bf
commit b2240f255b
  1. 11
      main/announcements/announcements.inc.php
  2. 13
      main/announcements/announcements.php
  3. 3
      main/inc/lib/groupmanager.lib.php

@ -60,10 +60,11 @@ class AnnouncementManager {
$sql="SELECT DISTINCT announcement.id, announcement.title, announcement.content
FROM $tbl_announcement announcement, $tbl_item_property toolitemproperties
WHERE announcement.id = toolitemproperties.ref
AND toolitemproperties.tool='announcement'
AND announcement.session_id = '$session_id' AND
c_id = $course_id
WHERE announcement.id = toolitemproperties.ref AND
toolitemproperties.tool='announcement' AND
announcement.session_id = '$session_id' AND
announcement.c_id = $course_id AND
toolitemproperties.c_id = $course_id
ORDER BY display_order DESC";
$rs = Database::query($sql);
$num_rows = Database::num_rows($rs);
@ -112,6 +113,7 @@ class AnnouncementManager {
public static function delete_all_announcements($_course) {
$announcements = self::get_all_annoucement_by_course($_course, api_get_session_id());
foreach ($announcements as $annon) {
api_item_property_update($_course, TOOL_ANNOUNCEMENT, $annon['id'], 'delete', api_get_user_id());
}
@ -570,7 +572,6 @@ class AnnouncementManager {
echo '<option value="'.$user['user_id'].'">'.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'.'</option>';
}
echo '</select>';
echo "</td>";
// the buttons for adding or removing groups/users

@ -780,10 +780,11 @@ if ($display_form) {
($email_ann=='1' || !empty($surveyid))?$checked='checked':$checked='';
echo '<div class="row">
<div class="label">
<input class="checkbox" type="checkbox" value="1" name="email_ann" '.$checked.'>
</div>
<div class="formw">'.
get_lang('EmailOption').': '.get_lang('MyGroup').'&nbsp;&nbsp;<a href="#" onclick="if(document.getElementById(\'recipient_list\').style.display==\'none\') document.getElementById(\'recipient_list\').style.display=\'block\'; else document.getElementById(\'recipient_list\').style.display=\'none\';">'.get_lang('ModifyRecipientList').'</a>';
<div class="formw">
<input class="checkbox" type="checkbox" value="1" name="email_ann" '.$checked.'>
'.get_lang('EmailOption').': '.get_lang('MyGroup').'&nbsp;&nbsp;
<a href="#" onclick="if(document.getElementById(\'recipient_list\').style.display==\'none\') document.getElementById(\'recipient_list\').style.display=\'block\'; else document.getElementById(\'recipient_list\').style.display=\'none\';">'.get_lang('ModifyRecipientList').'</a>';
AnnouncementManager::show_to_form_group($_SESSION['toolgroup']);
echo '</div></div>';
}
@ -833,9 +834,10 @@ if ($display_form) {
echo ' <div class="row">
<div class="label">
<a href="javascript://" onclick="return plus_attachment();"><span id="plus"><img style="vertical-align:middle;" src="../img/div_show.gif" alt="" />&nbsp;'.get_lang('AddAnAttachment').'</span></a>
</div>
<div class="formw">
<a href="javascript://" onclick="return plus_attachment();"><span id="plus"><img style="vertical-align:middle;" src="../img/div_show.gif" alt="" />&nbsp;'.get_lang('AddAnAttachment').'</span></a>
<br />
<table id="options" style="display: none;">
<tr>
<td colspan="2">
@ -928,7 +930,7 @@ if ($display_announcement_list) {
ORDER BY display_order DESC";
}
} elseif (api_get_group_id() !=0 ) {
} elseif (api_get_group_id() != 0 ) {
// A.2. you are a course admin with a GROUP filter
// => see only the messages of this specific group
$sql="SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date
@ -976,7 +978,6 @@ if ($display_announcement_list) {
}
}
} else {
//STUDENT
if (is_array($group_memberships) && count($group_memberships)>0) {

@ -1037,7 +1037,7 @@ class GroupManager {
$group_id = Database::escape_string($group_id);
$course_id = api_get_course_int_id();
$sql = "SELECT ug.id, u.user_id, u.lastname, u.firstname, u.email
$sql = "SELECT ug.id, u.user_id, u.lastname, u.firstname, u.email, u.username
FROM ".$table_user." u, ".$table_group_user." ug
WHERE ug.c_id = $course_id AND
ug.group_id='".$group_id."' AND
@ -1049,6 +1049,7 @@ class GroupManager {
$member['firstname'] = $user->firstname;
$member['lastname'] = $user->lastname;
$member['email'] = $user->email;
$member['username'] = $user->username;
$users[] = $member;
}
return $users;

Loading…
Cancel
Save