예제 #1
0
 public function current()
 {
     $message = SentMessage::fromArray($this->messageList[$this->index]);
     $message->setSenderFirstName($this->messageList[$this->index]['firstName']);
     $message->setSenderLastName($this->messageList[$this->index]['lastName']);
     return $message;
 }
예제 #2
0
파일: outbox.lib.php 프로젝트: rhertzog/lcs
 /**
  * return the current message
  *
  * @return SentMessage current message
  */
 public function current()
 {
     return SentMessage::fromArray($this->messageList[$this->index]);
 }
예제 #3
0
        $content .= $dialogbox->render();
    }
    if ($cmd == "rqDeleteMessage" && !is_null($messageId)) {
        $argDelete = makeArgLink($arguments);
        if ($argDelete == "") {
            $linkDelete = $_SERVER['PHP_SELF'] . "?";
        } else {
            $linkDelete = $_SERVER['PHP_SELF'] . "?" . $argDelete . "&";
        }
        $deleteConfirmation = get_lang('Are you sure to delete the message?') . '<br /><br />' . '<a href="' . $linkDelete . 'cmd=exDeleteMessage&amp;message_id=' . $messageId . '">' . get_lang('Yes') . '</a>' . ' | <a href="' . $linkDelete . '">' . get_lang('No') . '</a>';
        $dialogbox = new DialogBox();
        $dialogbox->question($deleteConfirmation);
        $content .= $dialogbox->render();
    }
    if ($cmd == "exDeleteMessage" && !is_null($messageId)) {
        $message = SentMessage::fromId($messageId);
        $message->delete();
    }
}
// ---------- paging
if (isset($_REQUEST['page'])) {
    $page = min(array($_REQUEST['page'], $box->getNumberOfPage()));
    $page = max(array($page, 1));
    $strategy->setPageToDisplay($page);
    $arguments['page'] = $page;
}
// ------------- display
if ($arguments['search'] == 'fromUser') {
    if (isset($arguments['name'])) {
        $name = $arguments['name'];
    } else {
예제 #4
0
 /**
  * diplay a sent message
  *
  * @param SentMessage $message Message to display
  * @param string $action list of action autorised on the message
  * @return string HTML source
  */
 private static function displaySentMessage($message, $action)
 {
     $recipientList = $message->getRecipientList();
     $recipientString = '';
     if ($recipientList['sentTo'] == 'toUser') {
         for ($count = 0; $count < count($recipientList['userList']); $count++) {
             if ($recipientString != '') {
                 $recipientString .= ", ";
             }
             $recipientString .= get_lang('%firstName %lastName', array('%firstName' => claro_htmlspecialchars($recipientList['userList'][$count]['firstName']), '%lastName' => claro_htmlspecialchars($recipientList['userList'][$count]['lastName'])));
             if ($count > 10 && $count < count($recipientList)) {
                 $recipientString .= ",...";
                 break;
             }
         }
     } elseif ($recipientList['sentTo'] == 'toCourse') {
         $courseData = claro_get_course_data($message->getCourseCode());
         $recipientString = get_lang('Course: ') . " ";
         if ($courseData) {
             $recipientString .= $courseData['name'];
         } else {
             $recipientString .= '?';
         }
     } elseif ($recipientList['sentTo'] == 'toGroup') {
         $groupInfo = claro_get_group_data(array(CLARO_CONTEXT_COURSE => $message->getCourseCode(), CLARO_CONTEXT_GROUP => $message->getGroupId()));
         $courseData = claro_get_course_data($message->getCourseCode());
         $recipientString = get_lang('Course') . ' : ';
         if ($courseData) {
             $recipientString .= $courseData['officialCode'];
         } else {
             $recipientString .= '?';
         }
         $recipientString .= '; ' . get_lang('Group') . ' : ';
         if ($groupInfo) {
             $recipientString .= $groupInfo['name'];
         } else {
             $recipientString .= '?';
         }
     } elseif ($recipientList['sentTo'] == 'toAll') {
         $recipientString = get_lang('All users of the platform');
     } else {
         throw new Exception("Unsupported sentTo in recipient list : " . claro_htmlspecialchars($recipientList['sentTo']));
     }
     $content = '<div id="im_message">' . "\n" . '<h4 class="header">' . claro_htmlspecialchars($message->getSubject()) . '</h4>' . "\n" . '<div class="imInfoBlock">' . "\n" . '<div class="imCmdList">' . $action . '</div>' . '<div class="imInfo">' . '<span class="imInfoTitle">' . get_lang('Recipient') . ' : </span>' . '<span class="imInfoValue">' . $recipientString . '</span>' . '</div>' . '<div class="imInfo">' . '<span class="imInfoTitle">' . get_lang('Date') . '</span>' . '<span class="imInfoValue">' . claro_html_localised_date(get_locale('dateTimeFormatLong'), strtotime($message->getSendTime())) . '</span>' . '</div>';
     if (!is_null($message->getCourseCode())) {
         $content .= '<div class="imInfo">' . '<span class="imInfoTitle">' . get_lang('Course') . '</span>' . '<span class="imInfoValue">';
         $courseData = claro_get_course_data($message->getCourseCode());
         if ($courseData) {
             $content .= $courseData['name'];
         } else {
             $content .= '&nbsp;';
         }
         $content .= '</span>' . '</div>';
         if (!is_null($message->getGroupId())) {
             $content .= '<div class="imInfo">' . '<span class="imInfoTitle">' . get_lang('Group') . '</span>' . '<span class="imInfoValue">';
             $groupData = claro_get_group_data(array(CLARO_CONTEXT_COURSE => $message->getCourseCode(), CLARO_CONTEXT_GROUP => $message->getGroupId()));
             if ($courseData) {
                 $content .= $groupData['name'];
             } else {
                 $content .= '&nbsp;';
             }
             $content .= '</span>' . '</div>';
         }
         if (!is_null($message->getToolsLabel())) {
             $content .= '<div class="imInfo">' . '<span class="imInfoTitle">' . get_lang('Tool') . '</span>' . '<span class="imInfoValue">';
             $md = get_module_data($message->getToolsLabel());
             if ($md) {
                 $content .= get_lang($md['moduleName']);
             } else {
                 $content .= '?';
             }
             $content .= '</span>' . '</div>';
         }
     }
     $body = $message->getMessage();
     $body = claro_html_sanitize_all($body);
     $content .= '</div>' . "\n" . '<div class="imContent">' . claro_parse_user_text($body) . '</div>' . '</div>' . "\n";
     return $content;
 }
예제 #5
0
 /**
  * create a new SentMessage with the information in parameter
  *
  * @param array $messageData 
  *  $messageData['message_id']
  *  $messageData['subject']
  *  $messageData['message']
  *  $messageData['sender']
  *  $messageData['send_time']
  *  $messageData['course']
  *  $messageData['group']
  *  $messageData['tools']
  * @return SentMessage the new message
  */
 public static function fromArray($messageData)
 {
     $message = new SentMessage($messageData['message_id']);
     $message->setFromArray($messageData);
     return $message;
 }