Updated Show model to include show image path

This commit is contained in:
Duncan Sommerville 2014-09-16 18:28:39 -04:00
parent 940d74ce39
commit 3f754c032a
2 changed files with 47 additions and 42 deletions

View file

@ -130,48 +130,45 @@ class Application_Model_RabbitMq
} }
/** public static function SendMessageToHaproxyConfigDaemon($md){
* Disabled to prevent warnings about /etc/airtime-saas/rabbitmq.ini $config = parse_ini_file("/etc/airtime-saas/rabbitmq.ini", true);
*/ $conn = new AMQPConnection($config["rabbitmq"]["host"],
// public static function SendMessageToHaproxyConfigDaemon($md){ $config["rabbitmq"]["port"],
// $config = parse_ini_file("/etc/airtime-saas/rabbitmq.ini", true); $config["rabbitmq"]["user"],
// $conn = new AMQPConnection($config["rabbitmq"]["host"], $config["rabbitmq"]["password"],
// $config["rabbitmq"]["port"], $config["rabbitmq"]["vhost"]);
// $config["rabbitmq"]["user"],
// $config["rabbitmq"]["password"],
// $config["rabbitmq"]["vhost"]);
// $exchange = $config["rabbitmq"]["queue"]; $exchange = $config["rabbitmq"]["queue"];
// $queue = $config["rabbitmq"]["queue"]; $queue = $config["rabbitmq"]["queue"];
// $ch = $conn->channel(); $ch = $conn->channel();
// /* /*
// name: $queue name: $queue
// passive: false passive: false
// durable: true // the queue will survive server restarts durable: true // the queue will survive server restarts
// exclusive: false // the queue can be accessed in other channels exclusive: false // the queue can be accessed in other channels
// auto_delete: false //the queue won't be deleted once the channel is closed. auto_delete: false //the queue won't be deleted once the channel is closed.
// */ */
// $ch->queue_declare($queue, false, true, false, false); $ch->queue_declare($queue, false, true, false, false);
// /* /*
// name: $exchange name: $exchange
// type: direct type: direct
// passive: false passive: false
// durable: true // the exchange will survive server restarts durable: true // the exchange will survive server restarts
// auto_delete: false //the exchange won't be deleted once the channel is closed. auto_delete: false //the exchange won't be deleted once the channel is closed.
// */ */
// $ch->exchange_declare($exchange, 'direct', false, true, false); $ch->exchange_declare($exchange, 'direct', false, true, false);
// $ch->queue_bind($queue, $exchange); $ch->queue_bind($queue, $exchange);
// $data = json_encode($md).PHP_EOL; $data = json_encode($md).PHP_EOL;
// $msg = new AMQPMessage($data, array('content_type' => 'application/json')); $msg = new AMQPMessage($data, array('content_type' => 'application/json'));
// $ch->basic_publish($msg, $exchange); $ch->basic_publish($msg, $exchange);
// $ch->close(); $ch->close();
// $conn->close(); $conn->close();
// } }
} }

View file

@ -879,6 +879,7 @@ SELECT si1.starts AS starts,
show.name AS name, show.name AS name,
show.color AS color, show.color AS color,
show.background_color AS background_color, show.background_color AS background_color,
show.image_path AS image_path,
show.linked AS linked, show.linked AS linked,
si1.file_id AS file_id, si1.file_id AS file_id,
si1.id AS instance_id, si1.id AS instance_id,
@ -1080,6 +1081,7 @@ SELECT si.starts AS start_timestamp,
si.id AS instance_id, si.id AS instance_id,
si.record, si.record,
s.url, s.url,
s.image_path,
starts, starts,
ends ends
FROM cc_show_instances si FROM cc_show_instances si
@ -1121,8 +1123,8 @@ SQL;
$CC_CONFIG = Config::getConfig(); $CC_CONFIG = Config::getConfig();
$con = Propel::getConnection(); $con = Propel::getConnection();
//
//TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin //TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
$sql = <<<SQL $sql = <<<SQL
SELECT si.starts AS start_timestamp, SELECT si.starts AS start_timestamp,
si.ends AS end_timestamp, si.ends AS end_timestamp,
@ -1131,6 +1133,7 @@ SELECT si.starts AS start_timestamp,
si.id AS instance_id, si.id AS instance_id,
si.record, si.record,
s.url, s.url,
s.image_path,
starts, starts,
ends ends
FROM cc_show_instances si FROM cc_show_instances si
@ -1181,6 +1184,7 @@ SQL;
"starts" => $rows[$i-1]['starts'], "starts" => $rows[$i-1]['starts'],
"ends" => $rows[$i-1]['ends'], "ends" => $rows[$i-1]['ends'],
"record" => $rows[$i-1]['record'], "record" => $rows[$i-1]['record'],
"image_path" => $rows[$i-1]['image_path'],
"type" => "show"); "type" => "show");
} }
@ -1197,7 +1201,8 @@ SQL;
"starts" => $rows[$i+1]['starts'], "starts" => $rows[$i+1]['starts'],
"ends" => $rows[$i+1]['ends'], "ends" => $rows[$i+1]['ends'],
"record" => $rows[$i+1]['record'], "record" => $rows[$i+1]['record'],
"type" => "show"); "image_path" => $rows[$i+1]['image_path'],
"type" => "show");
} }
break; break;
} }
@ -1217,7 +1222,8 @@ SQL;
"starts" => $rows[$i]['starts'], "starts" => $rows[$i]['starts'],
"ends" => $rows[$i]['ends'], "ends" => $rows[$i]['ends'],
"record" => $rows[$i]['record'], "record" => $rows[$i]['record'],
"type" => "show"); "image_path" => $rows[$i]['image_path'],
"type" => "show");
break; break;
} }
} }
@ -1233,7 +1239,8 @@ SQL;
"starts" => $rows[$previousShowIndex]['starts'], "starts" => $rows[$previousShowIndex]['starts'],
"ends" => $rows[$previousShowIndex]['ends'], "ends" => $rows[$previousShowIndex]['ends'],
"record" => $rows[$previousShowIndex]['record'], "record" => $rows[$previousShowIndex]['record'],
"type" => "show"); "image_path" => $rows[$previousShowIndex]['image_path'],
"type" => "show");
} }
return $results; return $results;
@ -1268,7 +1275,8 @@ SELECT si.starts AS start_timestamp,
si.id AS instance_id, si.id AS instance_id,
si.record, si.record,
s.url, s.url,
starts, s.image_path,
starts,
ends ends
FROM cc_show_instances si FROM cc_show_instances si
LEFT JOIN cc_show s LEFT JOIN cc_show s