$where["object_id"] = " = '{$user->_id}'"; $account_pop->loadObject($where); $where = array(); //mails $mail = new CUserMail(); switch ($mode) { case 'inbox': $nb_mails = CUserMail::countInbox($account_id); $mails = CUserMail::loadInbox($account_id, $page, $limit_list); break; case 'archived': $nb_mails = CUserMail::countArchived($account_id); $mails = CUserMail::loadArchived($account_id, $page, $limit_list); break; case 'favorites': $nb_mails = CUserMail::countFavorites($account_id); $mails = CUserMail::loadFavorites($account_id, $page, $limit_list); break; case 'sentbox': $nb_mails = CUserMail::countSent($account_id); $mails = CUserMail::loadSent($account_id, $page, $limit_list); break; case 'drafts': $nb_mails = CUserMail::countDrafted($account_id); $mails = CUserMail::loadDrafted($account_id, $page, $limit_list); break; } /** @var $mails CUserMail[] */ foreach ($mails as $_mail) { $_mail->loadReadableHeader(); $_mail->loadRefsFwd();
<?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(); $account_id = Cvalue::get('account_id'); $counts = array(array('name' => 'inbox', 'count' => CUserMail::countUnread($account_id)), array('name' => 'archived', 'count' => CUserMail::countArchived($account_id)), array('name' => 'sentbox', 'count' => CUserMail::countSent($account_id)), array('name' => 'favorites', 'count' => CUserMail::countFavorites($account_id)), array('name' => 'drafts', 'count' => CUserMail::countDrafted($account_id))); echo json_encode($counts);
/** * $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_connected = CMediusers::get(); $account_id = CValue::get("account_id"); $selected_folder = CValue::get('selected_folder', 'inbox'); $account = new CSourcePOP(); $account->load($account_id); if ($account_id) { CValue::setSession("account_id", $account_id); } //user is atempting to see an account private from another medisuers if ($account->object_id != $user_connected->_id && $account->is_private) { CAppUI::stepAjax("CSourcePOP-error-private_account", UI_MSG_ERROR); } $folders = array('inbox' => CUserMail::countUnread($account_id), 'archived' => CUserMail::countArchived($account_id), 'favorites' => CUserMail::countFavorites($account_id), 'sentbox' => CUserMail::countSent($account_id), 'drafts' => CUserMail::countDrafted($account_id)); //smarty $smarty = new CSmartyDP(); $smarty->assign("account", $account); $smarty->assign('folders', $folders); $smarty->assign('selected_folder', $selected_folder); $smarty->display("vw_account_mail.tpl");