本文整理汇总了PHP中Notify类的典型用法代码示例。如果您正苦于以下问题:PHP Notify类的具体用法?PHP Notify怎么用?PHP Notify使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Notify类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionSetMsg
public function actionSetMsg()
{
$data = Yii::$app->request->post();
$phone = User::findOne(['phone' => $data['phone']]);
$info = CollectInteract::findOne(['userid' => $phone['id'], 'msg' => $data['msg']]);
if ($info) {
echo json_encode(array('flag' => 0, 'msg' => 'Already collect!'));
return;
}
$to = Message::findOne(['id' => $data['msg']]);
$model2 = new Notify();
$model2->from = $phone['id'];
$model2->to = $to['userid'];
$model2->message = '收藏';
$model2->created_at = time();
if (!$model2->save()) {
echo json_encode(array('flag' => 0, 'msg' => 'Collect fail!'));
return;
}
$model = new CollectInteract();
$model->userid = $phone['id'];
$model->msg = $data['msg'];
$model->created_at = time();
if ($model->save()) {
echo json_encode(array('flag' => 1, 'msg' => 'Collect success!'));
} else {
echo json_encode(array('flag' => 0, 'msg' => 'Collect fail!'));
}
}
示例2: controller_global
public function controller_global()
{
$this->cms();
$this->contact_form = new WaxForm(new GetInTouch());
if ($data = $this->contact_form->save()) {
$notify = new Notify();
$notify->send_contact_details($data->row);
$this->redirect_to("/thanks/contact");
}
}
示例3: runTrigger
/**
* Function called when a Dolibarrr business event is done.
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (empty($conf->notification->enabled)) {
return 0;
}
// Module not active, we do nothing
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($this->db);
$notify->send($action, $object);
return 1;
}
示例4: 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));
}
示例5: 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;
}
示例6: notify
function notify()
{
$order_id = $_GET['order_id'];
$type = strtolower($_GET['type']);
$type_arr = array('cancel', 'alert');
if (!in_array($type, $type_arr)) {
echo 'no_type';
exit;
}
$order_model = M('Order');
// 查找订单
$order = $order_model->find($order_id);
if (empty($order)) {
echo 'no_order';
exit;
}
if ($order['status'] > 1) {
echo 'type_error';
exit;
}
// 更改订单状态
if ($type == 'cancel') {
$order_model->setStatus($order['store_id'], $order['order_id'], 5);
echo 'ok';
exit;
}
if ($type == 'alert') {
import('source.class.Notify');
Notify::alert('尊敬的会员' . $order['address_user'] . '您好,您的订单号:' . $order_id . '未付款,请及时付款');
}
}
示例7: do_private_post
function do_private_post($content, $results)
{
global $config, $speak;
$results = Mecha::O($results);
$results = $config->is->post ? Get::postHeader($results->path, POST . DS . $config->page_type, '/', $config->page_type . ':') : false;
if ($results === false) {
return $speak->plugin_private_post->description;
}
$s = isset($results->fields->pass) ? $results->fields->pass : "";
if (strpos($s, ':') !== false) {
$s = explode(':', $s, 2);
if (isset($s[1])) {
$speak->plugin_private_post->hint = ltrim($s[1]);
}
// override password hint
$s = $s[0];
}
$hash = md5($s . PRIVATE_POST_SALT);
$html = Notify::read(false) . '<div class="overlay--' . File::B(__DIR__) . '"></div><form class="form--' . File::B(__DIR__) . '" action="' . $config->url . '/' . File::B(__DIR__) . '/do:access" method="post">' . NL;
$html .= TAB . Form::hidden('token', Guardian::token()) . NL;
$html .= TAB . Form::hidden('_', $hash) . NL;
$html .= TAB . Form::hidden('kick', $config->url_current) . NL;
$html .= TAB . '<p>' . $speak->plugin_private_post->hint . '</p>' . NL;
$html .= TAB . '<p>' . Form::text('access', "", $speak->password . '…', array('autocomplete' => 'off')) . ' ' . Form::button($speak->submit, null, 'submit') . '</p>' . NL;
$html .= '</form>' . O_END;
if ($results && isset($results->fields->pass) && trim($results->fields->pass) !== "") {
if (!Guardian::happy() && Session::get('is_allow_post_access') !== $hash) {
return $html;
}
}
return $content;
}
示例8: 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)));
}
示例9: featured
/**
* Method to toggle the featured setting of a list of articles.
*
* @return void
* @since 1.6
*/
function featured()
{
// Check for request forgeries
Session::checkToken() or exit(Lang::txt('JINVALID_TOKEN'));
// Initialise variables.
$ids = Request::getVar('cid', array(), '', 'array');
$values = array('featured' => 1, 'unfeatured' => 0);
$task = $this->getTask();
$value = \Hubzero\Utility\Arr::getValue($values, $task, 0, 'int');
// Access checks.
foreach ($ids as $i => $id) {
if (!$user->authorise('core.edit.state', 'com_content.article.' . (int) $id)) {
// Prune items that you can't change.
unset($ids[$i]);
Notify::warning(Lang::txt('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
}
}
if (empty($ids)) {
Notify::error(Lang::txt('JERROR_NO_ITEMS_SELECTED'));
} else {
// Get the model.
$model = $this->getModel();
// Publish the items.
if (!$model->featured($ids, $value)) {
throw new Exception($model->getError(), 500);
}
}
$this->setRedirect('index.php?option=com_content&view=articles');
}
示例10: 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));
}
}
示例11: delete
/**
* Removes an item
*/
function delete()
{
// Check for request forgeries
Session::checkToken() or exit(Lang::txt('JINVALID_TOKEN'));
// Initialise variables.
$ids = Request::getVar('cid', array(), '', 'array');
// Access checks.
foreach ($ids as $i => $id) {
if (!User::authorise('core.delete', 'com_content.article.' . (int) $id)) {
// Prune items that you can't delete.
unset($ids[$i]);
Notify::warning(Lang::txt('JERROR_CORE_DELETE_NOT_PERMITTED'));
}
}
if (empty($ids)) {
Notify::error(Lang::txt('JERROR_NO_ITEMS_SELECTED'));
} else {
// Get the model.
$model = $this->getModel();
// Remove the items.
if (!$model->featured($ids, 0)) {
throw new Exception($model->getError(), 500);
}
}
$this->setRedirect('index.php?option=com_content&view=featured');
}
示例12: sms
public function sms($params)
{
$module = $params['module'];
$url = "";
if ($params['params']) {
$url = $this->OAuth2Url($this->buildUrl($params), $this->_base_config['APP']['sms']['agentid']);
}
$postData = array();
switch ($params['module']) {
case "email":
$content = $url != "" ? $params['content'] . ("\n<a href='" . $url . "'>") . _("ÔĶÁÓʼþ") . "</a>" : $params['content'];
$postData = array("touser" => $this->cUser($params['user']), "toparty" => $this->cDept($params['dept']), "msgtype" => "text", "agentid" => $this->_base_config['APP']['sms']['agentid'], "text" => array("content" => $content), "safe" => "0");
break;
case "news":
$picurl = "";
include_once "oa.news.php";
//( );
$News = new News();
$row = $News->getById("SUBJECT,CONTENT,ATTACHMENT_ID,ATTACHMENT_NAME,TO_ID,USER_ID,SUMMARY", $params['params']);
$picurl = $News->getFirstImage("news", $row['ATTACHMENT_ID'], $row['ATTACHMENT_NAME']);
$description = $row['SUMMARY'] == "" ? csubstr(strip_tags($this->cContent($row['CONTENT'])), 0, 30, TRUE, 1) . "..." : strip_tags($this->cContent($row['SUMMARY']));
if ($picurl != "") {
$picurl = $this->buildAttachUrl("http://" . BASE_URL . $picurl, $this->_base_config['APP']['sms']['agentid']);
}
$postData = array("touser" => $this->cUser($row['USER_ID'], $row['TO_ID']), "toparty" => $row['TO_ID'] == "ALL_DEPT" ? "" : $this->cDept($row['TO_ID']), "msgtype" => "news", "agentid" => $this->_base_config['APP']['sms']['agentid'], "news" => array("articles" => array(array("title" => strip_tags($row['SUBJECT']), "description" => $description, "url" => $url, "picurl" => $picurl))));
//parent::logs("test",$url);
break;
case "notify":
$picurl = "";
include_once "oa.notify.php";
//( );
$Notify = new Notify();
$row = $Notify->getById("SUBJECT,CONTENT,ATTACHMENT_ID,ATTACHMENT_NAME,TO_ID,USER_ID,SUMMARY", $params['params']);
$picurl = $Notify->getFirstImage("notify", $row['ATTACHMENT_ID'], $row['ATTACHMENT_NAME']);
$description = $row['SUMMARY'] == "" ? csubstr(strip_tags($this->cContent($row['CONTENT'])), 0, 30, TRUE, 1) . "..." : strip_tags($this->cContent($row['SUMMARY']));
if ($picurl != "") {
$picurl = $this->buildAttachUrl("http://" . BASE_URL . $picurl, $this->_base_config['APP']['sms']['agentid']);
}
$postData = array("touser" => $this->cUser($row['USER_ID'], $row['TO_ID']), "toparty" => $row['TO_ID'] == "ALL_DEPT" ? "" : $this->cDept($row['TO_ID']), "msgtype" => "news", "agentid" => $this->_base_config['APP']['sms']['agentid'], "news" => array("articles" => array(array("title" => strip_tags($row['SUBJECT']), "description" => $description, "url" => $url, "picurl" => $picurl))));
//parent::logs("test",$url);
break;
default:
$postData = array("touser" => $this->cUser($params['user']), "toparty" => $this->cDept($params['dept']), "msgtype" => "text", "agentid" => $this->_base_config['APP']['sms']['agentid'], "text" => array("content" => $params['content']), "safe" => "0");
}
$rs = $this->postData($this->url['send'], $postData);
}
示例13: 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);
}
示例14: ProcessRequest
function ProcessRequest()
{
$objNotify = new Notify();
if (isset($_GET['notifId'])) {
$arrModule = $objNotify->GetModuleFromNotify($_GET['notifId']);
$urlRedirect = Dispatcher::Instance()->GetUrl($arrModule['module'], $arrModule['submodule'], $arrModule['action'], $arrModule['type']) . $arrModule['notifyUrl'];
return array('exec' => 'GtfwAjax.replaceContentWithUrl("subcontent-element","' . $urlRedirect . '&ascomponent=1")');
}
if (isset($_GET['readNotifyId'])) {
$objNotify->setReadNotify($_GET['readNotifyId']);
}
if (isset($_GET['statusMessage'])) {
$message = $objNotify->GetAllNotify();
} else {
$message = $objNotify->GetUnloadNotify();
}
return array("exec" => "setNotify(" . json_encode($message) . ")");
}
示例15: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$lesson = Lesson::create(Input::all());
// Alternatively, fire and listen for an event
// Then, call this from the listener.
Notify::lessonSubscribers($lesson);
return 'Success';
// or redirect or whatever
}