예제 #1
0
 protected function loadRow(Gpf_DbEngine_RowBase $row) {
     try {
         $row->load();
     } catch (Gpf_DbEngine_NoRow $e) {
         throw new Gpf_Exception($this->_("%s does not exist", $this->getDbRowObjectName()));
     }
 }
    /**
     * @param $params
     * @param $row
     * @param $primaryKeyName
     * @param $baseAttributes
     */
    private function getResponse(Gpf_Rpc_Params $params, Gpf_DbEngine_RowBase $row, $primaryKeyName, array $baseAttributes = null) {
    	$this->visitorId = $params->get('visitorId');

        $response = new Gpf_Rpc_Data();
        if ($this->visitorId == '') {
            return $response;
        }
        $this->setAccountId($params->get('accountId'));
        
        $this->processAllVisitorVisits();
        if (($visitorAffiliate = $this->getCurrentVisitorAffiliate()) == null) {
            return $response;
        }  
              
    	if (is_null($baseAttributes)) {
    		$baseAttributes = array($primaryKeyName);
    	}
    	$row->set($primaryKeyName, $visitorAffiliate->get($primaryKeyName));
        try {
            $row->load();
        } catch (Gpf_Exception $e) {
            return $response;
        }
        if (Gpf_Session::getAuthUser()->hasPrivilege('click', 'write')) {
            foreach ($row->getAttributes() as $name => $value) {
                $response->setValue($name, $value);
            }
        } else {
        	foreach ($baseAttributes as $attribute) {
            	$response->setValue($attribute, $row->get($attribute));
        	}
        }
        return $response;
    }