Ejemplo n.º 1
0
<?php

/**
 * $Id$
 *  
 * @package    Mediboard
 * @subpackage messagerie
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 * @link       http://www.mediboard.org
 */
CCanDo::checkRead();
$usermessage_id = CValue::get('usermessage_id');
$usermessage = new CUserMessage();
$usermessage->load($usermessage_id);
if ($usermessage->_id) {
    echo nl2br($usermessage->content);
}
Ejemplo n.º 2
0
 * $Id$
 *  
 * @category Messagerie
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$user_id = CValue::get("user_id");
$user = CMediusers::get($user_id);
$mode = CValue::get("mode", "inbox");
$page = CValue::get("page", 0);
$step = CAppUI::pref("nbMailList");
$usermessage = new CUserMessage();
$group = null;
$where = array();
$lj = array("usermessage_dest" => "usermessage.usermessage_id = usermessage_dest.user_message_id");
$order = "usermessage_dest.datetime_sent DESC";
$unread = 0;
if ($mode == "inbox") {
    $where = array();
    $where["usermessage_dest.to_user_id"] = " = '{$user->_id}'";
    $where["datetime_sent"] = " IS NOT NULL";
    $where["usermessage_dest.archived"] = " = '0'";
    $where['usermessage_dest.deleted'] = " = '0'";
    $order = "usermessage_dest.starred DESC, usermessage_dest.datetime_sent DESC";
    $where["datetime_read"] = " IS NULL";
    $unread = $usermessage->countList($where, $group, $lj);
    $unread = $unread ? $unread : 0;
Ejemplo n.º 3
0
 /**
  * Count the messages drafted by the given user
  *
  * @param CMediusers $user The user
  *
  * @return int The number of drafted messages
  */
 public static function countDraftedFor($user)
 {
     $usermessage = new CUserMessage();
     $where = array('creator_id' => "= '{$user->_id}'");
     /** @var CUserMessage[] */
     $listDrafted = $usermessage->loadList($where);
     foreach ($listDrafted as $key => $_mail) {
         $dests = $_mail->loadRefDests();
         foreach ($dests as $_dest) {
             if ($_dest->datetime_sent) {
                 unset($listDrafted[$key]);
                 continue 2;
             }
         }
     }
     return count($listDrafted);
 }
Ejemplo n.º 4
0
/** $Id: do_usermessage_aed.php 28703 2015-06-23 14:14:07Z asmiane $ **/
/**
 * @package Mediboard
 * @subpackage messagerie
 * @version $Revision: 28703 $
 * @author Thomas despoix
 */
$user = CMediusers::get();
$date = CMbDT::dateTime();
$dests = CValue::post("dest", array());
$del = CValue::post("del", 0);
$send_it = CValue::post("_send");
$archive_mine = CValue::post("_archive");
$read_only = CValue::post("_readonly");
$callback = CValue::post('callback');
$usermessage = new CUserMessage();
// edit mode (draft)
$usermessage->load($_POST["usermessage_id"]);
if ($del && $usermessage->_id) {
    if ($msg = $usermessage->delete()) {
        CAppUI::stepAjax($msg, UI_MSG_ERROR);
    }
    $msg = 'CUserMessage-msg-delete';
    $message_id = null;
} else {
    $usermessage->bind($_POST);
    if ($msg = $usermessage->store()) {
        CAppUI::stepAjax($msg, UI_MSG_ERROR);
    }
    $message_id = $usermessage->usermessage_id;
    $destinataires = $usermessage->loadRefDests();
Ejemplo n.º 5
0
<?php

/** $Id: write_usermessage.php 20898 2013-11-07 10:19:55Z charlyecho $ **/
/**
* @package Mediboard
* @subpackage dPportail
* @version $Revision: 20898 $
* @author Thomas Despoix
*/
CCanDo::checkRead();
$user = CUser::get();
$usermessage = new CUserMessage();
$usermessage->from = $user->_id;
$usermessage->to = CValue::get("to");
$usermessage->subject = CValue::get("subject");
$usermessage->in_reply_to = CValue::get("in_reply_to");
$usermessage->load(CValue::getOrSession("usermessage_id"));
$usermessage->loadRefsFwd();
// Vérifiction de la première lecture par le destinataire
if ($usermessage->to == $user->_id && $usermessage->date_sent && !$usermessage->date_read) {
    $usermessage->date_read = CMbDT::dateTime();
    $usermessage->store();
}
if ($usermessage->in_reply_to) {
    $origin = $usermessage->loadOriginMessage();
    if ($origin->_id) {
        if (!$usermessage->subject) {
            $usermessage->subject = "Re: " . $origin->subject;
        }
        $usermessage->to = $origin->from;
    }
Ejemplo n.º 6
0
    if ($_dest->to_user_id == $user->_id && $usermessage->_id && !$_dest->datetime_read) {
        $_dest->datetime_read = CMbDT::dateTime();
        $_dest->store();
    }
    $_dest->loadRefTo()->loadRefFunction();
    $_dest->loadRefFrom()->loadRefFunction();
}
// last check
if (!$usermessage->_id) {
    $usermessage->creator_id = $user->_id;
    if ($subject) {
        $usermessage->subject = $subject;
    }
    // in reply to
    if ($in_reply_to) {
        $temp_message = new CUserMessage();
        $temp_message->load($in_reply_to);
        $usermessage->subject = "Re: " . $temp_message->subject;
        $usermessage->in_reply_to = $in_reply_to;
        $usermessage->creator_id = $user->_id;
        if ($answer_to_all) {
            $temp_message->loadRefDests();
            $usermessage->_ref_destinataires = array();
            foreach ($temp_message->_ref_destinataires as $_destinataire) {
                if ($_destinataire->to_user_id != $user->_id) {
                    $dest = new CUserMessageDest();
                    $dest->to_user_id = $_destinataire->to_user_id;
                    $dest->from_user_id = $usermessage->creator_id;
                    $dest->loadRefTo()->loadRefFunction();
                    $usermessage->_ref_destinataires[] = $dest;
                }
Ejemplo n.º 7
0
<?php

/**
 * $Id$
 *  
 * @package    Mediboard
 * @subpackage messagerie
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 * @link       http://www.mediboard.org
 */
CCanDo::checkRead();
$usermessage_id = CValue::get('usermessage_id');
$user = CMediusers::get();
$usermessage = new CUserMessage();
$usermessage->load($usermessage_id);
if ($usermessage->_id) {
    $usermessage->loadRefDests();
    $usermessage->loadRefDestUser();
    $usermessage->loadRefCreator()->loadRefFunction();
    foreach ($usermessage->_ref_destinataires as $_destinataire) {
        $_destinataire->loadRefTo()->loadRefFunction();
    }
    $mode = 'sentbox';
    if ($usermessage->_ref_dest_user->_id) {
        if ($usermessage->_ref_dest_user->archived) {
            $mode = 'archive';
        } else {
            $mode = 'inbox';
        }