• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP User_Model类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setFirst

 public function setFirst()
 {
     // 获取要赠送的短信的条数
     $sms_count = 0;
     $fields = array();
     // 如果还没设置过信息,则进行设置,并送短信
     foreach ($this->_support as $field => $smsCount) {
         $this->_field = $field;
         if (!$this->hasSet() && $this->_support[$this->_field] > 0) {
             $sms_count += $smsCount;
             $fields[] = $field;
         }
     }
     if ($sms_count > 0) {
         // 赠送短信,并发送通知
         $user = User_Model::instance();
         $smsUpdateStr = $this->smsUpdateStr();
         $content = '您好,这是您第一次设置' . $smsUpdateStr . ',系统赠送了' . $sms_count . '条短信给您';
         // echo $content;
         try {
             // @todo 应该支持事务操作
             $updated = $this->updateField($fields);
             $user->present_sms($this->_uid, $sms_count, $content, false);
         } catch (Exception $e) {
         }
     }
     return $sms_count;
 }
开发者ID:momoim,项目名称:momo-api,代码行数:28,代码来源:set_info_1st_time.php


示例2: __construct

 public function __construct($request)
 {
     parent::__construct($request);
     $this->templateDirectory = realpath(dirname(__FILE__) . "/../template") . "/";
     $this->template = "itemEdit.html.php";
     $UserModel = new User_Model();
     $this->component = "menu";
     $itemId = $request->get("itemId");
     if (empty($itemId)) {
         $this->action = "insert";
     } else {
         $this->action = "update";
     }
     $this->aItemSelect = DKY_Item::getItems(null, true);
     if (empty($itemId) && !empty($_SESSION["aBlock"][$this->block_id]["itemId"])) {
         $itemId = $_SESSION["aBlock"][$this->block_id]["itemId"];
     }
     if (empty($itemId) || $this->action == "insert") {
         $this->action = "insert";
         $this->aItem = null;
         unset($_SESSION["aBlock"][$this->block_id]["itemId"]);
     } else {
         $_SESSION["aBlock"][$this->block_id]["itemId"] = $itemId;
         $this->aItem = DKY_Item::getItemById($itemId);
         $this->action = "update";
         unset($this->aItemSelect[$itemId]);
         // Can't select itself as a parent.
     }
     $this->aGroups = $UserModel->getGroups(true);
     $this->getItemsURL = DKY_HTTP::makeURL($request->aURL["path"], "menu", "get_items");
     $this->cancelURL = DKY_HTTP::makeURL($request->aURL["path"], "menu", "list_items");
 }
开发者ID:nicholas-robson,项目名称:php-webapp,代码行数:32,代码来源:ItemEdit.php


示例3: play_game

 function play_game($shotbox)
 {
     $usuario = new User_Model();
     $toView["view"] = 'battlefield_view';
     $toView["userHit"] = $this->user_play($shotbox);
     $toView["fired"] = $this->sesion->obtener('fired');
     if ($this->check_player() == 1) {
         $id = $this->sesion->obtener('id');
         $usuario->won($id);
         $usuario->finished($id);
         $usuario->avgMoves($id, $tries);
         $usuario->setRanking($id);
         $toView["enemyFleet"] = $this->sesion->obtener('enemyFleet');
         $toView["winner"] = 1;
         $toView["userHits"] = $this->sesion->obtener('userHits');
         $toView["enemyHits"] = $this->sesion->obtener('enemyHits');
         $toView["view"] = "results_view";
         return $toView;
     }
     $toView["enemyHit"] = $this->enemy_play();
     $toView["userFleet"] = $this->sesion->obtener('userFleet');
     if ($this->check_enemy() == 1) {
         $id = $this->sesion->obtener('id');
         $usuario->lost($id);
         $usuario->finished($id);
         $usuario->setRanking($id);
         $toView["enemyFleet"] = $this->sesion->obtener('enemyFleet');
         $toView["winner"] = 2;
         $toView["userHits"] = $this->sesion->obtener('userHits');
         $toView["enemyHits"] = $this->sesion->obtener('enemyHits');
         $toView["view"] = 'results_view';
         return $toView;
     }
     return $toView;
 }
开发者ID:nicanor5,项目名称:BatallaNavalNGJL,代码行数:35,代码来源:batallanaval_model.php


示例4: create

 public function create()
 {
     $this->template->content = new View('users/create');
     $form = new Validation($_POST);
     $form->pre_filter('trim', true);
     $form->add_rules('username', 'required')->add_rules('password', 'required')->add_rules('email', 'required', 'valid::email');
     $this->template->content->repopulate = $form;
     if ($form->validate()) {
         // Create new user
         $user = new User_Model();
         if (!$user->username_exists($this->input->post('username'))) {
             foreach ($form->as_array() as $key => $val) {
                 // Set user data
                 $user->{$key} = $val;
             }
             if ($user->validate($form->as_array())) {
                 if ($user->add(ORM::factory('role', 'login')) and $user->save()) {
                     // Redirect to the login page
                     url::redirect('login');
                 }
             }
         }
     }
     // Error
     $this->template->content->error = $form->errors('login');
 }
开发者ID:carriercomm,项目名称:billing_cart,代码行数:26,代码来源:login.php


示例5: p_delete_action

 function p_delete_action($id)
 {
     $post_Model = new User_Model();
     $post_Model->delete_post($id);
     $posts = $post_Model->get_all_posts();
     require "view/template/user/admin.php";
 }
开发者ID:BorisRz,项目名称:Zrl,代码行数:7,代码来源:UserControllers.php


示例6: get_by_id

 public function get_by_id($id)
 {
     $user_model = null;
     //DATABASE CONNECTION
     $this->db->connect();
     //SELECT BY ID
     $sql = "SELECT * FROM user WHERE user_id=?";
     //PREPARE
     $stmt = $this->db->initialize($sql);
     //BIND
     $stmt->bind_param("i", $id);
     //EXECUTE
     $stmt->execute();
     //BIND RESULT
     $stmt->bind_result($user_id, $user_name, $first_name, $last_name, $contact_number, $user_type, $user_status, $user_hash);
     while ($stmt->fetch()) {
         //instantiate object
         $user_model = new User_Model();
         $user_model->set_user_id($user_id);
         $user_model->set_user_name($user_name);
         $user_model->set_first_name($first_name);
         $user_model->set_last_name($last_name);
         $user_model->set_contact_number($contact_number);
         $user_model->set_user_type($user_type);
         $user_model->set_user_status($user_status);
         $user_model->set_user_hash($user_hash);
     }
     $this->db->close();
     return $user_model;
 }
开发者ID:pratishshr,项目名称:Aawaaj,代码行数:30,代码来源:userrepository.class.php


示例7: run

 public function run()
 {
     try {
         $m_user = new User_Model();
         $view = new Login_View();
         $view->setparm('pagetitle', "用户登录" . $TITLE_SUFFIX);
         //TODO:反注入
         //TODO:验证码
         try {
             if (isset($_POST['username'])) {
                 $userid = $m_user->getuserid($_POST['username']);
                 switch ($m_user->checkpassword($userid, $_POST['password'])) {
                     case $m_user::CHECKPWD_ACCEPTED:
                         session_start();
                         $_SESSION['userid'] = $userid;
                         $_SESSION['expiretime'] = time() + $SESSION_ADD_TIME;
                         $_SESSION['absexpiretime'] = time() + $_POST['vaildtime'];
                         header("Location: " . $MAIN_PAGE_URL);
                         break;
                     case $m_user::CHECKPWD_DENIED:
                         throw new AuthFailed($TXT_PASSWORD_ERROR);
                         break;
                     case $m_user::CHECKPWD_RESTRICTED:
                         throw new AuthFailed($TXT_USER_RESTRICTED);
                 }
             }
         } catch (AuthFailed $e) {
             $view->setparm('errormsg', $e->getMessage());
         }
     } catch (ResourceFailed $e) {
         $view->setparm('errormsg', $e->getMessage());
     }
     $view->render();
 }
开发者ID:hanyuwei70,项目名称:VCBS-Sub,代码行数:34,代码来源:login.php


示例8: staff

 function staff($id, $display = 'week')
 {
     $um = new User_Model();
     $um->get_by_id($id);
     if (!$um->exists()) {
         return;
     }
     $this->data['object'] = $um;
     $um->shift->where('status', SHIFT_MODEL::STATUS_ACTIVE);
     /* find min and max date */
     $max_date = $um->shift->select_max('date')->get()->date;
     $min_date = $um->shift->select_min('date')->get()->date;
     $shifts = $um->shift->get_iterated();
     /* compile dates */
     $dates = array();
     $date = $min_date;
     $this->hc_time->setDateDb($date);
     switch ($display) {
         case 'week':
             $this->hc_time->setStartWeek();
             break;
         case 'month':
             $this->hc_time->setStartMonth();
             break;
     }
     $date = $this->hc_time->formatDate_Db();
     while ($date <= $max_date) {
         switch ($display) {
             case 'week':
                 $start = $this->hc_time->formatDate_Db();
                 $this->hc_time->setEndWeek();
                 $end = $this->hc_time->formatDate_Db();
                 break;
             case 'month':
                 $start = $this->hc_time->formatDate_Db();
                 $this->hc_time->setEndMonth();
                 $end = $this->hc_time->formatDate_Db();
                 break;
         }
         $dates[$start . '-' . $end] = array('shift_count' => 0, 'shift_duration' => 0, 'timeoff_count' => 0, 'timeoff_duration' => 0);
         $this->hc_time->modify('+1 day');
         $date = $this->hc_time->formatDate_Db();
     }
     foreach ($shifts as $sh) {
         reset($dates);
         foreach (array_keys($dates) as $dk) {
             list($start, $end) = explode('-', $dk);
             if ($sh->date >= $start && $sh->date <= $end) {
                 $dates[$dk]['shift_count']++;
                 $dates[$dk]['shift_duration'] += $sh->get_duration();
             }
         }
     }
     $this->data['dates'] = $dates;
     $this->data['display'] = $display;
     //		$this->conf['path'] = 'admin/users';
     $this->set_include('edit/stats', 'admin/users');
     $this->load->view($this->template, $this->data);
 }
开发者ID:RVRKC,项目名称:Hackathon_2015,代码行数:59,代码来源:stats.php


示例9: signUp

 /**
  * This method will handle the signup process
  *
  */
 function signUp()
 {
     $json_data = json_decode(file_get_contents('php://input'));
     $data = array('name' => $json_data->{'username'}, 'email' => $json_data->{'email'}, 'password' => $json_data->{'password'}, 'privilages' => 2);
     $this->load->model('User_Model');
     $user_model = new User_Model();
     $isAdded = $user_model->addNewUser($data);
     echo json_encode(array("status" => $isAdded));
 }
开发者ID:khsushan,项目名称:CW2_AWT_2012042,代码行数:13,代码来源:User_Controller.php


示例10: setup

 public function setup()
 {
     $user = new User_Model();
     $user->email = '[email protected]';
     $user->username = 'geek';
     $user->password = 'geekmeet';
     $user->roles = array(new Role_Model(1));
     $user->save();
 }
开发者ID:hdragomir,项目名称:SmartStudent,代码行数:9,代码来源:users.php


示例11: get_all

 public function get_all()
 {
     //ARRAY OBJECT HARU PASS GARNA
     $user_list = array();
     //DATABASE CONNECTION
     $this->db->connect();
     //SELECT ALL QUERY
     $sql = "SELECT user_id,user_name,first_name,last_name,contact_number,user_type,user_status,gen_id,age FROM user INNER JOIN generaluser ON user_id = u_id";
     //fetchquery
     $result = $this->db->fetchquery($sql);
     //STORE IN OBJECT AND SEND TO VIEW
     while ($row = $result->fetch_assoc()) {
         $user_model = new User_Model();
         $user_model->set_user_id($row['user_id']);
         $user_model->set_user_name($row['user_name']);
         $user_model->set_first_name($row['first_name']);
         $user_model->set_last_name($row['last_name']);
         $user_model->set_contact_number($row['contact_number']);
         $user_model->set_user_type($row['user_type']);
         $user_model->set_user_status($row['user_status']);
         array_push($user_list, $user_model);
     }
     $this->db->close();
     return $user_list;
 }
开发者ID:pratishshr,项目名称:Aawaaj,代码行数:25,代码来源:generaluserrepository.class.php


示例12: list_all

 /**
  * View all registered users
  * 
  * @access public
  * @return string Returns XML containing list of all users or error message
  */
 public function list_all()
 {
     if (apiler::is_authorized()) {
         $users = new User_Model();
         $list = $users->list_all_users();
         $view = new View('api/user_list');
         $view->list = $list;
         $view->render(true);
     } else {
         apiler::not_authorized();
     }
 }
开发者ID:ArtemD,项目名称:SpeedFreak,代码行数:18,代码来源:users.php


示例13: createObjectFromData

 public function createObjectFromData($row)
 {
     //Create a new user_model object
     $user = new User_Model();
     //Set the ID on the user model
     $user->setId($row->id);
     //Set the username on the user model
     $user->setUsername($row->username);
     //Set the password on the user model
     $user->setPassword($row->password);
     //Return the new user object
     return $user;
 }
开发者ID:Arkanius,项目名称:estudoCodeIgniter,代码行数:13,代码来源:UserFactory.php


示例14: is_authorized

 /**
  * Check if user is authorized
  * 
  * @access public
  * @static
  * @return boolean Returns TRUE if authorized and FALSE otherwise
  */
 public static function is_authorized()
 {
     if (isset($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) {
         $user = new User_Model();
         if ($user->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:ArtemD,项目名称:SpeedFreak,代码行数:20,代码来源:apiler.php


示例15: insert

 public function insert($category, $username, $value)
 {
     $cat = new Category_Model();
     $category = $cat->get_id($category);
     $user = new User_Model();
     $username = $user->get_id($username);
     $results = $this->db->query("INSERT INTO results SET cat_id = ?, user_id = ?, value = ?, result_date = NOW()", $category, $username, $value);
     if ($results) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:ArtemD,项目名称:SpeedFreak,代码行数:13,代码来源:result.php


示例16: login

 function login($userName, $password)
 {
     $this->db->select('*');
     $this->db->from($this->table_name);
     $this->db->where(array('users.userName' => $userName));
     $this->db->join('persons', 'persons.personId = users.personId');
     $data = $this->db->get()->row();
     $user = new User_Model($data);
     if (password_verify($password, $user->getPassword())) {
         return $user;
     } else {
         return false;
     }
 }
开发者ID:SerberthoWeb,项目名称:TouriExpert,代码行数:14,代码来源:User_Model.php


示例17: change_data

 /**
  * Change user profile
  * @param array post data
  * @param string user id
  */
 public function change_data($post, $email)
 {
     $user = new User_Model();
     $id = $user->get_id($email);
     if (self::profile_exists($email)) {
         //update data
         $data = array('customer_street' => $post['customer_street'], 'customer_city' => $post['customer_city'], 'customer_postal_code' => $post['customer_postal_code'], 'customer_phone' => $post['customer_phone'], 'billing_name' => $post['billing_name'], 'billing_street' => $post['billing_street'], 'billing_city' => $post['billing_city'], 'billing_postal_code' => $post['billing_postal_code'], 'billing_identity_number' => $post['billing_identity_number'], 'billing_vat_number' => $post['billing_vat_number']);
         $this->db->update(self::TN_EXTEND, $data, array('user' => $id));
     } else {
         //create data
         $data['user'] = $id;
         $this->db->insert(self::TN_EXTEND, $data);
     }
 }
开发者ID:repli2dev,项目名称:re-eshop,代码行数:19,代码来源:customer.php


示例18: up

 public function up()
 {
     /* remove trades table and set the trade column for shifts for pending trades */
     if (!$this->db->field_exists('has_trade', 'shifts')) {
         $this->dbforge->add_column('shifts', array('has_trade' => array('type' => 'TINYINT', 'null' => FALSE, 'default' => 0)));
     }
     if ($this->db->table_exists('trades')) {
         // TRADE_MODEL:STATUS_PENDING - set the trade column
         $this->db->where('status', 1);
         $this->db->select('shift_id');
         $query = $this->db->get('trades');
         foreach ($query->result_array() as $row) {
             $sm = new Shift_Model();
             $sm->get_by_id($row['shift_id']);
             $sm->has_trade = 1;
             $sm->save();
         }
         // TRADE_MODEL:STATUS_APPROVED - remove current user
         $this->db->where('status', 2);
         $this->db->select('shift_id');
         $query = $this->db->get('trades');
         foreach ($query->result_array() as $row) {
             $sm = new Shift_Model();
             $sm->get_by_id($row['shift_id']);
             $sm->user->get();
             $sm->delete($sm->user, 'user');
             $sm->save();
         }
         // TRADE_MODEL:STATUS_ACCEPTED - switch the shift to the new user
         $this->db->where('status', 3);
         $this->db->select(array('shift_id', 'to_user_id'));
         $query = $this->db->get('trades');
         foreach ($query->result_array() as $row) {
             $sm = new Shift_Model();
             $sm->get_by_id($row['shift_id']);
             $um = new User_Model();
             $um->get_by_id($row['to_user_id']);
             $sm->save(array('user' => $um));
         }
         // TRADE_MODEL:STATUS_DENIED - DO NOTHING
         //			$this->db->where('status', 4);
         // TRADE_MODEL:STATUS_COMPLETED - DO NOTHING
         //			$this->db->where('status', 5);
     }
     /* now delete the trades table */
     if ($this->db->table_exists('trades')) {
         $this->dbforge->drop_table('trades');
     }
 }
开发者ID:RVRKC,项目名称:Hackathon_2015,代码行数:49,代码来源:005_convert_trades.php


示例19: changeUserData

 function changeUserData($data)
 {
     $data['user'] = $data['user'];
     $data['name'] = $data['name'];
     $data['lastname'] = $data['lastname'];
     $data['email'] = $data['email'];
     $usuario = new User_Model();
     if (!$usuario->alreadyExist($data['user'])) {
         $usuario->update($userID, $data);
         $registration = 1;
     } else {
         $msgerror = "User already exist";
     }
     return $msgerror;
 }
开发者ID:nicanor5,项目名称:BatallaNavalNGJL,代码行数:15,代码来源:register_model.php


示例20: __construct

 public function __construct()
 {
     session_start();
     global $links_on_page;
     $links_on_page = 3;
     if (isset($_SESSION['uid'])) {
         global $logged_user;
         $logged_user = new User_Model();
         $logged_user->get_user_by_id($_SESSION['uid']);
     } else {
         global $logged_user;
         $logged_user = 0;
     }
     $this->configure_mail_settings();
 }
开发者ID:dariachechulina,项目名称:LinkStorage,代码行数:15,代码来源:Config.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP User_group类代码示例发布时间:2022-05-23
下一篇:
PHP User_Controller类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap