|
@@ -216,8 +216,8 @@ discard block |
|
|
block discarded – undo |
|
216
|
216
|
announcement.id = '$announcement_id' AND |
|
217
|
217
|
toolitemproperties.tool='announcement' AND |
|
218
|
218
|
( |
|
219
|
|
- toolitemproperties.to_user_id='" . api_get_user_id() . "' OR |
|
220
|
|
- toolitemproperties.to_group_id IN ('0', '" . implode("', '", $group_list) . "') OR |
|
|
219
|
+ toolitemproperties.to_user_id='".api_get_user_id()."' OR |
|
|
220
|
+ toolitemproperties.to_group_id IN ('0', '" . implode("', '", $group_list)."') OR |
|
221
|
221
|
toolitemproperties.to_group_id IS NULL |
|
222
|
222
|
) AND |
|
223
|
223
|
toolitemproperties.visibility='1' AND |
|
@@ -246,13 +246,13 @@ discard block |
|
|
block discarded – undo |
|
246
|
246
|
$title = $result['title']; |
|
247
|
247
|
$content = $result['content']; |
|
248
|
248
|
$html .= "<table height=\"100\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" class=\"data_table\">"; |
|
249
|
|
- $html .= "<tr><td><h2>" . $title . "</h2></td></tr>"; |
|
|
249
|
+ $html .= "<tr><td><h2>".$title."</h2></td></tr>"; |
|
250
|
250
|
|
|
251
|
251
|
if (api_is_allowed_to_edit(false, true) || |
|
252
|
252
|
(api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous()) |
|
253
|
253
|
) { |
|
254
|
|
- $modify_icons = "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&action=modify&id=" . $announcement_id . "\">" . |
|
255
|
|
- Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . "</a>"; |
|
|
254
|
+ $modify_icons = "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=modify&id=".$announcement_id."\">". |
|
|
255
|
+ Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>"; |
|
256
|
256
|
if ($result['visibility'] == 1) { |
|
257
|
257
|
$image_visibility = "visible"; |
|
258
|
258
|
$alt_visibility = get_lang('Hide'); |
|
@@ -262,12 +262,12 @@ discard block |
|
|
block discarded – undo |
|
262
|
262
|
} |
|
263
|
263
|
global $stok; |
|
264
|
264
|
|
|
265
|
|
- $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 . "\">" . |
|
266
|
|
- Display::return_icon($image_visibility . '.png', $alt_visibility, '', ICON_SIZE_SMALL) . "</a>"; |
|
|
265
|
+ $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."\">". |
|
|
266
|
+ Display::return_icon($image_visibility.'.png', $alt_visibility, '', ICON_SIZE_SMALL)."</a>"; |
|
267
|
267
|
|
|
268
|
268
|
if (api_is_allowed_to_edit(false, true)) { |
|
269
|
|
- $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;\">" . |
|
270
|
|
- Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . |
|
|
269
|
+ $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;\">". |
|
|
270
|
+ Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL). |
|
271
|
271
|
"</a>"; |
|
272
|
272
|
} |
|
273
|
273
|
$html .= "<tr><th style='text-align:right'>$modify_icons</th></tr>"; |
|
@@ -276,7 +276,7 @@ discard block |
|
|
block discarded – undo |
|
276
|
276
|
$content = self::parse_content($result['to_user_id'], $content, api_get_course_id(), api_get_session_id()); |
|
277
|
277
|
|
|
278
|
278
|
$html .= "<tr><td>$content</td></tr>"; |
|
279
|
|
- $html .= "<tr><td class=\"announcements_datum\">" . get_lang('LastUpdateDate') . " : " . api_convert_and_format_date($result['insert_date'], DATE_TIME_FORMAT_LONG) . "</td></tr>"; |
|
|
279
|
+ $html .= "<tr><td class=\"announcements_datum\">".get_lang('LastUpdateDate')." : ".api_convert_and_format_date($result['insert_date'], DATE_TIME_FORMAT_LONG)."</td></tr>"; |
|
280
|
280
|
|
|
281
|
281
|
// User or group icon |
|
282
|
282
|
$sent_to_icon = ''; |
|
@@ -288,7 +288,7 @@ discard block |
|
|
block discarded – undo |
|
288
|
288
|
$sent_to_form = self::sent_to_form($sent_to); |
|
289
|
289
|
$html .= Display::tag( |
|
290
|
290
|
'td', |
|
291
|
|
- get_lang('SentTo') . ' : ' . $sent_to_form, |
|
|
291
|
+ get_lang('SentTo').' : '.$sent_to_form, |
|
292
|
292
|
array('class' => 'announcements_datum') |
|
293
|
293
|
); |
|
294
|
294
|
} |
|
@@ -298,15 +298,15 @@ discard block |
|
|
block discarded – undo |
|
298
|
298
|
$html .= "<tr><td>"; |
|
299
|
299
|
$realname = $attachment_list['path']; |
|
300
|
300
|
$user_filename = $attachment_list['filename']; |
|
301
|
|
- $full_file_name = 'download.php?'.api_get_cidreq().'&file=' . $realname; |
|
|
301
|
+ $full_file_name = 'download.php?'.api_get_cidreq().'&file='.$realname; |
|
302
|
302
|
$html .= '<br/>'; |
|
303
|
303
|
$html .= Display::return_icon('attachment.gif', get_lang('Attachment')); |
|
304
|
|
- $html .= '<a href="' . $full_file_name . ' "> ' . $user_filename . ' </a>'; |
|
305
|
|
- $html .= ' - <span class="forum_attach_comment" >' . $attachment_list['comment'] . '</span>'; |
|
|
304
|
+ $html .= '<a href="'.$full_file_name.' "> '.$user_filename.' </a>'; |
|
|
305
|
+ $html .= ' - <span class="forum_attach_comment" >'.$attachment_list['comment'].'</span>'; |
|
306
|
306
|
if (api_is_allowed_to_edit(false, true)) { |
|
307
|
307
|
$html .= Display::url( |
|
308
|
308
|
Display::return_icon('delete.png', get_lang('Delete'), '', 16), |
|
309
|
|
- api_get_self() . "?" . api_get_cidreq() . "&action=delete_attachment&id_attach=" . $attachment_list['id'] . "&sec_token=" . $stok |
|
|
309
|
+ api_get_self()."?".api_get_cidreq()."&action=delete_attachment&id_attach=".$attachment_list['id']."&sec_token=".$stok |
|
310
|
310
|
); |
|
311
|
311
|
} |
|
312
|
312
|
$html .= '</td></tr>'; |
|
@@ -334,7 +334,7 @@ discard block |
|
|
block discarded – undo |
|
334
|
334
|
$order = 0; |
|
335
|
335
|
if (Database::num_rows($res_max)) { |
|
336
|
336
|
$row_max = Database::fetch_array($res_max); |
|
337
|
|
- $order = intval($row_max[0])+1; |
|
|
337
|
+ $order = intval($row_max[0]) + 1; |
|
338
|
338
|
} |
|
339
|
339
|
|
|
340
|
340
|
return $order; |
|
@@ -759,8 +759,8 @@ discard block |
|
|
block discarded – undo |
|
759
|
759
|
$result = array(); |
|
760
|
760
|
if ($num_rows > 0) { |
|
761
|
761
|
while ($myrow = Database::fetch_array($rs)) { |
|
762
|
|
- $content.= '<strong>' . $myrow['title'] . '</strong><br /><br />'; |
|
763
|
|
- $content.= $myrow['content']; |
|
|
762
|
+ $content .= '<strong>'.$myrow['title'].'</strong><br /><br />'; |
|
|
763
|
+ $content .= $myrow['content']; |
|
764
|
764
|
$i++; |
|
765
|
765
|
} |
|
766
|
766
|
$result['content'] = $content; |
|
@@ -791,7 +791,7 @@ discard block |
|
|
block discarded – undo |
|
791
|
791
|
echo "<table id=\"recipient_list\" >"; |
|
792
|
792
|
echo '<tr>'; |
|
793
|
793
|
echo '<td>'; |
|
794
|
|
- echo '<label><input type="checkbox" id="send_to_all_users">'.get_lang('SendToAllUsers') . "</label>"; |
|
|
794
|
+ echo '<label><input type="checkbox" id="send_to_all_users">'.get_lang('SendToAllUsers')."</label>"; |
|
795
|
795
|
echo "</td>"; |
|
796
|
796
|
echo '</tr>'; |
|
797
|
797
|
echo '<tr>'; |
|
@@ -799,7 +799,7 @@ discard block |
|
|
block discarded – undo |
|
799
|
799
|
|
|
800
|
800
|
// the form containing all the groups and all the users of the course |
|
801
|
801
|
echo '<td>'; |
|
802
|
|
- echo "<strong>" . get_lang('Users') . "</strong><br />"; |
|
|
802
|
+ echo "<strong>".get_lang('Users')."</strong><br />"; |
|
803
|
803
|
|
|
804
|
804
|
self::construct_not_selected_select_form($groupList, $userList, $to_already_selected); |
|
805
|
805
|
echo "</td>"; |
|
@@ -814,7 +814,7 @@ discard block |
|
|
block discarded – undo |
|
814
|
814
|
echo "<td>"; |
|
815
|
815
|
|
|
816
|
816
|
// the form containing the selected groups and users |
|
817
|
|
- echo "<strong>" . get_lang('DestinationUsers') . "</strong><br />"; |
|
|
817
|
+ echo "<strong>".get_lang('DestinationUsers')."</strong><br />"; |
|
818
|
818
|
self::construct_selected_select_form($groupList, $userList, $to_already_selected); |
|
819
|
819
|
echo "</td>"; |
|
820
|
820
|
echo "</tr>"; |
|
@@ -832,8 +832,8 @@ discard block |
|
|
block discarded – undo |
|
832
|
832
|
echo "<select id=\"not_selected_form\" name=\"not_selected_form[]\" size=5 style=\"width:200px\" multiple>"; |
|
833
|
833
|
$group_users = GroupManager::getStudentsAndTutors($group_id); |
|
834
|
834
|
foreach ($group_users as $user) { |
|
835
|
|
- echo '<option value="' . $user['user_id'] . '" title="' . sprintf(get_lang('LoginX'), $user['username']) . '" >' . |
|
836
|
|
- api_get_person_name($user['firstname'], $user['lastname']) . |
|
|
835
|
+ echo '<option value="'.$user['user_id'].'" title="'.sprintf(get_lang('LoginX'), $user['username']).'" >'. |
|
|
836
|
+ api_get_person_name($user['firstname'], $user['lastname']). |
|
837
|
837
|
'</option>'; |
|
838
|
838
|
} |
|
839
|
839
|
echo '</select>'; |
|
@@ -871,12 +871,12 @@ discard block |
|
|
block discarded – undo |
|
871
|
871
|
if (!empty($groupList)) { |
|
872
|
872
|
foreach ($groupList as $this_group) { |
|
873
|
873
|
if (is_array($to_already_selected)) { |
|
874
|
|
- if (!in_array("GROUP:" . $this_group['id'], $to_already_selected)) { |
|
|
874
|
+ if (!in_array("GROUP:".$this_group['id'], $to_already_selected)) { |
|
875
|
875
|
// $to_already_selected is the array containing the groups (and users) that are already selected |
|
876
|
|
- $user_label = ($this_group['userNb'] > 0) ? get_lang('Users') : get_lang('LowerCaseUser') ; |
|
877
|
|
- $user_disabled = ($this_group['userNb'] > 0) ? "" : "disabled=disabled" ; |
|
878
|
|
- echo "<option $user_disabled value=\"GROUP:" . $this_group['id'] . "\">", |
|
879
|
|
- "G: ", $this_group['name'], " - " . $this_group['userNb'] . " " . $user_label . |
|
|
876
|
+ $user_label = ($this_group['userNb'] > 0) ? get_lang('Users') : get_lang('LowerCaseUser'); |
|
|
877
|
+ $user_disabled = ($this_group['userNb'] > 0) ? "" : "disabled=disabled"; |
|
|
878
|
+ echo "<option $user_disabled value=\"GROUP:".$this_group['id']."\">", |
|
|
879
|
+ "G: ", $this_group['name'], " - ".$this_group['userNb']." ".$user_label. |
|
880
|
880
|
"</option>"; |
|
881
|
881
|
} |
|
882
|
882
|
} |
|
@@ -890,15 +890,15 @@ discard block |
|
|
block discarded – undo |
|
890
|
890
|
if (!empty($userList)) { |
|
891
|
891
|
foreach ($userList as $user) { |
|
892
|
892
|
if (is_array($to_already_selected)) { |
|
893
|
|
- if (!in_array("USER:" . $user['user_id'], $to_already_selected)) { |
|
|
893
|
+ if (!in_array("USER:".$user['user_id'], $to_already_selected)) { |
|
894
|
894
|
// $to_already_selected is the array containing the users (and groups) that are already selected |
|
895
|
|
- echo "<option value=\"USER:" . $user['user_id'] . "\" title='" . sprintf(get_lang('LoginX'), $user['username']) . "'>", |
|
|
895
|
+ echo "<option value=\"USER:".$user['user_id']."\" title='".sprintf(get_lang('LoginX'), $user['username'])."'>", |
|
896
|
896
|
"", api_get_person_name($user['firstname'], $user['lastname']), |
|
897
|
897
|
"</option>"; |
|
898
|
898
|
|
|
899
|
899
|
if (isset($user['drh_list']) && !empty($user['drh_list'])) { |
|
900
|
900
|
foreach ($user['drh_list'] as $drh) { |
|
901
|
|
- echo "<option value=\"USER:" . $drh['user_id'] . "\" title='" . sprintf(get_lang('LoginX'), $drh['username']) . "'> ", |
|
|
901
|
+ echo "<option value=\"USER:".$drh['user_id']."\" title='".sprintf(get_lang('LoginX'), $drh['username'])."'> ", |
|
902
|
902
|
"", api_get_person_name($drh['firstname'], $drh['lastname']), |
|
903
|
903
|
"</option>"; |
|
904
|
904
|
} |
|
@@ -930,16 +930,16 @@ discard block |
|
|
block discarded – undo |
|
930
|
930
|
foreach ($to_already_selected as $groupuser) { |
|
931
|
931
|
list($type, $id) = explode(":", $groupuser); |
|
932
|
932
|
if ($type == "GROUP") { |
|
933
|
|
- echo "<option value=\"" . $groupuser . "\">G: " . $ref_array_groups[$id]['name'] . "</option>"; |
|
|
933
|
+ echo "<option value=\"".$groupuser."\">G: ".$ref_array_groups[$id]['name']."</option>"; |
|
934
|
934
|
} else { |
|
935
|
935
|
foreach ($ref_array_users as $key => $value) { |
|
936
|
936
|
if ($value['user_id'] == $id) { |
|
937
|
|
- echo "<option value=\"" . $groupuser . "\" title='" . sprintf(get_lang('LoginX'), $value['username']) . "'>" . |
|
938
|
|
- api_get_person_name($value['firstname'], $value['lastname']) . "</option>"; |
|
|
937
|
+ echo "<option value=\"".$groupuser."\" title='".sprintf(get_lang('LoginX'), $value['username'])."'>". |
|
|
938
|
+ api_get_person_name($value['firstname'], $value['lastname'])."</option>"; |
|
939
|
939
|
|
|
940
|
940
|
if (isset($value['drh_list']) && !empty($value['drh_list'])) { |
|
941
|
941
|
foreach ($value['drh_list'] as $drh) { |
|
942
|
|
- echo "<option value=\"USER:" . $drh['user_id'] . "\" title='" . sprintf(get_lang('LoginX'), $drh['username']) . "'> ", |
|
|
942
|
+ echo "<option value=\"USER:".$drh['user_id']."\" title='".sprintf(get_lang('LoginX'), $drh['username'])."'> ", |
|
943
|
943
|
"", api_get_person_name($drh['firstname'], $drh['lastname']), |
|
944
|
944
|
"</option>"; |
|
945
|
945
|
} |
|
@@ -955,17 +955,17 @@ discard block |
|
|
block discarded – undo |
|
955
|
955
|
if (is_array($ref_array_groups)) { |
|
956
|
956
|
foreach ($ref_array_groups as $this_group) { |
|
957
|
957
|
//api_display_normal_message("group " . $thisGroup[id] . $thisGroup[name]); |
|
958
|
|
- if (!is_array($to_already_selected) || !in_array("GROUP:" . $this_group['id'], $to_already_selected)) { // $to_already_selected is the array containing the groups (and users) that are already selected |
|
959
|
|
- echo "<option value=\"GROUP:" . $this_group['id'] . "\">", |
|
960
|
|
- "G: ", $this_group['name'], " – " . $this_group['userNb'] . " " . get_lang('Users') . |
|
|
958
|
+ if (!is_array($to_already_selected) || !in_array("GROUP:".$this_group['id'], $to_already_selected)) { // $to_already_selected is the array containing the groups (and users) that are already selected |
|
|
959
|
+ echo "<option value=\"GROUP:".$this_group['id']."\">", |
|
|
960
|
+ "G: ", $this_group['name'], " – ".$this_group['userNb']." ".get_lang('Users'). |
|
961
|
961
|
"</option>"; |
|
962
|
962
|
} |
|
963
|
963
|
} |
|
964
|
964
|
} |
|
965
|
965
|
// adding the individual users to the select form |
|
966
|
966
|
foreach ($ref_array_users as $this_user) { |
|
967
|
|
- if (!is_array($to_already_selected) || !in_array("USER:" . $this_user['user_id'], $to_already_selected)) { // $to_already_selected is the array containing the users (and groups) that are already selected |
|
968
|
|
- echo "<option value=\"USER:", $this_user['user_id'], "\" title='" . sprintf(get_lang('LoginX'), $this_user['username']) . "'>", |
|
|
967
|
+ if (!is_array($to_already_selected) || !in_array("USER:".$this_user['user_id'], $to_already_selected)) { // $to_already_selected is the array containing the users (and groups) that are already selected |
|
|
968
|
+ echo "<option value=\"USER:", $this_user['user_id'], "\" title='".sprintf(get_lang('LoginX'), $this_user['username'])."'>", |
|
969
|
969
|
"", api_get_person_name($this_user['firstname'], $this_user['lastname']), |
|
970
|
970
|
"</option>"; |
|
971
|
971
|
} |
|
@@ -1078,14 +1078,14 @@ discard block |
|
|
block discarded – undo |
|
1078
|
1078
|
switch ($to_group) { |
|
1079
|
1079
|
// it was send to one specific user |
|
1080
|
1080
|
case null: |
|
1081
|
|
- $to[] = "USER:" . $row['to_user_id']; |
|
|
1081
|
+ $to[] = "USER:".$row['to_user_id']; |
|
1082
|
1082
|
break; |
|
1083
|
1083
|
// it was sent to everyone |
|
1084
|
1084
|
case 0: |
|
1085
|
1085
|
return "everyone"; |
|
1086
|
1086
|
break; |
|
1087
|
1087
|
default: |
|
1088
|
|
- $to[] = "GROUP:" . $row['to_group_id']; |
|
|
1088
|
+ $to[] = "GROUP:".$row['to_group_id']; |
|
1089
|
1089
|
} |
|
1090
|
1090
|
} |
|
1091
|
1091
|
return $to; |
|
@@ -1166,10 +1166,10 @@ discard block |
|
|
block discarded – undo |
|
1166
|
1166
|
$sent_to_array['groups'][0] !== 0 |
|
1167
|
1167
|
) { |
|
1168
|
1168
|
$group_id = $sent_to_array['groups'][0]; |
|
1169
|
|
- $output[] = " " . $group_names[$group_id]['name']; |
|
|
1169
|
+ $output[] = " ".$group_names[$group_id]['name']; |
|
1170
|
1170
|
} |
|
1171
|
1171
|
if (empty($sent_to_array['groups']) and empty($sent_to_array['users'])) { |
|
1172
|
|
- $output[] = " " . get_lang('Everybody'); |
|
|
1172
|
+ $output[] = " ".get_lang('Everybody'); |
|
1173
|
1173
|
} |
|
1174
|
1174
|
} |
|
1175
|
1175
|
|
|
@@ -1204,7 +1204,7 @@ discard block |
|
|
block discarded – undo |
|
1204
|
1204
|
|
|
1205
|
1205
|
$sql = "SELECT to_group_id, to_user_id |
|
1206
|
1206
|
FROM $tbl_item_property |
|
1207
|
|
- WHERE c_id = $course_id AND tool = '$tool' AND ref=" . $id; |
|
|
1207
|
+ WHERE c_id = $course_id AND tool = '$tool' AND ref=".$id; |
|
1208
|
1208
|
$result = Database::query($sql); |
|
1209
|
1209
|
|
|
1210
|
1210
|
while ($row = Database::fetch_array($result)) { |
|
@@ -1243,8 +1243,8 @@ discard block |
|
|
block discarded – undo |
|
1243
|
1243
|
$announcement_id = intval($announcement_id); |
|
1244
|
1244
|
$course_id = api_get_course_int_id(); |
|
1245
|
1245
|
$row = array(); |
|
1246
|
|
- $sql = 'SELECT id, path, filename, comment FROM ' . $tbl_announcement_attachment . ' |
|
1247
|
|
- WHERE c_id = ' . $course_id . ' AND announcement_id = ' . $announcement_id . ''; |
|
|
1246
|
+ $sql = 'SELECT id, path, filename, comment FROM '.$tbl_announcement_attachment.' |
|
|
1247
|
+ WHERE c_id = ' . $course_id.' AND announcement_id = '.$announcement_id.''; |
|
1248
|
1248
|
$result = Database::query($sql); |
|
1249
|
1249
|
if (Database::num_rows($result) != 0) { |
|
1250
|
1250
|
$row = Database::fetch_array($result, 'ASSOC'); |
|
@@ -1269,9 +1269,9 @@ discard block |
|
|
block discarded – undo |
|
1269
|
1269
|
|
|
1270
|
1270
|
if (is_array($file) && $file['error'] == 0) { |
|
1271
|
1271
|
// TODO: This path is obsolete. The new document repository scheme should be kept in mind here. |
|
1272
|
|
- $courseDir = $_course['path'] . '/upload/announcements'; |
|
|
1272
|
+ $courseDir = $_course['path'].'/upload/announcements'; |
|
1273
|
1273
|
$sys_course_path = api_get_path(SYS_COURSE_PATH); |
|
1274
|
|
- $updir = $sys_course_path . $courseDir; |
|
|
1274
|
+ $updir = $sys_course_path.$courseDir; |
|
1275
|
1275
|
|
|
1276
|
1276
|
// Try to add an extension to the file if it hasn't one |
|
1277
|
1277
|
$new_file_name = add_ext_on_mime(stripslashes($file['name']), $file['type']); |
|
@@ -1283,7 +1283,7 @@ discard block |
|
|
block discarded – undo |
|
1283
|
1283
|
Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension')); |
|
1284
|
1284
|
} else { |
|
1285
|
1285
|
$new_file_name = uniqid(''); |
|
1286
|
|
- $new_path = $updir . '/' . $new_file_name; |
|
|
1286
|
+ $new_path = $updir.'/'.$new_file_name; |
|
1287
|
1287
|
copy($file['tmp_name'], $new_path); |
|
1288
|
1288
|
|
|
1289
|
1289
|
$params = [ |
|
@@ -1324,9 +1324,9 @@ discard block |
|
|
block discarded – undo |
|
1324
|
1324
|
|
|
1325
|
1325
|
if (is_array($file) && $file['error'] == 0) { |
|
1326
|
1326
|
// TODO: This path is obsolete. The new document repository scheme should be kept in mind here. |
|
1327
|
|
- $courseDir = $_course['path'] . '/upload/announcements'; |
|
|
1327
|
+ $courseDir = $_course['path'].'/upload/announcements'; |
|
1328
|
1328
|
$sys_course_path = api_get_path(SYS_COURSE_PATH); |
|
1329
|
|
- $updir = $sys_course_path . $courseDir; |
|
|
1329
|
+ $updir = $sys_course_path.$courseDir; |
|
1330
|
1330
|
|
|
1331
|
1331
|
// Try to add an extension to the file if it hasn't one |
|
1332
|
1332
|
$new_file_name = add_ext_on_mime(stripslashes($file['name']), $file['type']); |
|
@@ -1338,13 +1338,13 @@ discard block |
|
|
block discarded – undo |
|
1338
|
1338
|
Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension')); |
|
1339
|
1339
|
} else { |
|
1340
|
1340
|
$new_file_name = uniqid(''); |
|
1341
|
|
- $new_path = $updir . '/' . $new_file_name; |
|
|
1341
|
+ $new_path = $updir.'/'.$new_file_name; |
|
1342
|
1342
|
@move_uploaded_file($file['tmp_name'], $new_path); |
|
1343
|
1343
|
$safe_file_comment = Database::escape_string($file_comment); |
|
1344
|
1344
|
$safe_file_name = Database::escape_string($file_name); |
|
1345
|
1345
|
$safe_new_file_name = Database::escape_string($new_file_name); |
|
1346
|
1346
|
$id_attach = intval($id_attach); |
|
1347
|
|
- $sql = "UPDATE $tbl_announcement_attachment SET filename = '$safe_file_name', comment = '$safe_file_comment', path = '$safe_new_file_name', size ='" . intval($file['size']) . "' |
|
|
1347
|
+ $sql = "UPDATE $tbl_announcement_attachment SET filename = '$safe_file_name', comment = '$safe_file_comment', path = '$safe_new_file_name', size ='".intval($file['size'])."' |
|
1348
|
1348
|
WHERE c_id = $course_id AND id = '$id_attach'"; |
|
1349
|
1349
|
$result = Database::query($sql); |
|
1350
|
1350
|
if ($result === false) { |
|
@@ -1446,7 +1446,7 @@ discard block |
|
|
block discarded – undo |
|
1446
|
1446
|
|
|
1447
|
1447
|
//if (!empty($user_id)) { |
|
1448
|
1448
|
if (0) { |
|
1449
|
|
- if (is_array($group_memberships) && count($group_memberships) > 0 ) { |
|
|
1449
|
+ if (is_array($group_memberships) && count($group_memberships) > 0) { |
|
1450
|
1450
|
$sql = "SELECT $select |
|
1451
|
1451
|
FROM $tbl_announcement announcement, $tbl_item_property ip |
|
1452
|
1452
|
WHERE |
|
@@ -1648,8 +1648,8 @@ discard block |
|
|
block discarded – undo |
|
1648
|
1648
|
if ($myrow['email_sent'] == '1') { |
|
1649
|
1649
|
$sent_to_icon = ' '.Display::return_icon('email.gif', get_lang('AnnounceSentByEmail')); |
|
1650
|
1650
|
} |
|
1651
|
|
- $groupReference = ($myrow['to_group_id'] > 0) ? ' <span class="label label-info">' . get_lang('Group') . '</span> ' : '' ; |
|
1652
|
|
- $title = $myrow['title'] . $groupReference . $sent_to_icon; |
|
|
1651
|
+ $groupReference = ($myrow['to_group_id'] > 0) ? ' <span class="label label-info">'.get_lang('Group').'</span> ' : ''; |
|
|
1652
|
+ $title = $myrow['title'].$groupReference.$sent_to_icon; |
|
1653
|
1653
|
$item_visibility = api_get_item_visibility($_course, TOOL_ANNOUNCEMENT, $myrow['id'], $session_id); |
|
1654
|
1654
|
$myrow['visibility'] = $item_visibility; |
|
1655
|
1655
|
|
|
@@ -1657,8 +1657,8 @@ discard block |
|
|
block discarded – undo |
|
1657
|
1657
|
$attachment_list = AnnouncementManager::get_attachment($myrow['id']); |
|
1658
|
1658
|
|
|
1659
|
1659
|
$attachment_icon = ''; |
|
1660
|
|
- if (count($attachment_list)>0) { |
|
1661
|
|
- $attachment_icon = ' '.Display::return_icon('attachment.gif',get_lang('Attachment')); |
|
|
1660
|
+ if (count($attachment_list) > 0) { |
|
|
1661
|
+ $attachment_icon = ' '.Display::return_icon('attachment.gif', get_lang('Attachment')); |
|
1662
|
1662
|
} |
|
1663
|
1663
|
|
|
1664
|
1664
|
/* TITLE */ |
|
@@ -1677,16 +1677,16 @@ discard block |
|
|
block discarded – undo |
|
1677
|
1677
|
|| (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous()) |
|
1678
|
1678
|
) { |
|
1679
|
1679
|
$modify_icons = "<a href=\"".$actionUrl."&action=modify&id=".$myrow['id']."\">". |
|
1680
|
|
- Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL)."</a>"; |
|
1681
|
|
- if ($myrow['visibility']==1) { |
|
1682
|
|
- $image_visibility="visible"; |
|
1683
|
|
- $alt_visibility=get_lang('Hide'); |
|
|
1680
|
+ Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>"; |
|
|
1681
|
+ if ($myrow['visibility'] == 1) { |
|
|
1682
|
+ $image_visibility = "visible"; |
|
|
1683
|
+ $alt_visibility = get_lang('Hide'); |
|
1684
|
1684
|
} else { |
|
1685
|
|
- $image_visibility="invisible"; |
|
1686
|
|
- $alt_visibility=get_lang('Visible'); |
|
|
1685
|
+ $image_visibility = "invisible"; |
|
|
1686
|
+ $alt_visibility = get_lang('Visible'); |
|
1687
|
1687
|
} |
|
1688
|
|
- $modify_icons .= "<a href=\"".$actionUrl."&origin=".$origin."&action=showhide&id=".$myrow['id']."&sec_token=".$stok."\">". |
|
1689
|
|
- Display::return_icon($image_visibility.'.png', $alt_visibility,'',ICON_SIZE_SMALL)."</a>"; |
|
|
1688
|
+ $modify_icons .= "<a href=\"".$actionUrl."&origin=".$origin."&action=showhide&id=".$myrow['id']."&sec_token=".$stok."\">". |
|
|
1689
|
+ Display::return_icon($image_visibility.'.png', $alt_visibility, '', ICON_SIZE_SMALL)."</a>"; |
|
1690
|
1690
|
|
|
1691
|
1691
|
// DISPLAY MOVE UP COMMAND only if it is not the top announcement |
|
1692
|
1692
|
if ($iterator != 1) { |
|
@@ -1701,12 +1701,12 @@ discard block |
|
|
block discarded – undo |
|
1701
|
1701
|
} else { |
|
1702
|
1702
|
$modify_icons .= Display::return_icon('down_na.gif', get_lang('Down')); |
|
1703
|
1703
|
} |
|
1704
|
|
- if (api_is_allowed_to_edit(false,true)) { |
|
1705
|
|
- $modify_icons .= "<a href=\"".$actionUrl."&action=delete&id=".$myrow['id']."&sec_token=".$stok."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,api_get_system_encoding()))."')) return false;\">". |
|
1706
|
|
- Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL). |
|
|
1704
|
+ if (api_is_allowed_to_edit(false, true)) { |
|
|
1705
|
+ $modify_icons .= "<a href=\"".$actionUrl."&action=delete&id=".$myrow['id']."&sec_token=".$stok."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, api_get_system_encoding()))."')) return false;\">". |
|
|
1706
|
+ Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL). |
|
1707
|
1707
|
"</a>"; |
|
1708
|
1708
|
} |
|
1709
|
|
- $iterator ++; |
|
|
1709
|
+ $iterator++; |
|
1710
|
1710
|
} else { |
|
1711
|
1711
|
$modify_icons = Display::url( |
|
1712
|
1712
|
Display::return_icon('default.png'), |
|
@@ -1736,7 +1736,7 @@ discard block |
|
|
block discarded – undo |
|
1736
|
1736
|
public static function getNumberAnnouncements() |
|
1737
|
1737
|
{ |
|
1738
|
1738
|
// Maximum title messages to display |
|
1739
|
|
- $maximum = '12'; |
|
|
1739
|
+ $maximum = '12'; |
|
1740
|
1740
|
// Database Table Definitions |
|
1741
|
1741
|
$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
1742
|
1742
|
$tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
@@ -1747,7 +1747,7 @@ discard block |
|
|
block discarded – undo |
|
1747
|
1747
|
$userId = api_get_user_id(); |
|
1748
|
1748
|
$condition_session = api_get_session_condition($session_id, true, true, 'announcement.session_id'); |
|
1749
|
1749
|
|
|
1750
|
|
- if (api_is_allowed_to_edit(false,true)) { |
|
|
1750
|
+ if (api_is_allowed_to_edit(false, true)) { |
|
1751
|
1751
|
// check teacher status |
|
1752
|
1752
|
if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') { |
|
1753
|
1753
|
|
|
@@ -1810,7 +1810,7 @@ discard block |
|
|
block discarded – undo |
|
1810
|
1810
|
} |
|
1811
|
1811
|
|
|
1812
|
1812
|
// the user is member of several groups => display personal announcements AND his group announcements AND the general announcements |
|
1813
|
|
- if (is_array($group_memberships) && count($group_memberships)>0) { |
|
|
1813
|
+ if (is_array($group_memberships) && count($group_memberships) > 0) { |
|
1814
|
1814
|
$sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id |
|
1815
|
1815
|
FROM $tbl_announcement announcement, $tbl_item_property ip |
|
1816
|
1816
|
WHERE |
|
@@ -1860,7 +1860,7 @@ discard block |
|
|
block discarded – undo |
|
1860
|
1860
|
} |
|
1861
|
1861
|
|
|
1862
|
1862
|
// the user is not identiefied => show only the general announcements |
|
1863
|
|
- $sql="SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id |
|
|
1863
|
+ $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id |
|
1864
|
1864
|
FROM $tbl_announcement announcement, $tbl_item_property ip |
|
1865
|
1865
|
WHERE |
|
1866
|
1866
|
announcement.c_id = $course_id AND |