コード例 #1
0
ファイル: puertosdir.php プロジェクト: codethics/proteoerp
 function filteredgrid()
 {
     $this->rapyd->load("datafilter", "datagrid");
     function rtrunc($forma)
     {
         $pos = strpos($forma, "\r\n");
         return substr($forma, 0, $pos);
     }
     $filter = new DataFilter("Filtro de Busqueda");
     $filter->db->select(array("forma", 'nombre'));
     $filter->db->from("formatos");
     $filter->db->orderby("nombre");
     //$filter->db->where("forma LIKE");
     $filter->nombre = new inputField("Nombre", "nombre");
     $filter->nombre->size = 20;
     $filter->forma = new inputField("Forma", "forma");
     $filter->forma->size = 20;
     $filter->buttons("reset", "search");
     $filter->build();
     $form = new DataForm("supervisor/puertosdir/filteredgrid/process");
     $form->puerto = new inputField("Nuevo Puerto", "puerto");
     $form->puerto->rule = "required";
     $form->submit("btnsubmit", "Cambiar");
     $form->build_form();
     if ($form->on_success()) {
         echo 'pasamos';
     }
     $grid = new Datagrid("Resultados");
     $grid->use_function('rtrunc');
     $link = site_url('/supervisor/acdatasis/activar');
     $grid->per_page = 15;
     $grid->column("Nombre", "nombre");
     $grid->column("Dirigido", "<rtrunc><#forma#></rtrunc>", 'align="center"');
     $grid->build();
     //echo $grid->db->last_query();
     $ssql = json_encode($grid->db->last_query());
     $data['script'] = "<script type='text/javascript'>\n\t\t\t\$(document).ready(function() {\n\t\t\t\tsql={$ssql};\n\t\t\t\t\n\t\t\t});\n\t\t\t</script>";
     $data['content'] = $filter->output . $form->output . $grid->output;
     $data['title'] = "<h1>Redirecci&oacute;n de puertos en formatos DataSIS</h1>";
     $data["head"] = script("jquery.js") . $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
コード例 #2
0
ファイル: acdatasis.php プロジェクト: codethics/proteoerp
    function copia($usua = null)
    {
        $this->rapyd->load("datafilter", "datagrid");
        $usuario = $usua;
        function ractivo($acceso, $codigo)
        {
            if ($acceso == 'S') {
                $retorna = form_checkbox($codigo, 'accept', TRUE);
            } else {
                $retorna = form_checkbox($codigo, 'accept', FALSE);
            }
            return $retorna;
        }
        $filter = new DataFilter("");
        $filter->db->select(array("b.modulo", 'b.codigo', "a.usuario", "a.usuario as value", "a.acceso", "b.titulo"));
        $filter->db->from("sida AS a");
        $filter->db->join("tmenus AS b", "a.modulo=b.codigo");
        $filter->db->orderby("b.modulo");
        $filter->usuario = new dropdownField("Copiar de", "usuario");
        $filter->usuario->options("Select us_codigo as value,CONCAT_WS('  - ', us_codigo, us_nombre) as codigo from usuario group by us_codigo");
        $filter->usuario->style = 'width:250px;';
        $filter->buttons("reset", "search");
        $filter->build();
        if ($this->rapyd->uri->is_set("search") and $filter->is_valid()) {
            $usr = $filter->usuario->newValue;
            $mSQL = "INSERT IGNORE INTO sida SELECT '{$usr}',b.codigo,'N'  FROM sida AS a RIGHT JOIN tmenus AS b ON a.modulo=b.codigo AND a.usuario='{$usr}' WHERE a.modulo IS NULL";
            $this->db->simple_query($mSQL);
            $copiar = anchor("supervisor/acdatasis/copiar/{$usr}/{$usuario}", 'Copiar');
            $grid = new Datagrid("Resultados");
            $grid->use_function('ractivo');
            $link = site_url('/supervisor/acdatasis/activar');
            //$grid->per_page = 15;
            $grid->column("M&oacute;dulo", "modulo");
            $grid->column("Nombre", "titulo");
            $grid->column("Acceso", "<ractivo><#acceso#>|<#codigo#>|</ractivo>", 'align="center"');
            $grid->build();
            $tabla = $copiar . $grid->output;
            //echo $grid->db->last_query();
            $url = site_url('supervisor/acdatasis/activar');
            $data['script'] = '<script type="text/javascript">
			$(document).ready(function() {
				$("form :checkbox").click(function () {
    	       usr=$("#usuario").attr("value");
    	       $.ajax({type: "POST",
    	       url: "' . $url . '",
    	       data: "codigo="+this.name+"&usuario="+usr,
    	       success: function(msg){
						  	if (msg==0)
						    	alert("Ocurrio un problema");
						  }
						});
    	    }).change();
			});
			</script>';
        } else {
            $tabla = '';
        }
        $data['content'] = ' Usuario:' . $usuario . $filter->output . form_open('') . $tabla . form_close();
        $data['title'] = "<h1>Copiar Accesos de Usuario en DataSIS</h1>";
        $data["head"] = script("jquery.js") . $this->rapyd->get_head();
        $this->load->view('view_ventanas', $data);
    }