Conjunto 465d726 en sipes


Ignorar:
Fecha y hora:
08/09/2017 10:15:03 (hace 7 años)
Autor:
Sipes Apn <root@…>
Branches:
stable
Children:
4b26eb0
Parents:
c57e2d8
Mensaje:

se agrego el display para poder mostrar el pdlp en el formato requerido por onapre

Fichero:
1 editado

Leyenda

No modificado
Añadido
Eliminado
  • 0.3-modules/politicas_proyectos/politicas_proyectos.module

    rde06505 r465d726  
    564564    ),
    565565    'politicas_proyectos_formatter_pndes_0' => array(
     566      'arguments' => array('element' => NULL, $html = TRUE, $unique = FALSE),
     567      'function' => 'theme_politicas_proyectos_formatter_generic',
     568    ),
     569    'politicas_proyectos_formatter_pndes_1' => array(
     570      'arguments' => array('element' => NULL, $html = TRUE, $unique = FALSE),
     571      'function' => 'theme_politicas_proyectos_formatter_generic',
     572    ),
     573    'politicas_proyectos_formatter_pndes_2' => array(
     574      'arguments' => array('element' => NULL, $html = TRUE, $unique = FALSE),
     575      'function' => 'theme_politicas_proyectos_formatter_generic',
     576    ),
     577    'politicas_proyectos_formatter_pndes_3' => array(
     578      'arguments' => array('element' => NULL, $html = TRUE, $unique = FALSE),
     579      'function' => 'theme_politicas_proyectos_formatter_generic',
     580    ),
     581    'politicas_proyectos_formatter_pndeso_0' => array(
    566582      'arguments' => array('element' => NULL),
     583      'function' => 'theme_politicas_proyectoso_formatter_generic',
     584    ),
     585    'politicas_proyectos_formatter_pndeso_1' => array(
     586      'arguments' => array('element' => NULL),
     587      'function' => 'theme_politicas_proyectoso_formatter_generic',
     588    ),
     589    'politicas_proyectos_formatter_pndeso_2' => array(
     590      'arguments' => array('element' => NULL),
     591      'function' => 'theme_politicas_proyectoso_formatter_generic',
     592    ),
     593    'politicas_proyectos_formatter_pndeso_3' => array(
     594      'arguments' => array('element' => NULL),
     595      'function' => 'theme_politicas_proyectoso_formatter_generic',
     596    ),
     597    'politicas_proyectos_formatter_pndesc_0' => array(
     598      'arguments' => array('element' => NULL, $html = TRUE, $unique = FALSE),
    567599      'function' => 'theme_politicas_proyectos_formatter_generic',
    568600    ),
    569     'politicas_proyectos_formatter_pndes_1' => array(
    570       'arguments' => array('element' => NULL),
     601    'politicas_proyectos_formatter_pndesc_1' => array(
     602      'arguments' => array('element' => NULL, $html = TRUE, $unique = FALSE),
    571603      'function' => 'theme_politicas_proyectos_formatter_generic',
    572604    ),
    573     'politicas_proyectos_formatter_pndes_2' => array(
    574       'arguments' => array('element' => NULL),
     605    'politicas_proyectos_formatter_pndesc_2' => array(
     606      'arguments' => array('element' => NULL, $html = TRUE, $unique = FALSE),
    575607      'function' => 'theme_politicas_proyectos_formatter_generic',
    576608    ),
    577     'politicas_proyectos_formatter_pndes_3' => array(
    578       'arguments' => array('element' => NULL),
    579       'function' => 'theme_politicas_proyectos_formatter_generic',
    580     ),
    581     'politicas_proyectos_formatter_pndesc_0' => array(
    582       'arguments' => array('element' => NULL),
    583       'function' => 'theme_politicas_proyectos_formatter_generic',
    584     ),
    585     'politicas_proyectos_formatter_pndesc_1' => array(
    586       'arguments' => array('element' => NULL),
    587       'function' => 'theme_politicas_proyectos_formatter_generic',
    588     ),
    589     'politicas_proyectos_formatter_pndesc_2' => array(
    590       'arguments' => array('element' => NULL),
    591       'function' => 'theme_politicas_proyectos_formatter_generic',
    592     ),
    593609    'politicas_proyectos_formatter_pndesc_3' => array(
    594       'arguments' => array('element' => NULL),
     610      'arguments' => array('element' => NULL, $html = TRUE, $unique = FALSE),
    595611      'function' => 'theme_politicas_proyectos_formatter_generic',
    596612    ),
     
    598614      'arguments' => array('element' => NULL),
    599615      'function' => 'theme_politicas_proyectos_formatter_metaspcc',
    600     ),
    601     'politicas_proyectos_row' => array(
    602       'arguments' => array('row' => NULL, 'type' => NULL),
    603616    ),
    604617  );
     
    656669}
    657670
     671
    658672/**
    659673 * Theme function for HS Content Taxonomy formatters.
    660674 *
    661675 */
    662 function theme_politicas_proyectos_formatter_generic($element) {
     676function theme_politicas_proyectoso_formatter_generic($element) {
     677  list($formatter, $level) = explode('_', $element['#formatter']);
     678  $output = theme('politicas_proyectos_formatter_pndes_' . $level, $element, FALSE, TRUE);
     679  return $output;
     680}
     681
     682
     683/**
     684 * Theme function for HS Content Taxonomy formatters.
     685 *
     686 */
     687function theme_politicas_proyectos_formatter_generic($element, $html = TRUE, $unique = FALSE) {
    663688  $output = '';
    664689  if (module_exists('hierarchical_select')) {
     
    702727    $flip = array('even' => 'odd', 'odd' => 'even');
    703728    $class = 'even';
    704     $output = '<ul class="hierarchical-select-lineages">';
     729    $terms = array();
     730    list($formatter, $level) = explode('_', $element['#formatter']);
     731    $sufix = $html? '</li>' : '';
    705732    foreach ($dropbox->lineages as $i => $lineage) {
    706       $class = $flip[$class];
    707       $classes = ' '. $class;
    708       if ($i == 0) {
    709         $classes .= ' first';
    710       }
    711       if ($i == $num_items - 1) {
    712         $classes .= ' last';
    713       }
    714       $output .= '<li class="lineage-'. $i . $classes .'">';
    715       $output .= theme('politicas_proyectos_row', $lineage, $element['#formatter']);
    716       $output .= '</li>';
    717     }
    718     $output .= '</ul>';
     733      $term = isset($lineage[$level]['value']) ? taxonomy_get_term($lineage[$level]['value']) : 0;
     734      if ($term && $term->tid) {
     735        $terms[$term->tid] .= $formatter == 'pndes' || 'pndeso'? $term->name : $term->name . HS_CONTENT_TAXONOMY_DESCRIPTION_SEP . $term->description;
     736      }
     737    }
     738    if ($unique) {
     739      //extract first element
     740      $key = key($terms);
     741      $new_array = array();
     742      $new_array[$key] = $terms[$key];
     743      $terms = $new_array;
     744    }
     745    $output = implode(' | ',$terms);
    719746    // Add the CSS.
    720     drupal_add_css(drupal_get_path('module', 'hierarchical_select') .'/hierarchical_select.css');
    721   }
    722   return $output;
    723 }
    724 
    725 /**
    726  *  Theme function to output single row (lineage) of CT field
    727  *
    728  *  Giving levels different classes so some funny theming is possible:
    729  *  for example, different font size depending on level (like tagadelic)
    730  */
    731 function theme_politicas_proyectos_row($row, $type) {
    732   list($formatter, $level) = explode('_', $type);
    733   $separator = '<span class="politicas-proyectos-pndes-item-separator">›</span>';
    734   $output = '';
    735   if (empty($row)) {
    736     return $output;
    737   }
    738   $items = array();
    739   $term = isset($row[$level]['value']) ? taxonomy_get_term($row[$level]['value']) : 0;
    740   $output = '';
    741   if ($term) {
    742     switch ($formatter) {
    743       case 'pndes':
    744         $output .= $term->name;
    745         break;
    746       case 'pndesc':
    747         $output .= $term->name . HS_CONTENT_TAXONOMY_DESCRIPTION_SEP . $term->description;
    748         break;
    749     }
     747    //drupal_add_css(drupal_get_path('module', 'hierarchical_select') .'/hierarchical_select.css');
    750748  }
    751749  return $output;
     
    766764}
    767765
    768 
    769 
    770 
    771766//----------------------------------------------------------------------------
    772767// CCK hooks.
     
    799794    ),
    800795    'pndes_0' => array(
    801       'label' => t('Objetivo Histórico'),
     796      'label' => t('Nivel 0'),
    802797      'field types' => array('content_taxonomy'),
    803798      'multiple values' => CONTENT_HANDLE_MODULE,
    804799    ),
    805800    'pndes_1' => array(
    806       'label' => t('Objetivo Nacional'),
     801      'label' => t('Nivel 1'),
    807802      'field types' => array('content_taxonomy'),
    808803      'multiple values' => CONTENT_HANDLE_MODULE,
    809804    ),
    810805    'pndes_2' => array(
    811       'label' => t('Objetivo Estratégico'),
     806      'label' => t('Nivel 2'),
    812807      'field types' => array('content_taxonomy'),
    813808      'multiple values' => CONTENT_HANDLE_MODULE,
    814809    ),
    815810    'pndes_3' => array(
    816       'label' => t('Objetivo General'),
    817       'field types' => array('content_taxonomy'),
    818       'multiple values' => CONTENT_HANDLE_MODULE,
    819     ),
     811      'label' => t('Nivel 3'),
     812      'field types' => array('content_taxonomy'),
     813      'multiple values' => CONTENT_HANDLE_MODULE,
     814    ),
     815
     816
     817    'pndeso_0' => array(
     818      'label' => t('Nivel 0 (ONAPRE)'),
     819      'field types' => array('content_taxonomy'),
     820      'multiple values' => CONTENT_HANDLE_MODULE,
     821    ),
     822    'pndeso_1' => array(
     823      'label' => t('Nivel 1 (ONAPRE)'),
     824      'field types' => array('content_taxonomy'),
     825      'multiple values' => CONTENT_HANDLE_MODULE,
     826    ),
     827    'pndeso_2' => array(
     828      'label' => t('Nivel 2 (ONAPRE)'),
     829      'field types' => array('content_taxonomy'),
     830      'multiple values' => CONTENT_HANDLE_MODULE,
     831    ),
     832    'pndeso_3' => array(
     833      'label' => t('Nivel 3 (ONAPRE)'),
     834      'field types' => array('content_taxonomy'),
     835      'multiple values' => CONTENT_HANDLE_MODULE,
     836    ),
     837
     838
    820839    'pndesc_0' => array(
    821       'label' => t('Objetivo Histórico (Con Descripción)'),
     840      'label' => t('Nivel 0 (Con Descripción)'),
    822841      'field types' => array('content_taxonomy'),
    823842      'multiple values' => CONTENT_HANDLE_MODULE,
    824843    ),
    825844    'pndesc_1' => array(
    826       'label' => t('Objetivo Nacional (Con Descripción)'),
     845      'label' => t('Nivel 1 (Con Descripción)'),
    827846      'field types' => array('content_taxonomy'),
    828847      'multiple values' => CONTENT_HANDLE_MODULE,
    829848    ),
    830849    'pndesc_2' => array(
    831       'label' => t('Objetivo Estratégico (Con Descripción)'),
     850      'label' => t('Nivel 2 (Con Descripción)'),
    832851      'field types' => array('content_taxonomy'),
    833852      'multiple values' => CONTENT_HANDLE_MODULE,
    834853    ),
    835854    'pndesc_3' => array(
    836       'label' => t('Objetivo General (Con Descripción)'),
     855      'label' => t('Nivel 3 (Con Descripción)'),
    837856      'field types' => array('content_taxonomy'),
    838857      'multiple values' => CONTENT_HANDLE_MODULE,
Nota: Vea TracChangeset para ayuda en el uso del visor de conjuntos de cambios.