/**
     * Load affiliate detail for affiliate manager
     *
     * @service affiliate read
     * @param $fields
     */
    public function affiliateDetails(Gpf_Rpc_Params $params) {
        $data = new Gpf_Rpc_Data($params);
        $search = $data->getFilters()->getFilter("id");
        if (sizeof($search) == 1) {
            $id = $search[0]->getValue();
        }
        

        $user = new Pap_Affiliates_User();
        $user->setId($id);
        try {
            $user->load();
        } catch (Gpf_DbEngine_NoRowException $e) {
            return $data;
        }
        $data->setValue("id", $user->getId());
        $data->setValue("name", $user->getFirstName()." ".$user->getLastName());
        $data->setValue("username", $user->getUserName());

        $formFields = $this->getUserFormFields();
        foreach($formFields as $record) {
            $code = $record->get('code');
            $data->setValue($code, $user->get($code));
        }

        return $data;
    }
Пример #2
0
    public function firstTimeApproved(Pap_Affiliates_User $user){
        $userInCommision = new Pap_Db_UserInCommissionGroup();

        $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->addAll(Pap_Db_Table_Campaigns::getInstance(), 'ca');
        
        $selectBuilder->from->add('qu_pap_commissiongroups', 'c');
        $selectBuilder->from->addInnerJoin('qu_pap_userincommissiongroup', 'u', 'u.commissiongroupid=c.commissiongroupid');
        $selectBuilder->from->addInnerJoin(Pap_Db_Table_Campaigns::getName(), 'ca', 'ca.'.Pap_Db_Table_Campaigns::ID.'=c.campaignid');
        $selectBuilder->where->add('u.userid','=',$user->getId());
        foreach ($selectBuilder->getAllRowsIterator() as $row){
            $campaign = new Pap_Common_Campaign();
            $campaign->fillFromRecord($row);
            $userInCommision->sendInviteMail($campaign,$user->getId());
        }
    }
 private function fillFromUser(Gpf_Rpc_Form $form, Pap_Affiliates_User $user) {
     $userData = new Gpf_Data_RecordSet();
     $userData->setHeader(array('userid', 'username','firstname', 'lastname'));
     $data = $userData->createRecord();
     $data->add('userid', $user->getId());
     $data->add('username', $user->getUserName());
     $data->add('firstname', $user->getFirstName());
     $data->add('lastname', $user->getLastName());
     $userData->add($data);
     $form->setField('userid', null, $userData->toObject());
 }
Пример #4
0
 protected function addSignupCommissions(Pap_Affiliates_User $affiliate) {
     $bonusValue = Gpf_Settings::get(Pap_Settings::SIGNUP_BONUS);
     if ($bonusValue != 0) {
         $this->insertTransaction($affiliate->getId(), Pap_Db_Transaction::TYPE_SIGNUP_BONUS,
         $bonusValue, $affiliate->getStatus());
     }
     $this->addReferralCommissions($affiliate);
 }