本文整理汇总了PHP中Email::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Email::model方法的具体用法?PHP Email::model怎么用?PHP Email::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Email
的用法示例。
在下文中一共展示了Email::model方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCategory
public function getCategory()
{
$gUid = Ibos::app()->user->uid;
$myFolders = EmailBox::model()->fetchAllNotSysByUid($gUid);
$notReadCount = Email::model()->countNotReadByToid($gUid, "inbox");
$return = array("folders" => $myFolders, "notread" => $notReadCount);
return $return;
}
示例2: loadModel
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer $id the ID of the model to be loaded
* @return Email the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = Email::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例3: actionDel
public function actionDel()
{
$fid = $this->fid;
$cleanAll = EnvUtil::getRequest("delemail");
$emailIds = Email::model()->fetchAllEmailIdsByFolderId($fid, $this->uid);
if ($cleanAll) {
$emailIds && Email::model()->completelyDelete($emailIds, $this->uid);
} else {
$emailIds && Email::model()->updateByPk($emailIds, array("fid" => parent::INBOX_ID));
}
$deleted = EmailFolder::model()->deleteByPk($fid);
if ($deleted) {
$this->ajaxReturn(array("isSuccess" => true));
} else {
$this->ajaxReturn(array("isSuccess" => false, "errorMsg" => Ibos::lang("Del failed", "message")));
}
}
示例4: getListData
private function getListData($operation)
{
$data["op"] = $operation;
$data["fid"] = $this->fid;
$data["webId"] = $this->webId;
$data["folders"] = $this->folders;
$data["archiveId"] = $this->archiveId;
$data["allowRecall"] = Yii::app()->setting->get("setting/emailrecall");
$uid = $this->uid;
if ($operation == "archive") {
if (!in_array($this->subOp, array("in", "send"))) {
$this->subOp = "in";
}
}
$data["subOp"] = $this->subOp;
$count = Email::model()->countByListParam($operation, $uid, $data["fid"], $data["archiveId"], $data["subOp"]);
$pages = PageUtil::create($count, $this->getListPageSize());
$data["pages"] = $pages;
$data["unreadCount"] = Email::model()->countUnreadByListParam($operation, $uid, $data["fid"], $data["archiveId"], $data["subOp"]);
$data["list"] = Email::model()->fetchAllByListParam($operation, $uid, $data["fid"], $data["archiveId"], $pages->getLimit(), $pages->getOffset(), $data["subOp"]);
return $data;
}
示例5: actionMark
public function actionMark()
{
$id = EnvUtil::getRequest("emailid");
$status = false;
if (!empty($id)) {
$condition = "toid = " . $this->uid . " AND FIND_IN_SET(emailid,\"" . $id . "\")";
$markFlag = EnvUtil::getRequest("ismark");
$ismark = strcasecmp($markFlag, "true") == 0 ? 1 : 0;
$status = Email::model()->setField("ismark", $ismark, $condition);
}
$errorMsg = !$status ? Ibos::lang("Operation failure", "message") : "";
$this->ajaxReturn(array("isSuccess" => !!$status, "errorMsg" => $errorMsg), "JSONP");
}
示例6: loadModel
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
*/
public function loadModel()
{
if ($this->_model === null) {
if (isset($_GET['id'])) {
$this->_model = Email::model()->findbyPk($_GET['id']);
}
if ($this->_model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
}
return $this->_model;
}
示例7: actionNotificar
public function actionNotificar($id)
{
$eventos = Evento::model()->findAll();
$model = Evento::model()->findByPK($id);
$contactos = Email::model()->findAll("estatus_did = 1");
$destinatarios = array();
if (count($contactos) > 0) {
foreach ($contactos as $contacto) {
$destinatarios[] = $contacto->correo;
}
}
$this->avisarAsociados($destinatarios, $model->nombre);
$this->redirect(array("evento/listar"));
}
示例8: receiveMail
public static function receiveMail($web)
{
self::$_web = $web;
@set_time_limit(0);
ignore_user_abort(true);
list($prefix) = explode(".", $web["server"]);
$user = User::model()->fetchByUid($web["uid"]);
$pwd = StringUtil::authCode($web["password"], "DECODE", $user["salt"]);
if ($prefix == "imap") {
$obj = new WebMailImap();
} else {
$obj = new WebMailPop();
}
$conn = $obj->connect($web["server"], $web["username"], $pwd, $web["ssl"], $web["port"], "plain");
if (!$conn) {
return implode(",", $obj->getError());
} else {
$totalNum = $obj->countMessages($conn, "INBOX");
if (0 < $totalNum) {
$messagesStr = "1:" . $totalNum;
} else {
$messagesStr = "";
}
if ($messagesStr != "") {
$headers = $obj->fetchHeaders($conn, "INBOX", $messagesStr);
$headers = $obj->sortHeaders($headers, "DATE", "DESC");
} else {
$headers = false;
}
if ($headers == false) {
$headers = array();
}
$count = 0;
if (0 < count($headers)) {
while (list($key, $val) = each($headers)) {
$header = $headers[$key];
$time = $header->timestamp + 28800;
if ($web["lastrectime"] == 0 || $web["lastrectime"] < $time) {
$count++;
$data = array();
$data["subject"] = str_replace(array("<", ">"), array("<", ">"), EmailLangUtil::langDecodeSubject($header->subject, CHARSET));
$data["sendtime"] = $time;
$data["towebmail"] = $web["address"];
$data["issend"] = 1;
$data["fromid"] = $data["secrettoids"] = "";
$data["fromwebmail"] = EmailLangUtil::langGetParseAddressList($header->from);
if (isset($header->to) && !empty($header->to)) {
$data["toids"] = EmailLangUtil::langGetParseAddressList($header->to, ",");
} else {
$data["toids"] = "";
}
if (isset($header->cc) && !empty($header->cc)) {
$data["copytoids"] = EmailLangUtil::langGetParseAddressList($header->cc, ",");
} else {
$data["copytoids"] = "";
}
$body = self::getBody($header->id, $conn, $obj, $header);
$data["content"] = implode("", $body);
$data["size"] = EmailUtil::getEmailSize($data["content"]);
$bodyId = EmailBody::model()->add($data, true);
if ($bodyId) {
$email = array("toid" => $web["uid"], "isread" => 0, "fid" => $web["fid"], "isweb" => 1, "bodyid" => $bodyId);
Email::model()->add($email);
}
}
}
EmailWeb::model()->updateByPk($web["webid"], array("lastrectime" => TIMESTAMP));
}
return $count;
}
}
示例9: actionMark
public function actionMark()
{
$op = EnvUtil::getRequest("op");
$opList = array("todo", "read", "unread", "sendreceipt", "cancelreceipt", "del", "restore", "batchdel", "move");
if (!in_array($op, $opList)) {
exit;
}
$ids = EnvUtil::getRequest("emailids");
$id = StringUtil::filterStr($ids);
$extends = array();
$condition = "toid = " . $this->uid . " AND FIND_IN_SET(emailid,\"" . $id . "\")";
$valueDriver = array("read" => array("isread", 1), "unread" => array("isread", 0), "sendreceipt" => array("isreceipt", 1), "cancelreceipt" => array("isreceipt", 2), "restore" => array("isdel", 0));
switch ($op) {
case "del":
case "batchdel":
if ($op == "del") {
$next = Email::model()->fetchNext($id, $this->uid, $this->fid, $this->archiveId);
if (!empty($next)) {
$extends["url"] = $this->createUrl("content/show", array("id" => $next["emailid"], "archiveid" => $this->archiveId));
} else {
$extends["url"] = $this->createUrl("list/index");
}
}
$status = Email::model()->setField("isdel", 3, $condition);
break;
case "move":
$fid = intval(EnvUtil::getRequest("fid"));
$status = Email::model()->updateAll(array("fid" => $fid, "isdel" => 0), $condition);
break;
case "todo":
$markFlag = EnvUtil::getRequest("ismark");
$ismark = strcasecmp($markFlag, "true") == 0 ? 1 : 0;
$status = Email::model()->setField("ismark", $ismark, $condition);
break;
case "sendreceipt":
$fromInfo = Ibos::app()->db->createCommand()->select("eb.bodyid,eb.subject,eb.fromid")->from("{{email_body}} eb")->leftJoin("{{email}} e", "e.bodyid = eb.bodyid")->where("e.emailid = " . intval($id))->queryRow();
if ($fromInfo) {
$config = array("{reader}" => Ibos::app()->user->realname, "{url}" => Ibos::app()->urlManager->createUrl("email/content/show", array("id" => $fromInfo["bodyid"])), "{title}" => $fromInfo["subject"]);
Notify::model()->sendNotify($fromInfo["fromid"], "email_receive_message", $config);
}
default:
if (isset($valueDriver[$op])) {
$value = $valueDriver[$op][1][0];
$valueDriver;
$status = Email::model()->setField($key, $value, $condition);
} else {
$status = false;
}
break;
}
$errorMsg = !$status ? Ibos::lang("Operation failure", "message") : "";
$this->ajaxReturn(array_merge(array("isSuccess" => !!$status, "errorMsg" => $errorMsg), $extends));
}
示例10: exportExcel
public static function exportExcel($id)
{
$data = Email::model()->fetchById($id);
if ($data) {
$users = UserUtil::loadUser();
header("Cache-control: private");
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=" . ConvertUtil::iIconv($data["subject"], CHARSET, "GBK") . "(" . date("Y-m-d") . ").xls");
//$html = " <html xmlns:o=\"urn:schemas-microsoft-com:office:office\"\r\n\t\txmlns:x=\"urn:schemas-microsoft-com:office:excel\"\r\n\t\txmlns=\"http://www.w3.org/TR/REC-html40\">\r\n\t\t<head>\r\n\t\t<title></title>\r\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n\t\t</head>\r\n\t\t<body topmargin=\"5\">\r\n\t\t <table border=\"1\" cellspacing=\"1\" width=\"95%\" class=\"small\" cellpadding=\"3\">\r\n\t\t\t<tr style=\"BACKGROUND: #D3E5FA; color: #000000; font-weight: bold;\">\r\n\t\t\t <td align=\"center\">收件人:</td>\r\n\t\t\t <td align=\"center\">发件人:</td>\r\n\t\t\t <td align=\"center\">抄送:</td>\r\n\t\t\t <td align=\"center\">重要性:</td>\r\n\t\t\t <td align=\"center\">标题:</td>\r\n\t\t\t <td align=\"center\">发送时间:</td>\r\n\t\t\t <td align=\"center\">内容:</td>\r\n\t\t\t <td align=\"center\">附件名称:</td>\r\n\t\t\t</tr> ";
$html = '<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body topmargin="5">
<table border="1" cellspacing="1" width="95%" class="small" cellpadding="3">
<tr style="BACKGROUND: #D3E5FA; color: #000000; font-weight: bold;">
<td align="center">收件人:</td>
<td align="center">发件人:</td>
<td align="center">抄送:</td>
<td align="center">重要性:</td>
<td align="center">标题:</td>
<td align="center">发送时间:</td>
<td align="center">内容:</td>
<td align="center">附件名称:</td>
</tr>';
$data["toname"] = self::joinStringByArray($data["toids"], $users, "realname", ";");
$data["content"] = str_replace(" ", " ", $data["content"]);
$data["content"] = str_replace("\n", "<br>", $data["content"]);
$data["fromname"] = isset($users[$data["fromid"]]) ? $users[$data["fromid"]]["realname"] : "";
$data["copytoname"] = self::joinStringByArray($data["copytoids"], $users, "realname", ";");
$important_desc = "";
if ($data["important"] == "0") {
$important_desc = "";
} elseif ($data["important"] == "1") {
$important_desc = "<font color=\"#ff6600\">一般邮件</font>";
} elseif ($data["important"] == "2") {
$important_desc = "<font color=\"#FF0000\">重要邮件</font>";
}
$attachmentname = "";
if ($data["attachmentid"] !== "") {
$tempdata = AttachUtil::getAttach($data["attachmentid"]);
foreach ($tempdata as $value) {
$attachmentname .= $value["filename"] . "; ";
}
}
$data["sendtime"] = ConvertUtil::formatDate($data["sendtime"]);
//$html .= "\r\n <tr>\r\n <td nowrap align=\"center\">" . $data["toname"] . "</td>\r\n <td nowrap align=\"center\">" . $data["fromname"] . "</td>\r\n <td>" . $data["copytoname"] . "</td>\r\n <td nowrap align=\"center\">" . $important_desc . "</td>\r\n <td nowrap>" . $data["subject"] . "</td>\r\n <td nowrap align=\"center\" x:str=\"" . $data["sendtime"] . "\">" . $data["sendtime"] . "</td>\r\n <td>" . $data["content"] . "</td>\r\n <td>" . $attachmentname . "</td>\r\n </tr>\r\n </table>";
$html .= '<tr>
<td nowrap align="center">' . $data["toname"] . '</td>
<td nowrap align="center">' . $data["fromname"] . '</td>
<td>' . $data["copytoname"] . '</td>
<td nowrap align="center">' . $important_desc . '</td>
<td nowrap>' . $data["subject"] . '</td>
<td nowrap align="center" x:str="' . $data["sendtime"] . '">' . $data["sendtime"] . '</td>
<td>' . $data["content"] . '</td>
<td>' . $attachmentname . '</td>
</tr></table>';
echo $html;
}
}
示例11: getSysFolderSize
public function getSysFolderSize($uid, $alias)
{
$param = Email::model()->getListParam($alias, $uid);
$count = Yii::app()->db->createCommand()->select("SUM(eb.size) AS sum")->from("{{email}} e")->leftJoin("{{email_body}} eb", "e.bodyid = eb.bodyid")->where($param["condition"])->queryScalar();
return intval($count);
}
示例12: save
private function save($bodyId, $bodyData)
{
if (!empty($bodyData["attachmentid"]) && $bodyId) {
AttachUtil::updateAttach($bodyData["attachmentid"], $bodyId);
}
if ($bodyData["issend"]) {
Email::model()->send($bodyId, $bodyData);
if (!empty($bodyData["towebmail"])) {
$toUsers = StringUtil::filterStr($bodyData["towebmail"], ";");
if (!empty($toUsers)) {
$webBox = EmailWeb::model()->fetchByPk($bodyData["fromwebid"]);
WebMailUtil::sendWebMail($toUsers, $bodyData, $webBox);
}
}
UserUtil::updateCreditByAction("postmail", $this->uid);
$message = Ibos::lang("Send succeed");
} else {
$message = Ibos::lang("Save succeed", "message");
}
if (Yii::app()->request->getIsAjaxRequest()) {
$this->ajaxReturn(array("isSuccess" => true, "messsage" => $message));
} else {
$this->success($message, $this->createUrl("list/index"));
}
}
示例13: actionEnviar
public function actionEnviar()
{
$model = new Email();
$contactos = Email::model()->findAll("estatus_did = 1");
if (count($contactos) <= 0) {
Yii::app()->user->setFlash('danger', "No tiene destinatarios, agregue uno por lo menos");
$this->redirect(array("create"));
}
if (isset($_POST["Email"]["correo"])) {
$destinatarios = $_POST["Email"]["correo"];
$destinatarios = array_values($destinatarios);
$this->avisarResponsable($destinatarios, $_POST["mensaje"]);
Yii::app()->user->setFlash('info', "Su Email se ha enviado correctamente");
$this->redirect(array("index"));
}
$this->render("enviar", array("contactos" => $contactos, "model" => $model));
}