Merge branch '2.5.x' of github.com:sourcefabric/Airtime into 2.5.x
This commit is contained in:
commit
e649863dff
|
@ -209,8 +209,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
$interval = 'P21D';
|
$interval = 'P21D';
|
||||||
} elseif ($formData["add_show_repeat_type"] == 5) {
|
} elseif ($formData["add_show_repeat_type"] == 5) {
|
||||||
$interval = 'P28D';
|
$interval = 'P28D';
|
||||||
} elseif ($formData["add_show_repeat_type"] == 2) {
|
} elseif ($formData["add_show_repeat_type"] == 2 && $formData["add_show_monthly_repeat_type"] == 2) {
|
||||||
$interval = 'P1M';
|
$interval = 'P1M';
|
||||||
|
} elseif ($formData["add_show_repeat_type"] == 2 && $formData["add_show_monthly_repeat_type"] == 3) {
|
||||||
|
list($weekNumberOfMonth, $dayOfWeek) =
|
||||||
|
Application_Service_ShowService::getMonthlyWeeklyRepeatInterval(
|
||||||
|
new DateTime($start_time, $showTimezone));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check first show
|
/* Check first show
|
||||||
|
@ -287,12 +291,26 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
$this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
|
$this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
|
||||||
break 1;
|
break 1;
|
||||||
} else {
|
} else {
|
||||||
$repeatShowStart->setTimezone($showTimezone);
|
if ($formData["add_show_repeat_type"] == 2 && $formData["add_show_monthly_repeat_type"] == 3) {
|
||||||
$repeatShowEnd->setTimezone($showTimezone);
|
$monthlyWeeklyStart = new DateTime($repeatShowStart->format("Y-m"),
|
||||||
$repeatShowStart->add(new DateInterval($interval));
|
new DateTimeZone("UTC"));
|
||||||
$repeatShowEnd->add(new DateInterval($interval));
|
$monthlyWeeklyStart->add(new DateInterval("P1M"));
|
||||||
$repeatShowStart->setTimezone($utc);
|
$repeatShowStart = clone Application_Service_ShowService::getNextMonthlyWeeklyRepeatDate(
|
||||||
$repeatShowEnd->setTimezone($utc);
|
$monthlyWeeklyStart,
|
||||||
|
$formData["add_show_timezone"],
|
||||||
|
$formData['add_show_start_time'],
|
||||||
|
$weekNumberOfMonth,
|
||||||
|
$dayOfWeek);
|
||||||
|
$repeatShowEnd = clone $repeatShowStart;
|
||||||
|
$repeatShowEnd->add(new DateInterval("PT".$hours."H".$minutes."M"));
|
||||||
|
} else {
|
||||||
|
$repeatShowStart->setTimezone($showTimezone);
|
||||||
|
$repeatShowEnd->setTimezone($showTimezone);
|
||||||
|
$repeatShowStart->add(new DateInterval($interval));
|
||||||
|
$repeatShowEnd->add(new DateInterval($interval));
|
||||||
|
$repeatShowStart->setTimezone($utc);
|
||||||
|
$repeatShowEnd->setTimezone($utc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,11 +88,19 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
||||||
|
|
||||||
public static function deleteStreams($p_ids, $p_userId)
|
public static function deleteStreams($p_ids, $p_userId)
|
||||||
{
|
{
|
||||||
$leftOver = self::streamsNotOwnedByUser($p_ids, $p_userId);
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
if (count($leftOver) == 0) {
|
$user = new Application_Model_User($userInfo->id);
|
||||||
CcWebstreamQuery::create()->findPKs($p_ids)->delete();
|
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||||
|
|
||||||
|
if (!$isAdminOrPM) {
|
||||||
|
$leftOver = self::streamsNotOwnedByUser($p_ids, $p_userId);
|
||||||
|
if (count($leftOver) == 0) {
|
||||||
|
CcWebstreamQuery::create()->findPKs($p_ids)->delete();
|
||||||
|
} else {
|
||||||
|
throw new WebstreamNoPermissionException;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new WebstreamNoPermissionException;
|
CcWebstreamQuery::create()->findPKs($p_ids)->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1109,7 +1109,7 @@ SQL;
|
||||||
$start = $this->getNextRepeatingPopulateStartDateTime($showDay);
|
$start = $this->getNextRepeatingPopulateStartDateTime($showDay);
|
||||||
|
|
||||||
if (is_null($repeatInterval)&& $repeatType == REPEAT_MONTHLY_WEEKLY) {
|
if (is_null($repeatInterval)&& $repeatType == REPEAT_MONTHLY_WEEKLY) {
|
||||||
$repeatInterval = $this->getMonthlyWeeklyRepeatInterval($start, $timezone);
|
$repeatInterval = self::getMonthlyWeeklyRepeatInterval($start, $timezone);
|
||||||
}
|
}
|
||||||
|
|
||||||
//DatePeriod in user's local time
|
//DatePeriod in user's local time
|
||||||
|
@ -1212,7 +1212,7 @@ SQL;
|
||||||
|
|
||||||
// We will only need this if the repeat type is MONTHLY_WEEKLY
|
// We will only need this if the repeat type is MONTHLY_WEEKLY
|
||||||
list($weekNumberOfMonth, $dayOfWeek) =
|
list($weekNumberOfMonth, $dayOfWeek) =
|
||||||
$this->getMonthlyWeeklyRepeatInterval(
|
self::getMonthlyWeeklyRepeatInterval(
|
||||||
new DateTime($first_show, new DateTimeZone($timezone)));
|
new DateTime($first_show, new DateTimeZone($timezone)));
|
||||||
|
|
||||||
$this->repeatType = $showDay->getDbRepeatType();
|
$this->repeatType = $showDay->getDbRepeatType();
|
||||||
|
@ -1272,7 +1272,7 @@ SQL;
|
||||||
$monthlyWeeklyStart = new DateTime($utcStartDateTime->format("Y-m"),
|
$monthlyWeeklyStart = new DateTime($utcStartDateTime->format("Y-m"),
|
||||||
new DateTimeZone("UTC"));
|
new DateTimeZone("UTC"));
|
||||||
$monthlyWeeklyStart->add(new DateInterval("P1M"));
|
$monthlyWeeklyStart->add(new DateInterval("P1M"));
|
||||||
$start = $this->getNextMonthlyWeeklyRepeatDate(
|
$start = self::getNextMonthlyWeeklyRepeatDate(
|
||||||
$monthlyWeeklyStart,
|
$monthlyWeeklyStart,
|
||||||
$timezone,
|
$timezone,
|
||||||
$showDay->getDbStartTime(),
|
$showDay->getDbStartTime(),
|
||||||
|
@ -1294,7 +1294,7 @@ SQL;
|
||||||
* @param string $showStart
|
* @param string $showStart
|
||||||
* @param string $timezone user's local timezone
|
* @param string $timezone user's local timezone
|
||||||
*/
|
*/
|
||||||
private function getMonthlyWeeklyRepeatInterval($showStart)
|
public static function getMonthlyWeeklyRepeatInterval($showStart)
|
||||||
{
|
{
|
||||||
$start = clone $showStart;
|
$start = clone $showStart;
|
||||||
$dayOfMonth = $start->format("j");
|
$dayOfMonth = $start->format("j");
|
||||||
|
@ -1369,7 +1369,7 @@ SQL;
|
||||||
* @param string (i.e. 'first', 'second') $weekNumberOfMonth
|
* @param string (i.e. 'first', 'second') $weekNumberOfMonth
|
||||||
* @param string (i.e. 'Monday') $dayOfWeek
|
* @param string (i.e. 'Monday') $dayOfWeek
|
||||||
*/
|
*/
|
||||||
private function getNextMonthlyWeeklyRepeatDate(
|
public static function getNextMonthlyWeeklyRepeatDate(
|
||||||
$start,
|
$start,
|
||||||
$timezone,
|
$timezone,
|
||||||
$startTime,
|
$startTime,
|
||||||
|
|
Loading…
Reference in New Issue