Conjunto de cambios 92f109b en sipes para 0.3-modules/ente_planificador_sector
- Fecha y hora:
- 09/06/2016 11:31:50 (hace 8 años)
- Branches:
- stable, version-3.0
- Children:
- a7e2cc0
- Parents:
- 7d9e4be
- Fichero:
-
- 1 editado
Leyenda
- No modificado
- Añadido
- Eliminado
-
0.3-modules/ente_planificador_sector/ente_planificador_sector.module
r3b8331b r92f109b 475 475 } 476 476 //recorer todos los ambitos 477 478 477 $tid = variable_get('ente_planificador_sector_Ambitos', 0); 478 $terms = taxonomy_get_tree($tid); 479 479 foreach ($terms as $term) { 480 480 $row = array(); 481 481 if ($term->depth == 0) { //si el termino es padre (AMBITO) 482 483 482 $fechas[0] = variable_get('ente_planificador_' . $type_node . '_all_from_' . $term->tid, $now); 483 $fechas[1] = variable_get('ente_planificador_' . $type_node . '_all_until_' . $term->tid, $now); 484 484 $FIPM = $fechas[0]; 485 485 $FFPM = $fechas[1]; … … 502 502 $fechas_display = FALSE; 503 503 } 504 504 $aux = ""; 505 505 if (module_exists('proyectos_operativos_mail')) { 506 506 $aux = l(t("Enviar Correo Electrónico a los entes planificadores por Ambito Social."), 'fechas_planificacion/notificacion/envia_email/ambito/' . $type_node); 507 507 } 508 508 if (user_access('admin planificador')) { 509 509 $FIPMA = variable_get('ente_planificador_' . $type_node . '_admin_from', $now); … … 919 919 //anadiendo el campo nivel de planificacion 920 920 $nivel_planificacion = ente_planificador_sector_nivel_planificacion(); 921 922 923 924 921 //SOLO DEJE A UN ENTE SER ENTE PLANIFICADOR MACRO 922 if (db_result(db_query("SELECT nid FROM {ente_planificador} where tipo = '1'")) > 0) { 923 unset($nivel_planificacion[1]); 924 } 925 925 $default = array(0); 926 926 if ($form['#node']->nid) { … … 930 930 $default = $entes->tipo; 931 931 } 932 932 $form['nivel'] = array( 933 933 '#type' => 'fieldset', 934 935 934 '#prefix' => '<div id="ente-planificador-sector-wrapper">', 935 '#suffix' => '</div>', 936 936 ); 937 937 $form['tipo'] = array( 938 938 '#type' => 'select', 939 939 '#title' => t('Nivel de Planificación'), … … 943 943 '#required' => TRUE, 944 944 '#weight' => -1, 945 945 '#ahah' => array( 946 946 'event' => 'change', 947 947 'path' => 'ente_planificador_sector_util', … … 949 949 'method' => 'replace', 950 950 'progress' => array('type' => 'bar', 'message' => t('Please wait...')), 951 952 953 951 ), 952 '#prefix' => '<div id="nivel">', 953 '#suffix' => '</div>', 954 954 ); 955 955 956 957 956 //anadiendo el campo sector 957 $options = array(); 958 958 if ($form['#node']->nid) { 959 959 $nid = $form['#node']->nid; … … 970 970 } 971 971 } 972 $parent = 0; 973 $parent = taxonomy_get_parents($default); 974 975 $form['nivel']['ambito'] = array( 976 '#type' => 'hidden', 977 '#value' => key($parent), 978 ); 972 979 $form['nivel']['sector'] = array( 973 980 '#type' => 'select', … … 976 983 '#required' => TRUE, 977 984 '#options' => $options, 978 979 985 '#prefix' => '<div id="sector_ente_planificador">', 986 '#suffix' => '</div>', 980 987 ); 981 982 988 //anadiendo el campo organismos_publicos 989 $options = array(); 983 990 $options[0] = "seleccione"; 984 991 $tid = variable_get('ente_planificador_sector_organismos', 0); 985 992 $terms = taxonomy_get_tree($tid); 986 993 $default = 0; 987 994 if ($form['#node']->nid) { 988 989 995 $default = db_result(db_query("SELECT organismo FROM {ente_planificador} WHERE nid = %d", $form['#node']->nid)); 996 } 990 997 foreach ($terms as $term) { 991 998 $options[$term->tid] = $term->name; 992 999 } 993 1000 $form['nivel']['ente_adscrito'] = array( 994 1001 '#type' => 'select', 995 1002 '#title' => t('Organismo Publico al que se esta adscrito'), … … 997 1004 '#required' => TRUE, 998 1005 '#options' => $options, 999 1000 1006 '#prefix' => '<div id="organismo">', 1007 '#suffix' => '</div>', 1001 1008 ); 1002 1003 1004 1005 1006 1007 1008 1009 1009 //anadiendo el campo sub-ente 1010 $options = array(); 1011 $options['0']= "seleccione"; 1012 $result = db_query("SELECT n.nid, n.title FROM {node} AS n INNER JOIN {ente_planificador} AS e ON n.nid = e.nid WHERE e.ente_adscrito != 0"); 1013 while ($rows = db_fetch_object($result)) { 1014 $options[$rows->nid] = $rows->title; 1015 } 1016 $default = 0; 1010 1017 if ($form['#node']->nid) { 1011 1012 1013 1018 $default = db_result(db_query("SELECT sub_ente FROM {ente_planificador} WHERE nid = %d", $form['#node']->nid)); 1019 } 1020 $form['nivel']['sub_ente'] = array( 1014 1021 '#type' => 'select', 1015 1022 '#title' => t('Ente al cual se esta adscrito'), … … 1017 1024 '#required' => TRUE, 1018 1025 '#options' => $options, 1019 1020 1026 '#prefix' => '<div id="sub_ente">', 1027 '#suffix' => '</div>', 1021 1028 ); 1022 } 1023 /*if ($form_id == 'ente_planificador_datos_basicos_forma') { 1024 //anadiendo el campo sector 1025 $options = array(); 1026 $tid = variable_get('ente_planificador_sector_Ambitos', 0); 1027 $terms = taxonomy_get_tree($tid); 1028 $options['0']= "seleccione"; 1029 foreach ($terms as $term) { 1030 if ($term->depth == 1) { //si el termino es padre 1031 $options[$term->tid] .= $term->name; 1032 } 1033 } 1034 $ente_planificador = NULL; 1035 $nid = $form['ente_planificador_nid']['#default_value']; 1036 if (is_numeric($nid)) { 1037 $ente_planificador = ente_planificador_leer_ente_planificadores($nid); 1038 } 1039 if ($ente_planificador && $ente_planificador->tipo == 2) { 1040 $form['nivel'] = array( 1041 '#type' => 'fieldset', 1042 '#prefix' => '<div id="ente-planificador-sector-wrapper">', 1043 '#suffix' => '</div>', 1044 ); 1045 $form['nivel']['sector'] = array( 1046 '#type' => 'select', 1047 '#title' => t('Sector Social'), 1048 '#default_value' => $ente_planificador->sector, 1049 '#required' => TRUE, 1050 '#options' => $options, 1051 '#prefix' => '<div id="sector_ente_planificador">', 1052 '#suffix' => '</div>', 1053 ); 1054 $form['#submit'][] = 'ente_planificador_sector_datos_basicos_forma_submit'; 1055 } 1056 }*/ 1057 } 1058 1059 /** 1060 * 1061 * 1062 function ente_planificador_sector_datos_basicos_forma_submit($form, &$form_state) { 1063 $terms = taxonomy_get_parents($form_state['values']['sector']); 1064 foreach ($terms as $tid => $term) { 1065 $tid = $term->tid; 1066 } 1067 $node_load = node_load($form_state['values']['ente_planificador_nid']); 1068 if ($tid) { 1069 $node_load->ambito = $tid; 1070 $node_load->sector = $form_state['values']['sector']; 1071 $node_load->revision = 1; 1072 node_save($node_load); 1073 } 1074 }*/ 1029 } 1030 } 1075 1031 1076 1032 /* … … 1418 1374 } 1419 1375 } 1376 else { 1377 if (isset($node->sector)) { 1378 $parent = taxonomy_get_parents($node->sector); 1379 $node->ambito = key($parent); 1380 } 1381 } 1420 1382 } 1421 1383 if ($op == 'view') { … … 1427 1389 '#suffix'=>'</p>', 1428 1390 ); 1429 1430 if ($node-> sector) {1391 } 1392 if ($node->tipo > 1 && $node->sector && $node->ambito) { 1431 1393 $tid = check_plain($node->sector); 1432 1394 $term = taxonomy_get_term($tid); … … 1437 1399 '#suffix'=>'</p>', 1438 1400 ); 1439 $terms = taxonomy_get_parents($tid); 1440 foreach ($terms as $tid => $term) { 1441 $name = $term->name; 1442 } 1401 $term = taxonomy_get_term($node->ambito); 1443 1402 $node->content['ambito'] = array( 1444 1403 '#prefix'=>'<p align="left">', 1445 '#value' => "<b>" . t('Ambito:') . "</b> " . $ name . "<br>",1404 '#value' => "<b>" . t('Ambito:') . "</b> " . $term->name . "<br>", 1446 1405 '#weight' => 1, 1447 1406 '#suffix'=>'</p>', … … 1627 1586 */ 1628 1587 function ente_planificador_sector_js_util() { 1629 1588 $tipo = 'nivel'; 1630 1589 $form_state = array('submitted' => FALSE); 1631 1590 $form_build_id = $_POST['form_build_id']; … … 1634 1593 // process it. We retreive the cached form, add the element, and resave. 1635 1594 $form = form_get_cache($form_build_id, $form_state); 1636 1637 1638 1639 1640 }1595 if ($_POST['tipo'] != 1) { 1596 $new_form['nivel'] = array( 1597 '#type' => 'fieldset', 1598 ); 1599 } 1641 1600 if ($_POST['tipo'] == 2) { 1642 1643 1601 $options = array(); 1602 $tid = variable_get('ente_planificador_sector_Ambitos', 0); 1644 1603 $terms = taxonomy_get_tree($tid); 1645 1604 $options['0']= "seleccione"; … … 1649 1608 } 1650 1609 } 1651 1610 $new_form['nivel']['sector'] = array( 1652 1611 '#title' => t('Sector Social'), 1653 1612 '#type' => 'select', 1654 1613 '#required' => TRUE, 1655 1614 '#options' => $options, 1656 1657 1615 '#prefix' => '<div id="sector_ente_planificador">', 1616 '#suffix' => '</div>', 1658 1617 ); 1659 1660 1661 1662 1663 1618 $form[$tipo]['sector'] = $new_form['sector']; 1619 } 1620 if ($_POST['tipo'] == 3) { 1621 $options = array(); 1622 $options[0] = "seleccione"; 1664 1623 $tid = variable_get('ente_planificador_sector_organismos', 0); 1665 1624 $terms = taxonomy_get_tree($tid); … … 1667 1626 $options[$term->tid] = $term->name; 1668 1627 } 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1628 $new_form['nivel']['ente_adscrito'] = array( 1629 '#type' => 'select', 1630 '#title' => t('Organismo Publico al que se esta adscrito'), 1631 '#required' => TRUE, 1632 '#options' => $options, 1633 '#prefix' => '<div id="organismo">', 1634 '#suffix' => '</div>', 1635 ); 1636 $form[$tipo]['ente_adscrito'] = $new_form['ente_adscrito']; 1637 } 1638 if ($_POST['tipo'] == 4) { 1639 $options = array(); 1640 $options['0']= "seleccione"; 1641 $result = db_query("SELECT n.nid, n.title FROM {node} AS n INNER JOIN {ente_planificador} AS e ON n.nid = e.nid WHERE e.ente_adscrito != 0"); 1642 while ($rows = db_fetch_object($result)) { 1643 $options[$rows->nid] = $rows->title; 1644 } 1645 $new_form['nivel']['sub_ente'] = array( 1646 '#type' => 'select', 1647 '#title' => t('Ente al cual se esta adscrito'), 1648 '#required' => TRUE, 1649 '#options' => $options, 1650 '#prefix' => '<div id="sub_ente">', 1651 '#suffix' => '</div>', 1652 ); 1653 $form[$tipo]['sub_ente'] = $new_form['sub_ente']; 1654 } 1696 1655 $form[$tipo] = $new_form; 1697 1656 form_set_cache($form_build_id, $form, $form_state); … … 1705 1664 $new_form = $form[$tipo]; 1706 1665 unset($new_form['#prefix'], $new_form['#suffix']); // Prevent duplicate wrappers. 1707 1708 1666 1709 1667 // Rebuild the form. … … 1742 1700 } 1743 1701 } 1702 elseif(isset($user->ambito_user) && $ente_planificador->tipo == 1 && !(in_array($rol_macro, array_keys($user->roles)))) { 1703 $term = taxonomy_get_term($user->ambito_user); 1704 $FIPMI = variable_get('ente_planificador_' . $type_proceso . '_all_from_' . $term->tid, $now); 1705 $FIPMF = variable_get('ente_planificador_' . $type_proceso . '_all_until_' . $term->tid, $now); 1706 } 1744 1707 } 1745 1708 if (is_numeric($ente_planificador) || user_access('admin all planificador')) { //si es el administrador se aplica la fecha especial … … 1775 1738 if ($type_proceso) { 1776 1739 if (is_object($ente_planificador)) { 1777 $sector = taxonomy_get_term($ente_planificador->sector); 1778 $ambito = taxonomy_get_term($ente_planificador->ambito); 1779 $mi_fecha = array( 1780 variable_get('ente_planificador_' . $type_proceso . '_all_from_' . $ambito->tid, $now), 1781 variable_get('ente_planificador_' . $type_proceso . '_all_until_' . $ambito->tid, $now), 1782 ); 1783 if ($expire) { 1784 $new_mensaje = t("Registrar y/o modificar los Proyectos Operativos para el Ambito %ambito en el Sector %sector no se encuentra disponible, se podra realizar desde el %fechaI hasta %fechaF", array('%ambito' => strtoupper($ambito->name), '%sector' => strtoupper($sector->name), '%fechaI' => format_date($mi_fecha[0]), '%fechaF' => format_date($mi_fecha[1]))); 1785 } 1786 else { 1787 $new_mensaje = t("Se podrá registrar y/o modificar los Proyectos Operativos para el Ambito %ambito en el Sector %sector desde el %fechaI hasta %fechaF", array('%ambito' => strtoupper($ambito->name), '%sector' => strtoupper($sector->name), '%fechaI' => format_date($mi_fecha[0]), '%fechaF' => format_date($mi_fecha[1]))); 1740 if ($ente_planificador->ambito) { 1741 $sector = taxonomy_get_term($ente_planificador->sector); 1742 $ambito = taxonomy_get_term($ente_planificador->ambito); 1743 $mi_fecha = array( 1744 variable_get('ente_planificador_' . $type_proceso . '_all_from_' . $ambito->tid, $now), 1745 variable_get('ente_planificador_' . $type_proceso . '_all_until_' . $ambito->tid, $now), 1746 ); 1747 if ($expire) { 1748 $new_mensaje = t("Registrar y/o modificar los Proyectos Operativos para el Ambito %ambito en el Sector %sector no se encuentra disponible, se podra realizar desde el %fechaI hasta %fechaF", array('%ambito' => strtoupper($ambito->name), '%sector' => strtoupper($sector->name), '%fechaI' => format_date($mi_fecha[0]), '%fechaF' => format_date($mi_fecha[1]))); 1749 } 1750 else { 1751 $new_mensaje = t("Se podra registrar y/o modificar los Proyectos Operativos para el Ambito %ambito en el Sector %sector desde el %fechaI hasta %fechaF", array('%ambito' => strtoupper($ambito->name), '%sector' => strtoupper($sector->name), '%fechaI' => format_date($mi_fecha[0]), '%fechaF' => format_date($mi_fecha[1]))); 1752 } 1753 } 1754 elseif(isset($user->ambito_user) && $ente_planificador->tipo == 1 && !(in_array($rol_macro, array_keys($user->roles)))) { 1755 if (empty($user->ambito_user)) { 1756 drupal_set_message(t('Especifique el ambito del usuario supervisor.'), 'warning'); 1757 } 1758 $ambito = taxonomy_get_term($user->ambito_user); 1759 $FIPMI = variable_get('ente_planificador_' . $type_proceso . '_all_from_' . $ambito->tid, $now); 1760 $FIPMF = variable_get('ente_planificador_' . $type_proceso . '_all_until_' . $ambito->tid, $now); 1761 1762 if ($expire) { 1763 $new_mensaje = t("Registrar y/o modificar los Proyectos Operativos para el Ambito %ambito no se encuentra disponible, se podra realizar desde el %fechaI hasta %fechaF", array('%ambito' => strtoupper($ambito->name), '%fechaI' => format_date($FIPMI), '%fechaF' => format_date($FIPMF))); 1764 } 1765 else { 1766 $new_mensaje = t("Se podra registrar y/o modificar los Proyectos Operativos para el Ambito %ambito desde el %fechaI hasta %fechaF", array('%ambito' => strtoupper($ambito->name), '%fechaI' => format_date($FIPMI), '%fechaF' => format_date($FIPMF))); 1767 } 1788 1768 } 1789 1769 }
Nota: Vea TracChangeset
para ayuda en el uso del visor de conjuntos de cambios.