當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserFactory::isValid方法代碼示例

本文整理匯總了PHP中UserFactory::isValid方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserFactory::isValid方法的具體用法?PHP UserFactory::isValid怎麽用?PHP UserFactory::isValid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserFactory的用法示例。


在下文中一共展示了UserFactory::isValid方法的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->setEmployeeNumber(1);
     $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);
開發者ID:J-P-Hanafin,項目名稱:TimeTrex-1,代碼行數:31,代碼來源:User.php


注:本文中的UserFactory::isValid方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。