public function init() { $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled' ? false : true; $this->isSaas = $isSaas; $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_general.phtml', "isSaas" => $isSaas)))); $defaultFade = Application_Model_Preference::GetDefaultFade(); if ($defaultFade == "") { $defaultFade = '0.500000'; } //Station name $this->addElement('text', 'stationName', array('class' => 'input_text', 'label' => 'Station Name', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetStationName(), 'decorators' => array('ViewHelper'))); //Default station fade $this->addElement('text', 'stationDefaultFade', array('class' => 'input_text', 'label' => 'Default Fade (s):', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', false, array('/^[0-9]{1,2}(\\.\\d{1,6})?$/', 'messages' => 'enter a time in seconds 0{.000000}'))), 'value' => $defaultFade, 'decorators' => array('ViewHelper'))); $third_party_api = new Zend_Form_Element_Radio('thirdPartyApi'); $third_party_api->setLabel('Allow Remote Websites To Access "Schedule" Info?<br> (Enable this to make front-end widgets work.)'); $third_party_api->setMultiOptions(array("Disabled", "Enabled")); $third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi()); $third_party_api->setDecorators(array('ViewHelper')); $this->addElement($third_party_api); /* Form Element for setting the Timezone */ $timezone = new Zend_Form_Element_Select("timezone"); $timezone->setLabel("Timezone"); $timezone->setMultiOptions($this->getTimezones()); $timezone->setValue(Application_Model_Preference::GetTimezone()); $timezone->setDecorators(array('ViewHelper')); $this->addElement($timezone); /* Form Element for setting which day is the start of the week */ $week_start_day = new Zend_Form_Element_Select("weekStartDay"); $week_start_day->setLabel("Week Starts On"); $week_start_day->setMultiOptions($this->getWeekStartDays()); $week_start_day->setValue(Application_Model_Preference::GetWeekStartDay()); $week_start_day->setDecorators(array('ViewHelper')); $this->addElement($week_start_day); }
public function __construct($id = null, $con = null) { if (isset($id)) { $this->block = CcBlockQuery::create()->findPk($id); if (is_null($this->block)) { throw new BlockNotFoundException(); } } else { $this->block = new CcBlock(); $this->block->setDbUTime(new DateTime("now", new DateTimeZone("UTC"))); $this->block->save(); } $defaultFade = Application_Model_Preference::GetDefaultFade(); if ($defaultFade !== "") { //fade is in format SS.uuuuuu $this->blockItem["fadein"] = $defaultFade; $this->blockItem["fadeout"] = $defaultFade; } $this->con = isset($con) ? $con : Propel::getConnection(CcBlockPeer::DATABASE_NAME); $this->id = $this->block->getDbId(); }
public function init() { $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_general.phtml')))); $defaultFade = Application_Model_Preference::GetDefaultFade(); if ($defaultFade == "") { $defaultFade = '00:00:00.000000'; } //Station name $this->addElement('text', 'stationName', array('class' => 'input_text', 'label' => 'Station Name', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetValue("station_name"), 'decorators' => array('ViewHelper'))); //Default station fade $this->addElement('text', 'stationDefaultFade', array('class' => 'input_text', 'label' => 'Default Fade:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', false, array('/^[0-2][0-3]:[0-5][0-9]:[0-5][0-9](\\.\\d{1,6})?$/', 'messages' => 'enter a time 00:00:00{.000000}'))), 'value' => $defaultFade, 'decorators' => array('ViewHelper'))); $stream_format = new Zend_Form_Element_Radio('streamFormat'); $stream_format->setLabel('Stream Label:'); $stream_format->setMultiOptions(array("Artist - Title", "Show - Artist - Title", "Station name - Show name")); $stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat()); $stream_format->setDecorators(array('ViewHelper')); $this->addElement($stream_format); $third_party_api = new Zend_Form_Element_Radio('thirdPartyApi'); $third_party_api->setLabel('Allow Remote Websites To Access "Schedule" Info?<br> (Enable this to make front-end widgets work.)'); $third_party_api->setMultiOptions(array("Disabled", "Enabled")); $third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi()); $third_party_api->setDecorators(array('ViewHelper')); $this->addElement($third_party_api); }
private function retrieveMediaFiles($id, $type) { $files = array(); if ($type === "audioclip") { $file = CcFilesQuery::create()->findPK($id, $this->con); if (is_null($file) || !$file->getDbFileExists()) { throw new Exception("A selected File does not exist!"); } else { $data = $this->fileInfo; $data["id"] = $id; $data["cliplength"] = $file->getDbLength(); $data["cueout"] = $file->getDbLength(); $defaultFade = Application_Model_Preference::GetDefaultFade(); if (isset($defaultFade)) { //fade is in format SS.uuuuuu $data["fadein"] = $defaultFade; $data["fadeout"] = $defaultFade; } $files[] = $data; } } elseif ($type === "playlist") { $pl = new Application_Model_Playlist($id); $contents = $pl->getContents(); foreach ($contents as $plItem) { if ($plItem['type'] == 0) { $data["id"] = $plItem['item_id']; $data["cliplength"] = $plItem['length']; $data["cuein"] = $plItem['cuein']; $data["cueout"] = $plItem['cueout']; $data["fadein"] = $plItem['fadein']; $data["fadeout"] = $plItem['fadeout']; $data["type"] = 0; $files[] = $data; } elseif ($plItem['type'] == 1) { $data["id"] = $plItem['item_id']; $data["cliplength"] = $plItem['length']; $data["cuein"] = $plItem['cuein']; $data["cueout"] = $plItem['cueout']; $data["fadein"] = "00.500000"; //$plItem['fadein']; $data["fadeout"] = "00.500000"; //$plItem['fadeout']; $data["type"] = 1; $files[] = $data; } elseif ($plItem['type'] == 2) { // if it's a block $bl = new Application_Model_Block($plItem['item_id']); if ($bl->isStatic()) { foreach ($bl->getContents() as $track) { $data["id"] = $track['item_id']; $data["cliplength"] = $track['length']; $data["cuein"] = $track['cuein']; $data["cueout"] = $track['cueout']; $data["fadein"] = $track['fadein']; $data["fadeout"] = $track['fadeout']; $data["type"] = 0; $files[] = $data; } } else { $dynamicFiles = $bl->getListOfFilesUnderLimit(); foreach ($dynamicFiles as $fileId => $f) { $file = CcFilesQuery::create()->findPk($fileId); if (isset($file) && $file->getDbFileExists()) { $data["id"] = $file->getDbId(); $data["cliplength"] = $file->getDbLength(); $data["cuein"] = "00:00:00"; $data["cueout"] = $file->getDbLength(); $defaultFade = Application_Model_Preference::GetDefaultFade(); if (isset($defaultFade)) { //fade is in format SS.uuuuuu $data["fadein"] = $defaultFade; $data["fadeout"] = $defaultFade; } $data["type"] = 0; $files[] = $data; } } } } } } elseif ($type == "stream") { //need to return $stream = CcWebstreamQuery::create()->findPK($id, $this->con); if (is_null($stream)) { throw new Exception("A selected File does not exist!"); } else { $data = $this->fileInfo; $data["id"] = $id; $data["cliplength"] = $stream->getDbLength(); $data["cueout"] = $stream->getDbLength(); $data["type"] = 1; $defaultFade = Application_Model_Preference::GetDefaultFade(); if (isset($defaultFade)) { //fade is in format SS.uuuuuu $data["fadein"] = $defaultFade; $data["fadeout"] = $defaultFade; } $files[] = $data; } } elseif ($type == "block") { $bl = new Application_Model_Block($id); if ($bl->isStatic()) { foreach ($bl->getContents() as $track) { $data["id"] = $track['item_id']; $data["cliplength"] = $track['length']; $data["cuein"] = $track['cuein']; $data["cueout"] = $track['cueout']; $data["fadein"] = $track['fadein']; $data["fadeout"] = $track['fadeout']; $data["type"] = 0; $files[] = $data; } } else { $dynamicFiles = $bl->getListOfFilesUnderLimit(); foreach ($dynamicFiles as $fileId => $f) { $file = CcFilesQuery::create()->findPk($fileId); if (isset($file) && $file->getDbFileExists()) { $data["id"] = $file->getDbId(); $data["cliplength"] = $file->getDbLength(); $data["cuein"] = "00:00:00"; $data["cueout"] = $file->getDbLength(); $defaultFade = Application_Model_Preference::GetDefaultFade(); if (isset($defaultFade)) { //fade is in format SS.uuuuuu $data["fadein"] = $defaultFade; $data["fadeout"] = $defaultFade; } $data["type"] = 0; $files[] = $data; } } } } return $files; }
/** * Insert a new playlist element. * * @param int $plId * id of Playlist * @param int $fileId * id of File * @param string $offset * relative offset in extent format * @param string $clipstart * audioClip clipstart in extent format * @param string $clipEnd * audioClip clipEnd in extent format * @param string $clipLength * audioClip playlength in extent format (?) * @param string $acGunid * audioClip gunid * @param string $acLen * audioClip length in extent format * @param string $acTit * audioClip title * @param string $fadeIn * fadeIn value in ss.ssssss or extent format * @param string $fadeOut * fadeOut value in ss.ssssss or extent format * @return array with fields: * <ul> * <li>plElId int - record id of playlistElement</li> * <li>plElGunid string - gl.unique id of playlistElement</li> * <li>fadeInId int - record id</li> * <li>fadeOutId int - record id</li> * </ul> */ private function insertPlaylistElement($plId, $fileId, $pos, $clipLength, $cuein, $cueout, $fadeIn = NULL, $fadeOut = NULL) { $defaultFade = Application_Model_Preference::GetDefaultFade(); if (is_null($fadeIn)) { if ($defaultFade != "") { $fadeIn = $defaultFade; } else { $fadeIn = '00:00:00.000'; } } if (is_null($fadeOut)) { if ($defaultFade != "") { $fadeOut = $defaultFade; } else { $fadeOut = '00:00:00.000'; } } $row = new CcPlaylistcontents(); $row->setDbPlaylistId($plId); $row->setDbFileId($fileId); $row->setDbPosition($pos); $row->save(); $row->setDbCliplength($clipLength); $row->setDbCuein($cuein); $row->setDbCueout($cueout); $row->setDbFadein($fadeIn); $row->setDbFadeout($fadeOut); return TRUE; }