Ejemplo n.º 1
0
 public function myBids($uid, $period)
 {
     $this->checkUser($uid);
     $sql = sprintf("SELECT * FROM location_bids WHERE owner_id=%s AND period_bids=%s order by bid_created_dt asc", $this->qstr($uid), $this->qstr($period));
     $result = $this->_connMain->Execute($sql);
     if ($result->RecordCount() == 0) {
         throw new Exception('No Bids available.');
     }
     $return = array();
     $Models_Geo = new Models_Geo();
     $return['country'] = array();
     $return['state'] = array();
     $return['city'] = array();
     while (!$result->EOF) {
         $location = array();
         switch ($result->fields['location_type']) {
             case 'Country':
                 $location = $Models_Geo->getCountryDetails($result->fields['location_id'], 0);
                 $return['country'][] = array('bidDetail' => $result->fields, 'location' => $location);
                 break;
             case 'State':
                 $location = $Models_Geo->getStateDetails($result->fields['location_id'], 0);
                 $return['state'][] = array('bidDetail' => $result->fields, 'location' => $location);
                 break;
             case 'City':
                 $location = $Models_Geo->getCityDetails($result->fields['location_id'], 0);
                 $return['city'][] = array('bidDetail' => $result->fields, 'location' => $location);
                 break;
         }
         $result->MoveNext();
     }
     return $return;
 }