getRequest()->getControllerName()); if ($currentController == "schedule") { $userIsOnCalendarPage = true; } if ($currentController == "plupload") { $userIsOnAddMediaPage = true; } } if (self::zeroFilesUploaded()) { if ($userIsOnAddMediaPage) { return _("Click the 'Add files' button and select files from your computer to upload."); } else { return sprintf(_("It looks like you have not uploaded any audio files yet. %sUpload a file now.%s "), "", ""); } } else if (!self::isFutureOrCurrentShowScheduled()) { if ($userIsOnCalendarPage) { return _("Click the 'Create New Show' button and fill out the required fields."); } else { return sprintf(_("It looks like you don't have any shows scheduled. %sCreate a show now.%s"), "", ""); } } else if (self::isCurrentShowEmpty()) { if ($userIsOnCalendarPage) { return _("To start broadcasting, click on the current show and select 'Add / Remove Content'"); } else { return sprintf(_("It looks like the current show needs more tracks. %sAdd tracks to your show now.%s"), "", ""); } } else if (!self::getCurrentShow() && self::isNextShowEmpty()) { if ($userIsOnCalendarPage) { return _("Click on the show starting next and select 'Add / Remove Content'"); } else { return sprintf(_("It looks like the next show is empty. %sAdd tracks to your show now.%s"), "", ""); } } else { return ""; } } /** * Returns true if no files have been uploaded. */ private 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. */ private static function isFutureOrCurrentShowScheduled() { $futureShow = self::getNextFutureShow(); $currentShow = self::getCurrentShow(); if (is_null($futureShow) && is_null($currentShow)) { return false; } else { return true; } } private static function isCurrentShowEmpty() { $currentShow = self::getCurrentShow(); if (is_null($currentShow)) { return false; } else { $now = new DateTime("now", new DateTimeZone("UTC")); $scheduledTracks = CcScheduleQuery::create() ->filterByDbInstanceId($currentShow->getDbId()) ->filterByDbEnds($now, Criteria::GREATER_EQUAL) ->find(); if ($scheduledTracks->count() == 0) { return true; } else { return false; } } } private static function isNextShowEmpty() { $futureShow = self::getNextFutureShow(); if (is_null($futureShow)) { return false; } else { $now = new DateTime("now", new DateTimeZone("UTC")); $scheduledTracks = CcScheduleQuery::create() ->filterByDbInstanceId($futureShow->getDbId()) ->filterByDbStarts($now, Criteria::GREATER_EQUAL) ->find(); if ($scheduledTracks->count() == 0) { return true; } else { return false; } } } 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(); } }