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


PHP Notifications类代码示例

本文整理汇总了PHP中Notifications的典型用法代码示例。如果您正苦于以下问题:PHP Notifications类的具体用法?PHP Notifications怎么用?PHP Notifications使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: create

function create($info, $data)
{
    $notifications = new Notifications();
    $notifications->info = $info;
    $notifications->data = $data;
    return $notifications->Create();
}
开发者ID:vinigomescunha,项目名称:Sistema-Baseado-em-Partes-com-MySQL,代码行数:7,代码来源:index.php

示例2: note

 public static function note($msg, $opt = array(0, 0, 0), $is_assign = 1)
 {
     list($creator, $destination, $shared_id) = $opt;
     $note = new Notifications();
     $note->msg = $msg;
     $note->time = time();
     $note->creator_id = $creator;
     $note->dest_id = $destination;
     $note->shared_id = $shared_id;
     $note->status = $is_assign == 2 ? 2 : 1;
     return $note->validate() && $note->save();
 }
开发者ID:mrtos,项目名称:OpenNVR,代码行数:12,代码来源:Notify.php

示例3: g

 public function g()
 {
     session_start();
     $data = array();
     $loginClass = new Login();
     $id = $loginClass->isLogged();
     if ($id) {
         $notif = new Notifications();
         $notif->newNotification(2, 0);
     } else {
         $this->redirect('');
     }
 }
开发者ID:Huijari,项目名称:WEB_Projeto_Final,代码行数:13,代码来源:userController.class.php

示例4: update

 public static function update()
 {
     $post = Input::post(array('sitename', 'description', 'theme', 'twitter', 'home_page', 'posts_page'));
     $errors = array();
     if (empty($post['sitename'])) {
         $errors[] = 'You need a site sitename';
     }
     if (empty($post['description'])) {
         $errors[] = 'You need a site description';
     }
     if (empty($post['theme'])) {
         $errors[] = 'You need a theme';
     }
     if (count($errors)) {
         Notifications::set('error', $errors);
         return false;
     }
     $post['sitename'] = htmlentities($post['sitename']);
     $post['description'] = htmlentities($post['description']);
     foreach ($post as $key => $value) {
         Db::update('meta', array('value' => $value), array('key' => $key));
     }
     Notifications::set('success', 'Your metadata has been updated');
     return true;
 }
开发者ID:rubenvincenten,项目名称:anchor-site,代码行数:25,代码来源:metadata.php

示例5: add

 public function add($user_follow, $user_followed, $type)
 {
     $check = Relationship::model()->findAllByAttributes(array('user_id_1' => $user_follow, 'user_id_2' => $user_followed));
     $check_2 = Relationship::model()->findAllByAttributes(array('user_id_2' => $user_follow, 'user_id_1' => $user_followed));
     $check_3 = Follow::model()->findByAttributes(array('user_follow' => $user_follow, 'user_followed' => $user_followed));
     if ($check || $check_2 || $check_3 || $user_followed == Yii::app()->session['user_id']) {
         return FALSE;
     }
     $model = new Follow();
     $model->user_follow = $user_follow;
     $model->user_followed = $user_followed;
     $model->created_at = time();
     $model->update_at = time();
     $model->type = $type;
     $user_follow_data = User::model()->findByPk($user_follow);
     $user_followed_data = User::model()->findByPk($user_followed);
     if ($user_follow != Yii::app()->session['user_id']) {
         $arr_noti = array('user_id' => $user_follow, 'content' => "{$user_follow_data->username} vừa theo dõi bạn", 'type' => 'follow', 'recipient_id' => $user_followed_data->id, 'url' => Yii::app()->createAbsoulteUrl('user/profile', array('user_id' => $user_follow_data->id, 'ref' => 'noti')));
         Notifications::model()->add($arr_noti);
     }
     if ($model->save(FALSE)) {
         return TRUE;
     }
     return FALSE;
 }
开发者ID:huynt57,项目名称:fashion,代码行数:25,代码来源:Follow.php

示例6: update

 public static function update()
 {
     $post = Input::post(array('sitename', 'description', 'theme', 'twitter', 'home_page', 'posts_page', 'auto_published_comments', 'posts_per_page'));
     $errors = array();
     if (empty($post['sitename'])) {
         $errors[] = 'You need a site sitename';
     }
     if (empty($post['description'])) {
         $errors[] = 'You need a site description';
     }
     if (empty($post['theme'])) {
         $errors[] = 'You need a theme';
     }
     // auto publish comments
     $post['auto_published_comments'] = $post['auto_published_comments'] ? 1 : 0;
     // format posts per page, must be a whole number above 1 defaults to 10 if a invalid number is entered
     $post['posts_per_page'] = ($posts_per_page = intval($post['posts_per_page'])) > 0 ? $posts_per_page : 10;
     if (count($errors)) {
         Notifications::set('error', $errors);
         return false;
     }
     foreach ($post as $key => $value) {
         Db::update('meta', array('value' => $value), array('key' => $key));
     }
     Notifications::set('success', 'Your metadata has been updated');
     return true;
 }
开发者ID:reqshark,项目名称:anchor-cms,代码行数:27,代码来源:metadata.php

示例7: post

 /**
  * @url POST import
  */
 public function post()
 {
     try {
         $session = Session::singleton();
         $allowedRoles = (array) Config::get('allowedRolesForExcelImport', 'excelImport');
         if (Config::get('loginEnabled') && !is_null($allowedRoles)) {
             $ok = false;
             $sessionRoles = Role::getAllSessionRoles();
             foreach ($sessionRoles as $role) {
                 if (in_array($role->label, $allowedRoles)) {
                     $ok = true;
                 }
             }
             if (!$ok) {
                 throw new Exception("You do not have access to import excel files", 401);
             }
         }
         if (is_uploaded_file($_FILES['file']['tmp_name'])) {
             // Parse:
             $parser = new ImportExcel($_FILES['file']['tmp_name']);
             $result = $parser->ParseFile();
             unlink($_FILES['file']['tmp_name']);
         } else {
             Notifications::addError('No file uploaded');
         }
         $result = array('notifications' => $result, 'files' => $_FILES);
         return $result;
     } catch (Exception $e) {
         throw new RestException($e->getCode(), $e->getMessage());
     }
 }
开发者ID:4ZP6Capstone2015,项目名称:Capstone,代码行数:34,代码来源:ExcelImportApi.php

示例8: SendSMS

function SendSMS($phonenumber, $message)
{
    $config = Config::get('sendSMSConfig', 'execEngine');
    $username = $config['username'];
    $password = $config['password'];
    $sender = $config['sender'];
    Notifications::addLog('Username = ' . $username, 'ExecEngine');
    // Set the Messabeird username and password, and create an instance of the MessageBird class
    $sms = new MessageBird($username, $password);
    // Set the sender, could be a number (16 numbers) or letters (11 characters)
    $sms->setSender($sender);
    // Add the destination mobile number.
    // This method can be called several times to add have more then one recipient for the same message
    $sms->addDestination($phonenumber);
    //e.g. $sms->addDestination('31600000000');
    // Set an reference, optional
    // $sms->setReference('123456789');
    // Set a schedule date-time, optional
    // $sms->setTimestamp('2014-01-01 10:02');
    // Replace non GSM-7 characters by appropriate valid GSM-7 characters
    // $sms->setReplacechars(false);
    // If you want a dlr notification of the message send to another url then that you have set on the web site, you can use this parameter. Don't forget to set a reference!
    // $sms->setDlrUrl('http://www.example.com/dlr_url.php');
    // If $test is TRUE, then the message is not actually sent or scheduled, and there will be no credits deducted.
    // $sms->setTest(true);
    // Send the message to the destination(s)
    $sms->sendSms($message);
    Notifications::addLog("ResponseCode: " . $sms->getResponseCode(), 'ExecEngine');
    Notifications::addLog("ResponseMessage: " . $sms->getResponseMessage(), 'ExecEngine');
    Notifications::addLog("Balance: " . $sms->getCreditBalance(), 'ExecEngine');
}
开发者ID:4ZP6Capstone2015,项目名称:Capstone,代码行数:31,代码来源:SendSMS.php

示例9: pushNotification

 private static function pushNotification($userKey, $message, $title = null, $url = null, $urltitle = null)
 {
     Notifications::addLog('Pushover[pushNotification' . ']; $userKey=[' . $userKey . ']; $message=[' . $message . ']; $title=[' . $title . ']; $url=[' . $url . ']; $urltitle=[' . $urltitle . ']', 'MESSAGING');
     $notification = new Pushover();
     $token = Config::get('applicationToken', 'msg_pushover');
     if (is_null($token)) {
         throw new Exception("Pushover - Application token not specified", 500);
     }
     if (is_null($userKey)) {
         throw new Exception("Pushover - User key not specified", 500);
     }
     $notification->setToken($token);
     $notification->setUser($userKey);
     $notification->setMessage($message);
     if (!is_null($title)) {
         $notification->setTitle($title);
     }
     $notification->setHtml(1);
     $notification->setUrl($url);
     $notification->setUrlTitle($urltitle);
     if (!$notification->send()) {
         Notifications::addError("Pushover - Error in sending a notification to '{$userKey}'");
     } else {
         Notifications::addSuccess('Pushover message sent.');
     }
 }
开发者ID:4ZP6Capstone2015,项目名称:ampersand-models,代码行数:26,代码来源:Pushover.php

示例10: add

 public static function add($post_id)
 {
     $post = Input::post(array('name', 'email', 'text'));
     $errors = array();
     if (empty($post['name'])) {
         $errors[] = 'Please enter your name';
     }
     if (filter_var($post['email'], FILTER_VALIDATE_EMAIL) === false) {
         $errors[] = 'Please enter a valid email address';
     }
     if (empty($post['text'])) {
         $errors[] = 'Please enter your comments';
     }
     if (count($errors)) {
         Notifications::set('error', $errors);
         return false;
     }
     $post['date'] = time();
     $post['status'] = Config::get('metadata.auto_published_comments', 0) ? 'published' : 'pending';
     $post['post'] = $post_id;
     // encode any html
     $post['text'] = Html::encode($post['text']);
     Db::insert('comments', $post);
     Notifications::set('success', 'Your comment has been sent');
     return true;
 }
开发者ID:reqshark,项目名称:anchor-cms,代码行数:26,代码来源:comments.php

示例11: add

 public static function add($post_id)
 {
     $post = Input::post(array('name', 'email', 'text'));
     $errors = array();
     if (empty($post['name'])) {
         $errors[] = 'Please enter ayour name';
     }
     if (filter_var($post['email'], FILTER_VALIDATE_EMAIL) === false) {
         $errors[] = 'Please enter a valid email address';
     }
     if (empty($post['text'])) {
         $errors[] = 'Please enter your comments';
     }
     if (count($errors)) {
         Notifications::set('error', $errors);
         return false;
     }
     $post['date'] = time();
     $post['status'] = 'pending';
     $post['post'] = $post_id;
     $keys = array();
     $values = array();
     $args = array();
     foreach ($post as $key => $value) {
         $keys[] = '`' . $key . '`';
         $values[] = '?';
         $args[] = $value;
     }
     $sql = "insert into comments (" . implode(', ', $keys) . ") values (" . implode(', ', $values) . ")";
     Db::query($sql, $args);
     Notifications::set('success', 'Your comment has been sent');
     return true;
 }
开发者ID:rubenvincenten,项目名称:anchor-site,代码行数:33,代码来源:comments.php

示例12: action_add

 public function action_add()
 {
     $post = $this->request->post();
     if ($post) {
         $this->template->data["post"] = $post;
         if ($post['role'] == "") {
             array_push($this->template->data["errors"], array("Role" => __("User role must be set.")));
         } else {
             /* automatically obtain password if user set none */
             if (empty($post['password'])) {
                 $post['password'] = Auth::randomPassword();
                 $post['password_confirm'] = $post['password'];
             }
             try {
                 $user = ORM::factory('User')->create_user($post, array('email', 'password'));
                 $user->add('roles', ORM::factory('Role', array('name' => $post['role'])));
                 $this->template->data["post"] = NULL;
             } catch (ORM_Validation_Exception $e) {
                 $this->template->data["errors"] = $e->errors('models');
             }
             if (empty($this->template->data["errors"])) {
                 Notifications::factory()->new_user_account($post['email'], $post);
                 $this->redirect('/admin/user/all');
             }
         }
     }
     $this->template->data["roles"] = ORM::factory("Role")->get_roles();
 }
开发者ID:Workhaven,项目名称:workhaven,代码行数:28,代码来源:User.php

示例13: saveMutation

 private static function saveMutation($operation, $fullRelationSignature, $stableAtom, $stableConcept, $modifiedAtom, $modifiedConcept, $source)
 {
     if (array_key_exists($fullRelationSignature, Config::get('mutationConcepts', 'MutationExtension'))) {
         Notifications::addLog("Save mutation on '{$fullRelationSignature}' (editUpdate)", 'Mutation');
         $mutConcept = Config::get('mutationConcepts', 'MutationExtension')[$fullRelationSignature];
         $database = Database::singleton();
         $database->setTrackAffectedConjuncts(false);
         // Don't track affected conjuncts for Mutation concept and relations;
         // New Mutation
         $mut = $database->addAtomToConcept(Concept::createNewAtom($mutConcept), $mutConcept);
         // Add mut info
         $database->editUpdate('mutRelation', false, $mut, 'Mutation', $fullRelationSignature, 'Relation');
         $database->editUpdate('mutDateTime', false, $mut, 'Mutation', date(DATE_ISO8601), 'DateTime');
         if ($source == 'User') {
             $user = Session::getSessionUserId();
         } else {
             $user = $source;
         }
         $database->editUpdate('mutBy', false, $mut, 'Mutation', $user, 'User');
         $database->editUpdate('mutOp', false, $mut, 'Mutation', $operation, 'Operation');
         // $database->editUpdate('mutReason', false, $mut, 'Mutation', 'zomaar', 'MutationReason'); // TODO: get reason from somewhere
         $database->editUpdate('mutValue', false, $mut, 'Mutation', $modifiedAtom, 'MutationValue');
         $database->editUpdate('mutStable', false, $mut, $mutConcept, $stableAtom, $stableConcept);
         $database->editUpdate('mutPublish', false, $mut, 'Mutation', $mut, 'Mutation');
         $database->setTrackAffectedConjuncts(true);
         // Enable tracking of affected conjuncts again!!
     }
 }
开发者ID:4ZP6Capstone2015,项目名称:ampersand,代码行数:28,代码来源:Mutation.php

示例14: create_new

 public function create_new($post, $discussion_id, $reply_comment_id = NULL)
 {
     $comment = NULL;
     if (isset($post['text']) && isset($discussion_id)) {
         $user = Auth::instance()->get_user();
         $comment = Model::factory('Comment');
         $values = array();
         $values["text"] = $post['text'];
         $values["discussion_id"] = $discussion_id;
         if ($user) {
             $values["user_id"] = $user->id;
         } else {
             if ($post['author_visitor'] != "") {
                 $values["author_visitor"] = $post['author_visitor'];
             }
         }
         $values["reply_comment_id"] = $reply_comment_id;
         $comment->values($values, array_keys($values));
         try {
             $comment->save();
             Notifications::factory()->new_comment($comment->reload());
         } catch (ORM_Validation_Exception $e) {
             $errors = $e->errors('models');
         }
     }
     return $comment;
 }
开发者ID:Workhaven,项目名称:workhaven,代码行数:27,代码来源:Comment.php

示例15: run

 /**
  * @url GET run
  * @param array $roleIds
  */
 public function run($roleIds = null)
 {
     try {
         $session = Session::singleton();
         $session->activateRoles($roleIds);
         // Check sessionRoles if allowedRolesForRunFunction is specified
         $allowedRoles = Config::get('allowedRolesForRunFunction', 'execEngine');
         if (!is_null($allowedRoles)) {
             $ok = false;
             foreach ($session->getSessionRoles() as $role) {
                 if (in_array($role->label, $allowedRoles)) {
                     $ok = true;
                 }
             }
             if (!$ok) {
                 throw new Exception("You do not have access to run the exec engine", 401);
             }
         }
         ExecEngine::run(true);
         $db = Database::singleton();
         $db->closeTransaction('Run completed', false, true, false);
         $result = array('notifications' => Notifications::getAll());
         return $result;
     } catch (Exception $e) {
         throw new RestException($e->getCode(), $e->getMessage());
     }
 }
开发者ID:4ZP6Capstone2015,项目名称:ampersand,代码行数:31,代码来源:ExecEngineApi.php


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