starting association of a show instance.
This commit is contained in:
parent
f97069bd0b
commit
d50cdd16c2
4 changed files with 57 additions and 3 deletions
|
@ -12,6 +12,15 @@ class Application_Form_EditHistoryItem extends Application_Form_EditHistory
|
||||||
'PrepareElements',
|
'PrepareElements',
|
||||||
array('ViewScript', array('viewScript' => 'form/edit-history-item.phtml'))
|
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 = new Zend_Form_Element_Text(self::ID_PREFIX.'starts');
|
||||||
$starts->setValidators(array(
|
$starts->setValidators(array(
|
||||||
|
@ -42,4 +51,10 @@ class Application_Form_EditHistoryItem extends Application_Form_EditHistory
|
||||||
|
|
||||||
parent::createFromTemplate($template, $required);
|
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();
|
$this->con->beginTransaction();
|
||||||
|
|
||||||
|
@ -702,6 +702,10 @@ class Application_Service_HistoryService
|
||||||
else {
|
else {
|
||||||
$historyRecord = new CcPlayoutHistory();
|
$historyRecord = new CcPlayoutHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($instance_id)) {
|
||||||
|
$historyRecord->setDbInstanceId($instance_id);
|
||||||
|
}
|
||||||
|
|
||||||
$timezoneUTC = new DateTimeZone("UTC");
|
$timezoneUTC = new DateTimeZone("UTC");
|
||||||
$timezoneLocal = new DateTimeZone($this->timezone);
|
$timezoneLocal = new DateTimeZone($this->timezone);
|
||||||
|
@ -780,12 +784,31 @@ class Application_Service_HistoryService
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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) {
|
public function createPlayedItem($data) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$form = $this->makeHistoryItemForm(null);
|
$form = $this->makeHistoryItemForm(null);
|
||||||
$history_id = $form->getElement("his_item_id");
|
$history_id = $form->getElement("his_item_id");
|
||||||
|
$instance_id = $data["instance_id"];
|
||||||
$json = array();
|
$json = array();
|
||||||
|
|
||||||
if ($form->isValid($data)) {
|
if ($form->isValid($data)) {
|
||||||
|
@ -795,7 +818,7 @@ class Application_Service_HistoryService
|
||||||
Logging::info("created list item");
|
Logging::info("created list item");
|
||||||
Logging::info($values);
|
Logging::info($values);
|
||||||
|
|
||||||
$this->populateTemplateItem($values);
|
$this->populateTemplateItem($values, null, $instance_id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Logging::info("created list item NOT VALID");
|
Logging::info("created list item NOT VALID");
|
||||||
|
@ -819,6 +842,7 @@ class Application_Service_HistoryService
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$id = $data["his_item_id"];
|
$id = $data["his_item_id"];
|
||||||
|
$instance_id = $data["instance_id"];
|
||||||
$form = $this->makeHistoryItemForm($id);
|
$form = $this->makeHistoryItemForm($id);
|
||||||
$history_id = $form->getElement("his_item_id");
|
$history_id = $form->getElement("his_item_id");
|
||||||
$history_id->setRequired(true);
|
$history_id->setRequired(true);
|
||||||
|
@ -833,7 +857,7 @@ class Application_Service_HistoryService
|
||||||
Logging::info("edited list item");
|
Logging::info("edited list item");
|
||||||
Logging::info($values);
|
Logging::info($values);
|
||||||
|
|
||||||
$this->populateTemplateItem($values, $id);
|
$this->populateTemplateItem($values, $id, $instance_id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Logging::info("edited list item NOT VALID");
|
Logging::info("edited list item NOT VALID");
|
||||||
|
|
|
@ -31,6 +31,14 @@
|
||||||
</dd>
|
</dd>
|
||||||
<?php endforeach;?>
|
<?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 foreach ($form->getSubForm('his_item_template') as $index=>$el): ?>
|
||||||
<?php $name = $el->getName(); ?>
|
<?php $name = $el->getName(); ?>
|
||||||
|
|
||||||
|
|
|
@ -577,6 +577,13 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
url;
|
url;
|
||||||
|
|
||||||
url = (id === "") ? createUrl : updateUrl;
|
url = (id === "") ? createUrl : updateUrl;
|
||||||
|
|
||||||
|
if (fnServerData.instance !== undefined) {
|
||||||
|
data.push({
|
||||||
|
name: "instance_id",
|
||||||
|
value: fnServerData.instance
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$.post(url, data, function(json) {
|
$.post(url, data, function(json) {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue