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


PHP Model_User::factory方法代码示例

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


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

示例1: action_create

 public function action_create($id = null)
 {
     if (Input::method() == 'POST') {
         $users = Model_User::factory(array('username' => Input::post('username'), 'password' => Input::post('password'), 'email' => Input::post('email'), 'profile_fields' => Input::post('profile_fields'), 'group' => Input::post('group'), 'last_login' => Input::post('last_login'), 'login_hash' => Input::post('login_hash')));
         if ($users and $users->save()) {
             Session::set_flash('notice', 'Added users #' . $users->id . '.');
             Response::redirect('users');
         } else {
             Session::set_flash('notice', 'Could not save users.');
         }
     }
     $this->template->title = "Users";
     $this->template->content = View::factory('users/create');
 }
开发者ID:bryanheo,项目名称:FuelPHP-Auth-AJAX,代码行数:14,代码来源:users.php

示例2: up

 public function up()
 {
     \DBUtil::create_table('users', array('id' => array('constraint' => 11, 'type' => 'int', 'auto_increment' => true), 'username' => array('constraint' => 255, 'type' => 'varchar'), 'password' => array('constraint' => 255, 'type' => 'varchar'), 'email' => array('constraint' => 255, 'type' => 'varchar'), 'profile_fields' => array('type' => 'text'), 'group' => array('constraint' => 11, 'type' => 'int'), 'last_login' => array('constraint' => 20, 'type' => 'int'), 'login_hash' => array('constraint' => 255, 'type' => 'varchar')), array('id'));
     // add an admin account
     $admin_username = "jsidhu";
     $admin_password = "1234";
     $admin_pass_hash = \Auth::instance()->hash_password($admin_password);
     $admin_email = "sidhu.j@gmail.com";
     $users = \Model_User::factory(array('username' => $admin_username, 'password' => $admin_pass_hash, 'email' => $admin_email, 'profile_fields' => '', 'group' => '', 'last_login' => '', 'login_hash' => ''));
     if ($users and $users->save()) {
         \Cli::write("added admin account");
     } else {
         \Cli::write("failed to add admin account");
     }
 }
开发者ID:bryanheo,项目名称:FuelPHP-Auth-AJAX,代码行数:15,代码来源:001_create_users.php

示例3: action_view

 /**
  * User view
  */
 public function action_view($user = NULL)
 {
     // Temporary ALWAYS redirect
     $this->request->redirect('forum');
     if (empty($user)) {
         $this->template->content = $content = View::factory('user/list');
         $content->users = Sprig::factory('user')->select_list();
     } else {
         $user = Model_User::factory($user)->load();
         $this->template->title = html::chars($user->username) . 's profil hos Änglarna Stockholm';
         $this->template->content = $content = View::factory('user/view');
         $content->user = (object) $user->as_array();
         unset($content->user->password);
         // Set flag to show edit controls
         $content->owner = FALSE;
         if ($this->auth->logged_in()) {
             $content->owner = $user->id = $this->auth->get_user()->id;
         }
     }
 }
开发者ID:Burgestrand,项目名称:Anglarna-Stockholm,代码行数:23,代码来源:user.php

示例4: find_user_light

 /**
  * Load one user light array
  *
  * @static
  * @param   mixed  $id  User model, user array, user id, username
  * @return  array|null
  */
 public static function find_user_light($id = null)
 {
     $ckey = 'user_light_';
     if ($id instanceof Model_User) {
         // Got user model, no need to load, just fill caches
         /** @var  Model_User  $id */
         return $id->light_array();
     } else {
         if (is_array($id)) {
             // Got user array, don't fill caches as we're not 100% sure it's valid
             return $id;
         } else {
             if (is_int($id) || is_numeric($id)) {
                 // Got id
                 $id = (int) $id;
             } else {
                 if (is_string($id)) {
                     // Got user name, find id
                     $id = Model_User::user_id($id);
                 } else {
                     return null;
                 }
             }
         }
     }
     if ($id === 0) {
         return null;
     }
     // Try static cache
     $user = Anqh::cache_get($ckey . $id);
     if (!is_array($user)) {
         // Load from DB
         $user = Model_User::factory($id)->light_array();
         Anqh::cache_set($ckey . $id, $user, Date::DAY);
     }
     return $user;
 }
开发者ID:anqh,项目名称:anqh,代码行数:44,代码来源:user.php

示例5: _get_object

 /**
  * Convert a unique identifier string to a user object
  * 
  * @param mixed $user
  * @return Model_User
  */
 protected function _get_object($user)
 {
     if (!is_object($user)) {
         // Load the user using special factory method
         $user = Model_User::factory($user)->load();
     }
     return $user;
 }
开发者ID:Burgestrand,项目名称:sprig-auth,代码行数:14,代码来源:sprig.php

示例6: _get_object

 protected function _get_object($user)
 {
     if (!is_object($user)) {
         // Load the user
         $user = Model_User::factory($user)->load();
     }
     return $user;
 }
开发者ID:ascseb,项目名称:sprig-auth,代码行数:8,代码来源:sprig.php


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