2013-07-03 21:19:05 +02:00
|
|
|
<?php
|
|
|
|
|
2013-07-03 22:00:48 +02:00
|
|
|
require_once 'formatters/LengthFormatter.php';
|
|
|
|
|
2013-07-03 21:19:05 +02:00
|
|
|
class Application_Service_HistoryService
|
|
|
|
{
|
|
|
|
private $con;
|
|
|
|
private $timezone;
|
2013-07-31 01:24:05 +02:00
|
|
|
|
|
|
|
const TEMPLATE_TYPE_ITEM = "item";
|
|
|
|
const TEMPLATE_TYPE_AGGREGATE = "aggregate";
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-09 00:00:02 +02:00
|
|
|
private $mDataPropMap = array (
|
|
|
|
"artist" => "artist_name",
|
|
|
|
"title" => "track_title",
|
|
|
|
"played" => "played",
|
|
|
|
"length" => "length",
|
|
|
|
"composer" => "composer",
|
|
|
|
"copyright" => "copyright",
|
2013-07-18 07:31:20 +02:00
|
|
|
"starts" => "starts",
|
|
|
|
"ends" => "ends"
|
2013-07-03 22:00:48 +02:00
|
|
|
);
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 21:20:40 +02:00
|
|
|
public function __construct()
|
|
|
|
{
|
2013-07-03 21:19:05 +02:00
|
|
|
$this->con = isset($con) ? $con : Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME);
|
2013-07-24 00:01:43 +02:00
|
|
|
$this->timezone = Application_Model_Preference::GetTimezone();
|
2013-07-03 22:00:48 +02:00
|
|
|
}
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 22:02:17 +02:00
|
|
|
/*
|
|
|
|
* map front end mDataProp labels to proper column names for searching etc.
|
|
|
|
*/
|
|
|
|
private function translateColumns($opts)
|
|
|
|
{
|
|
|
|
for ($i = 0; $i < $opts["iColumns"]; $i++) {
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-09 00:00:02 +02:00
|
|
|
if ($opts["bSearchable_{$i}"] === "true") {
|
|
|
|
$opts["mDataProp_{$i}"] = $this->mDataPropMap[$opts["mDataProp_{$i}"]];
|
2013-07-18 07:31:20 +02:00
|
|
|
}
|
2013-07-03 22:02:17 +02:00
|
|
|
}
|
|
|
|
}
|
2013-07-31 23:38:48 +02:00
|
|
|
|
|
|
|
//opts is from datatables.
|
|
|
|
public function getPlayedItemData($startDT, $endDT, $opts)
|
2013-07-18 07:31:20 +02:00
|
|
|
{
|
2013-07-31 23:39:45 +02:00
|
|
|
$mainSqlQuery = "";
|
2013-07-31 23:38:48 +02:00
|
|
|
$paramMap = array();
|
2013-07-31 02:04:10 +02:00
|
|
|
|
2013-07-31 23:39:45 +02:00
|
|
|
$start = $startDT->format("Y-m-d H:i:s");
|
2013-07-31 23:38:48 +02:00
|
|
|
$end = $endDT->format("Y-m-d H:i:s");
|
|
|
|
$paramMap["starts"] = $start;
|
|
|
|
$paramMap["ends"] = $end;
|
|
|
|
|
|
|
|
$template = $this->getConfiguredItemTemplate();
|
|
|
|
$fields = $template["fields"];
|
|
|
|
$required = $this->mandatoryItemFields();
|
|
|
|
|
|
|
|
$fields_filemd = array();
|
|
|
|
$fields_general = array();
|
|
|
|
|
|
|
|
foreach ($fields as $index=>$field) {
|
|
|
|
|
|
|
|
if (in_array($field["name"], $required)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($field["isFileMd"]) {
|
|
|
|
$fields_filemd[] = $field;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$fields_general[] = $field;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-31 23:39:45 +02:00
|
|
|
$historyRange = "(".
|
|
|
|
"SELECT history.starts, history.ends, history.id AS history_id".
|
|
|
|
" FROM cc_playout_history as history".
|
|
|
|
" WHERE history.starts >= :starts and history.starts < :ends".
|
|
|
|
") AS history_range";
|
|
|
|
|
|
|
|
$manualMeta = "(".
|
|
|
|
"SELECT %KEY%.value AS %KEY%, %KEY%.history_id".
|
|
|
|
" FROM (".
|
|
|
|
" SELECT * from cc_playout_history_metadata AS phm WHERE phm.key = :meta_%KEY%".
|
|
|
|
" ) AS %KEY%".
|
2013-07-31 23:38:48 +02:00
|
|
|
" ) AS %KEY%_filter";
|
2013-07-31 01:24:05 +02:00
|
|
|
|
2013-07-31 23:38:48 +02:00
|
|
|
$mainSelect = array("history_range.starts", "history_range.ends", "history_range.history_id");
|
|
|
|
$mdFilters = array();
|
2013-07-31 01:24:05 +02:00
|
|
|
|
2013-07-31 23:38:48 +02:00
|
|
|
$numFileMdFields = count($fields_filemd);
|
|
|
|
|
|
|
|
if ($numFileMdFields > 0) {
|
|
|
|
|
|
|
|
//these 3 selects are only needed if $fields_filemd has some fields.
|
|
|
|
$fileSelect = array("history_file.history_id");
|
|
|
|
$nonNullFileSelect = array("file.id as file_id");
|
|
|
|
$nullFileSelect = array("null_file.history_id");
|
|
|
|
|
|
|
|
$fileMdFilters = array();
|
|
|
|
|
|
|
|
//populate the different dynamic selects with file info.
|
|
|
|
for ($i = 0; $i < $numFileMdFields; $i++) {
|
|
|
|
|
|
|
|
$field = $fields_filemd[$i];
|
|
|
|
$key = $field["name"];
|
|
|
|
|
|
|
|
$fileSelect[] = "file_md.{$key}";
|
|
|
|
$nonNullFileSelect[] = "file.{$key}";
|
|
|
|
$nullFileSelect[] = "{$key}_filter.{$key}";
|
|
|
|
$mainSelect[] = "file_info.{$key}";
|
|
|
|
|
|
|
|
$fileMdFilters[] = str_replace("%KEY%", $key, $manualMeta);
|
|
|
|
$paramMap["meta_{$key}"] = $key;
|
|
|
|
}
|
|
|
|
|
2013-07-31 23:39:45 +02:00
|
|
|
//the files associated with scheduled playback in Airtime.
|
|
|
|
$historyFile = "(".
|
|
|
|
"SELECT history.id AS history_id, history.file_id".
|
|
|
|
" FROM cc_playout_history AS history".
|
|
|
|
" WHERE history.file_id IS NOT NULL".
|
|
|
|
") AS history_file";
|
|
|
|
|
|
|
|
$fileMd = "(".
|
|
|
|
"SELECT %NON_NULL_FILE_SELECT%".
|
|
|
|
" FROM cc_files AS file".
|
2013-07-31 23:38:48 +02:00
|
|
|
") AS file_md";
|
|
|
|
|
2013-07-31 23:39:45 +02:00
|
|
|
$fileMd = str_replace("%NON_NULL_FILE_SELECT%", join(", ", $nonNullFileSelect), $fileMd);
|
|
|
|
|
|
|
|
//null files are from manually added data (filling in webstream info etc)
|
|
|
|
$nullFile = "(".
|
|
|
|
"SELECT history.id AS history_id".
|
|
|
|
" FROM cc_playout_history AS history".
|
|
|
|
" WHERE history.file_id IS NULL".
|
2013-07-31 23:38:48 +02:00
|
|
|
") AS null_file";
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------
|
|
|
|
//building the file inner query
|
|
|
|
|
|
|
|
$fileSqlQuery =
|
|
|
|
"SELECT ".join(", ", $fileSelect).
|
|
|
|
" FROM {$historyFile}".
|
|
|
|
" LEFT JOIN {$fileMd} USING (file_id)".
|
|
|
|
" UNION".
|
|
|
|
" SELECT ".join(", ", $nullFileSelect).
|
|
|
|
" FROM {$nullFile}";
|
|
|
|
|
|
|
|
foreach ($fileMdFilters as $filter) {
|
|
|
|
|
|
|
|
$fileSqlQuery.=
|
|
|
|
" LEFT JOIN {$filter} USING(history_id)";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for ($i = 0, $len = count($fields_general); $i < $len; $i++) {
|
|
|
|
|
2013-07-31 23:39:45 +02:00
|
|
|
$field = $fields_general[$i];
|
2013-07-31 23:38:48 +02:00
|
|
|
$key = $field["name"];
|
|
|
|
|
2013-07-31 23:39:45 +02:00
|
|
|
$mdFilters[] = str_replace("%KEY%", $key, $manualMeta);
|
2013-07-31 23:38:48 +02:00
|
|
|
$paramMap["meta_{$key}"] = $key;
|
|
|
|
$mainSelect[] = "{$key}_filter.{$key}";
|
|
|
|
}
|
|
|
|
|
|
|
|
$mainSqlQuery.=
|
|
|
|
"SELECT ".join(", ", $mainSelect).
|
|
|
|
" FROM {$historyRange}";
|
|
|
|
|
|
|
|
if (isset($fileSqlQuery)) {
|
|
|
|
|
|
|
|
$mainSqlQuery.=
|
|
|
|
" LEFT JOIN ( {$fileSqlQuery} ) as file_info USING(history_id)";
|
|
|
|
}
|
|
|
|
|
2013-07-31 23:39:45 +02:00
|
|
|
foreach ($mdFilters as $filter) {
|
|
|
|
|
|
|
|
$mainSqlQuery.=
|
|
|
|
" LEFT JOIN {$filter} USING(history_id)";
|
2013-07-31 23:38:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Logging::info($mainSqlQuery);
|
|
|
|
|
2013-07-31 23:39:45 +02:00
|
|
|
$stmt = $this->con->prepare($mainSqlQuery);
|
|
|
|
foreach ($paramMap as $param => $v) {
|
|
|
|
$stmt->bindValue($param, $v);
|
2013-07-31 23:38:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$rows = array();
|
|
|
|
if ($stmt->execute()) {
|
|
|
|
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$msg = implode(',', $stmt->errorInfo());
|
2013-07-31 23:39:45 +02:00
|
|
|
Logging::info($msg);
|
2013-07-31 23:38:48 +02:00
|
|
|
throw new Exception("Error: $msg");
|
|
|
|
}
|
|
|
|
|
|
|
|
$totalRows = count($rows);
|
|
|
|
Logging::info($totalRows);
|
|
|
|
Logging::info($rows);
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------
|
|
|
|
//processing results.
|
|
|
|
|
2013-07-31 23:39:45 +02:00
|
|
|
$timezoneUTC = new DateTimeZone("UTC");
|
|
|
|
$timezoneLocal = new DateTimeZone($this->timezone);
|
|
|
|
|
|
|
|
//need to display the results in the station's timezone.
|
|
|
|
foreach ($rows as $index => &$result) {
|
|
|
|
|
|
|
|
$dateTime = new DateTime($result["starts"], $timezoneUTC);
|
|
|
|
$dateTime->setTimezone($timezoneLocal);
|
|
|
|
$result["starts"] = $dateTime->format("Y-m-d H:i:s");
|
|
|
|
|
|
|
|
$dateTime = new DateTime($result["ends"], $timezoneUTC);
|
|
|
|
$dateTime->setTimezone($timezoneLocal);
|
|
|
|
$result["ends"] = $dateTime->format("Y-m-d H:i:s");
|
2013-07-31 23:38:48 +02:00
|
|
|
}
|
|
|
|
|
2013-07-31 23:39:45 +02:00
|
|
|
return array(
|
|
|
|
"sEcho" => intval($opts["sEcho"]),
|
2013-07-31 23:38:48 +02:00
|
|
|
//"iTotalDisplayRecords" => intval($totalDisplayRows),
|
2013-07-31 23:39:45 +02:00
|
|
|
"iTotalDisplayRecords" => intval($totalRows),
|
|
|
|
"iTotalRecords" => intval($totalRows),
|
|
|
|
"history" => $rows
|
2013-07-31 23:38:48 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getListView($startDT, $endDT, $opts)
|
|
|
|
{
|
2013-07-18 07:37:39 +02:00
|
|
|
$this->translateColumns($opts);
|
|
|
|
|
|
|
|
$select = array (
|
|
|
|
"file.track_title as title",
|
|
|
|
"file.artist_name as artist",
|
|
|
|
"playout.starts",
|
|
|
|
"playout.ends",
|
|
|
|
"playout.history_id"
|
|
|
|
);
|
|
|
|
|
|
|
|
$start = $startDT->format("Y-m-d H:i:s");
|
|
|
|
$end = $endDT->format("Y-m-d H:i:s");
|
|
|
|
|
|
|
|
$historyTable = "(
|
2013-07-18 07:31:20 +02:00
|
|
|
select history.starts as starts, history.ends as ends,
|
2013-07-18 07:37:39 +02:00
|
|
|
history.id as history_id, history.file_id as file_id
|
|
|
|
from cc_playout_history as history
|
|
|
|
where history.starts >= '{$start}' and history.starts < '{$end}'
|
|
|
|
) AS playout
|
|
|
|
left join cc_files as file on (file.id = playout.file_id)";
|
|
|
|
|
|
|
|
$results = Application_Model_Datatables::findEntries($this->con, $select, $historyTable, $opts, "history");
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
$timezoneUTC = new DateTimeZone("UTC");
|
|
|
|
$timezoneLocal = new DateTimeZone($this->timezone);
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
//need to display the results in the station's timezone.
|
|
|
|
foreach ($results["history"] as $index => &$result) {
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
$dateTime = new DateTime($result["starts"], $timezoneUTC);
|
|
|
|
$dateTime->setTimezone($timezoneLocal);
|
|
|
|
$result["starts"] = $dateTime->format("Y-m-d H:i:s");
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
$dateTime = new DateTime($result["ends"], $timezoneUTC);
|
|
|
|
$dateTime->setTimezone($timezoneLocal);
|
|
|
|
$result["ends"] = $dateTime->format("Y-m-d H:i:s");
|
|
|
|
}
|
2013-07-18 07:37:39 +02:00
|
|
|
|
2013-07-18 07:31:20 +02:00
|
|
|
return $results;
|
|
|
|
}
|
|
|
|
|
2013-07-09 00:00:02 +02:00
|
|
|
public function getAggregateView($startDT, $endDT, $opts)
|
2013-07-03 22:02:17 +02:00
|
|
|
{
|
|
|
|
$this->translateColumns($opts);
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-09 00:00:02 +02:00
|
|
|
$select = array (
|
|
|
|
"file.track_title as title",
|
|
|
|
"file.artist_name as artist",
|
2013-07-18 07:31:20 +02:00
|
|
|
"playout.played as played",
|
2013-07-09 00:00:02 +02:00
|
|
|
"playout.file_id",
|
2013-07-18 07:31:20 +02:00
|
|
|
"file.composer as composer",
|
|
|
|
"file.copyright as copyright",
|
|
|
|
"file.length as length"
|
2013-07-03 22:02:17 +02:00
|
|
|
);
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 22:02:17 +02:00
|
|
|
$start = $startDT->format("Y-m-d H:i:s");
|
2013-07-18 07:31:20 +02:00
|
|
|
$end = $endDT->format("Y-m-d H:i:s");
|
|
|
|
|
2013-07-03 22:02:17 +02:00
|
|
|
$historyTable = "(
|
|
|
|
select count(history.file_id) as played, history.file_id as file_id
|
|
|
|
from cc_playout_history as history
|
|
|
|
where history.starts >= '{$start}' and history.starts < '{$end}'
|
2013-07-31 01:32:31 +02:00
|
|
|
and history.file_id is not NULL
|
2013-07-03 22:02:17 +02:00
|
|
|
group by history.file_id
|
2013-07-18 07:31:20 +02:00
|
|
|
) AS playout
|
2013-07-03 22:02:17 +02:00
|
|
|
left join cc_files as file on (file.id = playout.file_id)";
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 22:02:17 +02:00
|
|
|
$results = Application_Model_Datatables::findEntries($this->con, $select, $historyTable, $opts, "history");
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 22:02:17 +02:00
|
|
|
foreach ($results["history"] as &$row) {
|
|
|
|
$formatter = new LengthFormatter($row['length']);
|
|
|
|
$row['length'] = $formatter->format();
|
|
|
|
}
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 22:02:17 +02:00
|
|
|
return $results;
|
2013-07-03 21:19:05 +02:00
|
|
|
}
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 21:19:05 +02:00
|
|
|
public function insertPlayedItem($schedId) {
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 21:19:05 +02:00
|
|
|
$this->con->beginTransaction();
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 21:19:05 +02:00
|
|
|
try {
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 21:19:05 +02:00
|
|
|
$item = CcScheduleQuery::create()->findPK($schedId, $this->con);
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 21:19:05 +02:00
|
|
|
//TODO figure out how to combine these all into 1 query.
|
|
|
|
$showInstance = $item->getCcShowInstances($this->con);
|
|
|
|
$show = $showInstance->getCcShow($this->con);
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 21:19:05 +02:00
|
|
|
$fileId = $item->getDbFileId();
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 21:19:05 +02:00
|
|
|
//don't add webstreams
|
|
|
|
if (isset($fileId)) {
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 21:19:05 +02:00
|
|
|
//$starts = $item->getDbStarts(null);
|
|
|
|
//$ends = $item->getDbEnds(null);
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 21:19:05 +02:00
|
|
|
$metadata = array();
|
|
|
|
//$metadata["date"] = $starts->format('Y-m-d');
|
|
|
|
//$metadata["start"] = $starts->format('H:i:s');
|
|
|
|
//$metadata["end"] = $ends->format('H:i:s');
|
|
|
|
$metadata["showname"] = $show->getDbName();
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 21:20:40 +02:00
|
|
|
$history = new CcPlayoutHistory();
|
2013-07-03 21:19:05 +02:00
|
|
|
$history->setDbFileId($fileId);
|
|
|
|
$history->setDbStarts($item->getDbStarts(null));
|
|
|
|
$history->setDbEnds($item->getDbEnds(null));
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
/*
|
2013-07-03 21:19:05 +02:00
|
|
|
foreach ($metadata as $key => $val) {
|
2013-07-03 21:20:40 +02:00
|
|
|
$meta = new CcPlayoutHistoryMetaData();
|
|
|
|
$meta->setDbKey($key);
|
2013-07-03 21:19:05 +02:00
|
|
|
$meta->setDbValue($val);
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 21:19:05 +02:00
|
|
|
$history->addCcPlayoutHistoryMetaData($meta);
|
|
|
|
}
|
2013-07-23 00:11:44 +02:00
|
|
|
*/
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 21:19:05 +02:00
|
|
|
$history->save($this->con);
|
|
|
|
}
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-03 21:19:05 +02:00
|
|
|
$this->con->commit();
|
2013-07-18 07:31:20 +02:00
|
|
|
}
|
2013-07-03 21:20:40 +02:00
|
|
|
catch (Exception $e) {
|
|
|
|
$this->con->rollback();
|
|
|
|
throw $e;
|
2013-07-03 21:19:05 +02:00
|
|
|
}
|
|
|
|
}
|
2013-07-18 07:31:20 +02:00
|
|
|
|
|
|
|
/* id is an id in cc_playout_history */
|
2013-07-24 00:01:43 +02:00
|
|
|
public function makeHistoryItemForm($id) {
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
try {
|
|
|
|
$form = new Application_Form_EditHistoryItem();
|
2013-07-31 01:24:05 +02:00
|
|
|
$template = $this->getConfiguredItemTemplate();
|
|
|
|
$required = $this->mandatoryItemFields();
|
|
|
|
$form->createFromTemplate($template["fields"], $required);
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
return $form;
|
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
Logging::info($e);
|
|
|
|
throw $e;
|
|
|
|
}
|
2013-07-09 00:00:02 +02:00
|
|
|
}
|
2013-07-18 07:31:20 +02:00
|
|
|
|
|
|
|
/* id is an id in cc_files */
|
2013-07-09 00:00:02 +02:00
|
|
|
public function makeHistoryFileForm($id) {
|
2013-07-18 07:37:39 +02:00
|
|
|
|
2013-07-18 07:31:20 +02:00
|
|
|
try {
|
|
|
|
$form = new Application_Form_EditHistoryFile();
|
|
|
|
|
|
|
|
$file = Application_Model_StoredFile::RecallById($id, $this->con);
|
|
|
|
$md = $file->getDbColMetadata();
|
|
|
|
|
|
|
|
$form->populate(array(
|
2013-07-18 07:37:39 +02:00
|
|
|
'his_file_id' => $id,
|
|
|
|
'his_file_title' => $md[MDATA_KEY_TITLE],
|
|
|
|
'his_file_creator' => $md[MDATA_KEY_CREATOR],
|
|
|
|
'his_file_composer' => $md[MDATA_KEY_COMPOSER],
|
2013-07-18 07:31:20 +02:00
|
|
|
'his_file_copyright' => $md[MDATA_KEY_COPYRIGHT]
|
|
|
|
));
|
|
|
|
|
2013-07-18 07:37:39 +02:00
|
|
|
return $form;
|
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
2013-07-22 16:45:39 +02:00
|
|
|
Logging::info($e);
|
2013-07-23 00:11:44 +02:00
|
|
|
throw $e;
|
2013-07-18 07:31:20 +02:00
|
|
|
}
|
2013-07-26 17:36:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function populateTemplateItem($values) {
|
|
|
|
|
2013-07-26 23:33:17 +02:00
|
|
|
$this->con->beginTransaction();
|
2013-07-29 14:57:31 +02:00
|
|
|
|
2013-07-26 23:33:17 +02:00
|
|
|
try {
|
2013-07-31 01:24:05 +02:00
|
|
|
$template = $this->getConfiguredItemTemplate();
|
2013-07-29 14:57:31 +02:00
|
|
|
$prefix = Application_Form_EditHistoryItem::ID_PREFIX;
|
2013-07-26 23:33:17 +02:00
|
|
|
$historyRecord = new CcPlayoutHistory();
|
2013-07-29 14:57:31 +02:00
|
|
|
|
2013-07-26 23:33:17 +02:00
|
|
|
$timezoneUTC = new DateTimeZone("UTC");
|
|
|
|
$timezoneLocal = new DateTimeZone($this->timezone);
|
2013-07-29 14:57:31 +02:00
|
|
|
|
|
|
|
$dateTime = new DateTime($values[$prefix."starts"], $timezoneLocal);
|
|
|
|
$dateTime->setTimezone($timezoneUTC);
|
2013-07-26 23:33:17 +02:00
|
|
|
$historyRecord->setDbStarts($dateTime->format("Y-m-d H:i:s"));
|
2013-07-29 14:57:31 +02:00
|
|
|
|
|
|
|
$dateTime = new DateTime($values[$prefix."ends"], $timezoneLocal);
|
2013-07-26 23:33:17 +02:00
|
|
|
$dateTime->setTimezone($timezoneUTC);
|
|
|
|
$historyRecord->setDbEnds($dateTime->format("Y-m-d H:i:s"));
|
2013-07-29 14:57:31 +02:00
|
|
|
|
|
|
|
$templateValues = $values[$prefix."template"];
|
|
|
|
|
|
|
|
$file = $historyRecord->getCcFiles();
|
|
|
|
|
2013-07-31 01:24:05 +02:00
|
|
|
$md = array();
|
2013-07-29 14:59:04 +02:00
|
|
|
$metadata = array();
|
2013-07-31 01:24:05 +02:00
|
|
|
$fields = $template["fields"];
|
|
|
|
$required = $this->mandatoryItemFields();
|
|
|
|
|
|
|
|
for ($i = 0, $len = count($fields); $i < $len; $i++) {
|
|
|
|
|
|
|
|
$field = $fields[$i];
|
|
|
|
$key = $field["name"];
|
|
|
|
|
|
|
|
//required is delt with before this loop.
|
|
|
|
if (in_array($key, $required)) {
|
|
|
|
continue;
|
2013-07-29 14:57:31 +02:00
|
|
|
}
|
2013-07-31 01:24:05 +02:00
|
|
|
|
|
|
|
$isFileMd = $field["isFileMd"];
|
|
|
|
$entry = $templateValues[$prefix.$key];
|
|
|
|
|
|
|
|
if ($isFileMd && isset($file)) {
|
|
|
|
Logging::info("adding metadata associated to a file for {$key}");
|
|
|
|
$md[$key] = $entry;
|
2013-07-29 14:57:31 +02:00
|
|
|
}
|
|
|
|
else {
|
2013-07-31 01:24:05 +02:00
|
|
|
Logging::info("adding metadata for {$key}");
|
|
|
|
$metadata[$key] = $entry;
|
2013-07-29 14:57:31 +02:00
|
|
|
}
|
|
|
|
}
|
2013-07-31 01:24:05 +02:00
|
|
|
|
2013-07-31 01:25:06 +02:00
|
|
|
if (count($md) > 0) {
|
2013-07-31 01:24:05 +02:00
|
|
|
$f = Application_Model_StoredFile::createWithFile($file, $this->con);
|
2013-07-31 01:25:06 +02:00
|
|
|
$f->setDbColMetadata($md);
|
2013-07-29 14:57:31 +02:00
|
|
|
}
|
2013-07-29 14:59:04 +02:00
|
|
|
|
|
|
|
foreach ($metadata as $key => $val) {
|
|
|
|
|
2013-07-31 01:24:05 +02:00
|
|
|
$meta = new CcPlayoutHistoryMetaData();
|
2013-07-29 14:59:04 +02:00
|
|
|
$meta->setDbKey($key);
|
|
|
|
$meta->setDbValue($val);
|
|
|
|
|
|
|
|
$historyRecord->addCcPlayoutHistoryMetaData($meta);
|
|
|
|
}
|
2013-07-29 14:57:31 +02:00
|
|
|
|
|
|
|
$historyRecord->save($this->con);
|
2013-07-26 23:33:17 +02:00
|
|
|
$this->con->commit();
|
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
$this->con->rollback();
|
|
|
|
throw $e;
|
|
|
|
}
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-09 00:00:02 +02:00
|
|
|
}
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
public function createPlayedItem($data) {
|
2013-07-22 16:45:39 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
try {
|
2013-07-24 00:01:43 +02:00
|
|
|
$form = $this->makeHistoryItemForm(null);
|
|
|
|
$history_id = $form->getElement("his_item_id");
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
if ($form->isValid($data)) {
|
2013-07-24 00:01:43 +02:00
|
|
|
$history_id->setIgnore(true);
|
|
|
|
$values = $form->getValues();
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
Logging::info("created list item");
|
|
|
|
Logging::info($values);
|
2013-07-29 14:57:31 +02:00
|
|
|
|
|
|
|
$this->populateTemplateItem($values);
|
2013-07-23 00:11:44 +02:00
|
|
|
}
|
2013-07-24 00:01:43 +02:00
|
|
|
else {
|
|
|
|
Logging::info("created list item NOT VALID");
|
2013-07-31 01:24:05 +02:00
|
|
|
Logging::info($form->getMessages());
|
2013-07-24 00:01:43 +02:00
|
|
|
}
|
2013-07-23 00:11:44 +02:00
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
2013-07-31 01:24:05 +02:00
|
|
|
throw $e;
|
2013-07-23 00:11:44 +02:00
|
|
|
}
|
2013-07-22 16:45:39 +02:00
|
|
|
}
|
|
|
|
|
2013-07-09 00:00:02 +02:00
|
|
|
/* id is an id in cc_playout_history */
|
2013-07-24 00:01:43 +02:00
|
|
|
public function editPlayedItem($data) {
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
try {
|
2013-07-24 00:01:43 +02:00
|
|
|
$id = $data["his_item_id"];
|
|
|
|
$form = $this->makeHistoryItemForm($id);
|
|
|
|
$history_id = $form->getElement("his_item_id");
|
|
|
|
$history_id->setRequired(true);
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
if ($form->isValid($data)) {
|
2013-07-26 17:36:58 +02:00
|
|
|
$history_id->setIgnore(true);
|
2013-07-24 00:01:43 +02:00
|
|
|
$values = $form->getValues();
|
|
|
|
|
|
|
|
Logging::info("edited list item");
|
|
|
|
Logging::info($values);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Logging::info("edited list item NOT VALID");
|
|
|
|
}
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
Logging::info($form->getMessages());
|
2013-07-23 00:11:44 +02:00
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
Logging::info($e);
|
|
|
|
}
|
2013-07-09 00:00:02 +02:00
|
|
|
}
|
2013-07-18 07:31:20 +02:00
|
|
|
|
2013-07-09 00:00:02 +02:00
|
|
|
/* id is an id in cc_files */
|
2013-07-18 07:31:20 +02:00
|
|
|
public function editPlayedFile($data) {
|
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
$this->con->beginTransaction();
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
try {
|
|
|
|
$form = new Application_Form_EditHistoryFile();
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
$json = $form->processAjax($data);
|
|
|
|
Logging::info($json);
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
if ($form->isValid($data)) {
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
$id = $data["his_file_id"];
|
|
|
|
$file = Application_Model_StoredFile::RecallById($id, $this->con);
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
$md = array(
|
|
|
|
MDATA_KEY_TITLE => $data['his_file_title'],
|
|
|
|
MDATA_KEY_CREATOR => $data['his_file_creator'],
|
|
|
|
MDATA_KEY_COMPOSER => $data['his_file_composer'],
|
|
|
|
MDATA_KEY_COPYRIGHT => $data['his_file_copyright']
|
|
|
|
);
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
$file->setDbColMetadata($md);
|
|
|
|
}
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
$this->con->commit();
|
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
$this->con->rollback();
|
|
|
|
Logging::info($e);
|
|
|
|
throw $e;
|
|
|
|
}
|
2013-07-18 07:31:20 +02:00
|
|
|
|
|
|
|
return $json;
|
2013-07-09 00:00:02 +02:00
|
|
|
}
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
/* id is an id in cc_playout_history */
|
|
|
|
public function deletePlayedItem($id) {
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
$this->con->beginTransaction();
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
try {
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
$record = CcPlayoutHistoryQuery::create()->findPk($id, $this->con);
|
|
|
|
$record->delete($this->con);
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-24 00:01:43 +02:00
|
|
|
$this->con->commit();
|
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
$this->con->rollback();
|
|
|
|
Logging::info($e);
|
|
|
|
throw $e;
|
|
|
|
}
|
|
|
|
}
|
2013-07-26 17:36:58 +02:00
|
|
|
|
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
//---------------- Following code is for History Templates --------------------------//
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-29 14:57:31 +02:00
|
|
|
public function getFieldTypes() {
|
|
|
|
|
|
|
|
$fields = array(
|
2013-07-29 14:59:04 +02:00
|
|
|
TEMPLATE_DATE,
|
|
|
|
TEMPLATE_TIME,
|
|
|
|
TEMPLATE_DATETIME,
|
|
|
|
TEMPLATE_STRING,
|
|
|
|
TEMPLATE_BOOLEAN,
|
|
|
|
TEMPLATE_INT,
|
2013-07-29 14:57:31 +02:00
|
|
|
TEMPLATE_FLOAT,
|
|
|
|
);
|
|
|
|
|
|
|
|
return $fields;
|
|
|
|
}
|
2013-07-29 22:31:01 +02:00
|
|
|
|
|
|
|
public function getFileMetadataTypes() {
|
|
|
|
|
2013-07-29 22:32:05 +02:00
|
|
|
$fileMD = array(
|
|
|
|
array("name"=> MDATA_KEY_TITLE, "type"=> TEMPLATE_STRING),
|
|
|
|
array("name"=> MDATA_KEY_CREATOR, "type"=> TEMPLATE_STRING),
|
|
|
|
array("name"=> MDATA_KEY_SOURCE, "type"=> TEMPLATE_STRING),
|
|
|
|
array("name"=> MDATA_KEY_DURATION, "type"=> TEMPLATE_STRING),
|
|
|
|
array("name"=> MDATA_KEY_GENRE, "type"=> TEMPLATE_STRING),
|
|
|
|
array("name"=> MDATA_KEY_MOOD, "type"=> TEMPLATE_STRING),
|
|
|
|
array("name"=> MDATA_KEY_LABEL, "type"=> TEMPLATE_STRING),
|
|
|
|
array("name"=> MDATA_KEY_COMPOSER, "type"=> TEMPLATE_STRING),
|
|
|
|
array("name"=> MDATA_KEY_ISRC, "type"=> TEMPLATE_STRING),
|
|
|
|
array("name"=> MDATA_KEY_COPYRIGHT, "type"=> TEMPLATE_STRING),
|
|
|
|
array("name"=> MDATA_KEY_YEAR, "type"=> TEMPLATE_INT),
|
|
|
|
array("name"=> MDATA_KEY_TRACKNUMBER, "type"=> TEMPLATE_INT),
|
|
|
|
array("name"=> MDATA_KEY_CONDUCTOR, "type"=> TEMPLATE_STRING),
|
2013-07-29 22:31:01 +02:00
|
|
|
array("name"=> MDATA_KEY_LANGUAGE, "type"=> TEMPLATE_STRING),
|
|
|
|
);
|
|
|
|
|
|
|
|
return $fileMD;
|
|
|
|
}
|
2013-07-29 14:57:31 +02:00
|
|
|
|
2013-07-31 01:24:05 +02:00
|
|
|
public function mandatoryItemFields() {
|
2013-07-29 14:57:31 +02:00
|
|
|
|
2013-07-31 01:24:05 +02:00
|
|
|
$fields = array("starts", "ends");
|
2013-07-29 14:57:31 +02:00
|
|
|
|
|
|
|
return $fields;
|
|
|
|
}
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
private function defaultItemTemplate() {
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-31 01:24:05 +02:00
|
|
|
$template = array();
|
2013-07-23 00:11:44 +02:00
|
|
|
$fields = array();
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-29 14:59:04 +02:00
|
|
|
$fields[] = array("name" => "starts", "type" => TEMPLATE_DATETIME, "isFileMd" => false);
|
2013-07-29 14:57:31 +02:00
|
|
|
$fields[] = array("name" => "ends", "type" => TEMPLATE_DATETIME, "isFileMd" => false);
|
2013-07-23 00:11:44 +02:00
|
|
|
$fields[] = array("name" => MDATA_KEY_TITLE, "type" => TEMPLATE_STRING, "isFileMd" => true); //these fields can be populated from an associated file.
|
2013-07-26 17:36:58 +02:00
|
|
|
$fields[] = array("name" => MDATA_KEY_CREATOR, "type" => TEMPLATE_STRING, "isFileMd" => true);
|
|
|
|
|
2013-07-31 01:24:05 +02:00
|
|
|
$template["name"] = "";
|
|
|
|
$template["fields"] = $fields;
|
|
|
|
|
|
|
|
return $template;
|
2013-07-23 00:11:44 +02:00
|
|
|
}
|
2013-07-31 01:24:05 +02:00
|
|
|
|
|
|
|
private function loadTemplate($id) {
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-31 01:25:06 +02:00
|
|
|
try {
|
2013-07-31 01:24:05 +02:00
|
|
|
$template = CcPlayoutHistoryTemplateQuery::create()->findPk($id, $this->con);
|
|
|
|
|
|
|
|
$c = new Criteria();
|
|
|
|
$c->addAscendingOrderByColumn(CcPlayoutHistoryTemplateFieldPeer::POSITION);
|
|
|
|
$config = $template->getCcPlayoutHistoryTemplateFields($c, $this->con);
|
|
|
|
$fields = array();
|
|
|
|
|
|
|
|
foreach ($config as $item) {
|
|
|
|
|
|
|
|
$fields[] = array(
|
|
|
|
"name" => $item->getDbName(),
|
|
|
|
"type" => $item->getDbType(),
|
|
|
|
"isFileMd" => $item->getDbIsFileMD(),
|
|
|
|
"id" => $item->getDbId()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$data = array();
|
|
|
|
$data["name"] = $template->getDbName();
|
|
|
|
$data["fields"] = $fields;
|
|
|
|
|
2013-07-31 01:25:06 +02:00
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
throw $e;
|
2013-07-31 01:24:05 +02:00
|
|
|
}
|
|
|
|
}
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-31 01:24:05 +02:00
|
|
|
public function getItemTemplate($id) {
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-31 01:24:05 +02:00
|
|
|
if (is_numeric($id)) {
|
|
|
|
Logging::info("template id is: $id");
|
|
|
|
$template = $this->loadTemplate($id);
|
2013-07-23 00:11:44 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
Logging::info("Using default template");
|
|
|
|
$template = $this->defaultItemTemplate();
|
|
|
|
}
|
2013-07-26 17:36:58 +02:00
|
|
|
|
2013-07-23 00:11:44 +02:00
|
|
|
return $template;
|
|
|
|
}
|
2013-07-29 23:21:46 +02:00
|
|
|
|
2013-07-31 01:24:05 +02:00
|
|
|
public function getListItemTemplates() {
|
|
|
|
|
|
|
|
$list = array();
|
2013-07-31 01:25:06 +02:00
|
|
|
|
2013-07-31 01:24:05 +02:00
|
|
|
try {
|
|
|
|
|
|
|
|
$templates = CcPlayoutHistoryTemplateQuery::create()
|
|
|
|
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
|
|
|
|
->findByDbType(self::TEMPLATE_TYPE_ITEM);
|
|
|
|
|
|
|
|
foreach ($templates as $template) {
|
|
|
|
$list[$template->getDbId()] = $template->getDbName();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $list;
|
2013-07-31 01:25:06 +02:00
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
throw $e;
|
2013-07-31 01:24:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-31 23:38:48 +02:00
|
|
|
public function getDatatablesPlayedItemColumns() {
|
|
|
|
|
|
|
|
try {
|
|
|
|
//{"sTitle": $.i18n._("Start"), "mDataProp": "starts", "sClass": "his_starts"}
|
2013-07-31 23:39:45 +02:00
|
|
|
|
2013-07-31 23:38:48 +02:00
|
|
|
$template = $this->getConfiguredItemTemplate();
|
|
|
|
|
|
|
|
$columns = array();
|
|
|
|
|
|
|
|
foreach ($template["fields"] as $index=>$field) {
|
|
|
|
|
|
|
|
$key = $field["name"];
|
|
|
|
|
|
|
|
$columns[] = array(
|
|
|
|
"sTitle"=> $key,
|
|
|
|
"mDataProp"=> $key,
|
|
|
|
"sClass"=> "his_{$key}"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-07-31 23:39:45 +02:00
|
|
|
return $columns;
|
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
throw $e;
|
2013-07-31 23:38:48 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-31 01:25:06 +02:00
|
|
|
public function getConfiguredItemTemplate() {
|
|
|
|
try {
|
2013-07-31 01:24:05 +02:00
|
|
|
$id = Application_Model_Preference::GetHistoryItemTemplate();
|
2013-07-31 01:25:06 +02:00
|
|
|
return $this->getItemTemplate($id);
|
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
throw $e;
|
|
|
|
}
|
2013-07-31 01:24:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setConfiguredItemTemplate($id) {
|
|
|
|
try {
|
|
|
|
Application_Model_Preference::SetHistoryItemTemplate($id);
|
|
|
|
}
|
2013-07-31 01:25:06 +02:00
|
|
|
catch (Exception $e) {
|
|
|
|
throw $e;
|
2013-07-31 01:24:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-29 23:35:07 +02:00
|
|
|
public function createItemTemplate($config) {
|
2013-07-29 23:21:46 +02:00
|
|
|
|
2013-07-29 23:22:44 +02:00
|
|
|
$this->con->beginTransaction();
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
$template = new CcPlayoutHistoryTemplate();
|
2013-07-29 23:35:07 +02:00
|
|
|
$template->setDbName($config["name"]);
|
2013-07-31 01:24:05 +02:00
|
|
|
$template->setDbType(self::TEMPLATE_TYPE_ITEM);
|
2013-07-29 23:35:07 +02:00
|
|
|
|
|
|
|
$fields = $config["fields"];
|
|
|
|
|
|
|
|
foreach ($fields as $index=>$field) {
|
|
|
|
|
2013-07-31 01:24:05 +02:00
|
|
|
$isMd = ($field["filemd"] == 'true') ? true : false;
|
|
|
|
|
2013-07-29 23:35:07 +02:00
|
|
|
$templateField = new CcPlayoutHistoryTemplateField();
|
|
|
|
$templateField->setDbName($field["name"]);
|
|
|
|
$templateField->setDbType($field["type"]);
|
2013-07-31 01:24:05 +02:00
|
|
|
$templateField->setDbIsFileMD($isMd);
|
2013-07-29 23:35:07 +02:00
|
|
|
$templateField->setDbPosition($index);
|
|
|
|
|
|
|
|
$template->addCcPlayoutHistoryTemplateField($templateField);
|
|
|
|
}
|
|
|
|
|
|
|
|
$template->save($this->con);
|
2013-07-29 23:22:44 +02:00
|
|
|
|
2013-07-31 01:24:05 +02:00
|
|
|
$doSetDefault = $config['setDefault'];
|
|
|
|
if (isset($doSetDefault) && $doSetDefault) {
|
|
|
|
$this->setConfiguredItemTemplate($template->getDbid());
|
|
|
|
}
|
|
|
|
|
2013-07-29 23:22:44 +02:00
|
|
|
$this->con->commit();
|
|
|
|
}
|
2013-07-31 01:25:06 +02:00
|
|
|
catch (Exception $e) {
|
|
|
|
$this->con->rollback();
|
|
|
|
throw $e;
|
2013-07-31 01:24:05 +02:00
|
|
|
}
|
2013-07-29 23:21:46 +02:00
|
|
|
}
|
2013-07-03 21:19:05 +02:00
|
|
|
|
|
|
|
}
|