Ejemplo n.º 1
0
 /**
  * Load the drafted mails for an account
  *
  * @param int $account_id The account id
  * @param int $start      The start
  * @param int $limit      The number of mails to load
  *
  * @return CUserMail[]
  */
 public static function loadDrafted($account_id, $start, $limit)
 {
     $where['account_id'] = "= '{$account_id}'";
     $where['account_class'] = "= 'CSourcePOP'";
     $where['draft'] = "= '1' ";
     $order = "date_inbox DESC";
     $limit = "{$start}, {$limit}";
     $mail = new CUserMail();
     return $mail->loadList($where, $order, $limit);
 }
Ejemplo n.º 2
0
 * @subpackage messagerie
 * @version    $Revision$
 * @author     SARL OpenXtrem
 */
CCanDo::checkRead();
CPop::checkImapLib();
$account_id = CValue::get("account_id");
$user = CMediusers::get();
//get account
$account_pop = new CSourcePOP();
$account_pop->load($account_id);
//get the list
$mail = new CUserMail();
$where = array();
$where[] = "date_read IS NULL AND account_id = '{$account_id}' AND account_class = 'CSourcePOP'";
$mails = $mail->loadList($where);
$pop = new CPop($account_pop);
$pop->open();
$count = 0;
/** @var $mails CUserMail[] */
foreach ($mails as $_mail) {
    if ($pop->setflag($_mail->uid, "\\Seen")) {
        $_mail->date_read = CMbDT::dateTime();
        if (!($msg = $_mail->store())) {
            $count++;
        }
    }
}
$pop->close();
if ($count > 0) {
    CAppUI::stepAjax("CUserMail-markedAsRead", UI_MSG_OK, $count);