Esempio n. 1
0
 /**
  * Populate this object
  * @since Version 3.9.1
  * @return void
  * @param int|string $id
  */
 private function populate($id)
 {
     $row = $this->load($id);
     if (!isset($row) || !is_array($row)) {
         return;
     }
     $this->title = $row['title'];
     $this->desc = $row['description'];
     $this->meta = json_decode($row['meta'], true);
     $this->slug = $row['slug'];
     $this->status = isset($row['status']) ? $row['status'] : Events::STATUS_APPROVED;
     if (!isset($row['user_id'])) {
         $row['user_id'] = 45;
     }
     $this->setAuthor(UserFactory::CreateUser($row['user_id']));
     $this->flickr_tag = "railpage:event=" . $this->id;
     if (filter_var($row['category_id'], FILTER_VALIDATE_INT)) {
         $this->Category = Factory::CreateEventCategory($row['category_id']);
     }
     if (filter_var($row['organisation_id'], FILTER_VALIDATE_INT)) {
         $this->Organisation = OrganisationsFactory::CreateOrganisation($row['organisation_id']);
     }
     if (!empty($row['lat']) && round($row['lat'], 3) != "0.000" && !empty($row['lon']) && round($row['lon'], 3) != "0.000") {
         $this->Place = Place::Factory($row['lat'], $row['lon']);
     }
     $this->createUrls();
     $this->Templates = new stdClass();
     $this->Templates->view = sprintf("%s/event.tpl", $this->Module->Paths->html);
 }