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


PHP UserListFactory::getIterator方法代码示例

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


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

示例1: Validate

 function Validate()
 {
     if ($this->getUser() == $this->getParent()) {
         $this->Validator->isTrue('parent', FALSE, TTi18n::gettext('User is the same as parent'));
     }
     //Make sure both user and parent belong to the same company
     $ulf = new UserListFactory();
     $ulf->getById($this->getUser());
     $user = $ulf->getIterator()->current();
     unset($ulf);
     $ulf = new UserListFactory();
     $ulf->getById($this->getParent());
     $parent = $ulf->getIterator()->current();
     unset($ulf);
     if ($this->getUser() == 0 and $this->getParent() == 0) {
         $parent_company_id = 0;
         $user_company_id = 0;
     } elseif ($this->getUser() == 0) {
         $parent_company_id = $parent->getCompany();
         $user_company_id = $parent->getCompany();
     } elseif ($this->getParent() == 0) {
         $parent_company_id = $user->getCompany();
         $user_company_id = $user->getCompany();
     } else {
         $parent_company_id = $parent->getCompany();
         $user_company_id = $user->getCompany();
     }
     if ($user_company_id > 0 and $parent_company_id > 0) {
         Debug::Text(' User Company: ' . $user_company_id . ' Parent Company: ' . $parent_company_id, __FILE__, __LINE__, __METHOD__, 10);
         if ($user_company_id != $parent_company_id) {
             $this->Validator->isTrue('parent', FALSE, TTi18n::gettext('User or parent has incorrect company'));
         }
         $this->getFastTreeObject()->setTree($this->getHierarchyControl());
         $children_arr = $this->getFastTreeObject()->getAllChildren($this->getUser(), 'RECURSE');
         if (is_array($children_arr)) {
             $children_ids = array_keys($children_arr);
             if (isset($children_ids) and is_array($children_ids) and in_array($this->getParent(), $children_ids) == TRUE) {
                 Debug::Text(' Objects cant be re-parented to their own children...', __FILE__, __LINE__, __METHOD__, 10);
                 $this->Validator->isTrue('parent', FALSE, TTi18n::gettext('Unable to change parent to a child of itself'));
             }
         }
         /*
         			//Make sure we're not re-parenting to a child.
         			$uhlf = new UserHierarchyListFactory();
         			$hierarchy = $uhlf->getByCompanyIdArray( $parent_company_id );
         
         			Debug::Text(' User ID: '. $this->getUser() .' Parent ID: '. $this->getParent(), __FILE__, __LINE__, __METHOD__,10);
         			if ( is_array( $hierarchy ) ) {
         				if ( in_array( $this->getParent(), array_keys( $hierarchy[$this->getUser()] ) ) ) {
         					Debug::Text(' Trying to re-parent to a child! ', __FILE__, __LINE__, __METHOD__,10);
         
         					$this->Validator->isTrue(	'parent',
         												FALSE,
         												TTi18n::gettext('Unable to change parent to a child of itself')
         												);
         
         				} else {
         					Debug::Text(' NOT Trying to re-parent to a child! ', __FILE__, __LINE__, __METHOD__,10);
         				}
         			} else {
         				Debug::Text(' NOT Trying to re-parent to a child! 22', __FILE__, __LINE__, __METHOD__,10);
         			}
         */
     }
     return TRUE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:66,代码来源:HierarchyFactory.class.php


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