コード例 #1
0
ファイル: Job.php プロジェクト: adatta02/comp190-code
 public function createCalendarArray()
 {
     $prettyLoc = str_replace("<br/>", "\n", $this->getPrettyAddress());
     if (strlen($prettyLoc) == 0) {
         $prettyLoc = "UNKNOWN";
     }
     $jobUrl = "https://jobs.tuftsphoto.com/job/show/" . $this->getSlug();
     $arr = array();
     $tags = $this->getTags();
     $slugs = array();
     foreach ($tags as $key => $val) {
         $slugs[] = $key;
     }
     $slugs = implode(", ", $slugs);
     $arr["title"] = $this->getId() . " - " . $this->getEvent() . " : " . $slugs;
     $arr["location"] = $prettyLoc;
     $arr["content"] = $this->getEvent() . "\n\n" . "<a href='" . $jobUrl . "'>View Job</a>";
     $arr["startTime"] = $this->getStartTimestamp();
     $arr["endTime"] = $this->getEndTimestamp();
     if ($arr["endTime"] == $arr["startTime"] || $arr["endTime"] < $arr["startTime"]) {
         $arr["startTime"] = $this->getDate("Y-m-d");
         $arr["endTime"] = $this->getDate("Y-m-d");
     } else {
         $arr["startTime"] = sfGCalendar::timestampToRFC3339($arr["startTime"]);
         $arr["endTime"] = sfGCalendar::timestampToRFC3339($arr["endTime"]);
     }
     return $arr;
 }