home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / Services / Ebay / Model / User.php < prev   
Encoding:
PHP Script  |  2008-07-02  |  4.4 KB  |  140 lines

  1. <?PHP
  2. /**
  3.  * Model for an eBay user
  4.  *
  5.  *
  6.  * @package Services_Ebay
  7.  * @author  Stephan Schmidt <schst@php.net>
  8.  */
  9. class Services_Ebay_Model_User extends Services_Ebay_Model
  10. {
  11.    /**
  12.     * model type
  13.     *
  14.     * @var  string
  15.     */
  16.     protected $type = 'User';
  17.  
  18.    /**
  19.     * property that stores the unique identifier (=pk) of the model
  20.     *
  21.     * @var string
  22.     */
  23.     protected $primaryKey = 'UserId';
  24.  
  25.     /**
  26.     * get the feedback for the user
  27.     *
  28.     * @param    int     Detail Level
  29.     * @param    int     starting page
  30.     * @param    int     items per page
  31.     * @link     http://developer.ebay.com/DevZone/docs/API_Doc/Functions/GetFeedback/GetFeedback.htm
  32.     */
  33.     public function GetFeedback($DetailLevel = Services_Ebay::FEEDBACK_BRIEF, $StartingPage = 1, $ItemsPerPage = 25)
  34.     {
  35.         $args = array(
  36.                        'UserId'       => $this->properties['UserId'],
  37.                        'StartingPage' => $StartingPage,
  38.                        'ItemsPerPage' => $ItemsPerPage,
  39.                        'DetailLevel'  => $DetailLevel
  40.                     );
  41.         $call = Services_Ebay::loadAPICall('GetFeedback');
  42.         $call->setArgs($args);
  43.         
  44.         return $call->call($this->session);
  45.     }
  46.     
  47.    /**
  48.     * get the list of items the user is selling
  49.     *
  50.     * @param    array   all arguments
  51.     * @link     http://developer.ebay.com/DevZone/docs/API_Doc/Functions/GetSellerList/GetSellerList.htm
  52.     */
  53.     public function GetSellerList($args = array())
  54.     {
  55.         $defaultArgs = array(
  56.                        'UserId'       => $this->properties['UserId'],
  57.                        'DetailLevel'  => 16
  58.                     );
  59.         $args = array_merge($defaultArgs, $args);
  60.         $call = Services_Ebay::loadAPICall('GetSellerList');
  61.         $call->setArgs($args);
  62.         
  63.         return $call->call($this->session);
  64.     }
  65.  
  66.    /**
  67.     * get list of items on which the user is/has been bidding
  68.     *
  69.     * @link     http://developer.ebay.com/DevZone/docs/API_Doc/Functions/GetBidderList/GetBidderList.htm
  70.     */
  71.     public function GetBidderList($Active = 1, $DetailLevel = 32, $Days = null, $EndTimeFrom = null, $EndTimeTo = null)
  72.     {
  73.         $args = array(
  74.                        'UserId'       => $this->properties['UserId'],
  75.                        'Active'       => $Active,
  76.                        'DetailLevel'  => 32,
  77.                        'Days'         => $Days,
  78.                        'EndTimeFrom'  => $EndTimeFrom,
  79.                        'EndTimeTo'    => $EndTimeTo
  80.                     );
  81.         $call = Services_Ebay::loadAPICall('GetBidderList');
  82.         $call->setArgs($args);
  83.         
  84.         return $call->call($this->session);
  85.     }
  86.  
  87.    /**
  88.     * leave feedback for the user
  89.     *
  90.     * @param    array   all arguments
  91.     * @link     http://developer.ebay.com/DevZone/docs/API_Doc/Functions/LeaveFeedback/LeaveFeedbackLogic.htm
  92.     */
  93.     public function LeaveFeedback($ItemId, $CommentType, $Comment, $TransactionId = null)
  94.     {
  95.         $args = array(
  96.                        'TargetUser'   => $this->properties['UserId'],
  97.                        'ItemId'       => $ItemId,
  98.                        'CommentType'  => $CommentType,
  99.                        'Comment'      => $Comment
  100.                     );
  101.         if (!is_null($TransactionId)) {
  102.             $args['TransactionId'] = $TransactionId;
  103.         }
  104.         $call = Services_Ebay::loadAPICall('LeaveFeedback');
  105.         $call->setArgs($args);
  106.         
  107.         return $call->call($this->session);
  108.     }
  109.  
  110.    /**
  111.     * get the user from eBay
  112.     *
  113.     * Use this to query by a previously set user id
  114.     *
  115.     * <code>
  116.     * $user = Services_Ebay::loadModel('User', 'superman-74', $session);
  117.     * $user->Get();
  118.     * </code>
  119.     *
  120.     * @param    string    ItemId
  121.     * @see      Services_Ebay_Call_GetUser
  122.     */
  123.     public function Get($ItemId = null)
  124.     {
  125.         $args = array(
  126.                         'UserId' => $this->properties['UserId'],
  127.                         'ItemId' => $ItemId
  128.                     );
  129.  
  130.         $call = Services_Ebay::loadAPICall('GetUser');
  131.         $call->setArgs($args);
  132.         
  133.         $tmp = $call->call($this->session);
  134.         $this->properties     = $tmp->toArray();
  135.         $this->eBayProperties = $this->properties;
  136.         unset($tmp);
  137.         return true;
  138.     }
  139. }
  140. ?>