Exemplo n.º 1
0
 public function getEtimeAudiencesJoinEtime($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseEtimeAudiencePeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collEtimeAudiences === null) {
         if ($this->isNew()) {
             $this->collEtimeAudiences = array();
         } else {
             $criteria->add(EtimeAudiencePeer::AUDIENCE_ID, $this->getId());
             $this->collEtimeAudiences = EtimeAudiencePeer::doSelectJoinEtime($criteria, $con);
         }
     } else {
         $criteria->add(EtimeAudiencePeer::AUDIENCE_ID, $this->getId());
         if (!isset($this->lastEtimeAudienceCriteria) || !$this->lastEtimeAudienceCriteria->equals($criteria)) {
             $this->collEtimeAudiences = EtimeAudiencePeer::doSelectJoinEtime($criteria, $con);
         }
     }
     $this->lastEtimeAudienceCriteria = $criteria;
     return $this->collEtimeAudiences;
 }
Exemplo n.º 2
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = EtimeAudiencePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setEtimeId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setAudienceId($arr[$keys[1]]);
     }
 }
Exemplo n.º 3
0
 public static function retrieveByPK($etime_id, $audience_id, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria();
     $criteria->add(EtimeAudiencePeer::ETIME_ID, $etime_id);
     $criteria->add(EtimeAudiencePeer::AUDIENCE_ID, $audience_id);
     $v = EtimeAudiencePeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
Exemplo n.º 4
0
 public function executeCreate()
 {
     if ($this->getRequest()->getMethod() != sfRequest::POST) {
         $this->event = new Event();
         $this->etime = new Etime();
         $this->forward404Unless($this->event);
         $this->forward404Unless($this->etime);
     } else {
         $event = new Event();
         $etime = new Etime();
         $event->setTitle($this->getRequestParameter('title'));
         $event->setStatusId($this->getRequestParameter('status_id') ? $this->getRequestParameter('status_id') : null);
         $event->setCategoryId($this->getRequestParameter('category_id') ? $this->getRequestParameter('category_id') : null);
         $event->setPublished($this->getRequestParameter('published', 0));
         $event->setMediaPotential($this->getRequestParameter('media_potential', 0));
         $event->setDescription($this->getRequestParameter('description'));
         $event->setNotes($this->getRequestParameter('notes'));
         $event->setImageUrl($this->getRequestParameter('image_url'));
         //      $event->setOrganiser($this->getRequestParameter('organiser'));
         //      $event->setInterestedParties($this->getRequestParameter('interested_parties'));
         $event->save();
         $etime->setEventId($event->getId());
         $etime->setTitle($this->getRequestParameter('etime_title'));
         $etime->setStartDate(strtotime($this->getRequestParameter('start_date') . ' ' . $this->getRequestParameter('start_date_time')));
         $etime->setEndDate(strtotime($this->getRequestParameter('end_date') . ' ' . $this->getRequestParameter('end_date_time')));
         $etime->setAllDay($this->getRequestParameter('all_day') ? $this->getRequestParameter('all_day') : false);
         $etime->setLocation($this->getRequestParameter('location'));
         $etime->setDescription($this->getRequestParameter('etime_description'));
         $etime->setNotes($this->getRequestParameter('etime_notes'));
         $etime->setCapacity($this->getRequestParameter('capacity') ? $this->getRequestParameter('capacity') : null);
         $etime->setAdditionalGuests($this->getRequestParameter('additional_guests') ? $this->getRequestParameter('additional_guests') : 0);
         $etime->setHasFee($this->getRequestParameter('has_fee') ? $this->getRequestParameter('has_fee') : false);
         $etime->setAudioVisualSupport($this->getRequestParameter('audio_visual_support') ? $this->getRequestParameter('audio_visual_support') : false);
         //      $etime->setOrganiser($this->getRequestParameter('etime_organiser'));
         //      $etime->setInterestedParties($this->getRequestParameter('etime_interested_parties'));
         $etime->save();
         // Update many-to-many for "etime_rsvp"
         $c = new Criteria();
         $c->add(EtimeRsvpPeer::ETIME_ID, $etime->getPrimaryKey());
         EtimeRsvpPeer::doDelete($c);
         $ids = $this->getRequestParameter('associated_etime_rsvp');
         if (is_array($ids)) {
             foreach ($ids as $id) {
                 $EtimeRsvp = new EtimeRsvp();
                 $EtimeRsvp->setEtime($etime);
                 $EtimeRsvp->setRsvpId($id);
                 $EtimeRsvp->save();
             }
         }
         // Update many-to-many for "etime_audience"
         $c = new Criteria();
         $c->add(EtimeAudiencePeer::ETIME_ID, $etime->getPrimaryKey());
         EtimeAudiencePeer::doDelete($c);
         $ids = $this->getRequestParameter('associated_etime_audience');
         if (is_array($ids)) {
             foreach ($ids as $id) {
                 $EtimeAudience = new EtimeAudience();
                 $EtimeAudience->setEtime($etime);
                 $EtimeAudience->setAudienceId($id);
                 $EtimeAudience->save();
             }
         }
         if ($this->getRequestParameter('tag_string')) {
             TagTools::recordTags($this->getRequestParameter('tag_string'), "event", $event);
         }
         if ($this->getRequestParameter('etime_tag_string')) {
             TagTools::recordTags($this->getRequestParameter('etime_tag_string'), "etime", $etime);
         }
         return $this->redirect('@show_event?slug=' . $event->getSlug());
     }
     return sfView::SUCCESS;
 }