starting association of a show instance.
This commit is contained in:
parent
f97069bd0b
commit
d50cdd16c2
4 changed files with 57 additions and 3 deletions
|
@ -13,6 +13,15 @@ class Application_Form_EditHistoryItem extends Application_Form_EditHistory
|
|||
array('ViewScript', array('viewScript' => 'form/edit-history-item.phtml'))
|
||||
));
|
||||
|
||||
/*
|
||||
$instance = new Zend_Form_Element_Select("instance_id");
|
||||
$instance->setLabel(_("Choose Show Instance"));
|
||||
$instance->setMultiOptions(array("0" => "-----------"));
|
||||
$instance->setValue(0);
|
||||
$instance->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($instance);
|
||||
*/
|
||||
|
||||
$starts = new Zend_Form_Element_Text(self::ID_PREFIX.'starts');
|
||||
$starts->setValidators(array(
|
||||
new Zend_Validate_Date(self::VALIDATE_DATETIME_FORMAT)
|
||||
|
@ -42,4 +51,10 @@ class Application_Form_EditHistoryItem extends Application_Form_EditHistory
|
|||
|
||||
parent::createFromTemplate($template, $required);
|
||||
}
|
||||
|
||||
public function populateShowInstances($possibleInstances) {
|
||||
|
||||
$instance = $this->getElement("instance_id");
|
||||
$instance->setMultiOptions($possibleInstances);
|
||||
}
|
||||
}
|
|
@ -688,7 +688,7 @@ class Application_Service_HistoryService
|
|||
}
|
||||
}
|
||||
|
||||
public function populateTemplateItem($values, $id=null) {
|
||||
public function populateTemplateItem($values, $id=null, $instance_id=null) {
|
||||
|
||||
$this->con->beginTransaction();
|
||||
|
||||
|
@ -703,6 +703,10 @@ class Application_Service_HistoryService
|
|||
$historyRecord = new CcPlayoutHistory();
|
||||
}
|
||||
|
||||
if (isset($instance_id)) {
|
||||
$historyRecord->setDbInstanceId($instance_id);
|
||||
}
|
||||
|
||||
$timezoneUTC = new DateTimeZone("UTC");
|
||||
$timezoneLocal = new DateTimeZone($this->timezone);
|
||||
|
||||
|
@ -781,11 +785,30 @@ class Application_Service_HistoryService
|
|||
}
|
||||
}
|
||||
|
||||
//start,end timestamp strings in local timezone.
|
||||
public function populateShowInstances($start, $end) {
|
||||
$timezoneLocal = new DateTimeZone($this->timezone);
|
||||
|
||||
$startDT = new DateTime($start, $timezoneLocal);
|
||||
$endDT = new DateTime($end, $timezoneLocal);
|
||||
|
||||
$shows = $this->getShowList($startDT, $endDT);
|
||||
|
||||
$select = array();
|
||||
|
||||
foreach ($shows as &$show) {
|
||||
$select[$show["instance_id"]] = $show["name"];
|
||||
}
|
||||
|
||||
return $select;
|
||||
}
|
||||
|
||||
public function createPlayedItem($data) {
|
||||
|
||||
try {
|
||||
$form = $this->makeHistoryItemForm(null);
|
||||
$history_id = $form->getElement("his_item_id");
|
||||
$instance_id = $data["instance_id"];
|
||||
$json = array();
|
||||
|
||||
if ($form->isValid($data)) {
|
||||
|
@ -795,7 +818,7 @@ class Application_Service_HistoryService
|
|||
Logging::info("created list item");
|
||||
Logging::info($values);
|
||||
|
||||
$this->populateTemplateItem($values);
|
||||
$this->populateTemplateItem($values, null, $instance_id);
|
||||
}
|
||||
else {
|
||||
Logging::info("created list item NOT VALID");
|
||||
|
@ -819,6 +842,7 @@ class Application_Service_HistoryService
|
|||
|
||||
try {
|
||||
$id = $data["his_item_id"];
|
||||
$instance_id = $data["instance_id"];
|
||||
$form = $this->makeHistoryItemForm($id);
|
||||
$history_id = $form->getElement("his_item_id");
|
||||
$history_id->setRequired(true);
|
||||
|
@ -833,7 +857,7 @@ class Application_Service_HistoryService
|
|||
Logging::info("edited list item");
|
||||
Logging::info($values);
|
||||
|
||||
$this->populateTemplateItem($values, $id);
|
||||
$this->populateTemplateItem($values, $id, $instance_id);
|
||||
}
|
||||
else {
|
||||
Logging::info("edited list item NOT VALID");
|
||||
|
|
|
@ -31,6 +31,14 @@
|
|||
</dd>
|
||||
<?php endforeach;?>
|
||||
|
||||
<dt>
|
||||
<label for="<?php echo $name;?>"><?php echo _("Choose Show Instance") ?></label>
|
||||
</dt>
|
||||
<dd>
|
||||
<select id="his_instance_select"><option value="0"><?php echo "----------" ?><option></select>
|
||||
<button class="btn" type="button" id="his_instance_retrieve"><?php echo _("Find") ?></button>
|
||||
</dd>
|
||||
|
||||
<?php foreach ($form->getSubForm('his_item_template') as $index=>$el): ?>
|
||||
<?php $name = $el->getName(); ?>
|
||||
|
||||
|
|
|
@ -578,6 +578,13 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
url = (id === "") ? createUrl : updateUrl;
|
||||
|
||||
if (fnServerData.instance !== undefined) {
|
||||
data.push({
|
||||
name: "instance_id",
|
||||
value: fnServerData.instance
|
||||
});
|
||||
}
|
||||
|
||||
$.post(url, data, function(json) {
|
||||
|
||||
if (json.form !== undefined) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue