Conjunto 66a2dec en sipes


Ignorar:
Fecha y hora:
20/09/2016 09:11:20 (hace 8 años)
Autor:
planificacion <planificacion@…>
Branches:
stable, version-3.0
Children:
3959b2a
Parents:
42ac972
Mensaje:

se agrego un cambio

Fichero:
1 editado

Leyenda

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

    re32e12b r66a2dec  
    115115    $rows = array();
    116116  }
    117   if ($type == 'cvs') {
     117  elseif ($type == 'cvs') {
    118118    $cadena = '"PROY_PROY_ID"' . $cell_separator . '"FUENTE_ID"' . $cell_separator . '"MONTO"' . $row_separator;
    119119  }
    120   if ($type == 'data') {
     120  elseif ($type == 'data') {
    121121    $arreglo = array();
    122122  }
     
    135135      $row_nid = array('data' => $nid,);
    136136    }
    137     if ($type == 'cvs') {
     137    elseif ($type == 'cvs') {
    138138      $texto_base = '"' . $nid . '"' . $cell_separator;
    139139    }
    140     if ($type == 'other') {
     140    elseif ($type == 'data') {
    141141      $datos_other = array();
    142       $arreglo[$nid] = array();
    143142    }
    144143    foreach($fuentes_fin as $id => $valor) {
     
    150149        $rows[] = $row;
    151150      }
    152       if ($type == 'cvs') {
     151      elseif ($type == 'cvs') {
    153152        $cadena .= $texto_base . '"' . $id . '"' . $cell_separator . '"' . $valor . '"' . $row_separator;
    154153      }
    155       if ($type == 'other') {
    156         $arreglo[$nid][$id] = array(
    157           'PROY_PROY_ID' => $nid,
    158           'FUENTE_ID' => $id,
    159           'MONTO' => $valor,
    160         );
     154      elseif ($type == 'data') {
     155        $item = new stdClass();
     156        $item->PROY_PROY_ID = $nid;
     157        $item->FUENTE_ID = $id;
     158        $item->MONTO = $valor;
     159        $arreglo[] = $item;
    161160      }
    162161    }
     
    169168    return theme('table', $header, $rows, array('id' => 'fuentes_proy'));
    170169  }
    171   if ($type == 'cvs') {
     170  elseif ($type == 'cvs') {
    172171    $filename = 'fuentes_proyectos_' . time() . '.csv';
    173172    if (variable_get('onapre_encode_ISO_8859_1', FALSE)) {
     
    182181    exit();
    183182  }
    184   if ($type == 'other') {
     183  elseif ($type == 'data') {
    185184    return $arreglo;
    186185  }
     
    216215}
    217216
     217/**
     218 * Implementation of hook_services_resources().
     219 */
     220function sipesonapre_services_resources() {
     221  $resources['sipesonapre'] = array();
     222  $resources['sipesonapre']['retrieve'] = array(
     223    'help' => 'Retrieves Fuentes Proyectos ONAPRE.',
     224    'callback' => 'sipesonapre_retrieve',
     225    'access callback' => 'sipesonapre_access',
     226    'access arguments' => array('view'),
     227    'access arguments append' => TRUE,
     228  );
     229
     230  return $resources;
     231}
     232
     233/**
     234 * Check the access permission to a given views.
     235 *
     236 * @param $op
     237 *  String. The operation that's going to be performed.
     238 * @param $args
     239 *  Array. The arguments that will be passed to the callback.
     240 * @return
     241 *  Boolean. TRUE if the user is allowed to load the given view.
     242 */
     243function sipesonapre_access($op = 'view') {
     244  return user_access('consultar onapre');
     245}
     246
     247/**
     248 * Callback for retrieving fuentes onapre.
     249 *
     250 *
     251 * @return
     252 *  Array. The views return.
     253 */
     254function sipesonapre_retrieve() {
     255  $result = _sipesonapre_get_fuentes($nid = 0, 'data');
     256  return $result;
     257}
Nota: Vea TracChangeset para ayuda en el uso del visor de conjuntos de cambios.