Example #1
0
 /**
  * Create an associative array representing this object
  * @since Version 3.9.1
  * @return array
  */
 public function getArray()
 {
     $array = array("id" => $this->id, "date" => array("absolute" => $this->Date->format("Y-m-d H:i:s"), "iso8601" => $this->Date->format(DateTime::ISO8601), "ymd" => $this->Date->format("Y-m-d"), "nice" => $this->Date->format("l F j, Y"), "day" => $this->Date->format("d"), "month" => $this->Date->format("M")), "start" => $this->Start instanceof DateTime ? $this->Start->format("g:i a") : 0, "end" => $this->End instanceof DateTime ? $this->End->format("g:i a") : 0, "status" => array("id" => $this->status, "name" => $this->status == Events::STATUS_APPROVED ? "Approved" : "Unapproved"), "url" => $this->url->getURLs(), "event" => $this->Event->getArray(), "place" => array("lat" => 0, "lon" => 0), "author" => array("id" => $this->Author->id, "username" => $this->Author->username, "url" => $this->Author->url->getURLs()));
     if ($this->Place instanceof Place) {
         $array['place'] = array("lat" => $this->Place->lat, "lon" => $this->Place->lon, "address" => $this->Place->getAddress());
     }
     if (isset($this->Event->meta['coverphoto']) && !empty($this->Event->meta['coverphoto'])) {
         if ($CoverPhoto = (new Images())->getImageFromUrl($this->Event->meta['coverphoto'], Images::OPT_NOPLACE)) {
             $array['event']['coverphoto'] = $CoverPhoto->getArray();
         }
     }
     return $array;
 }