adding bi-weekly show option. new structure allows for different repeat types to be specified.

new playlist builder css/images.
This commit is contained in:
naomiaro 2011-02-05 23:21:52 -05:00
parent cb3f4dd31e
commit 13847e738b
6 changed files with 223 additions and 80 deletions

View File

@ -29,6 +29,15 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
'viewScript' => 'form/add-show-checkbox.phtml'
))));
//Add type select
$this->addElement('select', 'add_show_repeat_type', array(
'required' => true,
'multiOptions' => array(
"0" => "weekly",
"1" => "bi-weekly"
),
));
// Add end date element
$this->addElement('text', 'add_show_end_date', array(
'label' => 'Date End:',

View File

@ -53,8 +53,9 @@ class Show {
$data['add_show_day_check'] = array($startDow);
}
//find repeat type or set to a non repeating show.
if($data['add_show_repeats']) {
$repeat_type = 0; //chnage this when supporting more than just a weekly show option.
$repeat_type = $data["add_show_repeat_type"];
}
else {
$repeat_type = -1;
@ -110,73 +111,6 @@ class Show {
Show::populateShowUntilLastGeneratedDate($showId);
}
public function deleteShow($timestamp, $dayId=NULL) {
global $CC_DBC;
$today_timestamp = date("Y-m-d H:i:s");
$timeinfo = explode(" ", $timestamp);
$date = $timeinfo[0];
$time = $timeinfo[1];
$today_epoch = strtotime($today_timestamp);
$date_epoch = strtotime($timestamp);
//don't want someone to delete past shows.
if($date_epoch < $today_epoch) {
return;
}
$show = CcShowQuery::create()->findPK($this->_showId);
$sql = "SELECT start_time, first_show FROM cc_show_days
WHERE show_id = '{$this->_showId}'
ORDER BY first_show LIMIT 1";
$res = $CC_DBC->GetRow($sql);
$start_timestamp = $res["first_show"]." ".$res["start_time"];
$start_epoch = strtotime($start_timestamp);
// must not delete shows in the past
if($show->getDbRepeats() && ($start_epoch < $date_epoch)) {
$sql = "DELETE FROM cc_show_days WHERE first_show >= '{$date}' AND show_id = '{$this->_showId}'";
$CC_DBC->query($sql);
$sql = "UPDATE cc_show_days
SET last_show = '{$date}'
WHERE show_id = '{$this->_showId}' AND first_show <= '{$date}' ";
$CC_DBC->query($sql);
$sql = "SELECT group_id FROM cc_show_schedule WHERE show_day >= '{$date}' AND show_id = '{$this->_showId}'";
$rows = $CC_DBC->GetAll($sql);
$sql_opt = array();
foreach($rows as $row) {
$sql_opt[] = "group_id = '{$row["group_id"]}' ";
}
$groups = join(' OR ', $sql_opt);
$sql = "DELETE FROM cc_show_schedule
WHERE ($groups) AND show_id = '{$this->_showId}' AND show_day >= '{$date}' ";
$CC_DBC->query($sql);
$sql = "DELETE FROM cc_schedule WHERE ($groups)";
$CC_DBC->query($sql);
}
else {
$groups = CcShowScheduleQuery::create()->filterByDbShowId($this->_showId)->find();
foreach($groups as $group) {
$groupId = $group->getDbGroupId();
CcScheduleQuery::create()->filterByDbGroupId($groupId)->delete();
}
$show->delete();
}
}
public static function getShows($start_timestamp, $end_timestamp, $excludeInstance=NULL) {
global $CC_DBC;
@ -184,7 +118,8 @@ class Show {
FROM cc_show_instances
LEFT JOIN cc_show ON cc_show.id = cc_show_instances.show_id
WHERE ((starts >= '{$start_timestamp}' AND starts < '{$end_timestamp}')
OR (ends > '{$start_timestamp}' AND ends <= '{$end_timestamp}'))";
OR (ends > '{$start_timestamp}' AND ends <= '{$end_timestamp}'))
ORDER BY starts";
if(isset($excludeInstance)) {
foreach($excludeInstance as $instance) {
@ -261,6 +196,45 @@ class Show {
->save();
}
//for a show with repeat_type == 1
private static function populateBiWeeklyShow($show_id, $next_pop_date, $first_show, $last_show, $start_time, $duration, $day, $end_timestamp) {
global $CC_DBC;
if(isset($next_pop_date)) {
$next_date = $next_pop_date." ".$start_time;
}
else {
$next_date = $first_show." ".$start_time;
}
while(strtotime($next_date) < strtotime($end_timestamp) && (strtotime($last_show) > strtotime($next_date) || is_null($last_show))) {
$start = $next_date;
$sql = "SELECT timestamp '{$start}' + interval '{$duration}'";
$end = $CC_DBC->GetOne($sql);
$newShow = new CcShowInstances();
$newShow->setDbShowId($show_id);
$newShow->setDbStarts($start);
$newShow->setDbEnds($end);
$newShow->save();
$sql = "SELECT timestamp '{$start}' + interval '14 days'";
$next_date = $CC_DBC->GetOne($sql);
}
$nextInfo = explode(" ", $next_date);
$repeatInfo = CcShowDaysQuery::create()
->filterByDbShowId($show_id)
->filterByDbDay($day)
->findOne();
$repeatInfo->setDbNextPopDate($nextInfo[0])
->save();
}
private static function populateShow($repeat_type, $show_id, $next_pop_date, $first_show, $last_show, $start_time, $duration, $day, $end_timestamp) {
if($repeat_type == -1) {
@ -269,6 +243,9 @@ class Show {
else if($repeat_type == 0) {
Show::populateWeeklyShow($show_id, $next_pop_date, $first_show, $last_show, $start_time, $duration, $day, $end_timestamp);
}
else if($repeat_type == 1) {
Show::populateBiWeeklyShow($show_id, $next_pop_date, $first_show, $last_show, $start_time, $duration, $day, $end_timestamp);
}
}
//used to catch up a newly added show

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 830 B

After

Width:  |  Height:  |  Size: 830 B

View File

@ -80,9 +80,9 @@
font-size:12px;
}
#spl_editor {
/*#spl_editor {
height: 50px;
}
}*/
#spl_editor > div > span {
/* display: inline-block;
@ -169,7 +169,6 @@
}
#spl_sortable .spl_fade_control {
position:absolute;
top:-8px;
right:35px;
z-index: 6;
height:15px;
@ -201,11 +200,14 @@
background: transparent url(images/crossfade_playlist.png) no-repeat 0 -30px;
border:none;
}
#spl_sortable li .crossfade {
#spl_sortable li .crossfade, #spl_sortable li .cue-edit {
background:#debc9e url(images/crossfade_bg.png) repeat-x 0 0 !important;
border:1px solid #5d5d5d;
border-width: 1px 0 0 0;
height:60px;
min-height:35px;
}
#spl_sortable li .cue-edit {
background:#b6d1d5 url(images/cue-editor_bg.png) repeat-x 0 0 !important;
}
#spl_sortable dl.inline-list {
margin:10px 0 0 37px;
@ -237,4 +239,57 @@
#spl_sortable li .spl_fade_end.ui-state-active {
background: transparent url(images/fade_out.png) no-repeat 0 -30px;
border:none;
}
}
.crossfade dl.inline-list, .cue-edit dl.inline-list, .crossfade-main dl.inline-list {
padding-bottom:5px;
}
.crossfade dl.inline-list dt, .cue-edit dl.inline-list dt, .crossfade-main dl.inline-list dt {
clear: none;
min-width: 40px;
}
.crossfade dl.inline-list dd, .cue-edit dl.inline-list dd, .crossfade-main dl.inline-list dd {
float: left;
font-size: 12px;
margin: 0;
padding: 0 25px 0px 15px;
}
.edit-error {
clear:both;
color:#b80000;
margin:0 0 0px 37px;
padding-bottom:4px;
font-size:12px;
display:none;
}
.edit-error:last-child {
padding-bottom:10px;
}
.spl_text_input {
color:#fff;
}
.crossfade-main {
background:#debc9e;
border:1px solid #5b5b5b;
padding:10px 10px 6px 10px;
margin:0 1px 16px 0;
position:relative;
}
.crossfade-main .edit-error {
padding-bottom:4px;
margin:0;
}
.crossfade-main .edit-error:last-child {
padding-bottom:2px;
}
.crossfade-main .ui-icon-closethick {
position: absolute;
right: 6px;
top: 3px;
z-index: 3;
}

View File

@ -702,7 +702,7 @@ dt.block-display, dd.block-display {
.floated-panel {
margin-top:0;
width:99.99%;
z-index:999;
z-index:9999;
}
@ -805,10 +805,6 @@ div.ui-datepicker {
float:left;
margin-right: 8px;
}
#schedule_playlist_chosen li > h3 > span.ui-icon.ui-icon-triangle-1-s {
float:left;
margin-right: 8px;
}
#schedule_playlist_chosen li > h3 > span.ui-icon.ui-icon-close {
float:right;
margin-right: 8px;
@ -958,3 +954,109 @@ h2#scheduled_playlist_name span {
}
/*---//////////////////// Advenced Search ////////////////////---*/
.search_control {
padding:8px;
border:1pxp solid #8f8f8f;
background:#d8d8d8;
margin-bottom:8px;
}
.search_group {
padding:8px;
border:1pxp solid #8f8f8f;
margin-bottom:8px;
}
.search_group > fieldset {
padding:0;
border:none;
margin-top:8px;
}
.search_group > fieldset .input_text {
width:45%;
}
.search_group > fieldset .input_text, .search_group > fieldset .input_select {
margin-right:6px;
}
.search_group fieldset .ui-button-icon-only .ui-button-text, .search_group fieldset .ui-button-icons-only .ui-button-text {
padding: 3px 2px;
text-indent: -1e+7px;
}
.search_group fieldset .ui-button-icon-only {
width: 2.1em;
}
.search_group fieldset .ui-button-icon-only .ui-icon {
left: 48%;
margin-top: -9px;
position: absolute;
top: 50%;
}
/*---//////////////////// USERS ////////////////////---*/
.simple-formblock {
width: 30%;
}
.simple-formblock dl, .simple-formblock dl.zend_form {
margin: 0;
padding: 0;
width: 100%;
}
.simple-formblock dt {
clear: left;
color: #666666;
float: left;
font-size: 1.2em;
font-weight: bold;
margin: 0;
min-width: 90px;
padding: 4px 0;
text-align: left;
}
.simple-formblock dd {
float: left;
font-size: 1.2em;
margin: 0;
padding: 4px 0 4px 15px;
width:60%;
}
.simple-formblock.padded-strong {
padding:12px;
}
.simple-formblock dd .input_text {
width: 100%;
}
.simple-formblock h2 {
font-size:1.7em;
padding-bottom:16px;
}
.simple-formblock label {
padding:0;
}
.ui-button-icon-only.crossfade-main-button, .ui-button-icons-only.crossfade-main-button {
padding-right: 8px;
}
.ui-button-icon-only.crossfade-main-button .ui-button-text, .ui-button-icons-only.crossfade-main-button .ui-button-text {
padding: 0;
text-indent: -1e+7px;
padding: 0.1em 1em;
}
.ui-state-default .ui-icon.crossfade-main-icon {
background:url(images/crossfade_main.png) no-repeat 0 2px;
width:25px;
}
.ui-button-icon-only.crossfade-main-button .ui-icon {
left: 44%;
margin-left: -8px;
}
button, input {
margin-top:0;
margin-bottom:0;
}