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


PHP Notifications::factory方法代码示例

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


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

示例1: 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

示例2: 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

示例3: save_note

 private function save_note($post)
 {
     $note = new Model_Note();
     $note_data = array_filter($this->parse_post_data($post));
     $note->values($note_data, array_keys($note_data));
     try {
         $note->save();
         Notifications::factory()->new_note($note->reload());
     } catch (Exception $exc) {
         return false;
     }
     return true;
 }
开发者ID:Workhaven,项目名称:workhaven,代码行数:13,代码来源:Notes.php

示例4: action_add

 public function action_add()
 {
     $error = FALSE;
     if ($this->request->post()) {
         $this->template->data["values"] = $this->request->post();
         if ($_FILES['files']['name'][0] != "") {
             for ($i = 0; $i < count($_FILES['files']['name']); $i++) {
                 $image = Model::factory('Image');
                 $discussion = new Model_Discussion();
                 $discussion->save();
                 $post = $this->request->post();
                 $post["filename"] = "temp";
                 $post["discussion_id"] = $discussion->id;
                 $image->values($post, array_keys($post));
                 try {
                     $image->save();
                     $filename = $this->_save_image(array("name" => $_FILES['files']['name'][$i], "type" => $_FILES['files']['type'][$i], "tmp_name" => $_FILES['files']['tmp_name'][$i], "error" => $_FILES['files']['error'][$i], "size" => $_FILES['files']['size'][$i]), $this->request->post("project_id"), $image->id);
                     // set new name into DB:
                     if ($filename) {
                         $image->filename = $filename;
                         $image->save();
                     }
                     $discussion->image_id = $image->id;
                     $discussion->save();
                     Notifications::factory()->new_image($image);
                 } catch (ORM_Validation_Exception $e) {
                     $this->template->data["errors"] = $e->errors('models');
                     $error = TRUE;
                     $discussion->delete();
                 }
             }
         } else {
             $error = TRUE;
             array_push($this->template->data["errors"], "You must choose file/s.");
         }
         if (!$error) {
             $this->redirect('admin/projects/detail/' . $this->request->post("project_id"));
         }
     } else {
         if (isset($_GET["project_id"])) {
             $this->template->data["values"] = array("project_id" => $_GET["project_id"]);
         }
     }
     $this->template->data["projects"] = ORM::factory("Project")->order_by('id', 'desc')->find_all()->as_array("id", "name");
 }
开发者ID:Workhaven,项目名称:workhaven,代码行数:45,代码来源:Images.php


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