2015-07-13 14:06:41 +02:00
|
|
|
<?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()
|
|
|
|
{
|
2015-07-13 17:19:04 +02:00
|
|
|
$futureShow = self::getNextFutureShow();
|
|
|
|
$currentShow = self::getCurrentShow();
|
2015-07-13 14:06:41 +02:00
|
|
|
|
|
|
|
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()
|
|
|
|
{
|
2015-07-13 17:19:04 +02:00
|
|
|
$futureShow = self::getNextFutureShow();
|
|
|
|
$currentShow = self::getCurrentShow();
|
2015-07-13 14:06:41 +02:00
|
|
|
|
2015-07-13 17:19:04 +02:00
|
|
|
if (is_null($futureShow) && is_null($currentShow)) {
|
2015-07-13 14:06:41 +02:00
|
|
|
return false;
|
|
|
|
} else {
|
2015-07-13 17:19:04 +02:00
|
|
|
if ($currentShow) {
|
2015-07-13 14:06:41 +02:00
|
|
|
$scheduledTracks = CcScheduleQuery::create()
|
2015-07-13 17:19:04 +02:00
|
|
|
->filterByDbInstanceId($currentShow->getDbId())
|
2015-07-13 14:06:41 +02:00
|
|
|
->find();
|
|
|
|
if ($scheduledTracks->count() == 0) {
|
|
|
|
return true;
|
|
|
|
}
|
2015-07-13 17:19:04 +02:00
|
|
|
} else if ($futureShow) {
|
2015-07-13 14:06:41 +02:00
|
|
|
$scheduledTracks = CcScheduleQuery::create()
|
2015-07-13 17:19:04 +02:00
|
|
|
->filterByDbInstanceId($futureShow->getDbId())
|
2015-07-13 14:06:41 +02:00
|
|
|
->find();
|
|
|
|
if ($scheduledTracks->count() == 0) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-07-13 17:19:04 +02:00
|
|
|
|
|
|
|
private static function getCurrentShow()
|
|
|
|
{
|
|
|
|
$now = new DateTime("now", new DateTimeZone("UTC"));
|
|
|
|
|
|
|
|
return CcShowInstancesQuery::create()
|
|
|
|
->filterByDbStarts($now, Criteria::LESS_THAN)
|
|
|
|
->filterByDbEnds($now, Criteria::GREATER_THAN)
|
|
|
|
->filterByDbModifiedInstance(false)
|
|
|
|
->findOne();
|
|
|
|
}
|
|
|
|
|
|
|
|
private static function getNextFutureShow()
|
|
|
|
{
|
|
|
|
$now = new DateTime("now", new DateTimeZone("UTC"));
|
|
|
|
|
|
|
|
return CcShowInstancesQuery::create()
|
|
|
|
->filterByDbStarts($now, Criteria::GREATER_THAN)
|
|
|
|
->filterByDbModifiedInstance(false)
|
|
|
|
->orderByDbStarts()
|
|
|
|
->findOne();
|
|
|
|
}
|
2015-07-13 14:06:41 +02:00
|
|
|
}
|