cc-4347: PDO'd: GetLastShowInstance
This commit is contained in:
parent
737c3fcbae
commit
57aae73074
1 changed files with 10 additions and 15 deletions
|
@ -754,22 +754,17 @@ SQL;
|
||||||
|
|
||||||
public static function GetLastShowInstance($p_timeNow)
|
public static function GetLastShowInstance($p_timeNow)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
$sql = <<<SQL
|
||||||
$con = Propel::getConnection();
|
SELECT si.id
|
||||||
|
FROM cc_show_instances si
|
||||||
|
WHERE si.ends < :timeNow::TIMESTAMP
|
||||||
|
AND si.modified_instance = 'f'
|
||||||
|
ORDER BY si.ends DESC LIMIT 1;
|
||||||
|
SQL;
|
||||||
|
$id = Application_Common_Database( $sql, array(
|
||||||
|
':timeNow' => $p_timeNow ), 'column' );
|
||||||
|
|
||||||
$sql = "SELECT si.id"
|
return ($id ? new Application_Model_ShowInstance($id) : null );
|
||||||
." FROM $CC_CONFIG[showInstances] si"
|
|
||||||
." WHERE si.ends < TIMESTAMP '$p_timeNow'"
|
|
||||||
." AND si.modified_instance = 'f'"
|
|
||||||
." ORDER BY si.ends DESC"
|
|
||||||
." LIMIT 1";
|
|
||||||
|
|
||||||
$id = $con->query($sql)->fetchColumn(0);
|
|
||||||
if ($id) {
|
|
||||||
return new Application_Model_ShowInstance($id);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetCurrentShowInstance($p_timeNow)
|
public static function GetCurrentShowInstance($p_timeNow)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue