/**
 * Grilla de noticias
 */
function noticiasGrilla()
{
    $_ci =& get_instance();
    $_ci->load->helper(array("modulo/noticias/permiso"));
    $_ci->grid->setTabla("noticia_grilla");
    $_ci->grid->addSearch(true);
    $_ci->grid->setModel("noticia_model");
    $_ci->grid->setQuery("buscar", array("nombre" => "buscar_nombre", "fecha_desde" => "buscar_fecha_desde", "fecha_hasta" => "buscar_fecha_hasta"), array());
    $opciones = "<div class=\"btn-group\">";
    //if(permisoNoticias("ver")){
    $opciones .= "<button type=\"button\" class=\"btn btn-sm btn-default ver-noticia\" title=\"Ver noticia\" data-rel=\"?\">" . "<i class=\"fa fa-search\"></i>" . "</button>";
    //}
    if (permisoNoticias("editar")) {
        $opciones .= "<button type=\"button\" class=\"btn btn-sm btn-green editar-noticia\" title=\"Editar noticia\" data-rel=\"?\">" . "<i class=\"fa fa-edit\"></i>" . "</button>";
    }
    if (permisoNoticias("eliminar")) {
        $opciones .= "<button type=\"button\" class=\"btn btn-sm btn-danger eliminar-noticia\" title=\"Eliminar noticia\" data-rel=\"?\">" . "<i class=\"fa fa-remove\"></i>" . "</button>";
    }
    $opciones .= "</div>";
    $_ci->grid->setColumns(array(array("column_name" => "", "column_table" => array("id"), "column_type" => "html", "column_html" => $opciones, "sortable" => array("active" => false), "width" => "5%"), array("column_name" => "N° Noticia", "column_table" => array("id"), "column_type" => "method", "sortable" => array("active" => true, "sortable_field" => "a.id"), "width" => "5%", "search" => array("active" => true, "searchable_cond" => "id = ?")), array("column_name" => "Fecha ingreso", "column_table" => array("fecha"), "column_type" => "date", "column_formato" => array("Y-m-d H:i:s"), "column_formato_salida" => "d/m/Y H:i:s", "column_align" => "left", "sortable" => array("active" => true, "sortable_field" => "a.fecha"), "width" => "10%"), array("column_name" => "Titulo", "column_table" => array("nombre"), "column_type" => "method", "sortable" => array("active" => true, "sortable_field" => "a.nombre"), "width" => "30%", "search" => array("active" => true, "searchable_value" => "%?%", "searchable_cond" => "nombre LIKE ?"))));
    return $_ci->grid->getGrid();
}
                            </div>
                        </div>
                        <div class="col-lg-2">
                            <div class="form-group clearfix">
                                <label class="control-label" for="buscar_nombre">Nombre</label>
                                <input type="text" name="buscar_nombre" id="buscar_nombre" class="form-control"/>
                            </div>
                        </div>
                        <div class="col-lg-8 text-right">
                            <div class="btn-group">
                                <button id="buscar" type="button" class="btn btn-primary btn-square btn-buscar search-bar-button">
                                    <i class="fa fa-search"></i>
                                    Buscar
                                </button>
                                <?php 
if (permisoNoticias("ingresar")) {
    ?>
                                <button id="nueva" class="btn btn-square btn-green search-bar-button">
                                    <i class="fa fa-plus"></i>
                                    Nueva noticia
                                </button>
                                <?php 
}
?>
                            </div>
                        </div>

                    </div>
                </form>
            </div>
        </div>