/** *Function will load and return the contents of the requested show. */ public function getShowAction() { $baseUrl = Application_Common_OsPath::getBaseDir(); // disable the view and the layout $this->view->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $showID = $this->_getParam('showID'); if (!isset($showID)) { return; } $showInstance = new Application_Model_ShowInstance($showID); $result = array(); $position = 0; foreach ($showInstance->getShowListContent() as $track) { $elementMap = array('element_title' => isset($track['track_title']) ? $track['track_title'] : "", 'element_artist' => isset($track['creator']) ? $track['creator'] : "", 'element_position' => $position, 'element_id' => ++$position, 'mime' => isset($track['mime']) ? $track['mime'] : ""); $elementMap['type'] = $track['type']; if ($track['type'] == 0) { $mime = $track['mime']; if (strtolower($mime) === 'audio/mp3') { $elementMap['element_mp3'] = $track['item_id']; } elseif (strtolower($mime) === 'audio/ogg') { $elementMap['element_oga'] = $track['item_id']; } elseif (strtolower($mime) === 'audio/mp4') { $elementMap['element_m4a'] = $track['item_id']; } elseif (strtolower($mime) === 'audio/wav') { $elementMap['element_wav'] = $track['item_id']; } elseif (strtolower($mime) === 'audio/x-flac') { $elementMap['element_flac'] = $track['item_id']; } else { throw new Exception("Unknown file type: {$mime}"); } $elementMap['uri'] = $baseUrl . "api/get-media/file/" . $track['item_id']; } else { $elementMap['uri'] = $track['filepath']; } $result[] = $elementMap; } $this->_helper->json($result); }
public function showContentDialogAction() { $showInstanceId = $this->_getParam('id'); try { $show = new Application_Model_ShowInstance($showInstanceId); } catch (Exception $e) { $this->view->show_error = true; return false; } $originalShowId = $show->isRebroadcast(); if (!is_null($originalShowId)) { try { $originalShow = new Application_Model_ShowInstance($originalShowId); } catch (Exception $e) { $this->view->show_error = true; return false; } $originalShowName = $originalShow->getName(); $originalShowStart = $originalShow->getShowInstanceStart(); //convert from UTC to user's timezone for display. $originalDateTime = new DateTime($originalShowStart, new DateTimeZone("UTC")); $originalDateTime->setTimezone(new DateTimeZone(date_default_timezone_get())); //$timestamp = Application_Common_DateHelper::ConvertToLocalDateTimeString($originalDateTime->format("Y-m-d H:i:s")); $this->view->additionalShowInfo = "Rebroadcast of show \"{$originalShowName}\" from " . $originalDateTime->format("l, F jS") . " at " . $originalDateTime->format("G:i"); } $this->view->showLength = $show->getShowLength(); $this->view->timeFilled = $show->getTimeScheduled(); $this->view->percentFilled = $show->getPercentScheduled(); $this->view->showContent = $show->getShowListContent(); $this->view->dialog = $this->view->render('schedule/show-content-dialog.phtml'); $this->view->showTitle = $show->getName(); unset($this->view->showContent); }
public function showContentDialogAction() { $showInstanceId = $this->_getParam('id'); try { $show = new Application_Model_ShowInstance($showInstanceId); } catch (Exception $e) { $this->view->show_error = true; return false; } $originalShowId = $show->isRebroadcast(); if (!is_null($originalShowId)) { try { $originalShow = new Application_Model_ShowInstance($originalShowId); } catch (Exception $e) { $this->view->show_error = true; return false; } $originalShowName = $originalShow->getName(); $originalShowStart = $originalShow->getShowInstanceStart(); //convert from UTC to user's timezone for display. $displayTimeZone = new DateTimeZone(Application_Model_Preference::GetTimezone()); $originalDateTime = new DateTime($originalShowStart, new DateTimeZone("UTC")); $originalDateTime->setTimezone($displayTimeZone); $this->view->additionalShowInfo = sprintf(_("Rebroadcast of show %s from %s at %s"), $originalShowName, $originalDateTime->format("l, F jS"), $originalDateTime->format("G:i")); } $this->view->showLength = $show->getShowLength(); $this->view->timeFilled = $show->getTimeScheduled(); $this->view->percentFilled = $show->getPercentScheduled(); $this->view->showContent = $show->getShowListContent(); $this->view->dialog = $this->view->render('schedule/show-content-dialog.phtml'); $this->view->showTitle = htmlspecialchars($show->getName()); unset($this->view->showContent); }