inital attempt to add autoplaylist icon to calendar

This commit is contained in:
Robb Ebright 2017-11-28 15:12:27 -05:00
parent a4fdb9bc62
commit 01ec7ce797
3 changed files with 65 additions and 7 deletions

View File

@ -1023,6 +1023,8 @@ SQL;
$content_count = Application_Model_ShowInstance::getContentCount(
$p_start, $p_end);
$isFull = Application_Model_ShowInstance::getIsFull($p_start, $p_end);
$hasAutoPlaylist = Application_Model_ShowInstance::getShowHasAutoplaylist($p_start, $p_end);
$displayTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
$utcTimezone = new DateTimeZone("UTC");
@ -1055,6 +1057,7 @@ SQL;
$startsDT->setTimezone($displayTimezone);
$endsDT->setTimezone($displayTimezone);
xdebug_break();
$options["show_empty"] = (array_key_exists($show['instance_id'],
$content_count)) ? 0 : 1;
@ -1064,6 +1067,11 @@ SQL;
} else {
$options["show_partial_filled"] = true;
}
if (array_key_exists($show['instance_id'], $hasAutoPlaylist)) {
$options["show_has_auto_playlist"] = !$hasAutoPlaylist[$show['instance_id']];
} else {
$options["show_has_auto_playlist"] = true;
}
$event = array();

View File

@ -238,6 +238,7 @@ SQL;
$id = $this->_showInstance->getDbId();
$lastid = $this->getLastAudioItemId();
// Logging::info("The last id is $lastid");
xdebug_break();
$scheduler = new Application_Model_Scheduler($checkUserPerm);
$scheduler->scheduleAfter(
@ -290,7 +291,9 @@ SQL;
}
private function checkToDeleteShow($showId)
{
xdebug_break();
//UTC DateTime object
$showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil();
@ -556,6 +559,27 @@ SQL;
return $isFilled;
}
public static function getShowHasAutoplaylist($p_start, $p_end)
{
$sql = <<<SQL
SELECT c.id, s.has_autoplaylist
from cc_show_instances as c
LEFT JOIN cc_show as S ON s.id = c.show_id
WHERE ends > :p_start::TIMESTAMP
AND starts < :p_end::TIMESTAMP
SQL;
$res = Application_Common_Database::prepareAndExecute($sql, array(
':p_start' => $p_start->format("Y-m-d G:i:s"),
':p_end' => $p_end->format("Y-m-d G:i:s"))
, 'all');
$hasAutoplaylist = array();
foreach ($res as $r) {
$hasAutoplaylist[$r['id']] = $r['has_autoplaylist'];
}
return $hasAutoplaylist;
}
public function showEmpty()
{
$sql = <<<SQL

View File

@ -214,7 +214,13 @@ function eventRender(event, element, view) {
$(element)
.find(".fc-event-time")
.before('<span class="small-icon linked"></span><span class="small-icon show-empty"></span>');
} else {
// in theory a linked show shouldn't have an automatic playlist so adding this here
} else if (event.show_has_auto_playlist === true) {
$(element)
.find(".fc-event-time")
.before('<span class="small-icon autoplaylist"></span><span class="small-icon show-empty"></span>');
}
else {
$(element)
.find(".fc-event-time")
.before('<span class="small-icon show-empty"></span>');
@ -224,7 +230,11 @@ function eventRender(event, element, view) {
$(element)
.find(".fc-event-time")
.before('<span class="small-icon linked"></span><span class="small-icon show-partial-filled"></span>');
} else {
} else if (event.show_has_auto_playlist === true) {
$(element)
.find(".fc-event-time")
.before('<span class="small-icon autoplaylist"></span><span class="small-icon show-partial-filled"></span>');
} else {
$(element)
.find(".fc-event-time")
.before('<span class="small-icon show-partial-filled"></span>');
@ -234,26 +244,38 @@ function eventRender(event, element, view) {
$(element)
.find(".fc-event-time")
.before('<span class="small-icon linked"></span>');
} else if (event.show_has_auto_playlist === true) {
$(element)
.find(".fc-event-time")
.before('<span class="small-icon autoplaylist"></span>');
}
}
} else if (view.name === 'month') {
if (event.show_empty === 1) {
if (event.linked) {
$(element)
$(element)
.find(".fc-event-title")
.after('<span class="small-icon linked"></span><span title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>');
} else if (event.show_has_auto_playlist === true) {
$(element)
.find(".fc-event-title")
.after('<span title="'+$.i18n._("Show has an automatic playlist")+'"class="small-icon autoplaylist"></span><span title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>');
} else {
$(element)
$(element)
.find(".fc-event-title")
.after('<span title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>');
}
} else if (event.show_partial_filled === true) {
if (event.linked) {
$(element)
.find(".fc-event-title")
.after('<span class="small-icon linked"></span><span title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>');
.find(".fc-event-title")
.after('<span class="small-icon linked"></span><span title="' + $.i18n._("Show is partially filled") + '" class="small-icon show-partial-filled"></span>');
} else if (event.show_has_auto_playlist === true) {
$(element)
.find(".fc-event-title")
.after('<span title="'+$.i18n._("Show has an automatic playlist")+'"class="small-icon autoplaylist"></span><span title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>');
} else {
$(element)
$(element)
.find(".fc-event-title")
.after('<span title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>');
}
@ -262,6 +284,10 @@ function eventRender(event, element, view) {
$(element)
.find(".fc-event-title")
.after('<span class="small-icon linked"></span>');
} else if (event.show_has_auto_playlist === true) {
$(element)
.find(".fc-event-title")
.after('<span class="small-icon autoplaylist"></span>');
}
}
}