public static function getAllMessage($mediaType, $canalId) { $dbMgr = DbManager::getInstance(); //Instancier le gestionnaire $db = $dbMgr->getConn('game'); //Demander la connexion existante $titreEmission = Member_MediaFactory::getAllEmissionName($mediaType, $canalId); $result = array(); $query = 'SELECT *' . ' FROM `' . DB_PREFIX . 'media`' . ' WHERE `mediaType` = :mediaType' . ' AND `canalId` = :canalId' . ' AND `titre` = :titre' . ' ORDER BY `date` DESC;'; $prep = $db->prepare($query); $prep->bindValue(':mediaType', $mediaType, PDO::PARAM_STR); $prep->bindValue(':canalId', $canalId, PDO::PARAM_INT); foreach ($titreEmission as $titre) { $prep->bindValue(':titre', $titre['titre'], PDO::PARAM_STR); $prep->execute($db, __FILE__, __LINE__); $arrAll = $prep->fetchAll(); foreach ($arrAll as $arr) { $arr['date'] = fctToGameTime($arr['date']); $arr['message'] = BBCodes($arr['message'], false, true, true); $result[] = $arr; } } $prep->closeCursor(); $prep = NULL; return $result; }
private static function delete($mediaType, $canalId) { $messages = Member_MediaFactory::getAllMessage($mediaType, $canalId); foreach ($messages as $mes) { if (isset($_POST[$mes['id']])) { Member_MediaFactory::deleteMessage($mes['id']); } } }
public static function generatePage(&$tpl, &$session, &$account, &$mj) { $mediaList = Member_MediaFactory::getExistMediaList(); if (!empty($mediaList)) { $tpl->set('MEDIA_LIST', $mediaList); } //Retourner le template complété/rempli return $tpl->fetch($account->getSkinRemotePhysicalPath() . 'html/Mj/Lieu/Medias.htm', __FILE__, __LINE__); }
/** Retourne le contenu du média accessible * * @return array */ public function getMediaContenu($type, $channel) { if ($this->mediaType != 'tous') { if ($this->mediaType != $type) { throw new GameException('Type de média non supporté par l\'item ' . $this->invId . '.'); return; } } return Member_MediaFactory::getAllMessage($type, $channel); }
public function getMediaContenu() { return Member_MediaFactory::getAllMessage($this->mediaType, $this->channelId); }