Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 public static function SendMessageToShowRecorder($event_type)
 {
     $exchange = 'airtime-pypo';
     $now = new DateTime("@" . time());
     //in UTC timezone
     $end_timestamp = new DateTime("@" . (time() + 3600 * 2));
     //in UTC timezone
     $temp = array();
     $temp['event_type'] = $event_type;
     $temp['server_timezone'] = Application_Model_Preference::GetTimezone();
     if ($event_type == "update_recorder_schedule") {
         $temp['shows'] = Application_Model_Show::getShows($now, $end_timestamp, $onlyRecord = true);
     }
     $data = json_encode($temp);
     self::sendMessage($exchange, $data);
 }
 public function indexAction()
 {
     $CC_CONFIG = Config::getConfig();
     $request = $this->getRequest();
     $baseUrl = Application_Common_OsPath::getBaseDir();
     //default time is the last 24 hours.
     $now = time();
     $from = $request->getParam("from", $now - 24 * 60 * 60);
     $to = $request->getParam("to", $now);
     $utcTimezone = new DateTimeZone("UTC");
     $displayTimeZone = new DateTimeZone(Application_Model_Preference::GetTimezone());
     $start = DateTime::createFromFormat("U", $from, $utcTimezone);
     $start->setTimezone($displayTimeZone);
     $end = DateTime::createFromFormat("U", $to, $utcTimezone);
     $end->setTimezone($displayTimeZone);
     $form = new Application_Form_DateRange();
     $form->populate(array('his_date_start' => $start->format("Y-m-d"), 'his_time_start' => $start->format("H:i"), 'his_date_end' => $end->format("Y-m-d"), 'his_time_end' => $end->format("H:i")));
     $this->view->date_form = $form;
     $this->view->headScript()->appendFile($baseUrl . 'js/contextmenu/jquery.contextMenu.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/datatables/js/jquery.dataTables.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/datatables/plugin/dataTables.pluginAPI.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/datatables/plugin/TableTools-2.1.5/js/ZeroClipboard.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/datatables/plugin/TableTools-2.1.5/js/TableTools.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/timepicker/jquery.ui.timepicker.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/bootstrap-datetime/bootstrap-datetimepicker.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/airtime/buttons/buttons.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/airtime/utilities/utilities.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/airtime/playouthistory/historytable.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headLink()->appendStylesheet($baseUrl . 'css/bootstrap-datetimepicker.min.css?' . $CC_CONFIG['airtime_version']);
     $this->view->headLink()->appendStylesheet($baseUrl . 'js/datatables/plugin/TableTools-2.1.5/css/TableTools.css?' . $CC_CONFIG['airtime_version']);
     $this->view->headLink()->appendStylesheet($baseUrl . 'css/jquery.ui.timepicker.css?' . $CC_CONFIG['airtime_version']);
     $this->view->headLink()->appendStylesheet($baseUrl . 'css/playouthistory.css?' . $CC_CONFIG['airtime_version']);
     $this->view->headLink()->appendStylesheet($baseUrl . 'css/history_styles.css?' . $CC_CONFIG['airtime_version']);
     $this->view->headLink()->appendStylesheet($baseUrl . 'css/jquery.contextMenu.css?' . $CC_CONFIG['airtime_version']);
     //set datatables columns for display of data.
     $historyService = new Application_Service_HistoryService();
     $columns = json_encode($historyService->getDatatablesLogSheetColumns());
     $script = "localStorage.setItem( 'datatables-historyitem-aoColumns', JSON.stringify({$columns}) ); ";
     $columns = json_encode($historyService->getDatatablesFileSummaryColumns());
     $script .= "localStorage.setItem( 'datatables-historyfile-aoColumns', JSON.stringify({$columns}) );";
     $this->view->headScript()->appendScript($script);
     $user = Application_Model_User::getCurrentUser();
     $this->view->userType = $user->getType();
 }
 public function indexAction()
 {
     $CC_CONFIG = Config::getConfig();
     $request = $this->getRequest();
     $baseUrl = Application_Common_OsPath::getBaseDir();
     $this->view->headScript()->appendFile($baseUrl . 'js/flot/jquery.flot.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/flot/jquery.flot.crosshair.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/airtime/listenerstat/listenerstat.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/timepicker/jquery.ui.timepicker.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/airtime/buttons/buttons.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/airtime/utilities/utilities.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headLink()->appendStylesheet($baseUrl . 'css/jquery.ui.timepicker.css?' . $CC_CONFIG['airtime_version']);
     //default time is the last 24 hours.
     $now = time();
     $from = $request->getParam("from", $now - 24 * 60 * 60);
     $to = $request->getParam("to", $now);
     $utcTimezone = new DateTimeZone("UTC");
     $displayTimeZone = new DateTimeZone(Application_Model_Preference::GetTimezone());
     $start = DateTime::createFromFormat("U", $from, $utcTimezone);
     $start->setTimezone($displayTimeZone);
     $end = DateTime::createFromFormat("U", $to, $utcTimezone);
     $end->setTimezone($displayTimeZone);
     $form = new Application_Form_DateRange();
     $form->populate(array('his_date_start' => $start->format("Y-m-d"), 'his_time_start' => $start->format("H:i"), 'his_date_end' => $end->format("Y-m-d"), 'his_time_end' => $end->format("H:i")));
     $errorStatus = Application_Model_StreamSetting::GetAllListenerStatErrors();
     Logging::info($errorStatus);
     $out = array();
     foreach ($errorStatus as $v) {
         $key = explode('_listener_stat_error', $v['keyname']);
         if ($v['value'] != 'OK') {
             $v['value'] = _("Please make sure admin user/password is correct on System->Streams page.");
         }
         $out[$key[0]] = $v['value'];
     }
     $this->view->errorStatus = $out;
     $this->view->date_form = $form;
 }
Exemplo n.º 5
0
 public function checkRebroadcastDates($repeatShowStart, $formData, $hours, $minutes, $showEdit = false)
 {
     $overlapping = false;
     for ($i = 1; $i <= 10; $i++) {
         if (empty($formData["add_show_rebroadcast_date_" . $i])) {
             break;
         }
         $rebroadcastShowStart = clone $repeatShowStart;
         /* formData is in local time so we need to set the
          * show start back to local time
          */
         $rebroadcastShowStart->setTimezone(new DateTimeZone(Application_Model_Preference::GetTimezone()));
         $rebroadcastWhenDays = explode(" ", $formData["add_show_rebroadcast_date_" . $i]);
         $rebroadcastWhenTime = explode(":", $formData["add_show_rebroadcast_time_" . $i]);
         $rebroadcastShowStart->add(new DateInterval("P" . $rebroadcastWhenDays[0] . "D"));
         $rebroadcastShowStart->setTime($rebroadcastWhenTime[0], $rebroadcastWhenTime[1]);
         $rebroadcastShowStart->setTimezone(new DateTimeZone('UTC'));
         $rebroadcastShowEnd = clone $rebroadcastShowStart;
         $rebroadcastShowEnd->add(new DateInterval("PT" . $hours . "H" . $minutes . "M"));
         if ($showEdit) {
             $overlapping = Application_Model_Schedule::checkOverlappingShows($rebroadcastShowStart, $rebroadcastShowEnd, true, null, $formData['add_show_id']);
         } else {
             $overlapping = Application_Model_Schedule::checkOverlappingShows($rebroadcastShowStart, $rebroadcastShowEnd);
         }
         if ($overlapping) {
             break;
         }
     }
     return $overlapping;
 }
Exemplo n.º 6
0
 public function recordedShowsAction()
 {
     $today_timestamp = date("Y-m-d H:i:s");
     $now = new DateTime($today_timestamp);
     $end_timestamp = $now->add(new DateInterval("PT2H"));
     $end_timestamp = $end_timestamp->format("Y-m-d H:i:s");
     $this->view->shows = Application_Model_Show::getShows(Application_Common_DateHelper::ConvertToUtcDateTime($today_timestamp, date_default_timezone_get()), Application_Common_DateHelper::ConvertToUtcDateTime($end_timestamp, date_default_timezone_get()), $onlyRecord = true);
     $this->view->is_recording = false;
     $this->view->server_timezone = Application_Model_Preference::GetTimezone();
     $rows = Application_Model_Show::getCurrentShow($today_timestamp);
     Application_Model_Show::convertToLocalTimeZone($rows, array("starts", "ends", "start_timestamp", "end_timestamp"));
     if (count($rows) > 0) {
         $this->view->is_recording = $rows[0]['record'] == 1;
     }
 }
 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);
 }
 public function builderDialogAction()
 {
     $request = $this->getRequest();
     $id = $request->getParam("id");
     $instance = CcShowInstancesQuery::create()->findPK($id);
     if (is_null($instance)) {
         $this->view->error = _("show does not exist");
         return;
     }
     $displayTimeZone = new DateTimeZone(Application_Model_Preference::GetTimezone());
     $start = $instance->getDbStarts(null);
     $start->setTimezone($displayTimeZone);
     $end = $instance->getDbEnds(null);
     $end->setTimezone($displayTimeZone);
     $show_name = $instance->getCcShow()->getDbName();
     $start_time = $start->format("Y-m-d H:i:s");
     $end_time = $end->format("Y-m-d H:i:s");
     $this->view->title = "{$show_name}:    {$start_time} - {$end_time}";
     $this->view->start = $instance->getDbStarts("U");
     $this->view->end = $instance->getDbEnds("U");
     $this->view->dialog = $this->view->render('showbuilder/builderDialog.phtml');
 }
Exemplo n.º 9
0
<?php

require_once __DIR__ . "/configs/conf.php";
require_once __DIR__ . "/configs/ACL.php";
require_once 'propel/runtime/lib/Propel.php';
Propel::init(__DIR__ . "/configs/airtime-conf-production.php");
require_once __DIR__ . "/configs/constants.php";
require_once 'Preference.php';
require_once "DateHelper.php";
require_once "OsPath.php";
require_once "Database.php";
require_once __DIR__ . '/controllers/plugins/RabbitMqPlugin.php';
date_default_timezone_set('UTC');
require_once APPLICATION_PATH . "/logging/Logging.php";
Logging::setLogPath('/var/log/airtime/zendphp.log');
date_default_timezone_set(Application_Model_Preference::GetTimezone());
global $CC_CONFIG;
$airtime_version = Application_Model_Preference::GetAirtimeVersion();
$uniqueid = Application_Model_Preference::GetUniqueId();
$CC_CONFIG['airtime_version'] = md5($airtime_version . $uniqueid);
require_once __DIR__ . "/configs/navigation.php";
Zend_Validate::setDefaultNamespaces("Zend");
$front = Zend_Controller_Front::getInstance();
$front->registerPlugin(new RabbitMqPlugin());
/* The bootstrap class should only be used to initialize actions that return a view.
   Actions that return JSON will not use the bootstrap class! */
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initDoctype()
    {
        $this->bootstrap('view');
Exemplo n.º 10
0
 public function __construct()
 {
     $this->con = isset($con) ? $con : Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME);
     $this->timezone = Application_Model_Preference::GetTimezone();
 }
Exemplo n.º 11
0
 public function getLocalStartDateTime()
 {
     $startDT = $this->getDbStarts(null);
     return $startDT->setTimezone(new DateTimeZone(Application_Model_Preference::GetTimezone()));
 }