<?php
namespace TheatreCore\Repository;
use TheatreCore\Classes\Images\Images;
use TheatreCore\Entity\Dvdformats;
use TheatreCore\Entity\Dvds;
use TheatreCore\Entity\Dvdtechnos;
use TheatreCore\Entity\Dvdzones;
use TheatreCore\Entity\Multimedias;
use TheatreCore\Traits\TheatreTrait;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\ORM\Query;
/**
* DvdsRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class DvdsRepository extends ServiceEntityRepository
{
use TheatreTrait {
getRelationsArray as protected getRelationsArrayTrait;
getLinkedObject as protected getLinkedObjectTrait;
}
// les relations
public $array_types = array('moviedirector', 'author', 'director', 'intervenant', 'comedien', 'tournage', 'spectacle', 'multimedia', 'production', 'editeur');
private $em;
public $__table;
public $__table_object;
public $__idtable;
public function __construct(ManagerRegistry $registry, Images $images)
{
parent::__construct($registry, Dvds::class);
$this->__table = $this->getClassMetadata()->getTableName();
$this->__table_object = $this->getClassMetadata()->name;
$this->images = $images;
$this->__idtable = $this->getClassMetadata()->getSingleIdentifierFieldName();
// $this->__table = 'persons';
// $this->__table_object = '\\App\\Entity\\Persons';
}
// {{{ findData()
/** Recherche des dvds
*
* Permet de rechercher des dvds en fonction de certains critères :
* la première lettre, un bout du nom, le type de multimedia, si il est en ligne ou pas
*
* @access public
* @see Theatre::find()
*/
public function findData($publish = null, $keywords = null, $idobject = null, $object = null)
{
// requete perso
$query = null;
$con = $this->getEntityManager();
$query = $con->getRepository(Dvds::class)->createQueryBuilder('e');
if ($this->getCount()) {
$query->select('COUNT(e.iddvd)');
$this->setCount(false);
return $query;
}
// parametre
// if(isset($_REQUEST['iddvd']) && !empty($_REQUEST['iddvd'])) {
// $iddvd = $_REQUEST['iddvd'];
// }
//
// if(isset($_REQUEST['keywords']) && $_REQUEST['keywords']!='nom' && !empty($_REQUEST['keywords'])) {
// $keywords = $_REQUEST['keywords'];
// }
//
// if(isset($_REQUEST['publish']) && !empty($_REQUEST['publish'])) {
// $publish = $_REQUEST['publish'];
// }
//
// //recherche stricte par id
// if(!empty($iddvd)) {
// $this->whereAdd($this->__table.'.'.$this->__idtable.'='.((int)$iddvd));
// }
//
// // mots cles
// if (!empty($keywords)) {
// $this->whereAdd($this->__table.'.title LIKE \'%'.$this->escape($keywords).'%\'');
// }
//
// // selectionne les fiches hors ligne
// if (!empty($publish) && $publish=='no') {
// $this->whereAdd($this->__table.'.publish=0');
// }
// on lance la recherche
$this->specialQuery($query);
}
// }}}
// {{{ setToArray()
/** Liste des multimedias dans un tableau associatif
*
* Tableau associatif notament utilisé pour lister les informations sur les multimedias
* Utile pour générer les tableaux HTML de listes de multimedias
*
* @access public
* @return array
* @see findData()
*/
public function setToArray($spec = true)
{
if ($spec == true) {
$this->findData();
}
$values = array();
$color = null;
$nb = 0;
while ($this->fetch()) {
// valeurs de l'enregistrement
$values[$nb] = $this->getInfosDvd();
// couleur de ligne alternative
$color = $this->colorAlternate($color);
$values[$nb]['colorline'] = $color;
$values[$nb]['id'] = $this->iddvd;
$nb++;
}
return $values;
}
// }}}
// {{{ orderByDefaut()
/** Classement par défaut
*
* Défini le tri par défaut pour les requêtes de type SELECT
*
* @access public
* @return string
*/
public function orderByDefaut($order = null)
{
// tri par défaut
if (empty($order)) {
$order = 'iddvd';
}
return $order;
}
// }}}
// {{{ getInfosDvd()
/** Informations sur un dvd
*
* @access public
* @param int $iddvd numero de la fiche DVD
* @return array les infos sous forme de tableau
*/
public function getInfosDvd($iddvd = null, $params_data = array(), $params_display = array())
{
$conn = $this->getEntityManager();
$infos = array();
////////////// infos de la table
if (!isset($this->iddvd) || empty($this->iddvd)) {
if (!empty($iddvd)) {
if (!$infos = $this->get($iddvd)) {
return array();
}
}
} else {
$infos = $this->createQueryBuilder('e')
->select('e')
->andWhere('e.iddvd = :iddvd')
->setParameter('iddvd', $iddvd)
->getQuery()
->getSingleResult(Query::HYDRATE_ARRAY);
/*$infos = array(
'iddvd' => $this->iddvd,
'title' => $this->title,
'time_movie' => $this->time_movie,
);*/
}
// retourne toutes les infos liées
if (!empty($params_data['all'])) {
$recordedDvd = $this->createQueryBuilder('e')
->where('e.iddvd = :iddvd')
->setParameter('iddvd', $iddvd)
->getQuery()
->getSingleResult();
$recordedIdDvdzone = $recordedDvd->getIddvdzone()->getIddvdzone();
$recordedIdDvdformat = $recordedDvd->getIddvdformat()->getIddvdformat();
$recordedIdDvdtechno = $recordedDvd->getIddvdtechno()->getIddvdtechno();
// les infos zone, techno, format...
foreach (array('zone', 'techno', 'format') as $t) {
if (!empty(${'recordedIdDvd' . $t})) {
$infos['iddvd' . $t] = ${'recordedIdDvd' . $t};
}
if (!empty($infos['iddvd' . $t])) {
//$f = getDvd.$t;
$infos[$t] = $conn->getRepository('TheatreCore\Entity\Dvd' . $t . 's')->{'getDvd' . $t}($infos['iddvd' . $t]);
}
}
// les ralations
foreach ($this->array_types as $t) {
$infos['dvd_' . $t] = $this->noPunct($this->getLinkedObjectTrait($this->getRelationsArray('dvd_' . $t), $iddvd, 'dvd_' . $t, 'dvds'));
}
// voir si VOD
if (!empty($infos['dvd_multimedia'])) {
foreach ($infos['dvd_multimedia'] as $km => $vm) {
if (!empty($vm['price'])) {
$infos['vod'] = $vm;
break;
}
}
}
if (!empty($params_display['vignette_format'])) {
$infos['vignette'] = $this->getVignetteDvd($iddvd, $params_display['vignette_format']);
} else {
$infos['vignette'] = $this->getVignetteDvd($iddvd);
}
}
// récupèrer le détail des éléments multimedias associés
if (!empty($params_data['multimedias']) && !empty($infos['dvd_multimedia'])) {
$multimedias = $conn->getRepository(Multimedias::class);
foreach ($infos['dvd_multimedia'] as $m) {
$ids_multimedia[] = $m['idmultimedia'];
$infos['multimedias'][$m['idmultimedia']] = $multimedias->getInfosMultimedia($m['idmultimedia']);
}
$infos['multimedias'] = $multimedias->getListMultimedias(array(
'where' => array(array('multimedias', 'idmultimedia', $ids_multimedia)),
'dbg' => array('rech', 'Vidéos liées au DVD'),
));
}
if (!empty($infos['comments'])) {
$infos['description'] = $this->wikiTransform($infos['comments']);
}
if (!empty($infos['date_shooting']) && $infos['date_shooting'] != '0000-00-00 00:00:00') {
$infos['date_shooting_str'] = $this->getFormeDate($infos['date_shooting'], "%B %Y", true);
}
if (!empty($infos['place_shooting']) || !empty($infos['dvd_tournage'])) {
$infos['place_shooting_exist'] = true;
}
return $infos;
}
// }}}
// {{{ getItemsList()
/** Liste des items pour les champs relationnels
*
* Retourne un tableau associatif contenant la liste des items d'une relation
*
* @access public
* @param string $type Ce qu'on recherche
* @param string $idtext L'id de l'objet
* @return array
*/
public function getItemsList($iddvd, $type)
{
// fausse relation
if ($type == 'add_from_spectacle') {
return array();
}
$type_search = str_replace('dvd_', '', $type);
if (in_array($type_search, $this->array_types)) {
return $this->getLinkedObject($this->getRelationsArray($type), $iddvd, $type, 'dvds');
} else {
return 'Aucune fonction de recherche pour le type <strong>' . $type . '</strong> dans la méthode !';
}
}
// }}}
// {{{ getRelationsArray()
/** Tableau des relations
*
* @access public
* @param string|int $type le type de champ
*/
public function getRelationsArray($type = null)
{
// récupérer les relations communes
$array_types = $this->getRelationsArrayTrait('all');
$persons = array(
26 => array('moviedirector', 'Réalisateur(s)'),
21 => array('author', 'Auteur(s)'),
1 => array('director', 'Metteur(s) en scène'),
5 => array('comedien', 'Acteur(s)'),
25 => array('intervenant', 'Intervenant(s)'),
);
$array_types = array(
'dvd_spectacle' => array(
'type_join' => 'multiple',
'dest_table' => 'spectacles',
'fields' => array('idspectacle', 'title', 'url_clean'),
'join_table' => 'dvd_spectacle',
'hide_relation' => true,
'silent_delete_relation' => true,
'description' => 'Spectacle(s) associé(s) à ce DVD',
),
'dvd_multimedia' => array(
'type_join' => 'multiple',
'dest_table' => 'multimedias',
'fields' => array('idmultimedia', 'sujet_titre', 'url_clean', 'status', 'price'),
'join_table' => 'dvd_multimedia',
'hide_relation' => true,
'silent_delete_relation' => true,
'description' => 'Multimédia(s) associé(s) à ce DVD',
),
'dvd_tournage' => array(
'type_join' => 'multiple',
'dest_table' => 'contacts',
'fields' => array('idcontact', 'organisation', 'firstname', 'lastname', 'url_clean'),
'join_table' => 'dvd_contact',
'where' => ' AND j2.idrole=27', // idrole sur la table dvd_contact
'hide_relation' => true,
'silent_delete_relation' => true,
'description' => 'Lieu(x) de tournage associé(s) à ce DVD',
),
'dvd_editeur' => array(
'type_join' => 'multiple',
'dest_table' => 'contacts',
'fields' => array('idcontact', 'organisation', 'firstname', 'lastname', 'url_clean'),
'join_table' => 'dvd_contact',
'where' => ' AND j2.idrole=28', // idrole sur la table dvd_contact
'hide_relation' => true,
'silent_delete_relation' => true,
'description' => 'Editeur(x) associé(s) à ce DVD',
),
'dvd_production' => array(
'type_join' => 'multiple',
'dest_table' => 'contacts',
'fields' => array('idcontact', 'organisation', 'firstname', 'lastname', 'url_clean'),
'join_table' => 'dvd_contact',
'where' => ' AND j2.idrole=17', // idrole sur la table dvd_contact
'hide_relation' => true,
'silent_delete_relation' => true,
'description' => 'Production',
)
);
foreach ($persons as $k => $v) {
$array_types['dvd_' . $v[0]] = array(
'type_join' => 'multiple',
'dest_table' => 'persons',
'fields' => array('idperson', 'lastname', 'firstname', 'url_clean', 'valid'),
'where' => ' AND j2.idrole=' . $k, // idrole sur la table dvd_person
'join_table' => 'dvd_person',
'hide_relation' => true,
'silent_delete_relation' => true,
'description' => $v[1] . ' associé(s) à ce DVD',
);
}
if (!empty($array_types[$type])) {
$array_types[$type]['type'] = $type;
return $array_types[$type];
} else {
return $array_types;
}
}
// }}}
// {{{ getDvdformats()
/** Récupérer les formats DVD
*
* @access public
* @return array les infos sous forme de tableau
*/
public function getDvdformats()
{
return $this->getEntityManager()->getRepository(Dvdformats::class)->getDvdformats();
}
// }}}
// {{{ getDvdzones()
/** Récupérer les zones
*
* @access public
* @return array les infos sous forme de tableau
*/
public function getDvdzones($select_list = true)
{
return $this->getEntityManager()->getRepository(Dvdzones::class)->getDvdzones($select_list);
}
// }}}
// {{{ getDvdtechnos()
/** Récupérer les technos DVD
*
* @access public
* @return array les infos sous forme de tableau
*/
public function getDvdtechnos($select_list = true)
{
return $this->getEntityManager()->getRepository(Dvdtechnos::class)->getDvdtechnos($select_list);
}
// }}}
// {{{ getVignetteDvd()
/** Récupére la vignette d'un DVD ou la crée si besoin
*
* @access public
* param int iddvd identifiant du dvd
* @return string
*/
public function getVignetteDvd($iddvd = null, $format = array())
{
if (empty($iddvd)) {
$iddvd = $this->iddvd;
}
// par default : image normal 70px x 70px qualite 75
if (!empty($format)) {
$set_format = $format;
} else {
$set_format = array('width' => $_ENV['VIGN_DVD_WIDTH'], 'height' => $_ENV['VIGN_DVD_HEIGHT'], 'direction' => 'thumb');
}
// generation par la classe Images
if (!isset($this->images)) {
$this->images = new Images();
}
$this->images->setVignetteFormat($set_format);
return $this->images->getVignetteObject($iddvd, 'dvds', 'class_pochette_dvd');
}
// }}}
// {{{ getDvdsFromMultimedia()
/** Récupére les DVDs à partir d'un document multimedia
*
* @access public
* @param int $idmultimedia Identifiant de la vidéo
* @param int $count_only compter seulement le nb de vidéo liées
* @return array|int
*/
public function getDvdsFromMultimedia($idmultimedia, $count_only = false)
{
$sql = 'SELECT';
if ($count_only) {
$sql = ' COUNT(*) ';
} else {
$sql .= ' * ';
}
$sql .= '
FROM dvd_multimedia dm, dvds d
WHERE dm.`iddvd`=d.`iddvd`
AND dm.`idmultimedia`=' . (int)$idmultimedia . '
AND d.`publish`=1';
$list_dvds = $this->db->queryAll($sql);
return $list_dvds;
}
// }}}
// {{{ getSQLDvds()
/** Générer la requete standard pour des dvds
*
* $params = array(
* 'select' => champs en plus pour le select,
* 'from' => champs en plus pour le from,
* 'where' => paramètres en plus le where,
* 'order' => classement des résultats,
* 'limit' => limiter le nb de résultats array(debut,fin), (all pour pas de limit)
* )
* $special = array(
* 'select_by_text_or_adaptation' => text et adaptation,
* 'prochains' => true = date dans le future, un entier = fait un between
* 'anciens' =>
* 'join' => jointure gauche sur contacts et schedules
* )
*
*
* @access public
* @param array $params Les paramètres pour la requete
* @param array $special Les paramètres supplémentaires
* @param bool $debug afficher la requête TODO
* @return string
*/
public function getSQLDvds($query = array(), $debug = false)
{
// on prepare les tableaux
foreach (array('select', 'from', 'where', 'order', 'group', 'limit') as $t) {
if (!empty($query[$t])) {
if (!is_array($query[$t])) {
$query[$t][] = $query[$t];
} else {
$query[$t] = $query[$t];
}
} else {
$query[$t] = array();
}
}
// champs par défaut
if (empty($query['count_only'])) {
$this->addSQLParams('select', $query, array(
array('dvds' => '*')
));
} else {
$this->addSQLParams('from', $query, array(
'dvds',
));
}
// publié ou pas
if (empty($query['publish']) && $_ENV['CHECK_IF_ONLINE']) {
$this->addSQLParams('where', $query, array(
array('dvds', 'publish', 1)
));
} elseif (!empty($query['publish'])) {
$this->addSQLParams('where', $query, array(
array('dvds', 'publish', $query['publish'])
));
}
// recherche par liaison via dvd_multimedia
if (!empty($query['special']['idmultimedias'])) {
$this->addSQLParams('from', $query, array(
'dvd_multimedia',
));
// jointure entre les 3 tables
$this->addSQLParams('join', $query, array(
'dvds.`iddvd`' => 'dvd_multimedia.`iddvd`',
));
$this->addSQLParams('where', $query, array(
array('dvd_multimedia', 'idmultimedia', $query['special']['idmultimedias']),
));
}
// recherche par VOD
if (!empty($query['special']['vods'])) {
$this->addSQLParams('from', $query, array(
'dvd_multimedia',
'dvd_spectacle',
'multimedias',
));
// jointure entre les 3 tables
$this->addSQLParams('join', $query, array(
'dvds.`iddvd`' => 'dvd_multimedia.`iddvd`',
'multimedias.`idmultimedia`' => 'dvd_multimedia.`idmultimedia`',
));
// jointure entre les 3 tables
$this->addSQLParams('join', $query, array(
'dvds.`iddvd`' => 'dvd_spectacle.`iddvd`',
));
$this->addSQLParams('where', $query, array(
array('multimedias', 'status', 5),
array('multimedias', 'publish', 1),
));
}
// recherche par liaison via dvd_person
if (!empty($query['special']['idpersons'])) {
$this->addSQLParams('from', $query, array(
'dvd_person',
));
// jointure entre les 3 tables
$this->addSQLParams('join', $query, array(
'dvds.`iddvd`' => 'dvd_person.`iddvd`',
));
$this->addSQLParams('where', $query, array(
array('dvd_person', 'idperson', $query['special']['idpersons']),
));
// ajouter le role
if (!empty($query['special']['idrole_person'])) {
$this->addSQLParams('where', $query, array(
array('dvd_person', 'idrole', $query['special']['idrole_person']),
));
}
}
// recherche par liaison via dvd_contact
if (!empty($query['special']['idcontacts'])) {
$this->addSQLParams('from', $query, array(
'dvd_contact',
));
// jointure entre les 3 tables
$this->addSQLParams('join', $query, array(
'dvds.`iddvd`' => 'dvd_contact.`iddvd`',
));
$this->addSQLParams('where', $query, array(
array('dvd_contact', 'idcontact', $query['special']['idcontacts']),
));
// ajouter le role
if (!empty($query['special']['idrole_contact'])) {
$this->addSQLParams('where', $query, array(
array('dvd_contact', 'idrole', $query['special']['idrole_contact']),
));
}
}
// recherche par liaison via dvd_spectacle
if (!empty($query['special']['idspectacles'])) {
$this->addSQLParams('from', $query, array(
'dvd_spectacle',
));
// jointure entre les 3 tables
$this->addSQLParams('join', $query, array(
'dvds.`iddvd`' => 'dvd_spectacle.`iddvd`',
));
$this->addSQLParams('where', $query, array(
array('dvd_spectacle', 'idspectacle', $query['special']['idspectacles']),
));
}
return $this->getSQLObject($query);
}
// }}}
// {{{ getListDvds()
/** Retourne des listes de dvds
*
* Retourne des listes de dvd au format "standard""
*
* @access public
* @param array $params_sql paramètre pour la requete SQL
* @param array $format_vignette de la vignette si pas standard
* @param array $params_display paramètre pour l'affichage
* @return array
*/
public function getListDvds($params_sql = null, $format_vignette = array(), $params_display = array())
{
// si pas de tableau
if (!isset($params_sql['special'])) {
$params_sql['special'] = array();
}
if (!isset($params_sql['params'])) {
$params_sql['params'] = array();
}
// construction de la requête avec le passage de paramètres
$sql = $this->getSQLDvds($params_sql);
// vignettes
if (empty($format_vignette['vignette_format'])) {
$format_vignette['vignette_format'] = array('width' => $_ENV['VIGN_DVD_WIDTH'], 'height' => $_ENV['VIGN_DVD_HEIGHT'], 'direction' => 'thumb');
}
// paramètre de debug
$dbg = (empty($params_sql['dbg'])) ? array() : $dbg = $params_sql['dbg'];
// executer la requete
$this->query($sql, $dbg);
$videos = array();
// donnée entières ?
if (empty($params_display['alldata'])) {
$params_display['alldata'] = false;
}
// debug
$start_boucle = microtime(true);
$dvds = array();
$datas = $this->query($sql);
// on boucle
foreach ($datas as $data) {
$this->loadResult($data);
// le total
if (!empty($params_sql['count_only'])) {
return $this->total;
}
$iddvd = $this->iddvd;
if (!empty($params_sql['fields'])) {
foreach ($params_sql['fields'] as $f) {
$dvds[$iddvd][$f] = $this->$f;
}
} else {
$dvds[$iddvd] = $this->getInfosDvd($iddvd, array('all' => true), $format_vignette);
if (empty($dvds[$iddvd]['comments'])) {
$dvds[$iddvd]['description'] = $this->wikiTransform($this->comments);
}
// $dvds[$iddvd]['description_courte'] = $this->cutSentence(strip_tags($dvds[$iddvd]['description']),45,true);
$dvds[$iddvd]['dateinsert'] = $this->dateinsert;
}
}
// debug de la boucle
// if($this->isTraceMode('list_object')) {
// $this->setTraceInfos(array(
// 'execution_time_boucle' => microtime(true) - $start_boucle,
// 'nb_occurence' => count($dvds),
// 'dbg' => $dbg,
// ));
// }
$this->free();
return $dvds;
}
// }}}
// {{{ getObjectTitle()
/** Infos de l'item recherché
*
* Affichage standard du titre de l'objet
*
* @access public
* @param int $idobject Identifiant de l'item
* @param array $infos_object Informations pour construire le titre
* @param array $params Paramétres supplémentaires
* @return string
*/
public function getObjectTitle($idobject = null, $infos_object = array(), $params = array())
{
$title = '';
if (!$idobject) {
$idobject = $this->iddvd;
}
// champs
$fields = array('iddvd', 'title', 'url_clean');
if (!empty($infos_object)) {
foreach ($fields as $k => $v) {
if (array_key_exists($v, $infos_object)) {
$$v = $infos_object[$v];
}
}
} else {
//charger les infos que si necessaire
if (empty($this->title)) {
// $this->selectAdd();
// $this->selectAdd(join($fields, ','));
$datas = $this->get($idobject);
}
$this->loadResult($datas);
// foreach($fields as $k=>$v) {
// if(isset($this->$v) && $this->$v!='') {
// $$v = trim($this->$v);
// }
// }
}
return $title;
}
// }}}
// {{{ getListSearch()
/** Liste des dvds
*
* Pour les champs Ajax de relations et les recherches diverses
*
* @access public
* @param string $lettres Pour la recherche alphabetique
* @param string $type Pour le type recherche (editeurs, revues...)
* @param string $keywords Recherche par mots cles
* @return array
*/
public function getListSearch($lettre, $type = null, $keywords = null)
{
$sql = 'SELECT ' . $this->__idtable . ', title
FROM ' . $this->__table . '
WHERE 1 ';
// selection par ordre alpha
if (!empty($lettre) && $lettre != 'tous') {
$sql_where[] = array('LOWER(LEFT(LTRIM(title),1))=\'' . $this->escape($lettre) . '\'');
}
// recherche avec un mot cle
$list = $this->splitKeywords($keywords);
if ($list) {
if (!empty($list[$this->IDSTR])) {
// mots clés
foreach ($list[$this->IDSTR] as $s) {
$sql_more_name[] = 'title LIKE \'%' . $s . '%\'';
}
$sql_where[] = array('(' . join(' OR ', $sql_more_name) . ')');
}
if (!empty($list[$this->IDNUM])) {
// recherche par numéro d'id pour les mots clés numériques
$sql_where[] = array('iddvd IN (' . implode(',', $list[$this->IDNUM]) . ')', 'OR');
}
}
foreach ($sql_where as $k => $v) {
if (!empty($v[1])) {
$sql .= ' ' . $v[1] . ' ' . $v[0];
} else {
$sql .= ' AND ' . $v[0];
}
}
$sql .= ' ORDER BY title';
$this->query($sql);
$r = array();
while ($this->fetch()) {
$r[$this->iddvd] = $this->title;
// si trouvé par id, on l'affiche en fin de titre
if (!empty($list[$this->IDNUM]) && in_array($this->iddvd, $list[$this->IDNUM])) {
$r[$this->iddvd] .= ' - n°' . $this->iddvd;
}
}
$this->free();
return $r;
}
// }}}
// {{{ countDvds()
/** Nombre de DVD
*
* Compter le nb de DVD
*
* @access public
* @return int
*/
public function countDvds($object = null, $idobject = null)
{
if (!empty($object) && !empty($idobject)) {
$object = substr($object, 0, -1);
$sql_count = '
SELECT COUNT(DISTINCT(d.`' . $this->__idtable . '`)) as total
FROM ' . $this->__table . ' d, dvd_' . $object . ' do
WHERE d.`publish`=1
AND do.`iddvd`= d.`iddvd`
AND do.`id' . $object . '`=' . (int)$idobject;
} else {
$sql_count = '
SELECT COUNT(DISTINCT(' . $this->__idtable . ')) as total
FROM ' . $this->__table . '
WHERE publish=1';
}
$total = $this->queryOne($sql_count);
if ($total) {
return $total;
} else {
return null;
}
}
// }}}
}