本文整理汇总了PHP中Notify::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Notify::model方法的具体用法?PHP Notify::model怎么用?PHP Notify::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notify
的用法示例。
在下文中一共展示了Notify::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addDigg
public function addDigg($feedId, $uid)
{
$data["feedid"] = $feedId;
$data["uid"] = $uid;
$data["uid"] = !$data["uid"] ? Ibos::app()->user->uid : $data["uid"];
if (!$data["uid"]) {
$this->addError("addDigg", "未登录不能赞");
return false;
}
$isExit = $this->getIsExists($feedId, $uid);
if ($isExit) {
$this->addError("addDigg", "你已经赞过");
return false;
}
$data["ctime"] = time();
$res = $this->add($data);
if ($res) {
$feed = Source::getSourceInfo("feed", $feedId);
Feed::model()->updateCounters(array("diggcount" => 1), "feedid = " . $feedId);
Feed::model()->cleanCache($feedId);
$user = User::model()->fetchByUid($uid);
$config["{user}"] = $user["realname"];
$config["{sourceContent}"] = StringUtil::filterCleanHtml($feed["source_body"]);
$config["{sourceContent}"] = str_replace("◆", "", $config["{sourceContent}"]);
$config["{sourceContent}"] = StringUtil::cutStr($config["{sourceContent}"], 34);
$config["{url}"] = $feed["source_url"];
$config["{content}"] = Ibos::app()->getController()->renderPartial("application.modules.message.views.remindcontent", array("recentFeeds" => Feed::model()->getRecentFeeds()), true);
Notify::model()->sendNotify($feed["uid"], "message_digg", $config);
UserUtil::updateCreditByAction("diggweibo", $uid);
UserUtil::updateCreditByAction("diggedweibo", $feed["uid"]);
}
return $res;
}
示例2: setFocus
public function setFocus($setFocus, $runId, $uid)
{
$run = $this->fetchByPk(intval($runId));
$focusUser = $run["focususer"];
if ($setFocus) {
if (StringUtil::findIn($focusUser, $uid)) {
return false;
} else {
$focusUser = array_unique(array_merge(array($uid), !empty($focusUser) ? explode(",", $focusUser) : array()));
$allUser = FlowRunProcess::model()->fetchAllUidByRunId($runId);
if (!empty($allUser)) {
$config = array("{runName}" => $run["name"], "{userName}" => User::model()->fetchRealNameByUid($uid));
Notify::model()->sendNotify($allUser, "workflow_focus_notice", $config);
}
}
} elseif (!StringUtil::findIn($focusUser, $uid)) {
return false;
} else {
$userPart = explode(",", $focusUser);
$index = array_search($uid, $userPart);
if (is_int($index)) {
unset($userPart[$index]);
}
$focusUser = $userPart;
}
return $this->modify($runId, array("focususer" => implode(",", $focusUser)));
}
示例3: actionSetup
public function actionSetup()
{
$formSubmit = EnvUtil::submitCheck("formhash");
if ($formSubmit) {
$data =& $_POST;
foreach (array("sendemail", "sendsms", "sendmessage") as $field) {
if (!empty($data[$field])) {
$ids = array_keys($data[$field]);
$idstr = implode(",", $ids);
Notify::model()->updateAll(array($field => 1), sprintf("FIND_IN_SET(id,'%s')", $idstr));
Notify::model()->updateAll(array($field => 0), sprintf("NOT FIND_IN_SET(id,'%s')", $idstr));
} else {
Notify::model()->updateAll(array($field => 0));
}
}
CacheUtil::update("NotifyNode");
$this->success(Ibos::lang("Save succeed", "message"));
} else {
$nodeList = Notify::model()->getNodeList();
foreach ($nodeList as &$node) {
$node["moduleName"] = Module::model()->fetchNameByModule($node["module"]);
}
$this->render("setup", array("nodeList" => $nodeList));
}
}
示例4: actionIndex
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndex()
{
$this->setPageTitle('通知');
$type = Yii::app()->request->getQuery('type');
$type_arr = Notify::model()->type_arr;
$user = new User();
$notifys = array();
$uid = Yii::app()->user->id;
$model = new Notify();
//初始化
$criteria = new CDbCriteria();
$criteria->order = 'ctime';
$criteria->condition = "t.uid=:uid";
$criteria->params = array(':uid' => $uid);
if (!array_key_exists($type, $type_arr)) {
$type = 'all';
}
if ($type != 'all') {
$condition = "cate = '{$cate}'";
$criteria->addCondition($condition);
}
//取得数据总数,分页显示
$total = $model->count($criteria);
$pages = new CPagination($total);
$pages->pageSize = 20;
$pages->applyLimit($criteria);
//获取数据集
$notifys = $model->findAll($criteria);
$data = array('type' => $type, 'type_arr' => $type_arr, 'notifys' => $notifys, 'user' => $user, 'pages' => $pages);
$this->render('index', $data);
}
示例5: readNotify
public function readNotify($array)
{
$criteria = new CDbCriteria();
foreach ($array as $id) {
$criteria->addCondition('id=' . (int) $id, 'OR');
}
Notify::model()->updateAll(array('read' => Notify::READ), $criteria);
}
示例6: send
public function send($bodyId, $bodyData, $inboxId = EmailBaseController::INBOX_ID)
{
$toids = $bodyData["toids"] . "," . $bodyData["copytoids"] . "," . $bodyData["secrettoids"];
$toid = StringUtil::filterStr($toids);
foreach (explode(",", $toid) as $uid) {
$email = array("toid" => $uid, "fid" => $inboxId, "bodyid" => $bodyId);
$newId = $this->add($email, true);
$config = array("{sender}" => Ibos::app()->user->realname, "{subject}" => $bodyData["subject"], "{url}" => Ibos::app()->urlManager->createUrl("email/content/show", array("id" => $newId)), "{content}" => Ibos::app()->getController()->renderPartial("application.modules.email.views.remindcontent", array("body" => $bodyData), true));
Notify::model()->sendNotify($uid, "email_message", $config);
}
}
示例7: actionNotifications
public function actionNotifications($id = 0, $action = '')
{
if ($id) {
$notify = Notify::model()->findByPK($id);
if (!$notify) {
throw new CHttpException(404, Yii::t('errors', 'Wrong notify'));
} elseif ($action) {
if ($notify->status == 2 || $notify->status == 3) {
throw new CHttpException(404, Yii::t('errors', 'Status already set'));
}
if ($notify->shared_id) {
$cam = Shared::model()->findByPK($notify->shared_id);
if (!$cam) {
$notify->delete();
throw new CHttpException(404, Yii::t('errors', 'Wrong cam'));
}
} else {
$notify->delete();
throw new CHttpException(404, Yii::t('errors', 'Wrong cam'));
}
$n = new Notify();
$id = Yii::app()->user->getId();
if ($action == 'approve') {
//TODO specify user and cam
$n->note(Yii::t('user', 'User approve shared cam'), array($id, $notify->creator_id, 0));
$cam->is_approved = 1;
$cam->save();
$notify->status = 2;
$notify->save();
} elseif ($action == 'disapprove') {
$n->note(Yii::t('user', 'User decline shared cam'), array($id, $notify->creator_id, 0));
$cam->is_approved = 0;
$cam->save();
$notify->status = 3;
$notify->save();
} else {
throw new CHttpException(404, Yii::t('errors', 'Wrong action'));
}
} else {
throw new CHttpException(404, Yii::t('errors', 'Wrong action'));
}
}
$new = Notify::model()->findAllByAttributes(array('dest_id' => Yii::app()->user->getId(), 'status' => 1));
$old = Notify::model()->findAllByAttributes(array('dest_id' => Yii::app()->user->getId(), 'status' => array(0, 2, 3)), array('order' => 'time DESC'));
foreach ($new as $notify) {
if ($notify->shared_id == 0) {
$notify->status = 0;
$notify->save();
}
}
$this->render('notify', array('new' => $new, 'old' => $old));
}
示例8: addComment
public function addComment($data, $forApi = false, $notCount = false, $lessUids = null)
{
$add = $this->escapeData($data);
if ($add["content"] === "") {
$this->addError("comment", Ibos::lang("Required comment content", "message.default"));
return false;
}
$add["isdel"] = 0;
$res = $this->add($add, true);
if ($res) {
isset($data["touid"]) && !empty($data["touid"]) && ($lessUids[] = intval($data["touid"]));
$scream = explode("//", $data["content"]);
Atme::model()->addAtme("message", "comment", trim($scream[0]), $res, null, $lessUids);
$table = ucfirst($add["table"]);
$pk = $table::model()->getTableSchema()->primaryKey;
$table::model()->updateCounters(array("commentcount" => 1), "`{$pk}` = {$add["rowid"]}");
if (Ibos::app()->user->uid != $add["moduleuid"] && $add["moduleuid"] != "") {
!$notCount && UserData::model()->updateKey("unread_comment", 1, true, $add["moduleuid"]);
}
if (!empty($add["touid"]) && $add["touid"] != Ibos::app()->user->uid && $add["touid"] != $add["moduleuid"]) {
!$notCount && UserData::model()->updateKey("unread_comment", 1, true, $add["touid"]);
}
if ($add["table"] == "feed") {
if (Ibos::app()->user->uid != $add["uid"]) {
UserUtil::updateCreditByAction("addcomment", Ibos::app()->user->uid);
UserUtil::updateCreditByAction("getcomment", $data["moduleuid"]);
}
Feed::model()->cleanCache($add["rowid"]);
}
if ($add["touid"] != Ibos::app()->user->uid || $add["moduleuid"] != Ibos::app()->user->uid && $add["moduleuid"] != "") {
$author = User::model()->fetchByUid(Ibos::app()->user->uid);
$config["{name}"] = $author["realname"];
$sourceInfo = Source::getCommentSource($add, $forApi);
$config["{url}"] = $sourceInfo["source_url"];
$config["{sourceContent}"] = StringUtil::parseHtml($sourceInfo["source_content"]);
if (!empty($add["touid"])) {
$config["{commentType}"] = "回复了我的评论:";
Notify::model()->sendNotify($add["touid"], "comment", $config);
} else {
$config["{commentType}"] = "评论了我的微博:";
if (!empty($add["moduleuid"])) {
Notify::model()->sendNotify($add["moduleuid"], "comment", $config);
}
}
}
}
return $res;
}
示例9: changeReadStatus
/**
* @param $notify_id
* @param $user_id
* @param int $status_id
* @return bool|NotifyStatus
*/
public static function changeReadStatus($notify_id, $user_id, $status_id = Notify::READ)
{
$notify = Notify::model()->exists('id=:id', ['id' => $notify_id]);
if (!$notify || (int) $user_id <= 0) {
return false;
}
$status = self::model()->findByAttributes(['notify_id' => $notify_id, 'user_id' => (int) $user_id]);
if (!$status) {
$status = new self();
$status->notify_id = $notify_id;
$status->user_id = $user_id;
}
$status->read_status = $status_id == Notify::READ || $status_id == Notify::NOT_READ ? $status_id : Notify::READ;
if ($status->save()) {
return $status;
} else {
return false;
}
}
示例10: actionGetUserNotify
public function actionGetUserNotify($email)
{
header("Content-Type: text/xml");
$performer = 9;
$notify = Notify::model()->findAll(array('condition' => 'performer_id=:performer_id', 'limit' => '3', 'params' => array(':performer_id' => $performer)));
$dom = new domDocument("1.0", "cp1251");
// Создаём XML-документ версии 1.0 с кодировкой utf-8
$root = $dom->createElement("notifys");
// Создаём корневой элемент
$dom->appendChild($root);
foreach ($notify as $n) {
$notify = $dom->createElement("notify");
$header = $dom->createElement("header", $n->header);
$description = $dom->createElement("description", strip_tags($n->description));
$link = $dom->createElement("link", Notify::getCreateXmlUrl($n->route, $n->route_params));
$notify->appendChild($header);
$notify->appendChild($description);
$notify->appendChild($link);
$root->appendChild($notify);
}
$import = simplexml_import_dom($dom);
echo $import->asXML();
}
示例11: actionAdd
public function actionAdd()
{
if (!Ibos::app()->request->getIsAjaxRequest()) {
$this->error(IBos::lang("Parameters error", "error"), $this->createUrl("schedule/index"));
}
if (!$this->checkAddPermission()) {
$this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("No permission to add schedule")));
}
$getStartTime = EnvUtil::getRequest("CalendarStartTime");
$sTime = empty($getStartTime) ? date("y-m-d h:i", time()) : $getStartTime;
$getEndTime = EnvUtil::getRequest("CalendarEndTime");
$eTime = empty($getEndTime) ? date("y-m-d h:i", time()) : $getEndTime;
$getTitle = EnvUtil::getRequest("CalendarTitle");
$title = empty($getTitle) ? "" : $getTitle;
if ($this->uid != $this->upuid) {
$title .= " (" . User::model()->fetchRealnameByUid($this->upuid) . ")";
}
$getIsAllDayEvent = EnvUtil::getRequest("IsAllDayEvent");
$isAllDayEvent = empty($getIsAllDayEvent) ? 0 : intval($getIsAllDayEvent);
$getCategory = EnvUtil::getRequest("Category");
$category = empty($getCategory) ? -1 : $getCategory;
$schedule = array("uid" => $this->uid, "subject" => $title, "starttime" => CalendarUtil::js2PhpTime($sTime), "endtime" => CalendarUtil::js2PhpTime($eTime), "isalldayevent" => $isAllDayEvent, "category" => $category, "uptime" => time(), "upuid" => $this->upuid);
$addId = Calendars::model()->add($schedule, true);
if ($addId) {
$ret["isSuccess"] = true;
$ret["msg"] = "success";
$ret["data"] = intval($addId);
if ($this->upuid != $this->uid) {
$config = array("{sender}" => User::model()->fetchRealnameByUid($this->upuid), "{subject}" => $title, "{url}" => Ibos::app()->urlManager->createUrl("calendar/schedule/index"));
Notify::model()->sendNotify($this->uid, "add_calendar_message", $config, $this->upuid);
}
} else {
$ret["isSuccess"] = false;
$ret["msg"] = "fail";
}
$this->ajaxReturn($ret);
}
示例12: doFollow
public function doFollow($uid, $fid)
{
if (intval($uid) <= 0 || $fid <= 0) {
$this->addError("doFollow", Ibos::lang("Parameters error", "error"));
return false;
}
if ($uid == $fid) {
$this->addError("doFollow", Ibos::lang("Following myself forbidden", "message.default"));
return false;
}
if (!User::model()->fetchByUid($fid)) {
$this->addError("doFollow", Ibos::lang("Following people noexist", "message.default"));
return false;
}
$followState = $this->getFollowState($uid, $fid);
if (0 == $followState["following"]) {
$map["uid"] = $uid;
$map["fid"] = $fid;
$map["ctime"] = time();
$result = $this->add($map);
$user = User::model()->fetchByUid($uid);
$config = array("{user}" => $user["realname"], "{url}" => Ibos::app()->urlManager->createUrl("weibo/personal/follower"));
Notify::model()->sendNotify($fid, "user_follow", $config);
if ($result) {
$this->addError("doFollow", Ibos::lang("Add follow success", "message.default"));
$this->_updateFollowCount($uid, $fid, true);
$followState["following"] = 1;
return $followState;
} else {
$this->addError("doFollow", Ibos::lang("Add follow fail", "message.default"));
return false;
}
} else {
$this->addError("doFollow", Ibos::lang("Following", "message.default"));
return false;
}
}
示例13: actionAdd
public function actionAdd()
{
if (EnvUtil::submitCheck("formhash")) {
if (!$this->checkTaskPermission()) {
$this->error(Ibos::lang("No permission to add task"), $this->createUrl("task/index"));
}
foreach ($_POST as $key => $value) {
$_POST[$key] = StringUtil::filterCleanHtml($value);
}
$_POST["upuid"] = $this->upuid;
$_POST["uid"] = $this->uid;
$_POST["addtime"] = time();
if (!isset($_POST["pid"])) {
$count = Tasks::model()->count("pid=:pid", array(":pid" => ""));
$_POST["sort"] = $count + 1;
}
Tasks::model()->add($_POST, true);
if ($this->upuid != $this->uid) {
$config = array("{sender}" => User::model()->fetchRealnameByUid($this->upuid), "{subject}" => $_POST["text"], "{url}" => Ibos::app()->urlManager->createUrl("calendar/task/index"));
Notify::model()->sendNotify($this->uid, "task_message", $config, $this->upuid);
}
$this->ajaxReturn(array("isSuccess" => true));
}
}
示例14: save
private function save()
{
if (EnvUtil::submitCheck("formhash")) {
$postData = $_POST;
$uid = Ibos::app()->user->uid;
$postData["uid"] = $uid;
$postData["subject"] = StringUtil::filterCleanHtml($_POST["subject"]);
$toidArr = StringUtil::getId($postData["toid"]);
$postData["toid"] = implode(",", $toidArr);
$postData["begindate"] = strtotime($postData["begindate"]);
$postData["enddate"] = strtotime($postData["enddate"]);
$reportData = ICReport::handleSaveData($postData);
$repid = Report::model()->add($reportData, true);
if ($repid) {
if (!empty($postData["attachmentid"])) {
AttachUtil::updateAttach($postData["attachmentid"]);
}
$orgPlan = $outSidePlan = array();
if (array_key_exists("orgPlan", $_POST)) {
$orgPlan = $_POST["orgPlan"];
}
if (!empty($orgPlan)) {
foreach ($orgPlan as $recordid => $val) {
$updateData = array("process" => intval($val["process"]), "exedetail" => StringUtil::filterCleanHtml($val["exedetail"]));
if ($updateData["process"] == self::COMPLETE_FALG) {
$updateData["flag"] = 1;
}
ReportRecord::model()->modify($recordid, $updateData);
}
}
if (array_key_exists("outSidePlan", $_POST)) {
$outSidePlan = array_filter($_POST["outSidePlan"], create_function("\$v", "return !empty(\$v[\"content\"]);"));
}
if (!empty($outSidePlan)) {
ReportRecord::model()->addPlans($outSidePlan, $repid, $postData["begindate"], $postData["enddate"], $uid, 1);
}
$nextPlan = array_filter($_POST["nextPlan"], create_function("\$v", "return !empty(\$v[\"content\"]);"));
ReportRecord::model()->addPlans($nextPlan, $repid, strtotime($_POST["planBegindate"]), strtotime($_POST["planEnddate"]), $uid, 2);
$wbconf = WbCommonUtil::getSetting(true);
if (isset($wbconf["wbmovement"]["report"]) && $wbconf["wbmovement"]["report"] == 1) {
$userid = $postData["toid"];
$supUid = UserUtil::getSupUid($uid);
if (0 < intval($supUid) && !in_array($supUid, explode(",", $userid))) {
$userid = $userid . "," . $supUid;
}
$data = array("title" => Ibos::lang("Feed title", "", array("{subject}" => $postData["subject"], "{url}" => Ibos::app()->urlManager->createUrl("report/review/show", array("repid" => $repid)))), "body" => StringUtil::cutStr($_POST["content"], 140), "actdesc" => Ibos::lang("Post report"), "userid" => trim($userid, ","), "deptid" => "", "positionid" => "");
WbfeedUtil::pushFeed($uid, "report", "report", $repid, $data);
}
UserUtil::updateCreditByAction("addreport", $uid);
if (!empty($toidArr)) {
$config = array("{sender}" => User::model()->fetchRealnameByUid($uid), "{subject}" => $reportData["subject"], "{url}" => Ibos::app()->urlManager->createUrl("report/review/show", array("repid" => $repid)));
Notify::model()->sendNotify($toidArr, "report_message", $config, $uid);
}
$this->success(Ibos::lang("Save succeed", "message"), $this->createUrl("default/index"));
} else {
$this->error(Ibos::lang("Save faild", "message"), $this->createUrl("default/index"));
}
}
}
示例15: actionConfirmPost
public function actionConfirmPost()
{
if (EnvUtil::submitCheck("formhash")) {
$key = EnvUtil::getRequest("key");
$param = WfCommonUtil::param($key, "DECODE");
$runId = intval($param["runid"]);
$processId = intval($param["processid"]);
$flowId = intval($param["flowid"]);
$flowProcess = intval($param["flowprocess"]);
$opflag = intval($_POST["opflag"]);
$oldUid = intval($_POST["oldUid"]);
$this->checkRunAccess($runId);
$this->checkEntrustType($flowId);
$referer = EnvUtil::referer();
$frp = FlowRunProcess::model()->fetchRunProcess($runId, $processId, $flowProcess, $oldUid);
if ($frp) {
$parent = $frp["parent"];
$topflag = $frp["topflag"];
}
$toid = implode(",", StringUtil::getId($_POST["prcs_other"]));
$tempFRP = FlowRunProcess::model()->fetchRunProcess($runId, $processId, $flowProcess, $toid);
if (!$tempFRP) {
$data = array("runid" => $runId, "processid" => $processId, "uid" => $toid, "flag" => 1, "flowprocess" => $flowProcess, "opflag" => $opflag, "topflag" => $topflag, "parent" => $parent, "createtime" => TIMESTAMP);
FlowRunProcess::model()->add($data);
} else {
if ($tempFRP["opflag"] == 0 && $opflag == 1) {
FlowRunProcess::model()->updateAll(array("opflag" => 1, "flag" => 2), sprintf("runid = %d AND processid = %d AND flowprocess = %d AND uid = %d", $runId, $processId, $flowProcess, $toid));
} else {
$name = User::model()->fetchRealnameByUid($toid);
$this->error(Ibos::lang("Already are opuser", "", array("{name}" => $name)), $referer);
}
}
FlowRunProcess::model()->updateProcessTime($runId, $processId, $flowProcess, $oldUid);
FlowRunProcess::model()->updateAll(array("flag" => 4, "opflag" => 0, "delivertime" => TIMESTAMP), "runid = :runid AND processid = :prcsid AND flowprocess = :fp AND uid = :uid", array(":runid" => $runId, ":prcsid" => $processId, ":fp" => $flowProcess, ":uid" => $oldUid));
$toName = User::model()->fetchRealnameByUid($toid);
$userName = User::model()->fetchRealnameByUid($oldUid);
$content = Ibos::lang("Entrust to desc", "", array("{username}" => $userName, "{toname}" => $toName));
WfCommonUtil::runlog($runId, $processId, $flowProcess, $this->uid, 2, $content, $toid);
$message = StringUtil::filterCleanHtml($_POST["message"]);
if (!empty($message)) {
Notify::model()->sendNotify($toid, "workflow_entrust_notice", array("{message}" => $message));
}
$this->redirect($referer);
}
}