Example #1
0
 /**
  * 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);
 }
Example #2
0
        if (!empty($classIdList)) {
            $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'] . '">&lt;&lt;&nbsp;' . get_lang('Back') . '</a>');
        $content .= $dialogBox->render();
    }
    // end cmd exSendMessage
} else {
    /*
     * Get user    list of    this course
     */
Example #3
0
                 require_once dirname(__FILE__) . '/../messaging/lib/recipient/userlistrecipient.lib.php';
                 // subject
                 $subject = $_user['firstName'] . ' ' . $_user['lastName'] . ' : ' . get_lang('New submission posted in assignment tool.');
                 if ($assignment->getAssignmentType() == 'GROUP' && isset($_REQUEST['wrkGroup'])) {
                     $authId = $wrkForm['wrkGroup'];
                 } else {
                     $authId = $_REQUEST['authId'];
                 }
                 $url = Url::Contextualize(get_path('rootWeb') . 'claroline/work/user_work.php?authId=' . $authId . '&assigId=' . $assignmentId);
                 // email content
                 $body = get_lang('New submission posted in assignment tool.') . "\n\n" . $_user['firstName'] . ' ' . $_user['lastName'] . "\n" . '<a href="' . claro_htmlspecialchars($url) . '">' . $wrkForm['wrkTitle'] . '</a>' . "\n";
                 $message = new MessageToSend(claro_get_current_user_id(), $subject, $body);
                 // TODO use official code everywhere : $message->setCourse(claro_get_current_course_data('officialCode'));
                 $message->setCourse(claro_get_current_course_id());
                 $message->setTools('CLWRK');
                 $recipient = new UserListRecipient();
                 foreach ($userIdList as $thisUser) {
                     $recipient->addUserId((int) $thisUser['user_id']);
                 }
                 $recipient->sendMessage($message);
             }
         }
         // display flags
         $dispWrkLst = true;
     } else {
         // ask prepare form
         $cmd = "rqSubWrk";
     }
 }
 /*-----------------------------------
             STEP 1 : prepare form
Example #4
0
function trig_topic_notification($topicId)
{
    $tbl_mdb_names = claro_sql_get_main_tbl();
    $tbl_course_user = $tbl_mdb_names['rel_course_user'];
    $tbl_cdb_names = claro_sql_get_course_tbl();
    $tbl_user_notify = $tbl_cdb_names['bb_rel_topic_userstonotify'];
    $sql = "SELECT\n                notif.user_id\n            FROM\n                `" . $tbl_user_notify . "` AS notif\n            JOIN\n                `" . $tbl_course_user . "` AS cu\n            ON\n                notif.user_id = cu.user_id\n            AND\n                cu.code_cours = '" . claro_sql_escape(claro_get_current_course_id()) . "'\n            WHERE\n                notif.topic_id = " . (int) $topicId;
    $notifyResult = claro_sql_query_fetch_all_rows($sql);
    if (is_array($notifyResult) && count($notifyResult)) {
        $subject = get_lang('A reply to your topic has been posted');
        $url_topic = get_path('rootWeb') . 'claroline/phpbb/viewtopic.php?topic=' . $topicId . '&cidReq=' . claro_get_current_course_id();
        $url_forum = get_path('rootWeb') . 'claroline/phpbb/index.php?cidReq=' . claro_get_current_course_id();
        // send mail to registered user for notification
        $message = get_lang('You are receiving this notification because you are watching a topic on the forum of one of your courses.') . '<br/>' . "\n" . get_lang('View topic') . '<br/>' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize($url_topic)) . '">' . Url::Contextualize($url_topic) . '</a><br/><br/>' . "\n" . get_lang('View forum') . '<br/>' . '<a href="' . claro_htmlspecialchars(Url::Contextualize($url_forum)) . '">' . Url::Contextualize($url_forum) . '</a><br/>' . "\n";
        require_once dirname(__FILE__) . '/../../messaging/lib/recipient/userlistrecipient.lib.php';
        require_once dirname(__FILE__) . '/../../messaging/lib/message/platformmessagetosend.lib.php';
        $recipient = new UserListRecipient();
        foreach ($notifyResult as $user) {
            $recipient->addUserId($user['user_id']);
        }
        $message = new PlatformMessageToSend($subject, $message);
        $message->setCourse(claro_get_current_course_id());
        $message->setTools('CLFRM');
        if (claro_is_in_a_group()) {
            $message->setGroup(claro_get_current_group_id());
        }
        //$message->sendTo($recipient);
        $recipient->sendMessage($message);
    }
}
Example #5
0
/**
 * 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;
}