Пример #1
0
    default:
        $order_by = MessageService::DATE;
        $order_type = "DESC";
        break;
}
//Creo il MessageService e prendo i messaggi
$ms = new MessageService($currentUser['id']);
$messages = $ms->getFolder($folder, $page, $order_type, $order_by);
//Array contenente i dati del json
$array = array();
//Creo i dati della paginazione
$pag = new Pagination($ms->getFolderCountMessages($folder), MessageService::MESSAGE_FOR_PAGE, $page);
$array['pagination'] = $pag->getNavigator("default.html", "javascript:Messages.goToPage(#PAGE#);");
$array['messages'] = array();
foreach ($messages as $m) {
    $date = DateUtils::GetNice($m['date_tm']);
    $q = DB::FindOne("SELECT user FROM users WHERE id = " . $m[$to_field] . " LIMIT 1");
    $to_from = $m->isMultiple() && $folder == MessageService::SENT ? 'Tutti i membri' : $q['user'];
    $delete_restore = '';
    if ($folder == MessageService::INBOX) {
        $delete_restore = 'C';
    } else {
        if ($folder == MessageService::DELETED) {
            $delete_restore = 'R';
        }
    }
    $array['messages'][] = array("date" => $date, "to_from" => $to_from, "delete_restore" => $delete_restore, "id" => $m['id'], "subject" => $m->getRaw('subject'), "viewed" => $m['viewed'] == 1, "important" => $m['important'] == 1);
}
$response->set('value', $array);
$response->setSuccess(true);
$response->send();
Пример #2
0
      from_or_to : stringa 'A' o 'Da'
      date : data dell'invio del messaggio (formattata in maniera leggibile)
      discursive_date: data dell'invio del messaggio (gg/mm/yy HH:mm)
      important : true o false se il messaggio è importante o no
      message_html : testo del messaggio (formattato in HTML)
      message_plain : testo del messaggio (non formattato)
      reply : true o false se bisonga mostrare il bottone rispondi o no
      from_to_user : nome dell'utente che ha inviato o ricevuto il messaggio
  */
require_once "__inc__.php";
$response = new RestfulResponse("json");
$r = '';
$id = $_POST['id'];
validate_num($id);
$ms = new MessageService($currentUser['id']);
$m = $ms->getMessage($id);
if ($m['to_id'] == $currentUser['id']) {
    $ms->viewed($id);
}
$from_to = 'A';
$user = '******';
$write = "";
if ($m['to_id'] == $currentUser['id']) {
    $from_to = 'Da';
    $user = '******';
}
$user = DB::FindOne("SELECT user FROM users WHERE id=" . $m[$user] . " LIMIT 1");
$array = array("subject" => $m->getRaw('subject'), "from_or_to" => $from_to, "date" => DateUtils::GetNice($m['date_tm']), "discursive_date" => DateUtils::GetDiscursive($m['date_tm']), "important" => $m->isImportant(), "multiple" => $m->isMultiple(), "message_html" => Text::MessageToHtml($m->getRaw('message')), "message_plain" => $m->getRaw('message'), "reply" => $m['to_id'] == $currentUser['id'], "from_to_user" => $user['user']);
$response->set('value', $array);
$response->setSuccess(true);
$response->send();
Пример #3
0
 public function render($view_file, $values = array())
 {
     global $currentUser;
     return Entity::render($view_file, array_merge($values, array("avatar_url" => "/data/images/profiles/users/" . ($this['avatar'] ? $this['avatar'] : "default.png"), "parsed_message" => $this->getParsedMessage(), "parsed_signature" => Text::MessageToHtml($this['signature']), "view_profile_url" => "#", "formatted_post_date" => DateUtils::GetNice($this['post_date']), "edited" => $this['edit_by'] != '0', "edit_by" => $this['edit_by'], "edit_user" => $this['edit_user'], "edit_date" => DateUtils::GetNice($this['edit_date']), "is_mod" => $currentUser->isModOfForum($this['argument']), "can_edit" => $currentUser->isModOfForum($this['argument']) || $currentUser["id"] == $this['user_id'])));
 }