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


PHP UserListFactory::getByCompanyID方法代码示例

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


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

示例1: postInstall

 function postInstall()
 {
     Debug::text('postInstall: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
     //Copy iButton,Fingerprint,EmployeeNumber (barcode/proximity) fields to new UserIdentification table.
     //Find out if they have both TimeClocks and FingerPrint stations. If they do
     //we need to copy the fingerprint data to both types of UserIdentification rows.
     $clf = new CompanyListFactory();
     $clf->getAll();
     $clf->StartTransaction();
     foreach ($clf as $c_obj) {
         Debug::text('Company: ' . $c_obj->getName(), __FILE__, __LINE__, __METHOD__, 9);
         $max_templates = 4;
         $slf = new StationListFactory();
         $slf->getByCompanyIdAndTypeId($c_obj->getId(), array(30, 40, 50, 100, 110));
         if ($slf->getRecordCount() > 0) {
             $slf_tmp1 = $slf->getByCompanyIdAndTypeId($c_obj->getId(), array(50));
             $griaule_stations = $slf_tmp1->getRecordCount();
             Debug::text('  Found Griaule Stations: ' . $griaule_stations, __FILE__, __LINE__, __METHOD__, 9);
             unset($slf_tmp1);
             $slf_tmp2 = $slf->getByCompanyIdAndTypeId($c_obj->getId(), array(100, 110));
             $zk_stations = $slf_tmp2->getRecordCount();
             Debug::text('  Found ZK Stations: ' . $zk_stations, __FILE__, __LINE__, __METHOD__, 9);
             unset($slf_tmp2);
             $slf_tmp3 = $slf->getByCompanyIdAndTypeId($c_obj->getId(), array(40));
             $barcode_stations = $slf_tmp3->getRecordCount();
             Debug::text('  Found Barcode Stations: ' . $barcode_stations, __FILE__, __LINE__, __METHOD__, 9);
             unset($slf_tmp3);
             //Loop through each user copying their data to the UserIdenfification Table.
             $ulf = new UserListFactory();
             $ulf->getByCompanyID($c_obj->getId());
             if ($ulf->getRecordCount() > 0) {
                 foreach ($ulf as $u_obj) {
                     Debug::text('  User: ' . $u_obj->getUserName(), __FILE__, __LINE__, __METHOD__, 9);
                     if ($u_obj->getIButtonID() != '') {
                         Debug::text('    Converting iButton...', __FILE__, __LINE__, __METHOD__, 9);
                         $uif = new UserIdentificationFactory();
                         $uif->setUser($u_obj->getId());
                         $uif->setType(10);
                         //10=iButton
                         $uif->setNumber(0);
                         $uif->setValue($u_obj->getIButtonID());
                         if ($uif->isValid() == TRUE) {
                             $uif->Save();
                             $u_obj->getIButtonID('');
                         }
                     }
                     if ($u_obj->getRFID() != '') {
                         Debug::text('    Converting RFID...', __FILE__, __LINE__, __METHOD__, 9);
                         $uif = new UserIdentificationFactory();
                         $uif->setUser($u_obj->getId());
                         $uif->setType(40);
                         //40=Proximity
                         $uif->setNumber(0);
                         $uif->setValue($u_obj->getRFID());
                         if ($uif->isValid() == TRUE) {
                             $uif->Save();
                             $u_obj->getRFID('');
                         }
                     }
                     if ($barcode_stations > 0 and $u_obj->getEmployeeNumber() != '') {
                         Debug::text('    Converting EmployeeNumber...', __FILE__, __LINE__, __METHOD__, 9);
                         $uif = new UserIdentificationFactory();
                         $uif->setUser($u_obj->getId());
                         $uif->setType(30);
                         //30=Barcode
                         $uif->setNumber(0);
                         $uif->setValue($u_obj->getEmployeeNumber());
                         if ($uif->isValid() == TRUE) {
                             $uif->Save();
                         }
                     }
                     if ($griaule_stations > 0) {
                         for ($t = 1; $t <= $max_templates; $t++) {
                             $set_fingerprint_function = 'setFingerPrint' . $t;
                             $get_fingerprint_function = 'getFingerPrint' . $t;
                             //Griaule fingerprint templates start with: "p/8B"
                             if ($u_obj->{$get_fingerprint_function}() != '' and substr($u_obj->{$get_fingerprint_function}(), 0, 4) == 'p/8B') {
                                 Debug::text('    Converting Griaule FingerPrint: ' . $t, __FILE__, __LINE__, __METHOD__, 9);
                                 $uif = new UserIdentificationFactory();
                                 $uif->setUser($u_obj->getId());
                                 $uif->setType(20);
                                 //20=Griaule, 100=ZK
                                 $uif->setNumber($t * 10);
                                 $uif->setValue($u_obj->{$get_fingerprint_function}());
                                 if ($uif->isValid() == TRUE) {
                                     $uif->Save();
                                     $u_obj->{$set_fingerprint_function}('');
                                 }
                             }
                         }
                     }
                     if ($zk_stations > 0) {
                         for ($t = 1; $t <= $max_templates; $t++) {
                             $set_fingerprint_function = 'setFingerPrint' . $t;
                             $get_fingerprint_function = 'getFingerPrint' . $t;
                             //ZK fingerprint templates start with: "oco"
                             if ($u_obj->{$get_fingerprint_function}() != '' and substr($u_obj->{$get_fingerprint_function}(), 0, 3) == 'oco') {
                                 Debug::text('    Converting ZK FingerPrint: ' . $t, __FILE__, __LINE__, __METHOD__, 9);
                                 $uif = new UserIdentificationFactory();
                                 $uif->setUser($u_obj->getId());
//.........这里部分代码省略.........
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:101,代码来源:InstallSchema_1026A.class.php


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