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


PHP Staff::create方法代码示例

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


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

示例1: store

 /**
  * Store a newly created group in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Staff::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     Staff::create($data);
     return Redirect::route('staffs.index');
 }
开发者ID:sharad23,项目名称:power,代码行数:14,代码来源:VisitStaffController.php

示例2: include_once

 include_once(INCLUDE_DIR.'class.staff.php');
 $do=strtolower($_POST['do']);
 switch($do){
     case 'update':
         $staff = new Staff($_POST['staff_id']);
         if($staff && $staff->getId()) {
             if($staff->update($_POST,$errors))
                 $msg='Staff profile updated successfully';
             elseif(!$errors['err'])
                 $errors['err']='Error updating the user';
         }else{
             $errors['err']='Internal error';
         }
         break;
     case 'create':
         if(($uID=Staff::create($_POST,$errors)))
             $msg=Format::htmlchars($_POST['firstname'].' '.$_POST['lastname']).' added successfully';
         elseif(!$errors['err'])
             $errors['err']='Unable to add the user. Internal error';
         break;
     case 'mass_process':
         //ok..at this point..look WMA.
         if($_POST['uids'] && is_array($_POST['uids'])) {
             $ids=implode(',',$_POST['uids']);
             $selected=count($_POST['uids']);
             if(isset($_POST['enable'])) {
                 $sql='UPDATE '.STAFF_TABLE.' SET isactive=1,updated=NOW() WHERE isactive=0 AND staff_id IN('.$ids.')';
                 db_query($sql);
                 $msg=db_affected_rows()." of  $selected selected users enabled";
             
             }elseif(in_array($thisuser->getId(),$_POST['uids'])) {
开发者ID:hungnv0789,项目名称:vhtm,代码行数:31,代码来源:admin.php

示例3: sprintf

     if (isset($_REQUEST["weekend"])) {
         $mysqli->query("UPDATE ost_staff SET weekend_alert = '1' WHERE staff_id = " . $_REQUEST["id"]);
     } else {
         $mysqli->query("UPDATE ost_staff SET weekend_alert = '0' WHERE staff_id = " . $_REQUEST["id"]);
     }
     // Anthony 2016-01-18
     if (!$staff) {
         $errors['err'] = sprintf(__('%s: Unknown or invalid'), __('agent'));
     } elseif ($staff->update($_POST, $errors)) {
         $msg = sprintf(__('Successfully updated %s'), __('this agent'));
     } elseif (!$errors['err']) {
         $errors['err'] = sprintf(__('Unable to update %s. Correct error(s) below and try again!'), __('this agent'));
     }
     break;
 case 'create':
     if ($id = Staff::create($_POST, $errors)) {
         $msg = sprintf(__('Successfully added %s'), Format::htmlchars($_POST['firstname']));
         $_REQUEST['a'] = null;
     } elseif (!$errors['err']) {
         $errors['err'] = sprintf(__('Unable to add %s. Correct error(s) below and try again.'), __('this agent'));
     }
     break;
 case 'mass_process':
     if (!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
         $errors['err'] = sprintf(__('You must select at least %s.'), __('one agent'));
     } elseif (in_array($thisstaff->getId(), $_POST['ids'])) {
         $errors['err'] = __('You can not disable/delete yourself - you could be the only admin!');
     } else {
         $count = count($_POST['ids']);
         switch (strtolower($_POST['a'])) {
             case 'enable':
开发者ID:jmangarret,项目名称:ostickets,代码行数:31,代码来源:staff.php

示例4: authOrCreate

 function authOrCreate($username)
 {
     global $cfg;
     switch ($this->type) {
         case 'staff':
             if (($user = StaffSession::lookup($username)) && $user->getId()) {
                 if (!$user instanceof StaffSession) {
                     // osTicket <= v1.9.7 or so
                     $user = new StaffSession($user->getId());
                 }
                 return $user;
             } else {
                 $staff_groups = preg_split('/;|,/', $config->get('multiauth-staff-group'));
                 $chkgroup;
                 foreach ($staff_groups as $staff_group) {
                     if ($ldap->checkGroup($name, $staff_group)) {
                         $chkgroup = true;
                         break;
                     }
                 }
                 $config = $this->getConfig();
                 if ($config->get('multiauth-staff-register') && $chkgroup) {
                     if (!($info = $this->lookup($username, false))) {
                         return;
                     }
                     $errors = array();
                     $staff = array();
                     $staff['username'] = $info['username'];
                     $staff['firstname'] = $info['first'];
                     $staff['lastname'] = $info['last'];
                     $staff['email'] = $info['email'];
                     $staff['isadmin'] = 0;
                     $staff['isactive'] = 1;
                     $staff['group_id'] = 1;
                     $staff['dept_id'] = 1;
                     $staff['welcome_email'] = "on";
                     $staff['timezone_id'] = 8;
                     $staff['isvisible'] = 1;
                     Staff::create($staff, $errors);
                     if (($user = StaffSession::lookup($username)) && $user->getId()) {
                         if (!$user instanceof StaffSession) {
                             $user = new StaffSession($user->getId());
                         }
                         return $user;
                     }
                 }
             }
             break;
         case 'client':
             // Lookup all the information on the user. Try to get the email
             // addresss as well as the username when looking up the user
             // locally.
             if (!($info = $this->search($username)[0])) {
                 return;
             }
             $acct = ClientAccount::lookupByUsername($username);
             if ($acct && $acct->getId()) {
                 $client = new ClientSession(new EndUser($acct->getUser()));
             }
             if (!$client) {
                 $info['name'] = $info['first'] . " " . $info['last'];
                 $client = new ClientCreateRequest($this, $username, $info);
                 //if (!$cfg || !$cfg->isClientRegistrationEnabled() && self::$config->get('multiauth-force-register')) {
                 // return $client->attemptAutoRegister();
                 //}
             }
             return $client;
     }
     return null;
 }
开发者ID:philbertphotos,项目名称:osticket-ldap-auth,代码行数:70,代码来源:auth.php


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