CC-2166: Packaging Improvements. Moved the Zend app into airtime_mvc. It is now installed to /var/www/airtime. Storage is now set to /srv/airtime/stor. Utils are now installed to /usr/lib/airtime/utils/. Added install/airtime-dircheck.php as a simple test to see if everything is install/uninstalled correctly.
This commit is contained in:
parent
514777e8d2
commit
b11cbd8159
4546 changed files with 138 additions and 51 deletions
82
airtime_mvc/application/forms/AddShowRebroadcastDates.php
Normal file
82
airtime_mvc/application/forms/AddShowRebroadcastDates.php
Normal file
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/add-show-rebroadcast.phtml'))
|
||||
));
|
||||
|
||||
$relativeDates = array();
|
||||
$relativeDates[""] = "";
|
||||
for($i=0; $i<=30; $i++) {
|
||||
$relativeDates["$i days"] = "+$i days";
|
||||
}
|
||||
|
||||
for($i=1; $i<=10; $i++) {
|
||||
|
||||
$select = new Zend_Form_Element_Select("add_show_rebroadcast_date_$i");
|
||||
$select->setAttrib('class', 'input_select');
|
||||
$select->setMultiOptions($relativeDates);
|
||||
$select->setRequired(false);
|
||||
$select->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($select);
|
||||
|
||||
$text = new Zend_Form_Element_Text("add_show_rebroadcast_time_$i");
|
||||
$text->setAttrib('class', 'input_text');
|
||||
$text->addFilter('StringTrim');
|
||||
$text->addValidator('date', false, array('HH:mm'));
|
||||
$text->addValidator('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'));
|
||||
$text->setRequired(false);
|
||||
$text->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($text);
|
||||
}
|
||||
}
|
||||
|
||||
public function checkReliantFields($formData) {
|
||||
|
||||
$valid = true;
|
||||
|
||||
for($i=1; $i<=5; $i++) {
|
||||
|
||||
$days = $formData['add_show_rebroadcast_date_'.$i];
|
||||
|
||||
if(trim($days) == "") {
|
||||
continue;
|
||||
}
|
||||
|
||||
$time = $formData['add_show_rebroadcast_time_'.$i];
|
||||
if (trim($time) == ""){
|
||||
$this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Time must be specified"));
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
$days = explode(" ", $days);
|
||||
$day = $days[0];
|
||||
|
||||
$show_start_time = $formData['add_show_start_date']."".$formData['add_show_start_time'];
|
||||
$show_end = new DateTime($show_start_time);
|
||||
|
||||
$duration = $formData['add_show_duration'];
|
||||
$duration = explode(":", $duration);
|
||||
|
||||
$show_end->add(new DateInterval("PT$duration[0]H"));
|
||||
$show_end->add(new DateInterval("PT$duration[1]M"));
|
||||
$show_end->add(new DateInterval("PT1H"));//min time to wait until a rebroadcast
|
||||
|
||||
$rebroad_start = $formData['add_show_start_date']."".$formData['add_show_rebroadcast_time_'.$i];
|
||||
$rebroad_start = new DateTime($rebroad_start);
|
||||
$rebroad_start->add(new DateInterval("P".$day."D"));
|
||||
|
||||
if($rebroad_start < $show_end) {
|
||||
$this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Must wait at least 1 hour to rebroadcast"));
|
||||
$valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $valid;
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue