$userIdList = array_merge($userIdList, get_class_list_user_id_list($classIdList)); } if (!empty($groupIdList)) { $userIdList = array_merge($userIdList, get_group_list_user_id_list($groupIdList)); } // subject $subject = $_REQUEST['subject']; if (empty($subject)) { $subject .= get_lang('Message from your lecturer'); } // content $body = $_REQUEST['content']; $message = new MessageToSend(claro_get_current_user_id(), $subject, $body); $message->setCourse(claro_get_current_course_id()); $recipient = new UserListRecipient(); $recipient->addUserIdList($userIdList); $recipient->sendMessage($message); $dialogBox = new DialogBox(); $dialogBox->success(get_lang('Message sent')); if ($failure = claro_failure::get_last_failure()) { $dialogBox->warning($failure); } $dialogBox->info('<a href="' . $_SERVER['PHP_SELF'] . '"><< ' . get_lang('Back') . '</a>'); $content .= $dialogBox->render(); } // end cmd exSendMessage } else { /* * Get user list of this course */ $singleUserList = claro_get_course_user_list(claro_get_current_course_id());
/** * Send course creation information by mail to all platform administrators * * @param string creator firstName * @param string creator lastname * @param string creator email */ public function mailAdministratorOnCourseCreation($creatorFirstName, $creatorLastName, $creatorEmail) { $subject = get_lang('Course created : %course_name', array('%course_name' => $this->title)); $categoryCodeList = array(); foreach ($this->categories as $category) { $categoryCodeList[] = $category->name; } $body = nl2br(get_block('blockCourseCreationEmailMessage', array('%date' => claro_html_localised_date(get_locale('dateTimeFormatLong')), '%sitename' => get_conf('siteName'), '%user_firstname' => $creatorFirstName, '%user_lastname' => $creatorLastName, '%user_email' => $creatorEmail, '%course_code' => $this->officialCode, '%course_title' => $this->title, '%course_lecturers' => $this->titular, '%course_email' => $this->email, '%course_categories' => !empty($this->categories) ? implode(', ', $categoryCodeList) : get_lang('No category'), '%course_language' => $this->language, '%course_url' => get_path('rootWeb') . 'claroline/course/index.php?cid=' . claro_htmlspecialchars($this->courseId)))); // Get the concerned senders of the email $mailToUidList = claro_get_uid_of_system_notification_recipient(); if (empty($mailToUidList)) { $mailToUidList = claro_get_uid_of_platform_admin(); } $message = new MessageToSend(claro_get_current_user_id(), $subject, $body); $recipient = new UserListRecipient(); $recipient->addUserIdList($mailToUidList); //$message->sendTo($recipient); $recipient->sendMessage($message); }
/** * Current logged user send a mail to ask course creator status * @param string explanation message * @author Mathieu Laurent <*****@*****.**> */ function profile_send_request_revoquation($explanation, $login, $password) { if (empty($explanation)) { return claro_failure::set_failure('EXPLANATION_EMPTY'); } require_once dirname(__FILE__) . '/../../messaging/lib/message/messagetosend.lib.php'; require_once dirname(__FILE__) . '/../../messaging/lib/recipient/userlistrecipient.lib.php'; $_user = claro_get_current_user_data(); $mailToUidList = claro_get_uid_of_request_admin(); if (empty($mailToUidList)) { $mailToUidList = claro_get_uid_of_platform_admin(); } $requestMessage_Title = get_block('Revocation of %firstname %lastname', array('%firstname' => $_user['firstName'], '%lastname' => $_user['lastName'])); $requestMessage_Content = nl2br(get_block('blockRequestUserRevoquationMail', array('%time' => claro_html_localised_date(get_locale('dateFormatLong')), '%user_id' => claro_get_current_user_id(), '%firstname' => $_user['firstName'], '%lastname' => $_user['lastName'], '%email' => $_user['mail'], '%login' => $login, '%password' => '**********', '%comment' => nl2br($explanation), '%url' => rtrim(get_path('rootWeb'), '/') . '/claroline/admin/admin_profile.php?uidToEdit=' . claro_get_current_user_id()))); $message = new MessageToSend(claro_get_current_user_id(), $requestMessage_Title, $requestMessage_Content); $recipient = new UserListRecipient(); $recipient->addUserIdList($mailToUidList); $recipient->sendMessage($message); return true; }