コード例 #1
0
ファイル: VenueDao.php プロジェクト: justinlyon/scc
 function getVenueSummaries($pubStates = null)
 {
     global $logger;
     $logger->debug(get_class($this) . "::getVenues({$pubStates})");
     $pubStates = $pubStates == null ? array('Published') : $pubStates;
     $db =& JFactory::getDBO();
     // get the featured programs
     $query = 'SELECT DISTINCT v.eoid as oid, v.name as name, ev.value as pubState' . ' FROM _ez_relation_ as r, Venue as v, EnumeratedValue as ev' . ' WHERE (r.class_a = "Venue" AND r.class_b = "PublicationState")' . '   AND oid_b = ev.eoid AND (';
     $sep = "";
     foreach ($pubStates as $pubState) {
         $query .= $sep . 'ev.value="' . $pubState . '"';
         $sep = ' OR ';
     }
     $query .= ")";
     $db->setQuery($query);
     $venues = $db->loadAssocList();
     $result = array();
     foreach ($venues as $row) {
         $venue = new Venue($row);
         // Get the address
         $query = 'SELECT a.* FROM Address as a, _ez_relation_ as r' . ' WHERE (r.class_a = "Venue" AND r.class_b = "Address")' . ' AND a.eoid = r.oid_b AND r.oid_a = ' . $venue->getOid();
         $db->setQuery($query);
         $addrs = $db->loadAssocList();
         $addr = $addrs[0];
         $venue->setAddress(new Address($addr));
         // Get the event counts
         $types = array("Exhibition", "Program", "Course");
         $venueEvents = array();
         foreach ($types as $type) {
             $query = 'SELECT DISTINCT e.eoid ' . ' FROM ' . $type . ' as e, _ez_relation_ as r ' . ' WHERE r.class_a = "' . $type . '" AND r.class_b = "Venue" ' . ' AND r.oid_b = ' . $venue->getOid();
             $db->setQuery($query);
             $events = $db->loadAssocList();
             foreach ($events as $event) {
                 $venueEvents[] = new $type($event);
             }
         }
         $venue->setEvents($venueEvents);
         $result[] = $venue;
     }
     return $result;
 }
コード例 #2
0
ファイル: VenueAction.php プロジェクト: justinlyon/scc
 /**
  * Populates the Venue object from the request
  * @return bean Venue
  */
 private function getBeanFromRequest()
 {
     $venue = new Venue();
     $addr = new Address();
     $addr->setOid($_REQUEST['aoid']);
     $addr->setStreet($_REQUEST['street']);
     $addr->setUnit($_REQUEST['unit']);
     $addr->setCity($_REQUEST['city']);
     $addr->setState($_REQUEST['state']);
     $addr->setPostalCode($_REQUEST['postalCode']);
     $addr->setPhone($_REQUEST['phone']);
     $venue->setOid($_REQUEST['oid']);
     $venue->setName($_REQUEST['name']);
     $venue->setDescription($_REQUEST['description']);
     $venue->setPubState($_REQUEST['pubState']);
     $venue->setAddress($addr);
     if (isset($_REQUEST['gallery'])) {
         $venue->setGallery($_REQUEST['gallery']);
     }
     $links = array();
     //$links['exhibition'] = $_REQUEST['exhibition'];
     //$links['program'] = isset($_REQUEST['program']) ? $_REQUEST['program'] : null;
     //$links['course'] = isset($_REQUEST['course']) ? $_REQUEST['course'] : null;
     $venue->setEvents($links);
     return $venue;
 }