• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP MessageManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了MessageManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 <[email protected]>, 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


示例16: get_lang

             $emailbody = get_lang('ApprovalForNewAccount', null, $values['language']) . "\n";
             $emailbody .= get_lang('UserName', null, $values['language']) . ': ' . $values['username'] . "\n";
             if (api_is_western_name_order()) {
                 $emailbody .= get_lang('FirstName', null, $values['language']) . ': ' . $values['firstname'] . "\n";
                 $emailbody .= get_lang('LastName', null, $values['language']) . ': ' . $values['lastname'] . "\n";
             } else {
                 $emailbody .= get_lang('LastName', null, $values['language']) . ': ' . $values['lastname'] . "\n";
                 $emailbody .= get_lang('FirstName', null, $values['language']) . ': ' . $values['firstname'] . "\n";
             }
             $emailbody .= get_lang('Email', null, $values['language']) . ': ' . $values['email'] . "\n";
             $emailbody .= get_lang('Status', null, $values['language']) . ': ' . $values['status'] . "\n\n";
             $url_edit = Display::url(api_get_path(WEB_CODE_PATH) . 'admin/user_edit.php?user_id=' . $user_id, api_get_path(WEB_CODE_PATH) . 'admin/user_edit.php?user_id=' . $user_id);
             $emailbody .= get_lang('ManageUser', null, $values['language']) . ": {$url_edit}";
             $admins = UserManager::get_all_administrators();
             foreach ($admins as $admin_info) {
                 MessageManager::send_message($admin_info['user_id'], $emailsubject, $emailbody, null, null, null, null, null, null, $user_id);
             }
             // 3. exit the page
             unset($user_id);
             Display::display_header($tool_name);
             echo Display::page_header($tool_name);
             echo $content;
             Display::display_footer();
             exit;
         }
     }
 }
 // Terms & Conditions
 if (api_get_setting('registration.allow_terms_conditions') == 'true') {
     // Update the terms & conditions.
     if (isset($values['legal_accept_type'])) {
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:inscription.php


示例17: send_invitation_mail

 /**
  * Send the invitation by mail.
  *
  * @param int invitedUser - the userId (course user) or emailaddress of additional user
  * $param string $invitation_code - the unique invitation code for the URL
  * @return	void
  */
 public static function send_invitation_mail($invitedUser, $invitation_code, $invitation_title, $invitation_text)
 {
     $_user = api_get_user_info();
     $_course = api_get_course_info();
     // Replacing the **link** part with a valid link for the user
     $survey_link = api_get_path(WEB_CODE_PATH) . 'survey/fillsurvey.php?course=' . $_course['code'] . '&invitationcode=' . $invitation_code;
     $text_link = '<a href="' . $survey_link . '">' . get_lang('ClickHereToAnswerTheSurvey') . "</a><br />\r\n<br />\r\n" . get_lang('OrCopyPasteTheFollowingUrl') . " <br />\r\n " . $survey_link;
     $replace_count = 0;
     $full_invitation_text = api_str_ireplace('**link**', $text_link, $invitation_text, $replace_count);
     if ($replace_count < 1) {
         $full_invitation_text = $full_invitation_text . "<br />\r\n<br />\r\n" . $text_link;
     }
     // Sending the mail
     $sender_name = api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS);
     $sender_email = $_user['mail'];
     $sender_user_id = api_get_user_id();
     $replyto = array();
     if (api_get_setting('survey.survey_email_sender_noreply') == 'noreply') {
         $noreply = api_get_setting('mail.noreply_email_address');
         if (!empty($noreply)) {
             $replyto['Reply-to'] = $noreply;
             $sender_name = $noreply;
             $sender_email = $noreply;
             $sender_user_id = null;
         }
     }
     // Optionally: finding the e-mail of the course user
     if (is_numeric($invitedUser)) {
         $table_user = Database::get_main_table(TABLE_MAIN_USER);
         $sql = "SELECT firstname, lastname, email FROM {$table_user}\n                    WHERE user_id='" . Database::escape_string($invitedUser) . "'";
         $result = Database::query($sql);
         $row = Database::fetch_array($result);
         $recipient_email = $row['email'];
         $recipient_name = api_get_person_name($row['firstname'], $row['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
         MessageManager::send_message($invitedUser, $invitation_title, $full_invitation_text, [], [], null, null, null, null, $sender_user_id);
     } else {
         /** @todo check if the address is a valid email	 */
         $recipient_email = $invitedUser;
         @api_mail_html($recipient_name, $recipient_email, $invitation_title, $full_invitation_text, $sender_name, $sender_email, $replyto);
     }
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:48,代码来源:survey.lib.php


示例18: array

    if (isset($_POST['email'])) {
        ServerInterface::getInstance()->updateUserEmail($_SESSION['serverid'], $_SESSION['userid'], $_POST['email']);
    }
    // remove texture
    if (isset($_GET['remove_texture'])) {
        try {
            ServerInterface::getInstance()->updateUserTexture($_SESSION['serverid'], $_SESSION['userid'], array());
        } catch (Murmur_InvalidTextureException $exc) {
            MessageManager::addWarning(tr('profile_removetexturefailed'));
        }
    }
    // new texture
    //TODO reimplement setting texture
    if (isset($_FILES['texture'])) {
        if (!file_exists($_FILES['texture']['tmp_name'])) {
            MessageManager::addWarning(tr('profile_texture_notempfile'));
        } else {
            $imgData = file_get_contents($_FILES['texture']['tmp_name']);
            ServerInterface::getInstance()->updateUserTexture($_SESSION['serverid'], $_SESSION['userid'], $imgData);
        }
    }
}
?>
<div id="content">
	<h1><?php 
echo TranslationManager::getText('profile_head');
?>
</h1>
	<form action="?page=profile&amp;action=doedit" method="post" style="width:420px;"<?php 
if (isset($_GET['action']) && $_GET['action'] == 'edit_texture') {
    echo ' enctype="multipart/form-data"';
开发者ID:Cierce,项目名称:seventh-root.com,代码行数:31,代码来源:profile.template.php


示例19: outbox_display

 /**
  * @return string
  */
 static function outbox_display()
 {
     $social_link = false;
     if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'social') {
         $social_link = 'f=social';
     }
     $success = get_lang('SelectedMessagesDeleted') . '&nbsp</b><br /><a href="outbox.php?' . $social_link . '">' . get_lang('BackToOutbox') . '</a>';
     $html = null;
     if (isset($_REQUEST['action'])) {
         switch ($_REQUEST['action']) {
             case 'delete':
                 $number_of_selected_messages = count($_POST['id']);
                 if ($number_of_selected_messages != 0) {
                     foreach ($_POST['id'] as $index => $message_id) {
                         MessageManager::delete_message_by_user_receiver(api_get_user_id(), $message_id);
                     }
                 }
                 $html .= Display::return_message(api_xml_http_response_encode($success), 'normal', false);
                 break;
             case 'deleteone':
                 MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']);
                 $html .= Display::return_message(api_xml_http_response_encode($success), 'normal', false);
                 $html .= '<br/>';
                 break;
         }
     }
     // display sortable table with messages of the current user
     $table = new SortableTable('message_outbox', array('MessageManager', 'get_number_of_messages_sent'), array('MessageManager', 'get_message_data_sent'), 3, 20, 'DESC');
     $parameters['f'] = isset($_GET['f']) && $_GET['f'] == 'social' ? 'social' : null;
     $table->set_additional_parameters($parameters);
     $table->set_header(0, '', false, array('style' => 'width:15px;'));
     $table->set_header(1, get_lang('Messages'), false);
     $table->set_header(2, get_lang('Date'), true, array('style' => 'width:160px;'));
     $table->set_header(3, get_lang('Modify'), false, array('style' => 'width:70px;'));
     $table->set_form_actions(array('delete' => get_lang('DeleteSelectedMessages')));
     $html .= $table->return_table();
     return $html;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:41,代码来源:message.lib.php


示例20: array

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Messages类代码示例发布时间:2022-05-23
下一篇:
PHP MessageGroups类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap