CC-4961: Show linking

Add front-end for creating a show with monthly repeats on same day of week
This commit is contained in:
denise 2013-03-22 15:57:15 -04:00
parent 187e49e4b2
commit 327d0dd6c9
3 changed files with 31 additions and 3 deletions

View File

@ -35,6 +35,15 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
),
));
$repeatMonthlyType = new Zend_Form_Element_Radio("add_show_monthly_repeat_type");
$repeatMonthlyType
->setLabel(_("Repeat By:"))
->setRequired(true)
->setMultiOptions(
array(2 => _("day of the month"), 3 => _("day of the week")))
->setValue(2);
$this->addElement($repeatMonthlyType);
// Add end date element
$this->addElement('text', 'add_show_end_date', array(
'label' => _('Date End:'),

View File

@ -23,7 +23,15 @@ class Application_Service_ShowService
public function addUpdateShow($showData, $isUpdate=false)
{
$repeatType = ($showData['add_show_repeats']) ? $showData['add_show_repeat_type'] : -1;
if ($showData["add_show_repeats"]) {
$repeatType = $showData["add_show_repeat_type"];
if ($showData["add_show_repeat_type"] == 2) {
$repeatType = $showData["add_show_monthly_repeat_type"];
}
} else {
$repeatType = -1;
}
//$repeatType = ($showData['add_show_repeats']) ? $showData['add_show_repeat_type'] : -1;
$isRecorded = (isset($showData['add_show_record']) && $showData['add_show_record']) ? 1 : 0;
$isRebroadcast = (isset($showData['add_show_rebroadcast']) && $showData['add_show_rebroadcast']) ? 1 : 0;
@ -709,9 +717,9 @@ SQL;
* @param string $showStart
* @param string $timezone user's local timezone
*/
private function getMonthlyWeeklyRepeatInterval($showStart, $timezone)
private function getMonthlyWeeklyRepeatInterval($showStart)
{
$start = new DateTime($showStart, new DateTimeZone($timezone));
$start = clone $showStart;
$dayOfMonth = $start->format("j");
$dayOfWeek = $start->format("l");

View File

@ -216,11 +216,22 @@ function setAddShowEvents() {
form.find("#add_show_repeat_type").change(function(){
if($(this).val() == 2) {
form.find("#add_show_day_check-label, #add_show_day_check-element").hide();
//form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").show();
}
else {
form.find("#add_show_day_check-label, #add_show_day_check-element").show();
//form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").hide();
}
toggleMonthlyRepeatType();
});
toggleMonthlyRepeatType();
function toggleMonthlyRepeatType() {
if (form.find("#add_show_repeat_type").val() == 2) {
form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").show();
} else {
form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").hide();
}
}
form.find("#add_show_day_check-label").addClass("block-display");
form.find("#add_show_day_check-element").addClass("block-display clearfix");