diff --git a/sites/all/modules/gui/perfart/perfart.module b/sites/all/modules/gui/perfart/perfart.module index a011bd8..1752061 100644 --- a/sites/all/modules/gui/perfart/perfart.module +++ b/sites/all/modules/gui/perfart/perfart.module @@ -210,3 +210,114 @@ function perfart_init() { // } + +/** + * Implements hook_block_info(). + */ +function perfart_block_info() { + $blocks = array(); + $blocks['perf_prevnext'] = array( + 'info' => t('Performance prev next btns'), + ); + + return $blocks; +} + +/** + * Implements hook_block_view(). + */ +function perfart_block_view($delta='') { + $block = array(); + + switch($delta) { + case 'perf_prevnext' : + $block['content'] = perf_prevnext_view(); + break; + } + + return $block; +} + +/** + * Custom function to assemble renderable array for block content. + * Returns a renderable array with the block content. + * @return + * returns a renderable array of block content. + */ +function perf_prevnext_view() { + global $language; + + // get current perf nid + $current_perf = menu_get_object(); + if ($current_perf && $current_perf->nid && $current_perf->type == 'performance') { + // dsm($current_perf); + // You have a valid node to work with. + // get all perfs + + $query = new EffectuationEntityFieldQuery; + $result = $query->execute(); + $perfs = array(); + foreach ($result['node'] as $eff) { + $eff = node_load($eff->nid); + + if(!isset($eff->field_date_de_debut) || !isset($eff->field_performances)) + continue; + + $debut = $eff->field_date_de_debut['und'][0]['value']; + //1969/06/06-18:00 + $pattern = '/^(\d{4})\/?(\d{2})?\/?(\d{2})?-?(\d{2})?:?+(\d{2})?$/'; + preg_match($pattern, $debut, $debutMatches); + if(!isset($debutMatches[1])) + continue; + + $perfadded = array(); + foreach ($eff->field_performances['und'] as $perf) { + + if(in_array($perf['target_id'], $perfadded)) + continue; + + $perfadded[] = $perf['target_id']; + $perfs[] = $perf['target_id']; + } + } + + dsm($perfs); + + // get prev and next + // build links + $index = array_search($current_perf->nid, $perfs); + dsm($index); + $list = array(); + if($index > 0){ + $prev_nid = $perfs[$index-1]; + $prev = node_load($prev_nid); + $prev_path = drupal_get_path_alias('node/'.$prev->nid, $language->language); + $prev_link = l('< ' . $prev->title, $prev_path, array('html'=>true)); + $list['items'][] = array( + 'data' => $prev_link, + 'class' => array('perf-prev-link'), + ); + } + if ($index < count($perfs)-1) { + $next_nid = $perfs[$index+1]; + $next = node_load($next_nid); + $next_path = drupal_get_path_alias('node/'.$next->nid, $language->language); + $next_link = l($next->title . ' >', $next_path, array('html'=>true)); + $list['items'][] = array( + 'data' => $next_link, + 'class' => array('perf-next-link'), + ); + + } + + $list['attributes']['id'] = "perf-prev-next-btns"; + + dsm($list); + + return theme('item_list', $list); + + } + + + return null; +} \ No newline at end of file diff --git a/sites/all/modules/gui/perfart/perfart.pages.inc b/sites/all/modules/gui/perfart/perfart.pages.inc index 5757516..e21b9f2 100644 --- a/sites/all/modules/gui/perfart/perfart.pages.inc +++ b/sites/all/modules/gui/perfart/perfart.pages.inc @@ -258,7 +258,7 @@ function perfart_get_performances(){ $count = $count_query->count()->execute(); pager_default_initialize($count, $limit); - foreach ($result['node'] as $eff) { + foreach ($result['node'] as $eff) { $eff = node_load($eff->nid); //$eff = entity_load('node', array($eff->nid), NULL, FALSE); // dsm($eff, '$eff'); @@ -445,7 +445,7 @@ function perfart_get_performances(){ # filter artistes // $date['filters']['peoples'] = $personnes; - pager_default_initialize($count, $limit); + // pager_default_initialize($count, $limit); // $data[] = $date; diff --git a/sites/all/themes/gui/perfarttimeline/css/styles.css b/sites/all/themes/gui/perfarttimeline/css/styles.css index 2b39fbe..b54d303 100644 --- a/sites/all/themes/gui/perfarttimeline/css/styles.css +++ b/sites/all/themes/gui/perfarttimeline/css/styles.css @@ -2267,6 +2267,36 @@ html.classic-nav body.node-type-performance #main #center #content .node.type-pe font-weight: 500; font-size: 12px; } +html.no-js body.node-type-performance #block-perfart-perf-prevnext ul#perf-prev-next-btns, +html.classic-nav body.node-type-performance #block-perfart-perf-prevnext ul#perf-prev-next-btns { + display: flex; + flex-flow: row nowrap; +} +html.no-js body.node-type-performance #block-perfart-perf-prevnext ul#perf-prev-next-btns li.perf-prev-link, +html.classic-nav body.node-type-performance #block-perfart-perf-prevnext ul#perf-prev-next-btns li.perf-prev-link, +html.no-js body.node-type-performance #block-perfart-perf-prevnext ul#perf-prev-next-btns li.perf-next-link, +html.classic-nav body.node-type-performance #block-perfart-perf-prevnext ul#perf-prev-next-btns li.perf-next-link { + flex: 1 1 100%; + width: 50%; +} +html.no-js body.node-type-performance #block-perfart-perf-prevnext ul#perf-prev-next-btns li.perf-next-link, +html.classic-nav body.node-type-performance #block-perfart-perf-prevnext ul#perf-prev-next-btns li.perf-next-link { + text-align: right; +} +html.no-js body.node-type-performance #block-perfart-perf-prevnext ul#perf-prev-next-btns a, +html.classic-nav body.node-type-performance #block-perfart-perf-prevnext ul#perf-prev-next-btns a { + text-decoration: none; + font-family: "MuseoSans", Arial, sans-serif; + -moz-font-feature-settings: "calt=0,liga=0"; + font-size: 10px; + font-weight: 500; +} +@media screen and (min-width: 1201px) { + html.no-js body.node-type-performance #block-perfart-perf-prevnext ul#perf-prev-next-btns a, + html.classic-nav body.node-type-performance #block-perfart-perf-prevnext ul#perf-prev-next-btns a { + font-size: 12px; + } +} body.node-type-document #main, .node-type-document-sonor #main, .node-type-object #main, diff --git a/sites/all/themes/gui/perfarttimeline/less/styles.less b/sites/all/themes/gui/perfarttimeline/less/styles.less index 120a702..766345d 100644 --- a/sites/all/themes/gui/perfarttimeline/less/styles.less +++ b/sites/all/themes/gui/perfarttimeline/less/styles.less @@ -1070,7 +1070,25 @@ html.no-js, html.classic-nav{ } } - } + } + #block-perfart-perf-prevnext{ + ul#perf-prev-next-btns{ + display: flex; + flex-flow: row nowrap; + li.perf-prev-link, + li.perf-next-link{ + flex:1 1 100%; + width: 50%; + } + li.perf-next-link{ + text-align: right; + } + a{ + text-decoration: none; + .fs-filters-list; + } + } + } } } diff --git a/sites/all/themes/gui/perfarttimeline/templates/node--performance--full.tpl.php b/sites/all/themes/gui/perfarttimeline/templates/node--performance--full.tpl.php new file mode 100644 index 0000000..d5ca7a8 --- /dev/null +++ b/sites/all/themes/gui/perfarttimeline/templates/node--performance--full.tpl.php @@ -0,0 +1,35 @@ + +
"> + +

+ + type, $types)) : ?> + + + + +

+ + +
+ +
+ + + + + + + + + +
+