|
@@ -100,7 +100,7 @@ class D7NodeProgramme extends FieldableEntity {
|
|
$query->condition('n.type', $this->configuration['node_type']);
|
|
$query->condition('n.type', $this->configuration['node_type']);
|
|
}
|
|
}
|
|
|
|
|
|
- // field_popsu_special_typetaxo 31
|
|
|
|
|
|
+ // field_popsu_special_typetaxo 31 (Acueile)
|
|
$query->leftJoin('field_revision_field_popsu_special_typetaxo', 'ff', 'ff.revision_id = n.vid');
|
|
$query->leftJoin('field_revision_field_popsu_special_typetaxo', 'ff', 'ff.revision_id = n.vid');
|
|
$query->fields('ff', [
|
|
$query->fields('ff', [
|
|
'field_popsu_special_typetaxo_tid'
|
|
'field_popsu_special_typetaxo_tid'
|
|
@@ -130,12 +130,12 @@ class D7NodeProgramme extends FieldableEntity {
|
|
|
|
|
|
// title from taxo term
|
|
// title from taxo term
|
|
$field_popsu_special_popsu_tid = $row->getSourceProperty('field_popsu_special_popsu')[0]['tid'];
|
|
$field_popsu_special_popsu_tid = $row->getSourceProperty('field_popsu_special_popsu')[0]['tid'];
|
|
- Drush::output()->writeln('tid:' . $field_popsu_special_popsu_tid);
|
|
|
|
|
|
+ // Drush::output()->writeln('tid:' . $field_popsu_special_popsu_tid);
|
|
$q = $this->select('taxonomy_term_data', 'ttd')
|
|
$q = $this->select('taxonomy_term_data', 'ttd')
|
|
->fields('ttd', ['tid','name'])
|
|
->fields('ttd', ['tid','name'])
|
|
->condition('tid', $field_popsu_special_popsu_tid);
|
|
->condition('tid', $field_popsu_special_popsu_tid);
|
|
$term = $q->execute()->fetchAll();
|
|
$term = $q->execute()->fetchAll();
|
|
- Drush::output()->writeln(dump($term));
|
|
|
|
|
|
+ // Drush::output()->writeln(dump($term));
|
|
$row->setSourceProperty('term_title', $term[0]['name']);
|
|
$row->setSourceProperty('term_title', $term[0]['name']);
|
|
|
|
|
|
// text intro
|
|
// text intro
|
|
@@ -144,10 +144,56 @@ class D7NodeProgramme extends FieldableEntity {
|
|
$row->setSourceProperty('body_summary', $body[0]['summary']);
|
|
$row->setSourceProperty('body_summary', $body[0]['summary']);
|
|
|
|
|
|
// texts
|
|
// texts
|
|
|
|
+ $row->setSourceProperty('text_paragraphe_id', $nid);
|
|
// $text = $row->getSourceProperty('field_popsu_special_text')
|
|
// $text = $row->getSourceProperty('field_popsu_special_text')
|
|
// $row->setSourceProperty('text', $text[0]['value']);
|
|
// $row->setSourceProperty('text', $text[0]['value']);
|
|
// $row->setSourceProperty('text_summary', $text[0]['summary']);
|
|
// $row->setSourceProperty('text_summary', $text[0]['summary']);
|
|
|
|
|
|
|
|
+ // // colloques
|
|
|
|
+ // $colloques = $this->getAssociatedSpecial(28, $field_popsu_special_popsu_tid);
|
|
|
|
+ // Drush::output()->writeln(dump($colloques));
|
|
|
|
+ //
|
|
|
|
+ // // Publications
|
|
|
|
+ // $publications = $this->getAssociatedSpecial(29, $field_popsu_special_popsu_tid);
|
|
|
|
+ // Drush::output()->writeln(dump($publications));
|
|
|
|
+ //
|
|
|
|
+ // // Partenaires
|
|
|
|
+ // $partenaires = $this->getAssociatedSpecial(30, $field_popsu_special_popsu_tid);
|
|
|
|
+ // Drush::output()->writeln(dump($partenaires));
|
|
|
|
+
|
|
|
|
+ // associateds
|
|
|
|
+ $associateds = $this->getAssociatedSpecial($field_popsu_special_popsu_tid);
|
|
|
|
+ Drush::output()->writeln(dump($associateds));
|
|
|
|
+
|
|
|
|
+ // fichiers
|
|
|
|
+ # field_popsu_special_insert_intro
|
|
|
|
+ # field_popsu_special_insert
|
|
|
|
+ $fichiers = array();
|
|
|
|
+ foreach ($row->getSourceProperty('field_popsu_special_insert') as $value) {
|
|
|
|
+ $fichiers[] = $value;
|
|
|
|
+ }
|
|
|
|
+ foreach ($row->getSourceProperty('field_popsu_special_insert_intro') as $value) {
|
|
|
|
+ $fichiers[] = $value;
|
|
|
|
+ }
|
|
|
|
+ // files from associated nodes (colloques, publications, partenaires)
|
|
|
|
+ foreach ( ['colloques', 'publications'] as $name) {
|
|
|
|
+ foreach ($associateds[$name] as $key => $asso) {
|
|
|
|
+ foreach ($asso['field_popsu_special_insert'] as $value) {
|
|
|
|
+ $fichiers[] = $value;
|
|
|
|
+ }
|
|
|
|
+ foreach ($asso['field_popsu_special_insert_intro'] as $value) {
|
|
|
|
+ $fichiers[] = $value;
|
|
|
|
+ }
|
|
|
|
+ // tried with array merge but it failed
|
|
|
|
+ // and foreach is faster than array_merge
|
|
|
|
+ // array_merge(
|
|
|
|
+ // $fichiers,
|
|
|
|
+ // $asso['field_popsu_special_insert_intro'],
|
|
|
|
+ // $asso['field_popsu_special_insert']
|
|
|
|
+ // );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $row->setSourceProperty('fichiers', $fichiers);
|
|
|
|
|
|
return parent::prepareRow($row);
|
|
return parent::prepareRow($row);
|
|
}
|
|
}
|
|
@@ -184,4 +230,73 @@ class D7NodeProgramme extends FieldableEntity {
|
|
return $ids;
|
|
return $ids;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private function getAssociatedSpecial($filter_tid) {
|
|
|
|
+ $asso_tids = array(
|
|
|
|
+ "colloques" => 28,
|
|
|
|
+ "publications" => 29,
|
|
|
|
+ "partenaires" => 30
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $associateds = array();
|
|
|
|
+
|
|
|
|
+ foreach ($asso_tids as $name => $type_tid) {
|
|
|
|
+
|
|
|
|
+ $query = $this->select('node_revision', 'nr')
|
|
|
|
+ ->fields('n', [
|
|
|
|
+ 'nid',
|
|
|
|
+ 'type',
|
|
|
|
+ 'uid',
|
|
|
|
+ 'language',
|
|
|
|
+ 'status',
|
|
|
|
+ 'created',
|
|
|
|
+ 'changed',
|
|
|
|
+ ])
|
|
|
|
+ ->fields('nr', [
|
|
|
|
+ 'vid',
|
|
|
|
+ 'title',
|
|
|
|
+ 'log',
|
|
|
|
+ 'timestamp',
|
|
|
|
+ ])
|
|
|
|
+ ->orderBy('changed');
|
|
|
|
+
|
|
|
|
+ $query->addField('n', 'uid', 'node_uid');
|
|
|
|
+ $query->addField('nr', 'uid', 'revision_uid');
|
|
|
|
+ $query->innerJoin('node', 'n', static::JOIN);
|
|
|
|
+
|
|
|
|
+ if (isset($this->configuration['node_type'])) {
|
|
|
|
+ $query->condition('n.type', $this->configuration['node_type']);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // field_popsu_special_typetaxo
|
|
|
|
+ // filter to get the right special type (colloques, publication, etc)
|
|
|
|
+ $query->leftJoin('field_revision_field_popsu_special_typetaxo', 'ff', 'ff.revision_id = n.vid');
|
|
|
|
+ $query->fields('ff', [
|
|
|
|
+ 'field_popsu_special_typetaxo_tid'
|
|
|
|
+ ]);
|
|
|
|
+ $query->condition('ff.field_popsu_special_typetaxo_tid', $type_tid);
|
|
|
|
+
|
|
|
|
+ // field_popsu_special_popsu
|
|
|
|
+ // filter to get right popsu (popsu 1, popsu europe, etc)
|
|
|
|
+ $query->leftJoin('field_revision_field_popsu_special_popsu', 'sp', 'sp.revision_id = n.vid');
|
|
|
|
+ $query->fields('sp', [
|
|
|
|
+ 'field_popsu_special_popsu_tid'
|
|
|
|
+ ]);
|
|
|
|
+ $query->condition('sp.field_popsu_special_popsu_tid', $filter_tid);
|
|
|
|
+
|
|
|
|
+ $assos = $query->execute()->fetchAll();
|
|
|
|
+ // get the fields
|
|
|
|
+ foreach ($assos as $key => $asso) {
|
|
|
|
+ // Get Field API field values.
|
|
|
|
+ foreach ($this->getFields('node', $asso['type']) as $field_name => $field) {
|
|
|
|
+ $assos[$key][$field_name] = $this->getFieldValues('node', $field_name, $asso['nid'], $asso['vid'], NULL);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (count($assos)) {
|
|
|
|
+ // $associateds[$name] = array();
|
|
|
|
+ $associateds[$name] = $assos;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return $associateds;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|