Conjunto de78188 en sipes
- Fecha y hora:
- 30/08/2017 17:10:14 (hace 7 años)
- Branches:
- stable
- Children:
- de06505
- Parents:
- 7fee1ef
- Fichero:
-
- 1 editado
Leyenda
- No modificado
- Añadido
- Eliminado
-
0.3-modules/politicas_proyectos/politicas_proyectos.module
r7b75b73 rde78188 563 563 'function' => 'theme_politicas_proyectos_formatter_body', 564 564 ), 565 'politicas_proyectos_formatter_pndes_0' => array( 566 'arguments' => array('element' => NULL), 567 'function' => 'theme_politicas_proyectos_formatter_generic', 568 ), 569 'politicas_proyectos_formatter_pndes_1' => array( 570 'arguments' => array('element' => NULL), 571 'function' => 'theme_politicas_proyectos_formatter_generic', 572 ), 573 'politicas_proyectos_formatter_pndes_2' => array( 574 'arguments' => array('element' => NULL), 575 'function' => 'theme_politicas_proyectos_formatter_generic', 576 ), 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 ), 593 'politicas_proyectos_formatter_pndes_3' => array( 594 'arguments' => array('element' => NULL), 595 'function' => 'theme_politicas_proyectos_formatter_generic', 596 ), 597 'politicas_proyectos_formatter_metaspcc' => array( 598 'arguments' => array('element' => NULL), 599 'function' => 'theme_politicas_proyectos_formatter_metaspcc', 600 ), 601 'politicas_proyectos_row' => array( 602 'arguments' => array('row' => NULL, 'type' => NULL), 603 ), 565 604 ); 566 605 } … … 598 637 599 638 /** 639 * Theme function for 'default' text field formatter. 640 */ 641 function theme_politicas_proyectos_formatter_metaspcc($element) { 642 if (!empty($element['#item']['value'])) { 643 $term = taxonomy_get_term($element['#item']['value']); 644 if ($term) { 645 $valores = term_fields_get_fields_values($term); 646 return check_plain($valores['plan_carabobo_meta_value']); 647 } 648 } 649 } 650 651 /** 652 * Theme function for HS Content Taxonomy formatters. 653 * 654 */ 655 function theme_politicas_proyectos_formatter_generic($element) { 656 $output = ''; 657 if (module_exists('hierarchical_select')) { 658 // Extract required field information. 659 // $element contains only field name; so we use cck function to get more info. 660 $field = content_fields($element['#field_name'], $element['#type_name']); 661 $field_name = $field['field_name']; 662 $vid = $field['vid']; 663 $tid = (empty($field['tid'])) ? 0 : $field['tid']; 664 $depth = (empty($field['depth'])) ? 0 : $field['depth']; 665 // Get the config for this field. 666 require_once(drupal_get_path('module', 'hierarchical_select') .'/includes/common.inc'); 667 $config_id = "content-taxonomy-$field_name"; 668 $config = hierarchical_select_common_config_get($config_id); 669 $config += array( 670 'module' => 'hs_content_taxonomy_description', 671 'params' => array( 672 'vid' => $vid, 673 'tid' => $tid, 674 'depth' => $depth, 675 ), 676 ); 677 $selection = array(); 678 // Cycle through elements. 679 foreach (element_children($element) as $key) { 680 if (isset($element[$key]['#item']['value'])) { 681 $selection[] = $element[$key]['#item']['value']; 682 } 683 } 684 // It is said that formatter theme function is called even if field is empty. 685 if (empty($selection)) { 686 return $output; 687 } 688 // Generate a dropbox out of the selection. This will automatically 689 // calculate all lineages for us. 690 $dropbox = _hierarchical_select_dropbox_generate($config, $selection); 691 // Actual formatting. 692 // In 6.x formatter is fully themable 693 // We theme each lineage using additional theme function 694 $num_items = count($dropbox->lineages); 695 $flip = array('even' => 'odd', 'odd' => 'even'); 696 $class = 'even'; 697 $output = '<ul class="hierarchical-select-lineages">'; 698 foreach ($dropbox->lineages as $i => $lineage) { 699 $class = $flip[$class]; 700 $classes = ' '. $class; 701 if ($i == 0) { 702 $classes .= ' first'; 703 } 704 if ($i == $num_items - 1) { 705 $classes .= ' last'; 706 } 707 $output .= '<li class="lineage-'. $i . $classes .'">'; 708 $output .= theme('politicas_proyectos_row', $lineage, $element['#formatter']); 709 $output .= '</li>'; 710 } 711 $output .= '</ul>'; 712 // Add the CSS. 713 drupal_add_css(drupal_get_path('module', 'hierarchical_select') .'/hierarchical_select.css'); 714 } 715 return $output; 716 } 717 718 /** 719 * Theme function to output single row (lineage) of CT field 720 * 721 * Giving levels different classes so some funny theming is possible: 722 * for example, different font size depending on level (like tagadelic) 723 */ 724 function theme_politicas_proyectos_row($row, $type) { 725 list($formatter, $level) = explode('_', $type); 726 $separator = '<span class="politicas-proyectos-pndes-item-separator">âº</span>'; 727 $output = ''; 728 if (empty($row)) { 729 return $output; 730 } 731 $items = array(); 732 $term = isset($row[$level]['value']) ? taxonomy_get_term($row[$level]['value']) : 0; 733 $output = ''; 734 if ($term) { 735 switch ($formatter) { 736 case 'pndes': 737 $output .= $term->name; 738 break; 739 case 'pndesc': 740 $output .= $term->name . HS_CONTENT_TAXONOMY_DESCRIPTION_SEP . $term->description; 741 break; 742 } 743 } 744 return $output; 745 } 746 747 /** 600 748 * Implementation of _politicas_proyectos_load_politica(). 601 749 * Load node … … 642 790 'field types' => array('nodereference'), 643 791 'multiple values' => CONTENT_HANDLE_CORE, 792 ), 793 'pndes_0' => array( 794 'label' => t('Objetivo Histórico'), 795 'field types' => array('content_taxonomy'), 796 'multiple values' => CONTENT_HANDLE_MODULE, 797 ), 798 'pndes_1' => array( 799 'label' => t('Objetivo Nacional'), 800 'field types' => array('content_taxonomy'), 801 'multiple values' => CONTENT_HANDLE_MODULE, 802 ), 803 'pndes_2' => array( 804 'label' => t('Objetivo Estratégico'), 805 'field types' => array('content_taxonomy'), 806 'multiple values' => CONTENT_HANDLE_MODULE, 807 ), 808 'pndes_3' => array( 809 'label' => t('Objetivo General'), 810 'field types' => array('content_taxonomy'), 811 'multiple values' => CONTENT_HANDLE_MODULE, 812 ), 813 'pndesc_0' => array( 814 'label' => t('Objetivo Histórico (Con Descripción)'), 815 'field types' => array('content_taxonomy'), 816 'multiple values' => CONTENT_HANDLE_MODULE, 817 ), 818 'pndesc_1' => array( 819 'label' => t('Objetivo Nacional (Con Descripción)'), 820 'field types' => array('content_taxonomy'), 821 'multiple values' => CONTENT_HANDLE_MODULE, 822 ), 823 'pndesc_2' => array( 824 'label' => t('Objetivo Estratégico (Con Descripción)'), 825 'field types' => array('content_taxonomy'), 826 'multiple values' => CONTENT_HANDLE_MODULE, 827 ), 828 'pndesc_3' => array( 829 'label' => t('Objetivo General (Con Descripción)'), 830 'field types' => array('content_taxonomy'), 831 'multiple values' => CONTENT_HANDLE_MODULE, 832 ), 833 'metaspcc' => array( 834 'label' => t('Metas del Plan Campaña de Carabobo'), 835 'field types' => array('content_taxonomy'), 836 'multiple values' => CONTENT_HANDLE_MODULE, 644 837 ), 645 838 );
Nota: Vea TracChangeset
para ayuda en el uso del visor de conjuntos de cambios.