1. <?php
  2.  
  3.  
  4.  
  5. class Normasorganizacion_model extends Model {
  6.  
  7.  
  8.  
  9. function __construct() {
  10.  
  11. parent::Model();
  12.  
  13. }
  14.  
  15.  
  16.  
  17. function SaveForm($form_data, $id_normas_organizacion=NULL) {
  18.  
  19. if($id_normas_organizacion == NULL) {
  20.  
  21. $this->db->insert('normas_organizacion', $form_data);
  22.  
  23. $id_seguridad_personal = $this->db->insert_id();
  24.  
  25. $this->session->set_userdata('id', $id_normas_organizacion);
  26.  
  27. }
  28.  
  29. else {
  30.  
  31. $this->db->where('id', $id_normas_organizacion);
  32.  
  33. $this->db->update('normas_organizacion', $form_data);
  34.  
  35. }
  36.  
  37.  
  38.  
  39. if ($this->db->affected_rows() == '1') {
  40.  
  41. return TRUE;
  42.  
  43. }
  44.  
  45.  
  46.  
  47. return FALSE;
  48.  
  49. }
  50.  
  51.  
  52.  
  53. function get_info($tabla) {
  54.  
  55. return $this->db->get($tabla);
  56.  
  57. }
  58.  
  59.  
  60.  
  61. function get_datos($id_general) {
  62.  
  63. $this->db->where('id_datos_generales', $id_general);
  64.  
  65. $query = $this->db->get('normas_organizacion');
  66.  
  67.  
  68.  
  69. if ($query->num_rows() > 0) {
  70.  
  71. return $query->row();
  72.  
  73. }
  74.  
  75. }
  76.  
  77.  
  78.  
  79. }
  80.  
  81. ?>