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


PHP Notify::note方法代码示例

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


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

示例1: 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));
 }
开发者ID:mrtos,项目名称:OpenNVR,代码行数:52,代码来源:UsersController.php

示例2: unixtime

 public function unixtime()
 {
     $result = $this->moment->unixtime();
     if (!$result) {
         Notify::note(Yii::t('errors', 'Unixtime get fail, problem with nvr'));
     }
     return $result;
 }
开发者ID:mrtos,项目名称:OpenNVR,代码行数:8,代码来源:momentManager.php

示例3: delete

 public function delete($id)
 {
     Notify::note("{$this->options['protocol']}://{$this->options['server_ip']}/admin/remove_channel?conf_file={$id}");
     $result = $this->http->get("{$this->options['protocol']}://{$this->options['server_ip']}/admin/remove_channel?conf_file={$id}");
     return trim($result) == 'OK' ? true : $result;
 }
开发者ID:mrtos,项目名称:OpenNVR,代码行数:6,代码来源:moment.php

示例4: save

 public function save()
 {
     $id = Yii::app()->user->getId();
     foreach ($this->camBuff as $cam) {
         foreach ($this->emailBuff as $user) {
             $n = new Notify();
             $shared = Shared::model()->findByAttributes(array('owner_id' => $id, 'user_id' => $user->id, 'cam_id' => $cam->id, 'is_public' => 0));
             if (!$shared) {
                 $shared = new Shared();
                 $shared->owner_id = $id;
                 $shared->user_id = $user->id;
                 $shared->cam_id = $cam->id;
             }
             if ($this->type == 'assign') {
                 $shared->is_approved = 1;
             }
             $shared->save();
             $n->note(Yii::t('cams', 'You granted access to camera {cam}', array('{cam}' => $cam->name)), array($id, $user->id, $shared->id), intval($this->type == 'assign') * 2);
         }
     }
     return true;
 }
开发者ID:mrtos,项目名称:OpenNVR,代码行数:22,代码来源:ShareForm.php


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