Пример #1
0
 /**
  * Retorna un objeto de la clase YDatasetModel y lo asigna a la propiedad "modelo"
  *
  * @return YConcreteDatasetModel
  */
 private function _getOrConstructModel()
 {
     if (is_file(APPPATH . 'models/' . $this->getClassName() . '.php')) {
         Yupii::get_CI()->load->model($this->getClassName(), 'modelo');
     } else {
         //this is weird and ugly but is the only way to make it work on CI3...
         Yupii::get_CI()->load->model('Yconcretedatasetmodel', 'modelo');
         if (ifSet($this->modelo) == NULL) {
             $this->modelo = new YConcreteDatasetModel();
         }
     }
     return ifSet($this->modelo, NULL);
 }
Пример #2
0
 function calculateEncab($row)
 {
     $i = 2;
     if ($this->groups) {
         foreach ($this->groups as $f => &$g) {
             $i++;
             if (@$g['current'] != $row[$f] || $this->showldwritelevelheader) {
                 if (@$g['current'] == '') {
                     $this->showldwritelevelfooter = FALSE;
                 }
                 $g['current'] = $row[$f];
                 $this->showldwritelevelheader = TRUE;
                 $this->load->helper('utiles');
                 $this->encab .= "<h{$i}> " . ifSet($g['label'], $f) . ": {$row[$f]} </h{$i}>";
             }
         }
     }
 }
Пример #3
0
function makeList($options)
{
    $id = ifSet($options['id'], '(undefined)');
    $options['id'] = $id;
    $template = ifSet($options['template'], '');
    if (!$template) {
        throw new Exception("The template for {$id} list is null");
    }
    if (!file_exists($template)) {
        throw new Exception("The template for {$id} list does not exist");
    }
    $options['template'] = $template;
    $row_filter = ifSet($options['row_filter'], '');
    if ($row_filter && !file_exists($row_filter)) {
        throw new Exception("The row filter for {$id} list does not exist");
    }
    $options['row_filter'] = $row_filter;
    $data = ifSet($options['data'], array());
    if (!is_array($options['data'])) {
        throw new Exception("The data for {$id} list is not an array");
    }
    $options['data'] = $data;
    $columns = ifSet($options['columns'], array());
    if (!count($columns)) {
        throw new Exception("The columns for {$id} list are not defined");
    }
    foreach ($columns as $key => $column) {
        $columns[$key]['field'] = $key;
        $headers[$key] = x($column['label']);
    }
    $options['columns'] = $columns;
    $options['headers'] = $headers;
    $options['num_rows'] = count($data);
    $options['num_cols'] = count($columns);
    $options['makeListHeader'] = ifSet($options['makeListHeader'], 'makeListHeader');
    $options['makeListTable'] = ifSet($options['makeListTable'], 'makeListTable');
    $options['makeListRow'] = ifSet($options['makeListRow'], 'makeListRow');
    $options['makeListCell'] = ifSet($options['makeListCell'], 'makeListCell');
    ////
    global $display;
    ob_start();
    require $template;
    $result = ob_get_clean();
    return $result;
}
Пример #4
0
/**
 * Crea la página y la envía al browser
 * Si cacheId es no nulo, se cachea la página generada
 *
 * @param string  $template
 * @param string  $layout
 * @param boolean $exit
 * @param string  $cache_id
 */
function render($template, $layout, $exit = true, $cache_id = null, $cache_tags = null)
{
    global $cache;
    $result = makePage($template, $layout);
    if (!empty($cache_id)) {
        $cache_tags = ifSet($cache_tags, array());
        $cache->save($result, $cache_id, $cache_tags);
    }
    echo $result;
    if ($exit) {
        exit;
    }
}
Пример #5
0
 function textForTable($values, $fieldname)
 {
     $f = $this->fieldByName($fieldname);
     $value = $values[$this->realField($fieldname)];
     if ($f->getType() == 'multiselect') {
         $values = explode(',', $value);
         $opts = $f->getOptions();
         foreach ($values as $k => $v) {
             $values[$k] = @$opts[$v];
         }
         $value = implode(',', $values);
     }
     if ($f->getType() == 'dropdown') {
         $opts = $f->getOptions();
         $value = @$opts[$value];
     }
     $limite = config_item('yupii_show_ellipsis_for_text_longer_than');
     $limite = ifSet($limite, 30);
     $this->load->helper('text');
     $value = removeNewLines(character_limiter(strip_tags(addslashes($value)), $limite));
     return $value;
 }
Пример #6
0
t.dataTable({
"sPaginationType": "full_numbers",
"sDom": '<"H"lfr>t<"F"ip>',
"bProcessing": true,
"bFilter": true,
<?php 
if ($sortingField >= 0) {
    ?>
    "aaSorting":[[ <?php 
    echo $sortingField;
    ?>
, "<?php 
    echo ifSet($sortingDir, 'asc');
    ?>
" ]],
<?php 
} else {
    ?>
    "aaSorting":[], //no se requiere ordenar al principio
<?php 
}
?>
"bJQueryUI": false,
"bLengthChange": true,
"bServerSide": true,
"sAjaxSource": "<?php 
echo site_url($tc . '/getAjaxGridData');
?>
",
"bDeferRender": true,
"oLanguage": {
Пример #7
0
function cav($val)
{
    return CHtml::encode(ifSet($val));
}