CC-3174 : showbuilder

adding a showbuilder form, can filter by show,
or if you're a host user by all shows you can schedule in a range.
This commit is contained in:
Naomi Aro 2012-02-15 00:39:27 +01:00
parent eba84ee878
commit b1fbeeb448
14 changed files with 207 additions and 237 deletions

View file

@ -303,7 +303,7 @@ class Application_Model_Schedule {
* @return array $scheduledItems
*
*/
public static function GetScheduleDetailItems($p_startDateTime, $p_endDateTime)
public static function GetScheduleDetailItems($p_startDateTime, $p_endDateTime, $p_shows)
{
global $CC_CONFIG, $CC_DBC;
@ -328,9 +328,13 @@ class Application_Model_Schedule {
WHERE si.modified_instance = false AND
si.starts >= '{$p_startDateTime}' AND si.starts < '{$p_endDateTime}'
si.starts >= '{$p_startDateTime}' AND si.starts < '{$p_endDateTime}'";
ORDER BY si.starts, sched.starts;";
if (count($p_shows) > 0) {
$sql .= " AND show_id IN (".implode(",", $p_shows).")";
}
$sql .= " ORDER BY si.starts, sched.starts;";
Logging::log($sql);

View file

@ -6,6 +6,7 @@ class Application_Model_ShowBuilder {
private $startDT;
private $endDT;
private $user;
private $opts;
private $contentDT;
@ -28,12 +29,13 @@ class Application_Model_ShowBuilder {
* @param DateTime $p_startsDT
* @param DateTime $p_endsDT
*/
public function __construct($p_startDT, $p_endDT) {
public function __construct($p_startDT, $p_endDT, $p_opts) {
$this->startDT = $p_startDT;
$this->endDT = $p_endDT;
$this->timezone = date_default_timezone_get();
$this->user = Application_Model_User::GetCurrentUser();
$this->opts = $p_opts;
}
/*
@ -165,7 +167,23 @@ class Application_Model_ShowBuilder {
$current_id = -1;
$display_items = array();
$scheduled_items = Application_Model_Schedule::GetScheduleDetailItems($this->startDT->format("Y-m-d H:i:s"), $this->endDT->format("Y-m-d H:i:s"));
$shows = array();
if ($this->opts["myShows"] === 1) {
$host_shows = CcShowHostsQuery::create()
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
->filterByDbHost($this->user->getId())
->find();
foreach ($host_shows as $host_show) {
$shows[] = $host_show->getDbShow();
}
}
else if ($this->opts["showFilter"] !== 0) {
$shows[] = $this->opts["showFilter"];
}
$scheduled_items = Application_Model_Schedule::GetScheduleDetailItems($this->startDT->format("Y-m-d H:i:s"), $this->endDT->format("Y-m-d H:i:s"), $shows);
for ($i = 0, $rows = count($scheduled_items); $i < $rows; $i++) {