|
@@ -22,15 +22,20 @@ class PodcastRorController extends ControllerBase {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- private function query() {
|
|
|
|
|
|
+ private function query($baseQuery) {
|
|
//TODO: estrai argomento dall'url
|
|
//TODO: estrai argomento dall'url
|
|
$arg = array('ror_news', 'redazionali', 'news_trasmissioni');
|
|
$arg = array('ror_news', 'redazionali', 'news_trasmissioni');
|
|
- $query = \Drupal::entityQuery('node');
|
|
|
|
- $query
|
|
|
|
|
|
+ $query = $baseQuery
|
|
->condition('status', '1')
|
|
->condition('status', '1')
|
|
->condition('type', $arg, 'IN')
|
|
->condition('type', $arg, 'IN')
|
|
->sort('nid', 'DESC')
|
|
->sort('nid', 'DESC')
|
|
->range(0, 20);
|
|
->range(0, 20);
|
|
|
|
+ \Drupal::logger('podcast_ror')->info(var_export(\Drupal::request()->query->get('trxid'), true));
|
|
|
|
+ //$trxid = \Drupal::request()->query->get('trxid');
|
|
|
|
+ // TODO: se nell'url c'e' un trx=, allora bisogna
|
|
|
|
+ // aggiungere che arg=news_trasmissioni
|
|
|
|
+ // fare join con node__field_trasmissione ON // node.nid = node__field_trasmissione.entity_id
|
|
|
|
+ // condition: node__field_trasmissione.field_trasmissione_target_id=$trx
|
|
$nids = $query->execute();
|
|
$nids = $query->execute();
|
|
// TODO: load contenuti_audio referenced entities
|
|
// TODO: load contenuti_audio referenced entities
|
|
$data = array();
|
|
$data = array();
|
|
@@ -65,10 +70,9 @@ class PodcastRorController extends ControllerBase {
|
|
}
|
|
}
|
|
return $data;
|
|
return $data;
|
|
}
|
|
}
|
|
- public function podcast($path) {
|
|
|
|
- // TODO: use $path
|
|
|
|
|
|
+ public function podcast($query) {
|
|
$template = $this->twig->loadTemplate(drupal_get_path('module', 'podcast_ror') . '/templates/podcast.html.twig');
|
|
$template = $this->twig->loadTemplate(drupal_get_path('module', 'podcast_ror') . '/templates/podcast.html.twig');
|
|
- $tmpl_data = [ 'ror' => array('podcast' => $this->query(),
|
|
|
|
|
|
+ $tmpl_data = [ 'ror' => array('podcast' => $this->query($query),
|
|
'url' => \Drupal::service('path.current')->getPath(),
|
|
'url' => \Drupal::service('path.current')->getPath(),
|
|
)];
|
|
)];
|
|
//$variables['ror']['url'] =
|
|
//$variables['ror']['url'] =
|
|
@@ -77,10 +81,19 @@ class PodcastRorController extends ControllerBase {
|
|
return $resp;
|
|
return $resp;
|
|
}
|
|
}
|
|
public function podcastAll() {
|
|
public function podcastAll() {
|
|
- return $this->podcast('all.xml');
|
|
|
|
|
|
+ $query = \Drupal::entityQuery('node');
|
|
|
|
+ return $this->podcast($query);
|
|
|
|
+ }
|
|
|
|
+ //public function podcastByType(NodeInterface $ctype) {
|
|
|
|
+ public function podcastByType($contentType) {
|
|
|
|
+ $query = \Drupal::entityQuery('node')
|
|
|
|
+ ->condition('type', $contentType);
|
|
|
|
+ return $this->podcast($query);
|
|
}
|
|
}
|
|
- public function podcastAny(NodeInterface $ctype) {
|
|
|
|
- return new Response('tipo: BOH', 200,array( 'Content-Type' => 'application/rss+xml'));
|
|
|
|
- // return $this->podcast($ctype);
|
|
|
|
|
|
+ public function podcastByTrxID($trxID) {
|
|
|
|
+ $query = \Drupal::entityQuery('node')
|
|
|
|
+ ->condition('type', 'news_trasmissioni')
|
|
|
|
+ ->condition('field_trasmissione', $trxID);
|
|
|
|
+ return $this->podcast($query);
|
|
}
|
|
}
|
|
}
|
|
}
|