/** * Counts clips * * @param string $listtype * @return int */ public function countClips($listtype, $plugin = 'video') { switch ($listtype) { case 'featured': $featuredDao = VIDEO_BOL_ClipFeaturedDao::getInstance(); $query = "\n SELECT COUNT(`c`.`id`) \n FROM `" . $this->getTableName() . "` AS `c`\n LEFT JOIN `" . $featuredDao->getTableName() . "` AS `f` ON ( `c`.`id` = `f`.`clipId` )\n WHERE `c`.`status` = 'approved' AND `c`.`privacy` = 'everybody' AND `f`.`id` IS NOT NULL\n AND `c`.`plugin` = '" . $plugin . "'\n "; return $this->dbo->queryForColumn($query); break; case 'latest': $example = new OW_Example(); $example->andFieldEqual('status', 'approved'); $example->andFieldEqual('privacy', 'everybody'); $example->andFieldEqual('plugin', $plugin); return $this->countByExample($example); break; } return null; }
/** * Class constructor * */ private function __construct() { $this->clipDao = VIDEO_BOL_ClipDao::getInstance(); $this->clipFeaturedDao = VIDEO_BOL_ClipFeaturedDao::getInstance(); }