SAAS-940: Provide usability hints to user
This commit is contained in:
parent
a9cddde877
commit
55999a07ec
4 changed files with 111 additions and 1 deletions
|
@ -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';
|
||||
|
|
77
airtime_mvc/application/common/UsabilityHints.php
Normal file
77
airtime_mvc/application/common/UsabilityHints.php
Normal file
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
|
||||
class Application_Common_UsabilityHints
|
||||
{
|
||||
/**
|
||||
* Returns true if no files have been uploaded.
|
||||
*/
|
||||
public static function zeroFilesUploaded()
|
||||
{
|
||||
$fileCount = CcFilesQuery::create()
|
||||
->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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -70,7 +70,26 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
|||
</div>
|
||||
|
||||
|
||||
<div class="wrapper" id="content"><?php echo $this->layout()->content ?></div>
|
||||
<div class="wrapper" id="content">
|
||||
<?php if (Application_Common_UsabilityHints::zeroFilesUploaded()) { ?>
|
||||
<div class="usability_hint">
|
||||
<?php echo sprintf(_("It looks like you have not uploaded any audio files yet. %shere%s to upload a file."), "Click <a href='/plupload'>", "</a>"); ?>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
||||
<?php if (!Application_Common_UsabilityHints::isFutureOrCurrentShowScheduled()) { ?>
|
||||
<div class="usability_hint">
|
||||
<?php echo sprintf(_("It looks like you don't have any shows scheduled. Click %shere%s to create a show."), "<a href='/schedule'>", "</a>"); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (Application_Common_UsabilityHints::isCurrentOrNextShowEmpty()) { ?>
|
||||
<div class="usability_hint">
|
||||
<?php echo sprintf(_("To start broadcasting click %shere%s to schedule a track into your show."), "<a href='/showbuilder'>", "</a>"); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php echo $this->layout()->content ?></div>
|
||||
|
||||
<script id="tmpl-pl-cues" type="text/template">
|
||||
<div class="waveform-cues">
|
||||
|
|
|
@ -3330,3 +3330,16 @@ dd .stream-status {
|
|||
#schedule_iframe {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.usability_hint {
|
||||
padding: 5px 10px 5px 10px;
|
||||
margin-bottom: 10px;
|
||||
border: 1px solid #ff611f;
|
||||
background-color: #ff611f;
|
||||
color: white;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.usability_hint a {
|
||||
color: white;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue