Merge branch 'saas-dev' into saas-dev-usability-hints

This commit is contained in:
Albert Santoni 2015-07-13 15:34:06 -04:00
commit 8e15dd5e99
1 changed files with 31 additions and 9 deletions

View File

@ -155,19 +155,18 @@ class Application_Service_ShowFormService
if ($ccShowDay->isShowStartInPast()) { if ($ccShowDay->isShowStartInPast()) {
//for a non-repeating show, we should never allow user to change the start time. //for a non-repeating show, we should never allow user to change the start time.
//for a repeating show, we should allow because the form works as repeating template form //for a repeating show, we should allow because the form works as repeating template form
$form->disableStartDateAndTime(); if (!$ccShowDay->isRepeating()) {
// Removing this - if there is no future instance, this will throw an error.
// If there is a future instance, then we get a WHEN block representing the next instance
// which may be confusing.
/*if (!$ccShowDay->isRepeating()) {
$form->disableStartDateAndTime(); $form->disableStartDateAndTime();
} else { } else {
list($showStart, $showEnd) = $this->getNextFutureRepeatShowTime(); $showStartAndEnd = $this->getNextFutureRepeatShowTime();
if (!is_null($showStartAndEnd)) {
$showStart = $showStartAndEnd["starts"];
$showEnd = $showStartAndEnd["ends"];
}
if ($this->hasShowStarted($showStart)) { if ($this->hasShowStarted($showStart)) {
$form->disableStartDateAndTime(); $form->disableStartDateAndTime();
} }
}*/ }
} }
$form->populate( $form->populate(
@ -183,6 +182,29 @@ class Application_Service_ShowFormService
return $showStart; return $showStart;
} }
public function getNextFutureRepeatShowTime()
{
$ccShowInstance = CcShowInstancesQuery::create()
->filterByDbShowId($this->ccShow->getDbId())
->filterByDbModifiedInstance(false)
->filterByDbStarts(gmdate("Y-m-d H:i:s"), Criteria::GREATER_THAN)
->orderByDbStarts()
->findOne();
if (!$ccShowInstance) {
return null;
}
$starts = new DateTime($ccShowInstance->getDbStarts(), new DateTimeZone("UTC"));
$ends = new DateTime($ccShowInstance->getDbEnds(), new DateTimeZone("UTC"));
$showTimezone = $this->ccShow->getFirstCcShowDay()->getDbTimezone();
$starts->setTimezone(new DateTimeZone($showTimezone));
$ends->setTimezone(new DateTimeZone($showTimezone));
return array("starts" => $starts, "ends" => $ends);
}
private function populateInstanceFormWhen($form) private function populateInstanceFormWhen($form)
{ {
$ccShowInstance = CcShowInstancesQuery::create()->findPk($this->instanceId); $ccShowInstance = CcShowInstancesQuery::create()->findPk($this->instanceId);
@ -437,7 +459,7 @@ class Application_Service_ShowFormService
$ccShowInstance = CcShowInstancesQuery::create() $ccShowInstance = CcShowInstancesQuery::create()
->filterByDbShowId($this->ccShow->getDbId()) ->filterByDbShowId($this->ccShow->getDbId())
->filterByDbModifiedInstance(false) ->filterByDbModifiedInstance(false)
->filterByDbStarts(gmdate("Y-m-d"), Criteria::GREATER_EQUAL) ->filterByDbStarts(gmdate("Y-m-d H:i:s"), Criteria::GREATER_EQUAL)
->orderByDbStarts() ->orderByDbStarts()
->findOne(); ->findOne();