protected function process()
 {
     $this->show_fs_toolbar = FALSE;
     $this->busqueda = '';
     $this->resultado = array();
     if (isset($_GET['cod'])) {
         $clan = new clan_familiar();
         $this->clan = $clan->get($_GET['cod']);
     }
     if (isset($_POST['buscar_cliente'])) {
         $this->buscar_cliente();
     } else {
         if ($this->clan) {
             if (isset($_POST['nombre'])) {
                 $this->clan->nombre = $_POST['nombre'];
                 $this->clan->limite = floatval($_POST['limite']);
                 $this->clan->restringido = isset($_POST['restringido']);
                 if ($this->clan->save()) {
                     $this->new_message('Datos modificados correctamente.');
                 } else {
                     $this->new_error_msg('Imposible guardar los cambios.');
                 }
                 $this->clientes = $this->clan->get_clientes();
                 foreach ($this->clientes as $i => $value) {
                     if (!isset($_POST['codcliente'])) {
                         $this->quitar_cliente($value->codcliente);
                         unset($this->clientes[$i]);
                     } else {
                         if (!in_array($value->codcliente, $_POST['codcliente'])) {
                             $this->quitar_cliente($value->codcliente);
                             unset($this->clientes[$i]);
                         }
                     }
                 }
             } else {
                 if (isset($_GET['cliente'])) {
                     $cliente2clan = new cliente2clan();
                     $cliente2clan->codclan = $this->clan->codclan;
                     $cliente2clan->codcliente = $_GET['cliente'];
                     if ($cliente2clan->save()) {
                         $this->new_message('Cliente añadido correctamente.');
                     } else {
                         $this->new_error_msg('Error al añadir el cliente.');
                     }
                 }
             }
             $this->page->title = 'Clan ' . $this->clan->codclan;
             $this->clientes = $this->clan->get_clientes();
         } else {
             $this->new_error_msg('Clan familiar no encontrado.');
         }
     }
 }
 public function get_clan($codcliente)
 {
     $data = $this->db->select("SELECT * FROM " . $this->table_name . " WHERE codcliente = " . $this->var2str($codcliente) . ";");
     if ($data) {
         $clan = new clan_familiar();
         return $clan->get($data[0]['codclan']);
     } else {
         return FALSE;
     }
 }