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


PHP UserFactory::Save方法代码示例

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


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

示例1: createUser


//.........这里部分代码省略.........
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 100:
             //Administrator
             $uf->setUserName('demoadmin' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '3333' );
             //$uf->setPhonePassword( '3333' );
             $uf->setFirstName('Mr.');
             $uf->setLastName('Administrator');
             $uf->setSex(10);
             $uf->setAddress1(rand(100, 9999) . ' Main St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('New York');
             $uf->setCountry('US');
             $uf->setProvince('NY');
             $uf->setPostalCode(str_pad(rand(400, 599), 5, 0, STR_PAD_LEFT));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 999:
             //Random user
             $first_name = $this->getRandomFirstName();
             $last_name = $this->getRandomLastName();
             if ($first_name != '' and $last_name != '') {
                 $uf->setUserName($first_name . '.' . $last_name . $this->getUserNamePostfix());
                 $uf->setPassword('demo');
                 $uf->setFirstName($first_name);
                 $uf->setLastName($last_name);
                 $uf->setSex(20);
                 $uf->setAddress1(rand(100, 9999) . ' ' . $this->getRandomLastName() . ' St');
                 $uf->setAddress2('Unit #' . rand(10, 999));
                 $uf->setCity($this->getRandomArrayValue($this->city_names));
                 $uf->setCountry('US');
                 $uf->setProvince('WA');
                 $uf->setPostalCode(rand(98000, 99499));
                 $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
                 $uf->setWorkPhoneExt(rand(100, 1000));
                 $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
                 $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
                 $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
                 $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
                 $uf->setHireDate($hire_date);
                 $uf->setEmployeeNumber(rand(1000, 25000));
                 $uf->setDefaultBranch($default_branch_id);
                 $uf->setDefaultDepartment($default_department_id);
                 $uf->setCurrency($default_currency_id);
                 $uf->setGroup($user_group_id);
             }
             unset($first_name, $last_name);
             break;
     }
     if ($uf->isValid()) {
         $insert_id = $uf->Save();
         Debug::Text('User ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10);
         $this->createUserPreference($insert_id);
         /*
         			$preset_flags = array(
         								'invoice' => 0,
         								'job' => 1,
         								'document' => 0,
         								);
         */
         if ($type == 100) {
             //$this->createUserPermission( array( $insert_id ), 40, $preset_flags );
             $this->createUserPermission($insert_id, 40);
         } else {
             //$this->createUserPermission( array( $insert_id ), 10, $preset_flags );
             $this->createUserPermission($insert_id, 10);
         }
         //$this->createUserPermission( array( -1 ), 10, $preset_flags );
         //Default wage group
         $this->createUserWage($insert_id, '19.50', $hire_date);
         $this->createUserWage($insert_id, '19.75', strtotime('01-Jun-04'));
         $this->createUserWage($insert_id, '20.15', strtotime('01-Jan-05'));
         $this->createUserWage($insert_id, '21.50', strtotime('01-Jan-06'));
         $this->createUserWage($insert_id, '10.00', strtotime('01-Jan-04'), $this->user_wage_groups[0]);
         $this->createUserWage($insert_id, '20.00', strtotime('01-Jan-04'), $this->user_wage_groups[1]);
         //Assign Taxes to user
         $this->createUserDeduction($company_id, $insert_id);
         return $insert_id;
     }
     Debug::Text('Failed Creating User!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:101,代码来源:DemoData.class.php

示例2: PermissionControlListFactory

     $uf->setFirstName($user_data['first_name']);
     $uf->setLastName($user_data['last_name']);
     $uf->setWorkEmail($user_data['work_email']);
     //Get Permission Control with highest ID, assume its for Administrators
     //and use it.
     $pclf = new PermissionControlListFactory();
     $pclf->getByCompanyId($user_data['company_id'], NULL, NULL, NULL, array('id' => 'desc'));
     if ($pclf->getRecordCount() > 0) {
         $pc_obj = $pclf->getCurrent();
         if (is_object($pc_obj)) {
             Debug::Text('Adding User to Permission Control: ' . $pc_obj->getId(), __FILE__, __LINE__, __METHOD__, 10);
             $uf->setPermissionControl($pc_obj->getId());
         }
     }
     if ($uf->isValid()) {
         $user_id = $uf->Save();
         $uf->CommitTransaction();
         if ($external_installer == 1) {
             Redirect::Page(URLBuilder::getURL(NULL, 'Done.php'));
         } else {
             Redirect::Page(URLBuilder::getURL(NULL, 'MaintenanceJobs.php'));
         }
         break;
     }
     $uf->FailTransaction();
 default:
     if (isset($company_id)) {
         $user_data['company_id'] = $company_id;
     }
     $smarty->assign_by_ref('user_data', $user_data);
     break;
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:User.php


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