当前位置: 首页>>代码示例>>PHP>>正文


PHP MessageManager类代码示例

本文整理汇总了PHP中MessageManager的典型用法代码示例。如果您正苦于以下问题:PHP MessageManager类的具体用法?PHP MessageManager怎么用?PHP MessageManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MessageManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: indexAction

 /**
  * @Route("/{username}")
  * @Method({"GET"})
  */
 public function indexAction($username)
 {
     $userId = \UserManager::get_user_id_from_username($username);
     $userInfo = api_get_user_info($userId);
     $this->getTemplate()->assign('user', $userInfo);
     $this->getTemplate()->assign('form_send_message', \MessageManager::generate_message_form('send_message'));
     $this->getTemplate()->assign('form_send_invitation', \MessageManager::generate_invitation_form('send_invitation'));
     $response = $this->getTemplate()->renderTemplate($this->getTemplatePath() . 'profile.tpl');
     return new Response($response, 200, array());
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:14,代码来源:ProfileController.php

示例2: getNewMessages

 /**
  * Get the list of new messages for a user
  * @param string $username The username
  * @param int $lastId The id of the last received message
  * @return array the new message list
  */
 public function getNewMessages($username, $lastId = 0)
 {
     $messages = array();
     $userInfo = api_get_user_info_from_username($username);
     $userId = $userInfo['user_id'];
     $lastMessages = MessageManager::getMessagesFromLastReceivedMessage($userId, $lastId);
     foreach ($lastMessages as $message) {
         $hasAttachments = MessageManager::hasAttachments($message['id']);
         $messages[] = array('id' => $message['id'], 'title' => $message['title'], 'sender' => array('id' => $message['user_id'], 'lastname' => $message['lastname'], 'firstname' => $message['firstname'], 'completeName' => api_get_person_name($message['firstname'], $message['lastname'])), 'sendDate' => $message['send_date'], 'content' => $message['content'], 'hasAttachments' => $hasAttachments, 'platform' => array('website' => api_get_path(WEB_PATH), 'messagingTool' => api_get_path(WEB_PATH) . 'main/messages/inbox.php'));
     }
     return $messages;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:18,代码来源:MessagesWebService.class.php

示例3: echoAll

 public static function echoAll()
 {
     if (count(self::$errors)) {
         echo '<ul class="log_list_errors">';
         MessageManager::echoAllErrors('<li>', '</li>');
         echo '</ul>';
     }
     if (count(self::$warnings)) {
         echo '<ul class="log_list_warnings">';
         MessageManager::echoAllWarnings('<li>', '</li>');
         echo '</ul>';
     }
     if (count(self::$msgs)) {
         echo '<ul class="log_list_messages">';
         MessageManager::echoAllMessages('<li>', '</li>');
         echo '</ul>';
     }
 }
开发者ID:nicolasjoly,项目名称:MumPI,代码行数:18,代码来源:MessageManager.php

示例4: get_lang

        }
        if (!empty($user_info['teach'])) {
            $more_info .= '<div class="social-actions-message"><strong>' . get_lang('MyTeach') . '</strong></div>';
            $more_info .= '<div class="social-profile-extended">' . $user_info['teach'] . '</div>';
            $more_info .= '<br />';
        }
        $socialRightInformation .= SocialManager::social_wrapper_div($more_info, 4);
    }
}
$tpl = new Template(get_lang('Social'));
// Block Avatar Social
SocialManager::setSocialUserBlock($tpl, $user_id, 'shared_profile');
$tpl->assign('social_friend_block', $friend_html);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_wall_block', $social_wall_block);
$tpl->assign('social_post_wall_block', $social_post_wall_block);
$tpl->assign('social_extra_info_block', $social_extra_info_block);
$tpl->assign('social_course_block', $social_course_block);
$tpl->assign('social_group_info_block', $social_group_info_block);
$tpl->assign('social_rss_block', $social_rss_block);
$tpl->assign('social_skill_block', SocialManager::getSkillBlock($my_user_id));
$tpl->assign('sessionList', $social_session_block);
$tpl->assign('social_right_information', $socialRightInformation);
$tpl->assign('social_auto_extend_link', $socialAutoExtendLink);
$formModalTpl = new Template();
$formModalTpl->assign('messageForm', MessageManager::generate_message_form('send_message'));
$formModalTpl->assign('invitationForm', MessageManager::generate_invitation_form('send_invitation'));
$formModals = $formModalTpl->fetch('default/social/form_modals.tpl');
$tpl->assign('formModals', $formModals);
$social_layout = $tpl->get_template('social/profile.tpl');
$tpl->display($social_layout);
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:profile.php

示例5: Template

$social_avatar_block = SocialManager::show_social_avatar_block(
    'member_list',
    $group_id
);
$social_menu_block = SocialManager::show_social_menu('member_list', $group_id);

if (!empty($show_message)) {
    $social_right_content .= Display::return_message(
        $show_message,
        'confirmation'
    );
}
$social_right_content .= MessageManager::display_message_for_group(
    $group_id,
    $topic_id,
    $is_member,
    $message_id
);


$social_right_content = '<div class="span9">' . $social_right_content . '</div>';

$tpl = new Template($tool_name);
$tpl->set_help('Groups');
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:group_topics.php

示例6: get_lang

 Database::query($sql);
 if (isset($_POST['send_notification'])) {
     //@todo move this somewhere else
     $subject = get_lang('ExamSheetVCC');
     $message = '<p>' . get_lang('DearStudentEmailIntroduction') . '</p><p>' . get_lang('AttemptVCC');
     $message .= '<h3>' . get_lang('CourseName') . '</h3><p>' . Security::remove_XSS($course_info['name']) . '';
     $message .= '<h3>' . get_lang('Exercise') . '</h3><p>' . Security::remove_XSS($test);
     //Only for exercises not in a LP
     if ($lp_id == 0) {
         $message .= '<p>' . get_lang('ClickLinkToViewComment') . ' <a href="#url#">#url#</a><br />';
     }
     $message .= '<p>' . get_lang('Regards') . '</p>';
     $message .= $from_name;
     $message = str_replace("#test#", Security::remove_XSS($test), $message);
     $message = str_replace("#url#", $url, $message);
     MessageManager::send_message_simple($student_id, $subject, $message, api_get_user_id());
     if ($allowCoachFeedbackExercises) {
         Display::addFlash(Display::return_message(get_lang('MessageSent')));
         header('Location: ' . api_get_path(WEB_PATH));
         exit;
     }
 }
 //Updating LP score here
 if (in_array($origin, array('tracking_course', 'user_course', 'correct_exercise_in_lp'))) {
     $sql = "UPDATE {$TBL_LP_ITEM_VIEW} SET score = '" . floatval($tot) . "'\n                WHERE c_id = " . $course_id . " AND id = " . $lp_item_view_id;
     Database::query($sql);
     if ($origin == 'tracking_course') {
         //Redirect to the course detail in lp
         header('location: exercise.php?course=' . Security::remove_XSS($_GET['course']));
         exit;
     } else {
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:exercise_report.php

示例7: isset

    $user_list = isset($_POST['invitation']) ? $_POST['invitation'] : null;
    $group_id = intval($_POST['id']);
    if (!is_array($user_list)) {
        $user_list = array();
    }
    if ($form_sent == 1) {
        // invite this users
        $result = $usergroup->add_users_to_groups($user_list, array($group_id), GROUP_USER_PERMISSION_PENDING_INVITATION);
        $title = get_lang('YouAreInvitedToGroup') . ' ' . $group_info['name'];
        $content = get_lang('YouAreInvitedToGroupContent') . ' ' . $group_info['name'] . ' <br />';
        $content .= get_lang('ToSubscribeClickInTheLinkBelow') . ' <br />';
        $content .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php?accept=' . $group_id . '">' . get_lang('Subscribe') . '</a>';
        if (is_array($user_list) && count($user_list) > 0) {
            //send invitation message
            foreach ($user_list as $user_id) {
                $result = MessageManager::send_message($user_id, $title, $content);
            }
            Display::addFlash(Display::return_message(get_lang('InvitationSent')));
        }
        header('Location: ' . api_get_self() . '?id=' . $group_id);
        exit;
    }
}
$nosessionUsersList = $sessionUsersList = array();
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
$friends = SocialManager::get_friends(api_get_user_id());
$suggest_friends = false;
$Users = array();
if (!$friends) {
    $suggest_friends = true;
} else {
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:group_invitation.php

示例8: suscribe_users_to_session

 /**
  * Subscribes users (students)  to the given session and optionally (default) unsubscribes previous users
  * @author Carlos Vargas from existing code
  * @param    integer        Session ID
  * @param    array        List of user IDs
  * @param    bool        Whether to unsubscribe existing users (true, default) or not (false)
  * @return    void        Nothing, or false on error
  **/
 public static function suscribe_users_to_session($id_session, $user_list, $session_visibility = SESSION_VISIBLE_READ_ONLY, $empty_users = true, $send_email = false)
 {
     if ($id_session != strval(intval($id_session))) {
         return false;
     }
     foreach ($user_list as $intUser) {
         if ($intUser != strval(intval($intUser))) {
             return false;
         }
     }
     $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
     $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
     $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $session_info = api_get_session_info($id_session);
     if ($session_info) {
         $session_name = $session_info['name'];
     } else {
         return false;
     }
     //from function parameter
     if (empty($session_visibility)) {
         $session_visibility = $session_info['visibility'];
         //loaded from DB
         //default status loaded if empty
         if (empty($session_visibility)) {
             $session_visibility = SESSION_VISIBLE_READ_ONLY;
         }
         // by default readonly 1
     } else {
         if (!in_array($session_visibility, array(SESSION_VISIBLE_READ_ONLY, SESSION_VISIBLE, SESSION_INVISIBLE))) {
             $session_visibility = SESSION_VISIBLE_READ_ONLY;
         }
     }
     $sql = "SELECT id_user FROM {$tbl_session_rel_course_rel_user} WHERE id_session = '{$id_session}' AND status = 0";
     $result = Database::query($sql);
     $existingUsers = array();
     while ($row = Database::fetch_array($result)) {
         $existingUsers[] = $row['id_user'];
     }
     $sql = "SELECT c_id FROM {$tbl_session_rel_course} WHERE id_session = '{$id_session}'";
     $result = Database::query($sql);
     $course_list = array();
     while ($row = Database::fetch_array($result)) {
         $course_list[] = $row['c_id'];
     }
     if ($send_email) {
         //sending emails only
         if (is_array($user_list) && count($user_list) > 0) {
             foreach ($user_list as $user_id) {
                 if (!in_array($user_id, $existingUsers)) {
                     $subject = '[' . get_setting('siteName') . '] ' . get_lang('YourReg') . ' ' . get_setting('siteName');
                     $user_info = api_get_user_info($user_id);
                     $content = get_lang('Dear') . " " . stripslashes($user_info['complete_name']) . ",\n\n" . sprintf(get_lang('YouAreRegisterToSessionX'), $session_name) . " \n\n" . get_lang('Address') . " " . api_get_setting('siteName') . " " . get_lang('Is') . " : " . api_get_path(WEB_PATH) . "\n\n" . get_lang('Problem') . "\n\n" . get_lang('Formula') . ",\n\n" . get_setting('administratorName') . " " . get_setting('administratorSurname') . "\n" . get_lang('Manager') . " " . get_setting('siteName') . "\nT. " . get_setting('administratorTelephone') . "\n" . get_lang('Email') . " : " . get_setting('emailAdministrator');
                     MessageManager::send_message($user_id, $subject, $content, array(), array(), null, null, null, null, null);
                 }
             }
         }
     }
     foreach ($course_list as $courseId) {
         // for each course in the session
         $nbr_users = 0;
         $courseId = Database::escape_string($courseId);
         // delete existing users
         if ($empty_users) {
             foreach ($existingUsers as $existing_user) {
                 if (!in_array($existing_user, $user_list)) {
                     $sql = "DELETE FROM {$tbl_session_rel_course_rel_user} WHERE id_session='{$id_session}' AND c_id ='{$courseId}' AND id_user='{$existing_user}' AND status = 0";
                     $result = Database::query($sql);
                     if (Database::affected_rows($result)) {
                         $nbr_users--;
                     }
                 }
             }
         }
         //Replace with this new function
         //
         // insert new users into session_rel_course_rel_user and ignore if they already exist
         foreach ($user_list as $enreg_user) {
             if (!in_array($enreg_user, $existingUsers)) {
                 $enreg_user = Database::escape_string($enreg_user);
                 $insert_sql = "INSERT IGNORE INTO {$tbl_session_rel_course_rel_user}(id_session, c_id, id_user, visibility, status) VALUES('{$id_session}','{$courseId}','{$enreg_user}','{$session_visibility}', '0')";
                 $result = Database::query($insert_sql);
                 if (Database::affected_rows($result)) {
                     $nbr_users++;
                 }
             }
         }
         // count users in this session-course relation
         $sql = "SELECT COUNT(id_user) as nbUsers FROM {$tbl_session_rel_course_rel_user} WHERE id_session='{$id_session}' AND c_id ='{$courseId}' AND status<>2";
         $rs = Database::query($sql);
         list($nbr_users) = Database::fetch_array($rs);
//.........这里部分代码省略.........
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:101,代码来源:sessionmanager.lib.php

示例9: send_notification_for_oral_questions

 function send_notification_for_oral_questions($question_list_answers, $origin, $exe_id)
 {
     if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) {
         return null;
     }
     // Email configuration settings
     $courseCode = api_get_course_id();
     $course_info = api_get_course_info($courseCode);
     $url_email = api_get_path(WEB_CODE_PATH) . 'exercice/exercise_show.php?' . api_get_cidreq() . '&id_session=' . api_get_session_id() . '&id=' . $exe_id . '&action=qualify';
     $user_info = api_get_user_info(api_get_user_id());
     $oral_question_list = null;
     foreach ($question_list_answers as $item) {
         $question = $item['question'];
         $answer = $item['answer'];
         $answer_type = $item['answer_type'];
         if (!empty($question) && !empty($answer) && $answer_type == ORAL_EXPRESSION) {
             $oral_question_list .= '<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">' . '<tr>' . '<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;' . get_lang('Question') . '</td>' . '<td width="473" valign="top" bgcolor="#F3F3F3">' . $question . '</td>' . '</tr>' . '<tr>' . '<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;' . get_lang('Answer') . '</td>' . '<td valign="top" bgcolor="#F3F3F3">' . $answer . '</td>' . '</tr></table>';
         }
     }
     if (!empty($oral_question_list)) {
         $msg = get_lang('OralQuestionsAttempted') . '<br /><br />
                 ' . get_lang('AttemptDetails') . ' : <br /><br />' . '<table>' . '<tr>' . '<td><em>' . get_lang('CourseName') . '</em></td>' . '<td>&nbsp;<b>#course#</b></td>' . '</tr>' . '<tr>' . '<td>' . get_lang('TestAttempted') . '</td>' . '<td>&nbsp;#exercise#</td>' . '</tr>' . '<tr>' . '<td>' . get_lang('StudentName') . '</td>' . '<td>&nbsp;#firstName# #lastName#</td>' . '</tr>' . '<tr>' . '<td>' . get_lang('StudentEmail') . '</td>' . '<td>&nbsp;#mail#</td>' . '</tr>' . '</table>';
         $msg .= '<br />' . sprintf(get_lang('OralQuestionsAttemptedAreX'), $oral_question_list) . '<br />';
         $msg1 = str_replace("#exercise#", $this->exercise, $msg);
         $msg = str_replace("#firstName#", $user_info['firstname'], $msg1);
         $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg);
         $msg = str_replace("#mail#", $user_info['email'], $msg1);
         $msg = str_replace("#course#", $course_info['name'], $msg1);
         if ($origin != 'learnpath') {
             $msg .= '<br /><a href="#url#">' . get_lang('ClickToCommentAndGiveFeedback') . '</a>';
         }
         $msg1 = str_replace("#url#", $url_email, $msg);
         $mail_content = $msg1;
         $subject = get_lang('OralQuestionsAttempted');
         if (api_get_session_id()) {
             $teachers = CourseManager::get_coach_list_from_course_code($courseCode, api_get_session_id());
         } else {
             $teachers = CourseManager::getTeacherListFromCourse($course_info['real_id']);
         }
         if (!empty($teachers)) {
             foreach ($teachers as $user_id => $teacher_data) {
                 MessageManager::send_message_simple($user_id, $subject, $mail_content);
             }
         }
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:46,代码来源:exercise.class.php

示例10: function

         echo '
             $("#send_message_link").on("click", function() {
                 var url = "' . $ajax_url . '?a=send_message&user_id=' . $user_info['user_id'] . '";
                 var params = $("#send_message").serialize();
                 $.ajax({
                     url: url+"&"+params,
                     success:function(data) {
                         $("#subject_id").val("");
                         $("#content_id").val("");
                         $("#send_message").html(data);
                         $("#send_message_link").hide();
                     }
                 });
             });';
         echo '</script>';
         echo MessageManager::generate_message_form('send_message', array(), 'block');
         echo '
             <div class="row">
                 <div class="col-sm-10 col-sm-offset-2">
                     <a class="btn btn-primary" id="send_message_link">
                         <em class="fa fa-envelope"></em> ' . get_lang('Send') . '
                     </a>
                 </div>
             </div>
         ';
     }
     break;
 case 'user_id_exists':
     if (api_is_anonymous()) {
         echo '';
     } else {
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:user_manager.ajax.php

示例11: send

 /**
  * Send emails to users.
  * @param bool $sendToUsersInSession
  * @param bool $sendToDrhUsers send a copy of the message to the DRH users
  * related to the main user
  */
 public function send($sendToUsersInSession = false, $sendToDrhUsers = false)
 {
     $sender = $this->sender();
     $subject = $this->subject();
     // Send email one by one to avoid antispam
     $users = $this->sent_to();
     foreach ($users as $user) {
         $message = $this->message($user['user_id']);
         MessageManager::send_message_simple($user['user_id'], $subject, $message, $sender['user_id'], $sendToDrhUsers, true);
     }
     if ($sendToUsersInSession) {
         $sessionList = SessionManager::get_session_by_course($this->course['real_id']);
         if (!empty($sessionList)) {
             foreach ($sessionList as $sessionInfo) {
                 $sessionId = $sessionInfo['id'];
                 $message = $this->message(null, $sessionId);
                 $userList = CourseManager::get_user_list_from_course_code($this->course['code'], $sessionId);
                 if (!empty($userList)) {
                     foreach ($userList as $user) {
                         MessageManager::send_message_simple($user['user_id'], $subject, $message, $sender['user_id'], false, true);
                     }
                 }
             }
         }
     }
     $this->log_mail_sent();
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:33,代码来源:AnnouncementEmail.php

示例12: intval

    }
    $actionsRight = $form->returnForm();
    $social_right_content .= Display::toolbarAction('toolbar', [$actionsLeft, $actionsRight]);
}
//MAIN CONTENT
if (!isset($_GET['del_msg'])) {
    $social_right_content .= MessageManager::inbox_display();
} else {
    $num_msg = intval($_POST['total']);
    for ($i = 0; $i < $num_msg; $i++) {
        if ($_POST[$i]) {
            //the user_id was necesarry to delete a message??
            Display::addFlash(MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_POST['_' . $i]));
        }
    }
    $social_right_content .= MessageManager::inbox_display();
}
if (api_get_setting('social.allow_social_tool') == 'true') {
    $social_right_content .= '</div>';
}
$tpl = \Chamilo\CoreBundle\Framework\Container::getTwig();
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
if (api_get_setting('social.allow_social_tool') == 'true') {
    $tpl->addGlobal('social_menu_block', $social_menu_block);
    $tpl->addGlobal('social_right_content', $social_right_content);
    echo $tpl->render('@template_style/social/inbox.html.twig');
} else {
    $content = $social_right_content;
    echo $actions;
    echo $content;
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:inbox.php

示例13: process

 public function process($parameters)
 {
     //iba prihlaseny uzivatelia
     $this->checkUser();
     $userManager = new UserManager();
     $messageManager = new MessageManager();
     $loggedUser = $userManager->returnUser();
     //ak je zadane URL pre vytvorenie novej spravy
     if (!empty($parameters[0]) && $parameters[0] == 'vytvorit') {
         $users = $userManager->returnUsers();
         //vytvorenie zdroja pre automaticke doplnovanie uzivatelov v poli 'prijemca'
         $autocompleteSource = '';
         foreach ($users as $user) {
             $autocompleteSource = $autocompleteSource . "'" . $user['name'] . "'" . ', ';
         }
         $autocompleteSource = rtrim($autocompleteSource, ", ");
         $this->data['autocompleteSource'] = $autocompleteSource;
         //ak bol zadany prijemca v URL
         if (!empty($parameters[1])) {
             $this->data['recipient_url'] = strip_tags($parameters[1]);
         } else {
             $this->data['recipient_url'] = '';
         }
         $this->head['title'] = 'Nová správa';
         $this->view = 'messageForm';
     }
     //ak je zadane URL na odstranenie spravy
     if (!empty($parameters[1]) && $parameters[1] == 'odstranit') {
         $message = $messageManager->returnMessage($parameters[0]);
         if ($message) {
             $messageManager->deleteMessage($parameters[0], $loggedUser);
             $this->createMessage('Správa bola odstránená', 'success');
             $this->redirect('panel');
         } else {
             $this->redirect('chyba');
         }
     }
     //ak je zadane URL na zobrazenie spravy
     if (!empty($parameters[1]) && $parameters[1] == 'zobrazit') {
         $message = $messageManager->returnMessage($parameters[0]);
         //ak sprava existuje a otvara ju prijimatel, alebo odosielatel
         if ($message && ($message['sender'] == $loggedUser['name'] || $message['recipient'] == $loggedUser['name'])) {
             //pri prvom otvoreni, oznac spravu ako precitanu
             if ($message['unread'] == 1 && $message['recipient'] == $loggedUser['name']) {
                 $messageManager->readMessage($message['message_id']);
             }
             $this->head['title'] = 'Správa - ' . $message['subject'];
             $this->data['message'] = $message;
             $this->view = 'message';
         } else {
             $this->redirect('chyba');
         }
     }
     //ak bol odoslany formular pre odoslanie spravy
     if ($_POST) {
         $sender = $userManager->returnUser();
         $recipient = strip_tags($_POST['recipient']);
         $subject = htmlspecialchars($_POST['subject']);
         $message = htmlspecialchars($_POST['message']);
         try {
             $recipient = $userManager->returnUserInfo($recipient);
             if (!$recipient) {
                 throw new UserError('Užívateľ neexistuje');
             }
             if ($sender['name'] == $recipient['name']) {
                 throw new UserError('Nemôžete poslať správu sám sebe');
             }
             //odoslanie spravy do databazy
             $messageManager->sendMessage($sender['name'], $recipient['name'], $subject, $message);
             $this->createMessage('Vaša správa bola úspešne odoslaná', 'success');
             $this->redirect('panel');
         } catch (UserError $error) {
             $this->createMessage($error->getMessage(), 'warning');
         }
     }
     //zadane URL bez parametrov
     if (empty($parameters)) {
         $this->redirect('chyba');
     }
 }
开发者ID:tomas3093,项目名称:cms-blog,代码行数:80,代码来源:SpravaController.php

示例14: send_notifications

/**
 * Get all the users who need to receive a notification of a new post (those subscribed to
 * the forum or the thread)
 *
 * @param integer $forum_id the id of the forum
 * @param integer $thread_id the id of the thread
 * @param integer $post_id the id of the post
 * @return bool
 *
 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
 * @version May 2008, dokeos 1.8.5
 * @since May 2008, dokeos 1.8.5
 */
function send_notifications($forum_id = 0, $thread_id = 0, $post_id = 0)
{
    $_course = api_get_course_info();
    // The content of the mail
    $thread_link = api_get_path(WEB_CODE_PATH) . 'forum/viewthread.php?' . api_get_cidreq() . '&forum=' . $forum_id . '&thread=' . $thread_id;
    // Users who subscribed to the forum
    if ($forum_id != 0) {
        $users_to_be_notified_by_forum = get_notifications('forum', $forum_id);
    } else {
        return false;
    }
    $current_thread = get_thread_information($thread_id);
    $current_forum = get_forum_information($current_thread['forum_id']);
    $subject = get_lang('NewForumPost') . ' - ' . $_course['official_code'] . ' - ' . $current_forum['forum_title'] . ' - ' . $current_thread['thread_title'];
    // User who subscribed to the thread
    if ($thread_id != 0) {
        $users_to_be_notified_by_thread = get_notifications('thread', $thread_id);
    }
    // Merging the two
    $users_to_be_notified = array_merge($users_to_be_notified_by_forum, $users_to_be_notified_by_thread);
    $sender_id = api_get_user_id();
    if (is_array($users_to_be_notified)) {
        foreach ($users_to_be_notified as $value) {
            $user_info = api_get_user_info($value['user_id']);
            $email_body = get_lang('Dear') . ' ' . api_get_person_name($user_info['firstname'], $user_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS) . ", <br />\n\r";
            $email_body .= get_lang('NewForumPost') . ": " . $current_forum['forum_title'] . ' - ' . $current_thread['thread_title'] . " <br />\n";
            $email_body .= get_lang('Course') . ': ' . $_course['name'] . ' - [' . $_course['official_code'] . "]  <br />\n";
            $email_body .= get_lang('YouWantedToStayInformed') . "<br />\n";
            $email_body .= get_lang('ThreadCanBeFoundHere') . ': <br /> <a href="' . $thread_link . '">' . $thread_link . "</a>\n";
            MessageManager::send_message_simple($value['user_id'], $subject, $email_body, $sender_id);
        }
    }
}
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:46,代码来源:forumfunction.inc.php

示例15: updateUserTexture

 function updateUserTexture($srvid, $uid, $newTexture)
 {
     try {
         if (is_string($newTexture)) {
             // conversation string -> byte array (PHP5)
             $newTexture = str_split($newTexture);
         }
         $this->getServer($srvid)->setTexture($uid, $newTexture);
         return true;
     } catch (Murmur_InvalidTextureException $exc) {
         MessageManager::addError(tr('error_invalidTexture'));
         return false;
     }
 }
开发者ID:nicolasjoly,项目名称:MumPI,代码行数:14,代码来源:ServerInterface.php


注:本文中的MessageManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。