Conjunto 28143b8 en sipes


Ignorar:
Fecha y hora:
06/07/2017 15:56:29 (hace 7 años)
Autor:
Sipes Apn <root@…>
Branches:
stable
Children:
96e211e
Parents:
34e3034
Mensaje:

se realizaron varios ajustes relacionados con los padres e hijos de los terminos

Fichero:
1 editado

Leyenda

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

    r9ffeea7 r28143b8  
    247247        $node->ente_planificador_hierarchical = array(
    248248          'fathers' => _ente_planificador_hierarchical_get_desc($node->nid, 1),
    249           'children' => _ente_planificador_hierarchical_get_desc($node->nid, 0),
     249          'children' => _ente_planificador_hierarchical_get_children($node->nid, $node->tipo),
    250250        );
    251251        $hierarchical = variable_get('ente_planificador_hierarchical_count', 2);
     
    255255        }
    256256      }
    257 
    258257    break;
    259258    case 'presave':
     
    319318            $fathers = '';
    320319            $sep = '';
    321             foreach($node->ente_planificador_hierarchical['children'] as $level => $ente) {
    322               $fathers .= $sep . l($ente['title'], 'node/'. $ente['nid']);
    323               $sep = ' > ';
     320            foreach($node->ente_planificador_hierarchical['children'] as $nid => $ente) {
     321              $fathers .= $sep . l($ente['title'], 'node/'. $nid);
     322              $sep = ' | ';
    324323            }
    325324          $node->content['ente_planificador_hierarchical_childrens'] = array(
     
    333332  }
    334333}
    335 
    336 
    337 
     334/**
     335 *
     336 */
    338337function ente_planificador_hierarchical_obtiene_tipos_alter(&$tipos) {
    339338  $hierarchical = variable_get('ente_planificador_hierarchical_count', 2);
    340   for($i = 1; $i < $hierarchical + 1; $i++) {
     339  for ($i = 1; $i < $hierarchical + 1; $i++) {
    341340    if ($i == 1) {
    342341      $tipos[$i] = t(variable_get('ente_planificador_hierarchical_text_' . $i, 'Actor estratégico-táctico'));
     
    356355    if ($wid){
    357356      $states = workflow_get_states($wid);
    358 
    359357      $form['buttons']['#weight'] = 1000;
    360358      if (count($states)) {
     
    366364        );
    367365        $hierarchical = variable_get('ente_planificador_hierarchical_count', 2);
    368         for($i = 1; $i < $hierarchical + 1; $i++) {
     366        for ($i = 1; $i < $hierarchical + 1; $i++) {
    369367          $form['workflow_formuladores']['proyectos_operativos_state_form_' . $i] = array(
    370368            '#type' => 'select',
     
    374372            '#multiple' => FALSE,
    375373          );
    376 
    377 
    378374        }
    379375      }
     
    386382      $ente_planificador = ente_planificador_leer_ente_planificadores($form['node']['#value']->field_proyecto_ente[0]['nid']);
    387383      $hierarchical = variable_get('ente_planificador_hierarchical_count', 2);
    388       for($i = 1; $i < $hierarchical + 1; $i++) {
    389 //print_r($ente_planificador);
     384      for ($i = 1; $i < $hierarchical + 1; $i++) {
    390385        if ($ente_planificador->tipo != $i) {
    391386          $estado = variable_get('proyectos_operativos_state_form_' . $i, 0);
     
    595590}
    596591
    597 function _ente_planificador_hierarchical_get_desc($nid, $father = 1, $level = 0) {
     592function _ente_planificador_hierarchical_get_desc($nid, $get_father = 1, $level = 0) {
    598593  $fathers = array();
    599594  //get fathers
    600   if ($father) {
     595  if ($get_father) {
    601596    $sql = 'SELECT father.father as nid, father.level, n.title FROM {ente_planificador_hierarchical} AS father INNER JOIN {node} AS n ON n.nid = father.father WHERE father.nid = %d';
    602597  }
     
    614609  $query = db_query($sql, $inputs);
    615610  while ($father = db_fetch_object($query)) {
    616     $fathers[$father->level] = array(
    617       'title' => $father->title,
    618       'nid' =>  $father->nid,
    619     );
     611    if ($get_father) {
     612      $fathers[$father->level] = array(
     613        'title' => $father->title,
     614        'nid' =>  $father->nid,
     615        'level' =>  $father->level,
     616      );
     617    }
     618    else {
     619      $fathers[$father->nid] = array(
     620        'title' => $father->title,
     621        'nid' =>  $father->nid,
     622        'level' =>  $father->level,
     623      );
     624    }
    620625  }
    621626  return $fathers;
     
    657662  $query = db_query($sql, $inputs);
    658663  while ($father = db_fetch_object($query)) {
    659     $fathers[$father->nid] = $father->title;
     664    $fathers[$father->nid] = array(
     665      'title' => $father->title,
     666      'nid' => $father->nid,
     667      'level' => $father->level + 1,
     668    );   
    660669  }
    661670  return $fathers;
     
    720729  );
    721730}
     731
     732/**
     733 * Implementation of hook_obtiene_macro_alter()
     734 */
     735function ente_planificador_hierarchical_obtiene_macro_alter(&$actor_macr0, $ente_planificador) {
     736  if (count($ente_planificador->ente_planificador_hierarchical['children'])) {
     737    if ($ente_planificador->tipo <= variable_get('situacion_actual_preliminar_hierarchical_count', 2)) {
     738      $actor_macr0 = $ente_planificador->nid;
     739    }
     740  }
     741  else if (count($ente_planificador->ente_planificador_hierarchical['fathers'])) {
     742    $pos = variable_get('situacion_actual_preliminar_hierarchical_count', 2);
     743    $actor_macr0 = $ente_planificador->ente_planificador_hierarchical['fathers'][$pos];
     744  }
     745}
Nota: Vea TracChangeset para ayuda en el uso del visor de conjuntos de cambios.