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


PHP Application_Model_User::setType方法代码示例

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


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

示例1: addUserAction

 public function addUserAction()
 {
     global $CC_CONFIG;
     $request = $this->getRequest();
     $baseUrl = $request->getBaseUrl();
     $js_files = array('/js/datatables/js/jquery.dataTables.js?', '/js/datatables/plugin/dataTables.pluginAPI.js?', '/js/airtime/user/user.js?');
     foreach ($js_files as $js) {
         $this->view->headScript()->appendFile($baseUrl . $js . $CC_CONFIG['airtime_version'], 'text/javascript');
     }
     $this->view->headLink()->appendStylesheet($baseUrl . '/css/users.css?' . $CC_CONFIG['airtime_version']);
     $form = new Application_Form_AddUser();
     $this->view->successMessage = "";
     if ($request->isPost()) {
         if ($form->isValid($request->getPost())) {
             $formdata = $form->getValues();
             if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1 && $formdata['login'] == 'admin' && $formdata['user_id'] != 0) {
                 $this->view->successMessage = "<div class='errors'>Specific action is not allowed in demo version!</div>";
             } elseif ($form->validateLogin($formdata)) {
                 $user = new Application_Model_User($formdata['user_id']);
                 $user->setFirstName($formdata['first_name']);
                 $user->setLastName($formdata['last_name']);
                 $user->setLogin($formdata['login']);
                 // We don't allow 6 x's as a password.
                 // The reason is because we that as a password placeholder
                 // on the client side.
                 if ($formdata['password'] != "xxxxxx") {
                     $user->setPassword($formdata['password']);
                 }
                 $user->setType($formdata['type']);
                 $user->setEmail($formdata['email']);
                 $user->setCellPhone($formdata['cell_phone']);
                 $user->setSkype($formdata['skype']);
                 $user->setJabber($formdata['jabber']);
                 $user->save();
                 $form->reset();
                 if (strlen($formdata['user_id']) == 0) {
                     $this->view->successMessage = "<div class='success'>User added successfully!</div>";
                 } else {
                     $this->view->successMessage = "<div class='success'>User updated successfully!</div>";
                 }
             }
         }
     }
     $this->view->form = $form;
 }
开发者ID:nidzix,项目名称:Airtime,代码行数:45,代码来源:UserController.php

示例2: addUserAction

 public function addUserAction()
 {
     $CC_CONFIG = Config::getConfig();
     $request = $this->getRequest();
     $baseUrl = Application_Common_OsPath::getBaseDir();
     $js_files = array('js/datatables/js/jquery.dataTables.js?', 'js/datatables/plugin/dataTables.pluginAPI.js?', 'js/airtime/user/user.js?');
     foreach ($js_files as $js) {
         $this->view->headScript()->appendFile($baseUrl . $js . $CC_CONFIG['airtime_version'], 'text/javascript');
     }
     $this->view->headLink()->appendStylesheet($baseUrl . 'css/users.css?' . $CC_CONFIG['airtime_version']);
     $form = new Application_Form_AddUser();
     $this->view->successMessage = "";
     if ($request->isPost()) {
         $params = $request->getPost();
         $postData = explode('&', $params['data']);
         $formData = array();
         foreach ($postData as $k => $v) {
             $v = explode('=', $v);
             $formData[$v[0]] = urldecode($v[1]);
         }
         if ($form->isValid($formData)) {
             if ($form->validateLogin($formData)) {
                 $user = new Application_Model_User($formData['user_id']);
                 if (empty($formData['user_id'])) {
                     $user->setLogin($formData['login']);
                 }
                 $user->setFirstName($formData['first_name']);
                 $user->setLastName($formData['last_name']);
                 // We don't allow 6 x's as a password.
                 // The reason is because we that as a password placeholder
                 // on the client side.
                 if ($formData['password'] != "xxxxxx") {
                     $user->setPassword($formData['password']);
                 }
                 $user->setType($formData['type']);
                 $user->setEmail($formData['email']);
                 $user->setCellPhone($formData['cell_phone']);
                 $user->setSkype($formData['skype']);
                 $user->setJabber($formData['jabber']);
                 $user->save();
                 // Language and timezone settings are saved on a per-user basis
                 // By default, the default language, and timezone setting on
                 // preferences page is what gets assigned.
                 Application_Model_Preference::SetUserLocale();
                 Application_Model_Preference::SetUserTimezone();
                 $form->reset();
                 $this->view->form = $form;
                 if (strlen($formData['user_id']) == 0) {
                     $this->view->successMessage = "<div class='success'>" . _("User added successfully!") . "</div>";
                 } else {
                     $this->view->successMessage = "<div class='success'>" . _("User updated successfully!") . "</div>";
                 }
                 $this->_helper->json->sendJson(array("valid" => "true", "html" => $this->view->render('user/add-user.phtml')));
             } else {
                 $this->view->form = $form;
                 $this->_helper->json->sendJson(array("valid" => "false", "html" => $this->view->render('user/add-user.phtml')));
             }
         } else {
             $this->view->form = $form;
             $this->_helper->json->sendJson(array("valid" => "false", "html" => $this->view->render('user/add-user.phtml')));
         }
     }
     $this->view->form = $form;
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:64,代码来源:UserController.php


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