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 / Feedback.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  1.5 KB  |  65 lines

  1. <?PHP
  2. /**
  3.  * Model for a eBay feedback
  4.  *
  5.  *
  6.  * @package Services_Ebay
  7.  * @author  Stephan Schmidt <schst@php.net>
  8.  */
  9. class Services_Ebay_Model_Feedback extends Services_Ebay_Model implements IteratorAggregate
  10. {
  11.    /**
  12.     * property that stores the unique identifier (=pk) of the model
  13.     *
  14.     * @var string
  15.     */
  16.     protected $primaryKey = 'FeedbackId';
  17.  
  18.    /**
  19.     * feedback items
  20.     *
  21.     * @var  array
  22.     */
  23.     private $items = array();
  24.     
  25.    /**
  26.     * create new feedback model
  27.     *
  28.     * @param    array   feedback
  29.     */
  30.     public function __construct($feedback, $session = null)
  31.     {
  32.         if (isset($feedback['FeedbackDetail'])) {
  33.             foreach ($feedback['FeedbackDetail']['FeedbackDetailItem'] as $tmp) {
  34.                 array_push($this->items, Services_Ebay::loadModel('FeedbackEntry', $tmp, $session));
  35.             }
  36.             unset($feedback['FeedbackDetail']);
  37.         }
  38.         parent::__construct($feedback);
  39.     }
  40.     
  41.    /**
  42.     * get one entry of the feedback list
  43.     *
  44.     * @param    int
  45.     * @return   object Services_Ebay_Model_FeedbackEntry
  46.     */
  47.     public function getEntry($pos)
  48.     {
  49.         if (isset($this->items[$pos])) {
  50.             return $this->items[$pos];    
  51.         }
  52.         return false;
  53.     }
  54.  
  55.    /**
  56.     * iterate through the feedback items
  57.     *
  58.     * @return array
  59.     */
  60.     public function getIterator()
  61.     {
  62.         return new ArrayObject($this->items);
  63.     }
  64. }
  65. ?>