示例#1
0
	private function spilloverChosenAffiliate(Pap_Common_User $child, Pap_Common_User $originalParentUser) {
		$user = $this->userTree->getChosenUser(Gpf_Settings::get(Pap_Settings::MATRIX_AFFILIATE));
		if ($user === null) {
			$child->setParentUserId(self::NONE_PARENT_USER_ID);
			return;
		}
		$this->initLimit($this->matrixWidth);
		$parent = $this->getParent(array($user));
		if ($parent === null) {
			$parent = $this->getParentSpillover($user);
			if ($parent === null) {
				$child->setParentUserId($user->getId());
				return;
			}
		}
		$child->setParentUserId($parent->getId());
	}
 private function getChildAffilitesMails($parent){
     $tree = new Pap_Common_UserTree();
     $children = $tree->getChildren($parent);
     foreach($children as $child){
         $this->childAffiliates[] = $child->getEmail();
         $this->getChildAffilitesMails($child);
     }
 }
示例#3
0
 private function getTransaction(Pap_Contexts_Tracking $context) {
     $userTree = new Pap_Common_UserTree();
     $tier = 1;
     $currentUser = $context->getUserObject();
     $currentTransaction = $context->getTransaction($tier);
     
     while ($currentUser != null && $tier < 100) {
         if ($currentTransaction != null) {
             $transactionId = $currentTransaction->getTransactionId();
             if ($transactionId != null && $transactionId != '') {
                 return $currentTransaction;
             }
         }
         $tier++;
         $currentUser = $userTree->getParent($currentUser);
         $currentTransaction = $context->getTransaction($tier);
     }
     return $context->getTransaction();
 }
 protected function checkForCycle(Pap_Affiliates_User $potentialParent, $userId) {
     $tree = new Pap_Common_UserTree();
     $tree->startCheckingLoops();
     $affiliate = $potentialParent;
     while ($affiliate != null){
         if ($userId == $affiliate->getId()) {
             return false;
         }
         $affiliate = $tree->getParent($affiliate);
     }
     return true;
 }