<?php
namespace TheatreCore\Repository;
use TheatreCore\Entity\Classifications;
use TheatreCore\Entity\Multimedias;
use TheatreCore\Entity\Playlists;
use TheatreCore\Traits\TheatreTrait;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* PlaylistsRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class PlaylistsRepository extends ServiceEntityRepository
{
public $array_types = array('idperson', 'idspectacle', 'idcontact', 'idtext', 'playlist_multimedia', 'playlistClassification');
use TheatreTrait {
getRelationsArray as protected getRelationsArrayTrait;
getItemsList as protected getItemsListTrait;
}
private $em;
public $__table;
public $__table_object;
public $__idtable;
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Playlists::class);
$this->__table = $this->getClassMetadata()->getTableName();
$this->__table_object = $this->getClassMetadata()->name;
$this->__idtable = $this->getClassMetadata()->getSingleIdentifierFieldName();
// $this->__table = 'persons';
// $this->__table_object = '\\App\\Entity\\Persons';
}
// {{{ findData()
/** Recherche des playlists
*
* Permet de rechercher des playlists 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 = $this->createQueryBuilder('e');
if ($this->getCount()) {
$query->select('COUNT(e.idplaylist)');
$this->setCount(false);
return $query;
}
// parametre
if (isset($_REQUEST['idplaylist']) && !empty($_REQUEST['idplaylist'])) {
$idplaylist = $_REQUEST['idplaylist'];
}
if (isset($_REQUEST['keywords']) && $_REQUEST['keywords'] != 'nom' && !empty($_REQUEST['keywords'])) {
$keywords = $_REQUEST['keywords'];
}
if (isset($_REQUEST['publish']) && !empty($_REQUEST['publish'])) {
$publish = $_REQUEST['publish'];
}
if (isset($_REQUEST['idclassification']) && !empty($_REQUEST['idclassification'])) {
$idclassification = (int)$_REQUEST['idclassification'];
}
//recherche stricte par id
if (!empty($idplaylist)) {
// $this->whereAdd($this->__table.'.'.$this->__idtable.'='.((int)$idplaylist));
$query->andWhere('e.idplaylist = :idplaylist')->setParameter(':idplaylist', $idplaylist);
}
// mots cles
if (!empty($keywords)) {
// $this->whereAdd($this->__table.'.title LIKE \'%'.$this->escape($keywords).'%\'');
$query->andWhere('e.title LIKE \'%:title%\'')->setParameter(':title', $keywords);
}
// selectionne les fiches hors ligne
if (!empty($publish) && $publish == 'no') {
$this->whereAdd($this->__table . '.publish=0');
$query->andWhere('e.publish=0');
}
// selectionne les playlists auteur par lui même
if (!empty($idclassification)) {
dump('à refaire la recherche par classification');
// $this->whereAdd($this->__table.'.idplaylist IN (SELECT idplaylist FROM playlist_classification WHERE idclassification='.$idclassification.')');
}
// on lance la recherche
return $query->getQuery();
}
// }}}
// {{{ 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->getInfosPlaylist();
// couleur de ligne alternative
$color = $this->colorAlternate($color);
$values[$nb]['colorline'] = $color;
$values[$nb]['id'] = $this->idplaylist;
$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 = 'idplaylist';
}
return $order;
}
// }}}
// {{{ getInfosPlaylist()
/** Informations sur un playlist
*
* @access public
* @param int $idplaylist numero de la fiche playlist
* @return array les infos sous forme de tableau
*/
public function getInfosPlaylist($idplaylist = null, $params_data = array(), $params_display = array())
{
$infos = array();
$con = $this->getEntityManager();
////////////// infos de la table
if (!isset($this->idplaylist) || empty($this->idplaylist) || $this->idplaylist != $idplaylist) {
if (!empty($idplaylist)) {
// $x;
// if(!$this->get($idplaylist)) {
// return array();
// } else {
// $infos = $this->objToArray();
// }
$query = $con->getRepository(Playlists::class)
->createQueryBuilder('e')
->select('e')
->andWhere('e.idplaylist = :idplaylist')
->setParameter('idplaylist', $idplaylist)
->getQuery();
$infos = $this->objToArray($query);
$this->loadResult($infos);
if (empty($infos)) {
return [];
}
}
} else {
$idplaylist = $this->idplaylist;
// $x->setParameter('$idplaylist', $idplaylist);
$query = $con->getRepository(Playlists::class)
->createQueryBuilder('e')
->select('e')
->andWhere('e.idplaylist = :idplaylist')
->setParameter('idplaylist', $idplaylist)
->getQuery();
$infos = $this->objToArray($query);
$this->loadResult($infos);
if (empty($infos)) {
return [];
}
}
$format_vignette = array();
if (!empty($params_data['format_vignette'])) {
$format_vignette = $params_data['format_vignette'];
}
$params_display = array_merge(array('alldata' => true), $params_display);
$infos['nameview'] = $this->title ?? null;
if (!empty($params_data['all'])) {
// les relations
foreach ($this->array_types as $t) {
$x = $this->getRelationsArray($t);
$infos[$t] = $this->noPunct($this->getLinkedObject($this->getRelationsArray($t), $idplaylist, $t, 'playlists'));
}
// récupèrer le détail des éléments multimedias associés
if (!empty($params_data['multimedias']) && !empty($infos['playlist_multimedia'])) {
$multimedias = $con->getRepository(Multimedias::class);
foreach ($infos['playlist_multimedia'] as $m) {
$ids_multimedia[] = $m['idmultimedia'];
}
$params_multimedias = array(
'where' => array(array('multimedias', 'idmultimedia', $ids_multimedia)),
'order' => array(array('multimedias', 'idmultimedia', $ids_multimedia)), // classement par le IN via FIELD
'dbg' => array('rech', 'Vidéos liées au playlist'),
);
if (!empty($params_display['limitmultimedias'])) {
$params_multimedias['limit'] = $params_display['limitmultimedias'];
}
$infos['multimedias'] = $multimedias->getListMultimedias($params_multimedias, $format_vignette, $params_display);
// compter
$infos['nb_multimedias'] = count($ids_multimedia);
// prendre la première vignette
foreach ($infos['multimedias'] as $k => $v) {
$infos['vignette'] = $v['vignette'];
$infos['vignette_flou'] = $v['vignette_flou'];
}
}
// récupèrer les classifications
$infos['classifications'] = $con->getRepository(Classifications::class)->getObjectClassification('playlists', $idplaylist, $this->getRelationsArray('playlist_classification'));
}
if (!empty($infos['description'])) {
$infos['description_html'] = $this->wikiTransform($infos['description']);
}
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($idplaylist, $type)
{
if (in_array($type, $this->array_types)) {
return $this->getLinkedObject($this->getRelationsArray($type), $idplaylist, $type, 'playlists');
} 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');
$array_types += array(
'idspectacle' => array(
'type_join' => 'simple',
'dest_table' => 'spectacles',
'join_field_src' => 'idspectacle',
'dest_table_field' => 'idspectacle',
'fields' => array('idspectacle', 'title', 'url_clean'),
'hide_relation' => true,
'silent_delete_relation' => true,
'description' => 'Spectacle associé à cette playlist',
),
'idperson' => array(
'type_join' => 'simple',
'dest_table' => 'persons',
'join_field_src' => 'idperson',
'dest_table_field' => 'idperson',
'fields' => array('idperson', 'lastname', 'firstname', 'url_clean'),
'silent_delete_relation' => true,
'description' => 'Personne associée à cette playlist',
),
'idcontact' => array(
'type_join' => 'simple',
'dest_table' => 'contacts',
'join_field_src' => 'idcontact',
'dest_table_field' => 'idcontact',
'fields' => array('idcontact', 'organisation', 'url_clean'),
'silent_delete_relation' => true,
'description' => 'Contact associé à cette playlist',
),
'idtext' => array(
'type_join' => 'simple',
'dest_table' => 'texts',
'join_field_src' => 'idtext',
'dest_table_field' => 'idtext',
'fields' => array('idtext', 'title', 'url_clean'),
'silent_delete_relation' => true,
'description' => 'Texte associé à cette playlist',
),
'playlist_multimedia' => array(
'type_join' => 'multiple',
'dest_table' => 'multimedias',
'fields' => array('idmultimedia', 'sujet_titre', 'url_clean', 'status', 'price'),
'join_table' => 'playlist_multimedia',
'hide_relation' => true,
'silent_delete_relation' => true,
'sql_more' => ' ORDER BY j2.`orderplaylist` ',
'description' => 'Multimédia(s) associé(s) à cette playlist',
),
'playlist_classification' => array(
'type_join' => 'multiple',
'dest_table' => 'classifications',
'fields' => array('idclassification', 'classification', 'type', 'idgroupclassification'),
'join_table' => 'playlist_classification',
'hide_relation' => true,
'silent_delete_relation' => true,
'description' => 'Classification(s) associée(s) à cette playlist',
),
);
if (!empty($array_types[$type])) {
$array_types[$type]['type'] = $type;
return $array_types[$type];
} else {
return $array_types;
}
}
// }}}
// {{{ getSQLPlaylists()
/** Générer la requete standard pour des playlists
*
*
* @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 getSQLPlaylists($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
$this->addSQLParams('select', $query, array(
array('playlists' => '*')
));
// publié ou pas
if (empty($query['publish']) && $_ENV['CHECK_IF_ONLINE']) {
$this->addSQLParams('where', $query, array(
array('playlists', 'publish', 1)
));
} elseif (!empty($query['publish'])) {
$this->addSQLParams('where', $query, array(
array('playlists', 'publish', $query['publish'])
));
}
// recherche par liaison via playlist_multimedia
if (!empty($query['special']['idmultimedias'])) {
$this->addSQLParams('from', $query, array(
'playlist_multimedia',
));
// jointure entre les 3 tables
$this->addSQLParams('join', $query, array(
'playlists.`idplaylist`' => 'playlist_multimedia.`idplaylist`',
));
$this->addSQLParams('where', $query, array(
array('playlist_multimedia', 'idmultimedia', $query['special']['idmultimedias']),
));
$this->addSQLParams('order', $query, array(
array('playlist_multimedia', 'orderplaylist'),
));
}
// recherche par liaison via playlist_person
if (!empty($query['special']['idpersons'])) {
$this->addSQLParams('where', $query, array(
array('playlists', 'idperson', $query['special']['idpersons']),
));
$this->addSQLParams('order', $query, array(
array('playlists', 'idperson', $query['special']['idpersons']),
));
}
// jointure avec persons
if (!empty($query['special']['persons'])) {
$this->addSQLParams('from', $query, array(
'persons',
));
$this->addSQLParams('join', $query, array(
'playlists.`idperson`' => 'persons.`idperson`',
));
$this->addSQLParams('order', $query, array('persons.`lastname`'));
$this->addSQLParams('direction', $query, 'ASC');
if (!empty($query['special']['persons']['group'])) {
$this->addSQLParams('group', $query, $query['special']['persons']['group']);
}
if (!empty($query['special']['persons']['idperson'])) {
$this->addSQLParams('where', $query, array(
array('persons', 'idperson', $query['special']['persons']['idperson']),
));
}
}
// recherche par liaison via playlist_text
if (!empty($query['special']['idtext'])) {
$this->addSQLParams('where', $query, array(
array('playlists', 'idtext', $query['special']['idtext']),
));
}
// jointure avec text_aide et aide
if (!empty($query['special']['aides'])) {
$this->addSQLParams('from', $query, array(
'aides',
));
if (!empty($query['special']['aides']['text_aide'])) {
$this->addSQLParams('from', $query, array(
'text_aide',
));
$this->addSQLParams('join', $query, array(
'playlists.`idtext`' => 'text_aide.`idtext`',
));
$this->addSQLParams('join', $query, array(
'text_aide.`idaide`' => 'aides.`idaide`',
));
}
if (!empty($query['special']['aides']['idaidecontact'])) {
$this->addSQLParams('where', $query, array(
array('aides', 'idaidecontact', $query['special']['aides']['idaidecontact']),
));
}
}
// recherche par classification
if (!empty($query['special']['idclassifications'])) {
$this->addSQLParams('from', $query, array(
'playlist_classification',
));
// jointure entre les 3 tables
$this->addSQLParams('join', $query, array(
'playlists.`idplaylist`' => 'playlist_classification.`idplaylist`',
));
$this->addSQLParams('where', $query, array(
array('playlist_classification', 'idclassification', $query['special']['idclassifications']),
));
}
return $this->getSQLObject($query);
}
// }}}
// {{{ countListPlaylists()
/** Compter la liste des playlists
*
* @access public
* @param array $params_sql paramètre pour la requete SQL
* @param bool $debug mode débugage
* @return int
*/
public function countListPlaylists($params_sql = null, $debug = false)
{
// si pas de tableau
if (!isset($params_sql['special'])) {
$params_sql['special'] = array();
}
if (!isset($params_sql['params'])) {
$params_sql['params'] = array();
}
// si pas de limite => tout
if (empty($params_sql['params']['limit'])) {
$params_sql['limit'] = array('all');
}
$params_sql['count_only'] = true;
// construction de la requête avec le passage de paramètres
return $this->queryOne($this->getSQLPlaylists($params_sql, $debug));
}
// }}}
// {{{ getListPlaylists()
/** Retourne des listes de playlists
*
* Retourne des listes de playlist 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 getListPlaylists($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->getSQLPlaylists($params_sql);
// 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);
$playlists = array();
$datas = $this->query($sql);
// on boucle
foreach ($datas as $data) {
$this->loadResult($data);
if (!empty($params_sql['count_only'])) {
return $this->total;
}
$idplaylist = $this->idplaylist;
if (!empty($params_sql['fields'])) {
foreach ($params_sql['fields'] as $f) {
$playlists[$idplaylist][$f] = $this->$f;
}
} else {
$playlists[$idplaylist] = $this->getInfosPlaylist($idplaylist, array('all' => true, 'multimedias' => true), array('vignette_format' => $format_vignette));
}
}
if (!empty($params_display['other_url_clean'])) {
if (!empty($playlists)) {
foreach ($playlists as $k => $v) {
// le lien vers le contenu directement
if (!empty($v['idtext'])) {
foreach ($v['idtext'] as $t) {
$playlists[$k]['other_url_clean'] = '/textes/' . $t['url_clean'] . '/playlist/id/' . $v['urlClean'];
}
}
}
}
}
// debug de la boucle
if ($this->isTraceMode('list_object')) {
$this->setTraceInfos(array(
'execution_time_boucle' => microtime(true) - $start_boucle,
'nb_occurence' => count($playlists),
'dbg' => $dbg,
));
}
$this->free();
return $playlists;
}
// }}}
// {{{ 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->idplaylist;
}
// champs
$fields = array('idplaylist', '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(implode(',', $fields));
$this->get($idobject);
}
foreach ($fields as $k => $v) {
if (isset($this->$v) && $this->$v != '') {
$$v = trim($this->$v);
}
}
}
return $title;
}
// }}}
// {{{ getListSearch()
/** Liste des playlists
*
* 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('idplaylist 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->idplaylist] = $this->title;
// si trouvé par id, on l'affiche en fin de titre
if (!empty($list[$this->IDNUM]) && in_array($this->idplaylist, $list[$this->IDNUM])) {
$r[$this->idplaylist] .= ' - n°' . $this->idplaylist;
}
}
$this->free();
return $r;
}
// }}}
// {{{ countPlaylists()
/** Nombre de Playlist
*
* Compter le nb de playlists
*
* @access public
* @return int
*/
public function countPlaylists($object = null, $idobject = null, $classification = null)
{
if (!empty($object) && !empty($idobject)) {
$object = substr($object, 0, -1);
$sql_count = '
SELECT COUNT(DISTINCT(p.`' . $this->__idtable . '`)) as total
FROM ' . $this->__table . ' p
LEFT JOIN playlist_classification pc ON pc.`idplaylist`=p.`idplaylist`
LEFT JOIN classifications c ON pc.`idclassification`=c.`idclassification`
WHERE p.`publish`=1
AND p.`id' . $object . '` IN (' . $this->arrayToIn($idobject) . ') ';
} else {
$sql_count = '
SELECT COUNT(DISTINCT(p.`' . $this->__idtable . '`)) as total
FROM ' . $this->__table . ' p
LEFT JOIN playlist_classification pc ON pc.`idplaylist`=p.`idplaylist`
LEFT JOIN classifications c ON pc.`idclassification`=c.`idclassification`
WHERE p.`publish`=1';
}
if (!empty($classification)) {
if ($this->my_is_int($classification)) {
$sql_count .= ' AND c.`idclassification`=' . (int)$classification;
} else {
if (is_array($classification)) {
$sql_count .= ' AND c.`classification` IN (\'' . implode('\',\'', $classification) . '\')';
} else {
$sql_count .= ' AND c.`classification`=\'' . $this->escape($classification) . '\'';
}
}
}
$total = $this->queryOne($sql_count);
if ($total) {
return $total;
} else {
return null;
}
}
// }}}
// {{{ getByClassification()
/** Nombre de Playlist
*
* Compter le nb de playlists
*
* @access public
* @return int
*/
public function getByClassification($object, $idobject, $classification = null)
{
if (!empty($object) && !empty($idobject)) {
$object = substr($object, 0, -1);
$sql_count = '
SELECT p.`idplaylist`
FROM ' . $this->__table . ' p
LEFT JOIN playlist_classification pc ON pc.`idplaylist`=p.`idplaylist`
LEFT JOIN classifications c ON pc.`idclassification`=c.`idclassification`
WHERE p.`publish`=1
AND p.`id' . $object . '`=' . (int)$idobject;
} else {
$sql_count = '
SELECT p.`idplaylist`
FROM ' . $this->__table . ' p
LEFT JOIN playlist_classification pc ON pc.`idplaylist`=p.`idplaylist`
LEFT JOIN classifications c ON pc.`idclassification`=c.`idclassification`
WHERE p.`publish`=1';
}
if (!empty($classification)) {
if ($this->my_is_int($classification)) {
$sql_count .= ' AND c.`idclassification`=' . (int)$classification;
} else {
if (is_array($classification)) {
$sql_count .= ' AND c.`classification` IN (\'' . implode('\',\'', $classification) . '\')';
} else {
$sql_count .= ' AND c.`classification`=\'' . $this->escape($classification) . '\'';
}
}
}
$sql_count .= ' LIMIT 0,1';
$idplaylist = $this->queryOne($sql_count);
if ($idplaylist) {
return $this->getInfosPlaylist($idplaylist, array('all' => true));
} else {
return null;
}
}
// }}}
// {{{ getSpectaclesAnneesSaisons()
/** Récupèrer les années saisons où il y a des spectacles
*
* Récupérer les années et saisons où il y a des spectacles à l'affiche associés ipar le texte à une playlist avec une classification
*
* @access public
* @return array
*/
public function getSpectaclesAnneesSaisons($idclassifications = array())
{
$sql_annees = 'SELECT sc.`date`, YEAR(sc.`date`) as annee
FROM `schedules` sc
JOIN `spectacles` s ON sc.`idspectacle`=s.`idspectacle`
JOIN `text_spectacle` ts ON ts.`idspectacle`=s.`idspectacle`
JOIN `playlists` p ON p.`idtext`=ts.`idtext`
JOIN `playlist_classification` pc ON pc.`idplaylist`=p.`idplaylist`
WHERE 1
AND s.`textfictif`=0 AND s.`publish`=1 AND s.`valid`=1
AND p.`publish`=1
AND pc.`idclassification` IN (' . $this->arrayToIn($idclassifications) . ')
AND sc.`date` > \'1999-12-31\'
ORDER BY sc.`date` ';
$listdates = $this->queryAll($sql_annees);
return $listdates;
}
// }}}
// {{{ getAutors()
/** Récupèrer les auteurs qui ont un texte par l'auteur
*
* @access public
* @return array
*/
public function getAuthors()
{
$fields = array(
'idperson',
'lastname',
'firstname',
'url_clean',
);
foreach ($fields as $k => $v) {
$select[] = '`persons`.`' . $v . '`';
}
$sql_persons = 'SELECT ' . implode(', ', $select) . '
FROM `persons` , `playlist_classification` , `playlists`
WHERE 1 AND playlists.`publish`=1
AND playlist_classification.`idclassification` IN (144) AND playlists.`idperson`=persons.`idperson`
AND playlists.`idplaylist`=playlist_classification.`idplaylist`
GROUP BY `persons`.`idperson`
ORDER BY `persons`.`lastname` ';
$listpersons = $this->queryAll($sql_persons);
if (!empty($listpersons)) {
foreach ($listpersons as $k => $v) {
$listpersons[$k]['lastname'] = mb_strtoupper($v['lastname'], 'UTF8');
}
}
return $listpersons;
}
// }}}
}