Fix function params see #8144

ofaj
jmontoya 9 years ago
parent c220189ee8
commit 7aa819cf0e
  1. 14
      main/announcements/announcements.php
  2. 4
      main/inc/lib/AnnouncementManager.php
  3. 1
      main/inc/lib/agenda.lib.php

@ -51,6 +51,7 @@ $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$_course = api_get_course_info_by_id($course_id); $_course = api_get_course_info_by_id($course_id);
$group_id = api_get_group_id(); $group_id = api_get_group_id();
$sessionId = api_get_session_id();
api_protect_course_group(GroupManager::GROUP_TOOL_ANNOUNCEMENT); api_protect_course_group(GroupManager::GROUP_TOOL_ANNOUNCEMENT);
@ -142,7 +143,7 @@ switch ($action) {
); );
$searchForm->addElement('text', 'keyword', get_lang('Title')); $searchForm->addElement('text', 'keyword', get_lang('Title'));
$users = CourseManager::get_user_list_from_course_code(api_get_course_id(), api_get_session_id()); $users = CourseManager::get_user_list_from_course_code(api_get_course_id(), $sessionId);
$userList = array('' => ''); $userList = array('' => '');
if (!empty($users)) { if (!empty($users)) {
foreach ($users as $user) { foreach ($users as $user) {
@ -270,7 +271,7 @@ switch ($action) {
case 'delete': case 'delete':
/* Delete announcement */ /* Delete announcement */
$id = intval($_GET['id']); $id = intval($_GET['id']);
if (api_get_session_id() != 0 && api_is_allowed_to_session_edit(false, true) == false) { if ($sessionId != 0 && api_is_allowed_to_session_edit(false, true) == false) {
api_not_allowed(); api_not_allowed();
} }
@ -302,7 +303,7 @@ switch ($action) {
case 'showhide': case 'showhide':
if (!isset($_GET['isStudentView']) || $_GET['isStudentView'] != 'false') { if (!isset($_GET['isStudentView']) || $_GET['isStudentView'] != 'false') {
if (isset($_GET['id']) && $_GET['id']) { if (isset($_GET['id']) && $_GET['id']) {
if (api_get_session_id() != 0 && if ($sessionId != 0 &&
api_is_allowed_to_session_edit(false, true) == false api_is_allowed_to_session_edit(false, true) == false
) { ) {
api_not_allowed(); api_not_allowed();
@ -326,7 +327,7 @@ switch ($action) {
break; break;
case 'add': case 'add':
case 'modify': case 'modify':
if (api_get_session_id() != 0 && if ($sessionId != 0 &&
api_is_allowed_to_session_edit(false, true) == false api_is_allowed_to_session_edit(false, true) == false
) { ) {
api_not_allowed(true); api_not_allowed(true);
@ -371,7 +372,7 @@ switch ($action) {
$to = Tracking:: getInactiveStudentsInCourse( $to = Tracking:: getInactiveStudentsInCourse(
api_get_course_int_id(), api_get_course_int_id(),
$since, $since,
api_get_session_id() $sessionId
); );
// setting the variables for the form elements: the users who need to receive the message // setting the variables for the form elements: the users who need to receive the message
foreach ($to as &$user) { foreach ($to as &$user) {
@ -473,7 +474,7 @@ switch ($action) {
$form->addElement('textarea', 'file_comment', get_lang('FileComment')); $form->addElement('textarea', 'file_comment', get_lang('FileComment'));
$form->addElement('hidden', 'sec_token', $stok); $form->addElement('hidden', 'sec_token', $stok);
if (api_get_session_id() == 0) { if (empty($sessionId)) {
$form->addCheckBox('send_to_users_in_session', null, get_lang('SendToUsersInSessions')); $form->addCheckBox('send_to_users_in_session', null, get_lang('SendToUsersInSessions'));
} }
@ -533,6 +534,7 @@ switch ($action) {
$data['users'], $data['users'],
$file, $file,
$file_comment, $file_comment,
null,
$sendToUsersInSession $sendToUsersInSession
); );
} else { } else {

@ -386,7 +386,6 @@ class AnnouncementManager
if (empty($last_id)) { if (empty($last_id)) {
return false; return false;
} else { } else {
$sql = "UPDATE $tbl_announcement SET id = iid WHERE iid = $last_id"; $sql = "UPDATE $tbl_announcement SET id = iid WHERE iid = $last_id";
Database::query($sql); Database::query($sql);
@ -399,7 +398,6 @@ class AnnouncementManager
} }
// store in item_property (first the groups, then the users // store in item_property (first the groups, then the users
if (empty($sentTo) || !empty($sentTo) && if (empty($sentTo) || !empty($sentTo) &&
isset($sentTo[0]) && $sentTo[0] == 'everyone' isset($sentTo[0]) && $sentTo[0] == 'everyone'
) { ) {
@ -460,6 +458,8 @@ class AnnouncementManager
* @param $to_users * @param $to_users
* @param array $file * @param array $file
* @param string $file_comment * @param string $file_comment
* @param bool $sendToUsersInSession
*
* @return bool|int * @return bool|int
*/ */
public static function add_group_announcement( public static function add_group_announcement(

@ -2150,7 +2150,6 @@ class Agenda
); );
} }
if ($id) { if ($id) {
$form->addButtonUpdate(get_lang('ModifyEvent')); $form->addButtonUpdate(get_lang('ModifyEvent'));
} else { } else {

Loading…
Cancel
Save