From 55999a07ecf4a267af4c9aeefc19aa76e9ade6b4 Mon Sep 17 00:00:00 2001 From: drigato Date: Mon, 13 Jul 2015 08:06:41 -0400 Subject: [PATCH 01/15] SAAS-940: Provide usability hints to user --- airtime_mvc/application/Bootstrap.php | 1 + .../application/common/UsabilityHints.php | 77 +++++++++++++++++++ .../application/layouts/scripts/layout.phtml | 21 ++++- airtime_mvc/public/css/styles.css | 13 ++++ 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 airtime_mvc/application/common/UsabilityHints.php diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index 4a5157f1e..edb78cec5 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -30,6 +30,7 @@ require_once "Timezone.php"; require_once "Auth.php"; require_once "interface/OAuth2.php"; require_once "TaskManager.php"; +require_once "UsabilityHints.php"; require_once __DIR__.'/services/CeleryService.php'; require_once __DIR__.'/services/SoundcloudService.php'; require_once __DIR__.'/forms/helpers/ValidationTypes.php'; diff --git a/airtime_mvc/application/common/UsabilityHints.php b/airtime_mvc/application/common/UsabilityHints.php new file mode 100644 index 000000000..84f670c68 --- /dev/null +++ b/airtime_mvc/application/common/UsabilityHints.php @@ -0,0 +1,77 @@ +filterByDbFileExists(true) + ->filterByDbHidden(false) + ->count(); + + if ($fileCount == 0) { + return true; + } else { + return false; + } + } + + /** + * Returns true if there is at least one show scheduled in the future. + */ + public static function isFutureOrCurrentShowScheduled() + { + $now = new DateTime("now", new DateTimeZone("UTC")); + $futureShow = CcShowInstancesQuery::create() + ->filterByDbStarts($now, Criteria::GREATER_THAN) + ->filterByDbModifiedInstance(false) + ->findOne(); + + $currentShow = CcShowInstancesQuery::create() + ->filterByDbStarts($now, Criteria::LESS_THAN) + ->filterByDbEnds($now, Criteria::GREATER_THAN) + ->filterByDbModifiedInstance(false) + ->findOne(); + if (is_null($futureShow) && is_null($currentShow)) { + return false; + } else { + return true; + } + } + + /** + * Returns true if the current show does not have anything scheduled in it. + * + * Returns true if there is nothing currently scheduled and the next show + * is empty. + */ + public static function isCurrentOrNextShowEmpty() + { + $schedule = Application_Model_Schedule::GetPlayOrderRange(); + $shows = $schedule["shows"]; + + if (empty($shows["current"]) && empty($shows["next"])) { + return false; + } else { + if ($shows["current"]) { + $scheduledTracks = CcScheduleQuery::create() + ->filterByDbInstanceId($shows["current"]["instance_id"]) + ->find(); + if ($scheduledTracks->count() == 0) { + return true; + } + } else if ($shows["next"]) { + $nextShow = $shows["next"][0]; + $scheduledTracks = CcScheduleQuery::create() + ->filterByDbInstanceId($nextShow["instance_id"]) + ->find(); + if ($scheduledTracks->count() == 0) { + return true; + } + } + } + } +} \ No newline at end of file diff --git a/airtime_mvc/application/layouts/scripts/layout.phtml b/airtime_mvc/application/layouts/scripts/layout.phtml index 780a5f69e..e16b82248 100644 --- a/airtime_mvc/application/layouts/scripts/layout.phtml +++ b/airtime_mvc/application/layouts/scripts/layout.phtml @@ -70,7 +70,26 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= -
layout()->content ?>
+
+ +
+ ", ""); ?> +
+ + + +
+ ", ""); ?> +
+ + + +
+ ", ""); ?> +
+ + + layout()->content ?>