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 / Call / ReviseItem.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  2.1 KB  |  83 lines

  1. <?PHP
  2. /**
  3.  * Revise (change) an item that has been added to Ebay
  4.  *
  5.  * <code>
  6.  * $item = $eBay->GetItem('12345678');
  7.  * $item->Title = 'New title';
  8.  * $eBay->ReviseItem($item);
  9.  * </code>
  10.  *
  11.  * $Id: ReviseItem.php,v 1.3 2004/12/14 19:08:25 schst Exp $
  12.  *
  13.  * @package Services_Ebay
  14.  * @author  Stephan Schmidt <schst@php.net>
  15.  * @link    http://developer.ebay.com/DevZone/docs/API_Doc/Functions/ReviseItem/ReviseItemLogic.htm
  16.  * @see     Services_Ebay_Model_Item::Revise()
  17.  */
  18. class Services_Ebay_Call_ReviseItem extends Services_Ebay_Call 
  19. {
  20.    /**
  21.     * verb of the API call
  22.     *
  23.     * @var  string
  24.     */
  25.     protected $verb = 'ReviseItem';
  26.  
  27.    /**
  28.     * parameter map that is used, when scalar parameters are passed
  29.     *
  30.     * @var  array
  31.     */
  32.     protected $paramMap = array();
  33.  
  34.    /**
  35.     * constructor
  36.     *
  37.     * @param    array
  38.     */
  39.     public function __construct($args)
  40.     {
  41.         $item = $args[0];
  42.         
  43.         if (!$item instanceof Services_Ebay_Model_Item) {
  44.             throw new Services_Ebay_Exception( 'No item passed.' );
  45.         }
  46.         
  47.         $id = $item->Id;
  48.         
  49.         if (empty($id)) {
  50.             throw new Services_Ebay_Exception( 'Item has no ID.' );
  51.         }
  52.  
  53.         $this->args = $item->GetModifiedProperties();
  54.         if (isset($this->args['Id'])) {
  55.             throw new Services_Ebay_Exception( 'You must not change the item ID.' );
  56.         }
  57.         
  58.         $this->args['ItemId'] = $id;
  59.     }
  60.     
  61.    /**
  62.     * make the API call
  63.     *
  64.     * @param    object Services_Ebay_Session
  65.     * @return   string
  66.     */
  67.     public function call(Services_Ebay_Session $session)
  68.     {
  69.         $return = parent::call($session);
  70.         if (isset($return['Item'])) {
  71.             $returnItem = $return['Item'];
  72.  
  73.             $this->item->Id = $returnItem['Id'];
  74.             $this->item->StartTime = $returnItem['StartTime'];
  75.             $this->item->EndTime = $returnItem['EndTime'];
  76.             $this->item->Fees = $returnItem['Fees'];
  77.         
  78.             return true;
  79.         }
  80.         return false;
  81.     }
  82. }
  83. ?>