当前位置: 首页>>代码示例>>PHP>>正文


PHP Notification::model方法代码示例

本文整理汇总了PHP中Notification::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::model方法的具体用法?PHP Notification::model怎么用?PHP Notification::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Notification的用法示例。


在下文中一共展示了Notification::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: clearAllNotifications

 /**
  * Delete all notifications for this user and this survey
  * @param int|null $surveyId
  * @return void
  */
 public function clearAllNotifications($surveyId = null)
 {
     Notification::model()->deleteAll('entity = \'user\' AND entity_id = ' . Yii::app()->user->id);
     if (is_int($surveyId)) {
         Notification::model()->deleteAll('entity = \'survey\' AND entity_id = ' . $surveyId);
     }
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:12,代码来源:NotificationController.php

示例2: remove

 /**
  * Remove notification after member had approved/declined the invite
  *
  * @param type $userId
  * @param type $room
  */
 public static function remove($userId, $room)
 {
     $notifications = Notification::model()->findAllByAttributes(array('class' => 'RoomInviteNotification', 'target_object_model' => 'Room', 'target_object_id' => $room->id, 'user_id' => $userId));
     foreach ($notifications as $notification) {
         $notification->delete();
     }
 }
开发者ID:verdin12345,项目名称:humhub-modules-rooms,代码行数:13,代码来源:RoomInviteNotification.php

示例3: actionIndex

 public function actionIndex()
 {
     if (is_numeric($_GET['id'])) {
         $article = Article::model()->findByPk($_GET['id']);
     } else {
         $article = Article::model()->findByAttributes(array('ident_label' => $_GET['id']));
     }
     if ($article === null) {
         throw new CHttpException(404, 'The requested Topic does not exist.');
     }
     // page view plus expcet the owner of the article
     if ($article->user_id != Yii::app()->user->id) {
         $article->pv = $article->pv + 1;
         $article->save();
     }
     //article auther read the reply
     if ($article->user_id == Yii::app()->user->id) {
         Notification::model()->article_auther_readed_notices($article->id, Yii::app()->user->id);
     }
     $model = new Post();
     //		$model->content = "<p></p>";
     $model->article_id = $article->id;
     $this->_pageTitle = CHtml::encode($article->title) . API::lchart() . $article->leaf->name . API::lchart();
     // only show the author reply
     if ($_GET['s']) {
         $criteria = new CDbCriteria();
         $criteria->condition = "t.user_id = {$article->user_id} AND t.article_id = {$article->id}";
         $criteria->order = 't.c_time ASC ';
         $posts = Post::model()->findAll($criteria);
     } else {
         $posts = $article->posts;
     }
     $this->render('index', array('inst' => $article, 'model' => $model, 'posts' => $posts));
 }
开发者ID:paranoidxc,项目名称:iwebhost,代码行数:34,代码来源:TController.php

示例4: remove

 /**
  * Remove notification after member was approved/declined or canceled the
  * request.
  *
  * @param type $userId
  * @param type $workspace
  */
 public static function remove($userId, $workspace)
 {
     $notifications = Notification::model()->findAllByAttributes(array('class' => 'SpaceApprovalRequestNotification', 'target_object_model' => 'Space', 'target_object_id' => $workspace->id, 'source_object_model' => 'User', 'source_object_id' => $userId));
     foreach ($notifications as $notification) {
         $notification->delete();
     }
 }
开发者ID:alefernie,项目名称:intranet,代码行数:14,代码来源:SpaceApprovalRequestNotification.php

示例5: beforeSave

 /**
  * Do some things before save
  * 
  */
 public function beforeSave()
 {
     if ($this->fixed == 1) {
         Notification::model()->updateAll(array('fixed' => 0), 'notification_type_id=:notification_type_id', array(':notification_type_id' => $this->notification_type_id));
     }
     return true;
 }
开发者ID:jjsub,项目名称:samesub,代码行数:11,代码来源:Notification.php

示例6: checkAccess

 public function checkAccess()
 {
     // Save users last action on this space
     $membership = $this->space->getMembership(Yii::app()->user->id);
     if ($membership != null) {
         $membership->updateLastVisit();
     } else {
         // Super Admin can always enter
         if (!Yii::app()->user->isAdmin()) {
             // Space invisible?
             if ($this->space->visibility == Space::VISIBILITY_NONE) {
                 // Not Space Member
                 throw new CHttpException(404, Yii::t('SpaceModule.behaviors_SpaceControllerBehavior', 'Space is invisible!'));
             }
         }
     }
     // Delete all pending notifications for this space
     $notifications = Notification::model()->findAllByAttributes(array('space_id' => $this->space->id, 'user_id' => Yii::app()->user->id), 'seen != 1');
     foreach ($notifications as $n) {
         // Ignore Approval Notifications
         if ($n->class == "SpaceApprovalRequestNotification" || $n->class == "SpaceInviteNotification") {
             continue;
         }
         $n->seen = 1;
         $n->save();
     }
 }
开发者ID:alefernie,项目名称:intranet,代码行数:27,代码来源:SpaceControllerBehavior.php

示例7: loadModel

 public function loadModel($id)
 {
     $model = Notification::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:Dvionst,项目名称:vvfy,代码行数:8,代码来源:NotificationController.php

示例8: actionNotice

 /**
  * 用户提醒列表
  */
 public function actionNotice()
 {
     $sql = "SELECT * FROM {{notification}} WHERE uid='{$this->uid}' ORDER BY cTime DESC";
     Posts::getAll(array('sql' => $sql), $pages, $comLists);
     Notification::model()->updateAll(array('new' => 0), 'uid=:uid', array(':uid' => $this->uid));
     $data = array('posts' => $comLists, 'pages' => $pages);
     $this->pageTitle = $this->userInfo['truename'] . '的提醒 - ' . zmf::config('sitename');
     $this->render('notice', $data);
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:12,代码来源:UsersController.php

示例9: loadNotification

 public function loadNotification($notificationId)
 {
     $notification = Notification::model()->findByPk($notificationId);
     if ($notification === null || $notification->user_id !== Yii::app()->getUser()->getModel()->id) {
         throw new CHttpException(404, Yii::t('application', 'The requested page does not exist.'));
     } else {
         return $notification;
     }
 }
开发者ID:jayrulez,项目名称:yiisns,代码行数:9,代码来源:NotificationController.php

示例10: actionDel

 public function actionDel()
 {
     $u =& $this->iuser;
     $n = Notification::model()->findByPk($_GET['id']);
     if ($n === null) {
         throw new CHttpException(404, 'The requested Node does not exist.');
     }
     if ($n->user_id == user()->id) {
         $n->delete();
     }
     $this->redirect(array('n/index'));
 }
开发者ID:paranoidxc,项目名称:iwebhost,代码行数:12,代码来源:NController.php

示例11: getNum

 public function getNum()
 {
     $uid = zmf::uid();
     if (!$uid) {
         return '0';
     }
     $num = Notification::model()->count('new=1 AND uid=:uid', array(':uid' => $uid));
     if ($num > 0) {
         return $num;
     } else {
         return '0';
     }
 }
开发者ID:ph7pal,项目名称:momo,代码行数:13,代码来源:Notification.php

示例12: actionMarkAsSeen

 public function actionMarkAsSeen()
 {
     // build query
     $criteria = new CDbCriteria();
     $criteria->condition = 'seen=0';
     // load all unseen notification for this user
     $notifications = Notification::model()->findAllByAttributes(array('user_id' => Yii::app()->user->id), $criteria);
     foreach ($notifications as $notification) {
         // mark all unseen notification as seen
         $notification->markAsSeen();
     }
     // compete action
     Yii::app()->end();
 }
开发者ID:alefernie,项目名称:intranet,代码行数:14,代码来源:ListController.php

示例13: actionFriendnotification

 public function actionFriendnotification()
 {
     $this->layout = 'layout_user';
     $type = 'friend';
     $notification = Notification::model()->findAll("user_id=:uid AND type = '{$type}'", array(':uid' => Yii::app()->user->userId));
     foreach ($notification as $n) {
         $n->is_read = 1;
         $n->save();
     }
     $friend = UserFriend::model()->findAll('friend_id=:uid AND is_read=0', array(':uid' => Yii::app()->user->userId));
     foreach ($friend as $n) {
         $n->is_read = 1;
         $n->save();
     }
     $this->render('shownotification', array('notification' => $notification));
 }
开发者ID:nomannoor,项目名称:social-property,代码行数:16,代码来源:NotificationController.php

示例14: actionIndex

 /**
  * Returns a List of all Comments belong to this Model
  */
 public function actionIndex()
 {
     $notificationId = (int) Yii::app()->request->getParam('id');
     $notification = Notification::model()->findByAttributes(array('user_id' => Yii::app()->user->id, 'id' => $notificationId));
     if ($notification == null) {
         throw new CHttpException(500, 'Invalid notification id!');
     }
     if ($notification->class != "SpaceApprovalRequestNotification" && $notification->class != "SpaceInviteNotification") {
         $notification->seen = 1;
         $notification->save();
         // Mark similar notification as read
         $notifications = Notification::model()->findAllByAttributes(array('target_object_model' => $notification->target_object_model, 'target_object_id' => $notification->target_object_id, 'user_id' => Yii::app()->user->id), 'seen != 1');
         foreach ($notifications as $n) {
             $n->markAsSeen();
         }
     }
     $notification->redirectToTarget();
 }
开发者ID:alefernie,项目名称:intranet,代码行数:21,代码来源:EntryController.php

示例15: actionNotices

 public function actionNotices()
 {
     self::checkLogin();
     $uid = zmf::uid();
     $items = Notification::model()->findAll('new=1 AND uid=:uid ORDER BY cTime DESC', array(':uid' => $uid));
     if (!empty($items)) {
         $longstr = '<ul>';
         foreach ($items as $item) {
             $longstr .= '<li>';
             $longstr .= $item['content'];
             $longstr .= '</li>';
         }
         $longstr .= '</ul>';
         //Notification::model()->updateAll(array('new' => 0), 'uid=:uid', array(':uid' => $uid));
         $this->jsonOutPut(1, $longstr);
     } else {
         $this->jsonOutPut(1, '<div class="suggitem"><span>暂无提醒</span></div>');
     }
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:19,代码来源:AjaxController.php


注:本文中的Notification::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。