function getSidebarMessages() { global $uid, $urlServer, $langFrom, $dateFormatLong, $langDropboxNoMessage, $langMailSubject, $langCourse; $message_content = ''; $mbox = new Mailbox($uid, 0); $msgs = $mbox->getInboxMsgs(''); $msgs = array_filter($msgs, function ($msg) { return !$msg->is_read; }); if (!count($msgs)) { $message_content .= "<li class='list-item no-messages'>" . "<span class='item-wholeline'>" . $langDropboxNoMessage . "</span>" . "</li>"; } else { foreach ($msgs as $message) { if ($message->course_id > 0) { $course_title = q(ellipsize(course_id_to_title($message->course_id), 30)); } else { $course_title = ''; } $message_date = claro_format_locale_date($dateFormatLong, $message->timestamp); $message_content .= "<li class='list-item'> <span class='item-wholeline'> <div class='text-title'>$langFrom: " . display_user($message->author_id, false, false) . "<br> $langMailSubject: <a href='{$urlServer}modules/dropbox/index.php?mid=$message->id'>" . q($message->subject) . "</a> </div>"; if ($course_title) { $message_content .= "<div class='text-grey'>$langCourse: $course_title</div>"; } $message_content .= "<div>$message_date</div> </span> </li>"; } } return $message_content; }
exit(); } $mbox = new Mailbox($uid, $course_id); $limit = intval($_GET['iDisplayLength']); $offset = intval($_GET['iDisplayStart']); //Total records $data['iTotalRecords'] = $mbox->MsgsNumber($mbox_type); $keyword = $_GET['sSearch']; if ($mbox_type == 'inbox') { //Total records after applying search filter $data['iTotalDisplayRecords'] = count($mbox->getInboxMsgs($keyword)); $msgs = $mbox->getInboxMsgs($keyword, $limit, $offset); } else { //Total records after applying search filter $data['iTotalDisplayRecords'] = count($mbox->getOutboxMsgs($keyword)); $msgs = $mbox->getOutboxMsgs($keyword, $limit, $offset); } $data['aaData'] = array(); foreach ($msgs as $msg) { if ($msg->is_read == 1) { $bold_start = ""; $bold_end = "";
/** * @brief get user personal messages * @global type $uid * @global type $urlServer * @global type $langFrom * @global type $dateFormatLong * @param type $lesson_id * @return string */ function getUserMessages() { global $uid, $urlServer, $langFrom, $dateFormatLong; $message_content = ''; $mbox = new Mailbox($uid, 0); $msgs = $mbox->getInboxMsgs('', 5); foreach ($msgs as $message) { if ($message->course_id > 0) { $course_title = q(ellipsize(course_id_to_title($message->course_id), 30)); } else { $course_title = ''; } $message_date = claro_format_locale_date($dateFormatLong, $message->timestamp); $message_content .= "<li class='list-item'> <div class='item-wholeline'> <div class='text-title'>$langFrom ".display_user($message->author_id, false, false).": <a href='{$urlServer}modules/dropbox/index.php?mid=$message->id'>" .q($message->subject)."</a> </div> <div class='text-grey'>$course_title</div> <div>$message_date</div> </div> </li>"; } return $message_content; }