public function load($chatId, $editorialId = null, $portal = null) { $sql = 'CALL `admin_editorial_fetch`(:chatId, :editorialId, :portalId)'; $stmt = Zend_Registry::get('dbh')->prepare($sql); $stmt->bindParam(':chatId', $chatId, PDO::PARAM_INT); $stmt->bindParam(':editorialId', $editorialId, PDO::PARAM_INT); $stmt->bindParam(':portalId', $portal->id, PDO::PARAM_INT); try { $stmt->execute(); $result = $stmt->fetchAll(Zend_Db::FETCH_OBJ); $stmt->closeCursor(); $editorials = array(); foreach ($result as $row) { $editorial = new Showcase_Content_Editorial(); $editorial->unlock(Showcase_Admin::getInstance()); $editorial->id = $row->editorial; $editorial->chatId = $row->chat; $editorial->headline = $row->headline; $editorial->alias = $row->alias; $editorial->sponsor = Showcase_Sponsor::factory($row->sponsorId, $row->sponsorName, $row->sponsorUrl); $editorial->channel = Showcase_Channel::factory($portal, $row->channel); $editorial->lock(); $editorials[$editorial->id] = $editorial; } return $editorials; } catch (Zend_Db_Statement_Exception $e) { echo $e->getMessage(); } }
public function __construct() { // check that the Admin object exists. This is the thing with all the save power so it's pretty uber if (!Showcase_Admin::getInstance()) { die("You cannot instantiate an admin helper without the appropriate permissions. Which you don't have!"); } }