Advertisement
reynierpm

Untitled

Dec 13th, 2012
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 18.63 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * Proyecto Biblios
  5.  * Proyecto desarrollado por 3WD.
  6.  *
  7.  * @package     CodeIgniter
  8.  * @author      3WD - Tomas Losis <tomas.losis@treswd.com>
  9.  * @since       Version 1.0 Marzo 2012
  10.  * @description     Modelo de tabla de paises
  11.  */
  12. class Mauthor extends CI_Model {
  13.  
  14.     private $tbl_author_ppi = 'autores_ppi';
  15.     private $tbl_author_censo83 = 'autores_censo83';
  16.     private $tbl_autores = 'autores';
  17.     private $tbl_autores_ppi_ano = 'autores_ppi_ano';
  18.     // RENAME TABLE `autores_ppi_aƱo` TO `autores_ppi_ano`
  19.     private $tbl_autores_filiacion = 'autores_filiacion';
  20.     private $tbl_pais = 'paises';
  21.     private $tbl_ciudad = 'ciudades';
  22.     private $tbl_filiacion = 'filiacion';
  23.  
  24.     function __construct() {
  25.     // Call the Model constructor
  26.     parent::__construct();
  27.     }
  28.  
  29.     public function getAllList($sort, $direction, $limit = 10, $offset = 0) {
  30.     $search = $this->session->userdata('search');
  31.     $this->db->select("*");
  32.     $this->db->from('autores');
  33.  
  34.     if (!empty($search)) {
  35.         $this->db->where('(nom_usuario like "%' . $search . '%" OR ape_usuario like "%' . $search . '%" OR email like "%' . $search . '%")');
  36.     }
  37.  
  38.     $this->db->order_by($sort, $direction);
  39.     $this->db->limit($limit, $offset);
  40.     return $this->db->get();
  41.     }
  42.  
  43.     public function getNumList() {
  44.     $search = $this->session->userdata('search');
  45.     $this->db->select("*");
  46.     $this->db->from('autores');
  47.  
  48.     if (!empty($search)) {
  49.         $this->db->where('(nom_usuario like "%' . $search . '%" OR ape_usuario like "%' . $search . '%" OR email like "%' . $search . '%")');
  50.     }
  51.  
  52.     $this->db->order_by('id_autor', 'desc');
  53.  
  54.     $query = $this->db->get();
  55.     return $query->num_rows();
  56.     }
  57.  
  58.     public function insert($nombre, $apellido, $genero, $nacionalidad, $cedula, $nacimiento, $email, $email2, $idUnesco, $palclaves, $maisanta, $telOficina, $telCelular) {
  59.     //insercion en tabla maestra
  60.     $data = array(
  61.         'NOMBRE' => $nombre,
  62.         'ID_UNESCO' => $idUnesco,
  63.         'APELLIDO' => $apellido,
  64.         'AUTOR' => strtoupper($nombre) . " " . strtoupper($apellido),
  65.         'GENERO' => $genero,
  66.         'NACIONALID' => $nacionalidad,
  67.         'CI' => $cedula,
  68.         'FECHA_NACI' => $nacimiento,
  69.         'PALCLAVES' => $palclaves,
  70.         'MAISANTA' => $maisanta,
  71.         'TELE_OFI' => $telOficina,
  72.         'TELE_CEL' => $telCelular,
  73.         'EMAIL' => $email,
  74.         'EMAIL_1' => $email2,
  75.         'ES_PPI' => 'N',
  76.         'ES_CENSO83' => 'N'
  77.     );
  78.     $this->db->insert('autores', $data);
  79.  
  80.     $id_user_wp = $this->db->insert_id();
  81.     return $id_user_wp;
  82.     }
  83.  
  84.     public function delete($idautor) {
  85.     $this->db->where('ID_AUTOR', $idautor);
  86.     return $this->db->delete('autores');
  87.     }
  88.  
  89.     public function get_row($idautor) {
  90.     $query = $this->db->query("SELECT NOMBRE, APELLIDO, GENERO, NACIONALID, CI, FECHA_NACI, EMAIL, EMAIL_1, PALCLAVES, MAISANTA, TELE_OFI, TELE_CEL, ES_PPI, ES_CENSO83, ID_UNESCO FROM autores WHERE ID_AUTOR='" . $idautor . "' LIMIT 1");
  91.     if ($row = $query->row())
  92.         return array($row->NOMBRE, $row->APELLIDO, $row->GENERO, $row->NACIONALID, $row->CI, $row->FECHA_NACI, $row->EMAIL, $row->EMAIL_1, $row->PALCLAVES, $row->MAISANTA, $row->TELE_OFI, $row->TELE_CEL, $row->ES_PPI, $row->ES_CENSO83, $row->ID_UNESCO);
  93.     else
  94.         return FALSE;
  95.     }
  96.  
  97.     public function update($id, $nombre, $apellido, $genero, $nacionalidad, $cedula, $nacimiento, $email, $email2, $idUnesco, $palclaves, $maisanta, $telOficina, $telCelular) {
  98.     //insercion en tabla maestra
  99.     $data = array(
  100.         'NOMBRE' => $nombre,
  101.         'ID_UNESCO' => $idUnesco,
  102.         'APELLIDO' => $apellido,
  103.         'AUTOR' => strtoupper($nombre) . " " . strtoupper($apellido),
  104.         'GENERO' => $genero,
  105.         'NACIONALID' => $nacionalidad,
  106.         'CI' => $cedula,
  107.         'FECHA_NACI' => $nacimiento,
  108.         'PALCLAVES' => $palclaves,
  109.         'MAISANTA' => $maisanta,
  110.         'TELE_OFI' => $telOficina,
  111.         'TELE_CEL' => $telCelular,
  112.         'EMAIL' => $email,
  113.         'EMAIL_1' => $email2,
  114.         'ES_PPI' => 'N',
  115.         'ES_CENSO83' => 'N'
  116.     );
  117.     $this->db->where('ID_AUTOR', $id);
  118.     $this->db->update('autores', $data);
  119.     }
  120.  
  121.     /**
  122.      * Get all magazines for show up in a Modal Window
  123.      * @param int $limit
  124.      * @param int $start
  125.      * @return boolean
  126.      */
  127.     public function getAllAuthor($limit, $start) {
  128.     $this->db->limit($limit, $start);
  129.     $query = $this->db->get('autores');
  130.  
  131.     if ($query->num_rows() > 0) {
  132.         foreach ($query->result() as $row) {
  133.         $data[] = $row;
  134.         }
  135.         return $data;
  136.     }
  137.     return false;
  138.     }
  139.  
  140.     /**
  141.      * Count how many magazines exists
  142.      * @return int
  143.      */
  144.     public function getCountList() {
  145.     $this->db->select("*");
  146.     $this->db->from('autores');
  147.     return $this->db->get()->num_rows();
  148.     }
  149.  
  150.     /**
  151.      * Associated new authors
  152.      */
  153.     public function associateAuthor($data = array()) {
  154.     // Security fallback to be sure we run a valid query and don't get MySQL errors
  155.     if (!$data || empty($data))
  156.         return FALSE;
  157.  
  158.     $this->db->select('*');
  159.     $this->db->where('ID_ARTICULO', $data['id_article']);
  160.     $this->db->where('ID_AUTOR', $data['id_author']);
  161.  
  162.     if ($this->db->get('articulos_autores')->num_rows() > 0) {
  163.         return FALSE;
  164.     } else {
  165.         $this->db->select('ORDEN_AUTORES');
  166.         $this->db->where('ID_ARTICULO', $data['id_article']);
  167.         $this->db->order_by('ORDEN_AUTORES', 'DESC');
  168.         $result = $this->db->get('articulos_autores')->result();
  169.  
  170.         $data_insert = array(
  171.         'ID_ARTICULO' => $data['id_article'],
  172.         'ID_AUTOR' => $data['id_author'],
  173.         'ORDEN_AUTORES' => $result[0]->ORDEN_AUTORES + 1
  174.         );
  175.  
  176.         $this->db->insert('articulos_autores', $data_insert);
  177.     }
  178.     }
  179.  
  180.     public function getOne($author_id) {
  181.     // Security fallback to be sure we run a valid query and don't get MySQL errors
  182.     if (!$author_id)
  183.         return FALSE;
  184.  
  185.     $this->db->where('id_autor', (int) $author_id);
  186.     return $this->db->get('autores')->row();
  187.     }
  188.  
  189.     public function getFieldsName($table_name) {
  190.     return $this->db->list_fields($table_name);
  191.     }
  192.  
  193.     /**
  194.      * Get PPI author data based on author_id parameter
  195.      * @param   mixed   $author_id  The primary key as identifier
  196.      * @return  boolean         Whether or not there were any errors
  197.      */
  198.     public function getPPI($author_id) {
  199.     // Security fallback to be sure we run a valid query and don't get MySQL errors
  200.     if (!$author_id)
  201.         return FALSE;
  202.  
  203.     $this->db->where($this->tbl_author_ppi . '.ID_AUTOR', (int) $author_id);
  204.     return $this->db->get($this->tbl_author_ppi)->row_array();
  205.     }
  206.  
  207.     /**
  208.      * Get PPI author data based on author_id parameter
  209.      * @param   mixed   $author_id  The primary key as identifier
  210.      * @return  boolean         Whether or not there were any errors
  211.      */
  212.     public function getPPIByID($ppi_id) {
  213.     // Security fallback to be sure we run a valid query and don't get MySQL errors
  214.     if (!$ppi_id)
  215.         return FALSE;
  216.  
  217.     $this->db->where($this->tbl_author_ppi . '.ID_AUTOR_PPI', (int) $ppi_id);
  218.     return $this->db->get($this->tbl_author_ppi)->row_array();
  219.     }
  220.  
  221.     /**
  222.      * Add PPI author data
  223.      *
  224.      * @param   array   $author_id  The new data for the array
  225.      * @return  boolean         Whether or not there were any errors
  226.      */
  227.     public function addPPI($data = array()) {
  228.     // Security fallback to be sure we run a valid query and don't get MySQL errors
  229.     if (!$data || empty($data))
  230.         return FALSE;
  231.  
  232.     if ($this->db->insert($this->tbl_author_ppi, $data)) {
  233.         return TRUE;
  234.     }
  235.     }
  236.  
  237.     /**
  238.      * Add Censo83 author data
  239.      *
  240.      * @param   array   $author_id  The new data for the array
  241.      * @return  boolean         Whether or not there were any errors
  242.      */
  243.     public function addCenso83($data = array()) {
  244.     // Security fallback to be sure we run a valid query and don't get MySQL errors
  245.     if (!$data || empty($data))
  246.         return FALSE;
  247.  
  248.     if ($this->db->insert($this->tbl_author_censo83, $data)) {
  249.         return TRUE;
  250.     }
  251.     }
  252.  
  253.     public function getCenso83($id_author) {
  254.     // Security fallback to be sure we run a valid query and don't get MySQL errors
  255.     if (!$id_author)
  256.         return FALSE;
  257.  
  258.     return $this->db->where('id_autor', (int) $id_author)->get($this->tbl_author_censo83)->result();
  259.     }
  260.  
  261.     /**
  262.      * Add PPI author data
  263.      *
  264.      * @param   array   $author_id  The new data for the array
  265.      * @return  boolean         Whether or not there were any errors
  266.      */
  267.     public function updatePPI($data = array(), $ppi_id) {
  268.     // Security fallback to be sure we run a valid query and don't get MySQL errors
  269.     if (!$data || empty($data) || !$ppi_id || $ppi_id == NULL)
  270.         return FALSE;
  271.  
  272.     $this->db->where('ID_AUTOR_PPI', (int) $ppi_id);
  273.     if ($this->db->update($this->tbl_author_ppi, $data)) {
  274.         return TRUE;
  275.     }
  276.     }
  277.  
  278.     /**
  279.      * Get PPI by year for certain author
  280.      * @param mixed $author_id
  281.      * @return boolean if $author_id = NULL or empty or MySQL Object on success
  282.      */
  283.     public function getPPIByAuthor($author_id) {
  284.     // Security fallback to be sure we run a valid query and don't get MySQL errors
  285.     if (!$author_id || $author_id == NULL)
  286.         return FALSE;
  287.  
  288.     $this->db->where('ID_AUTOR', (int) $author_id);
  289.     $this->db->order_by('ANO', 'ASC');
  290.     return $this->db->get($this->tbl_autores_ppi_ano)->result();
  291.     }
  292.  
  293.     /**
  294.      * Count how many filiated authors are in DB
  295.      * @return integer
  296.      */
  297.     public function getFiliatedAuthors() {
  298.     $query = $this->db->query("SELECT ID_AUTOR FROM autores_filiacion GROUP BY ID_AUTOR");
  299.     return $query->num_rows();
  300.     }
  301.  
  302.     /**
  303.      * Return how many unfiliated authors are in DB
  304.      * @return type
  305.      */
  306.     public function getUnFiliatedAuthors() {
  307.     $sql = "SELECT COUNT(*) AS qty FROM autores LEFT JOIN autores_filiacion ON (autores.ID_AUTOR = autores_filiacion.ID_AUTOR) WHERE autores.ID_AUTOR NOT IN (SELECT DISTINCT ID_AUTOR FROM autores_filiacion)";
  308.     return $this->db->query($sql)->row()->qty;
  309.     }
  310.  
  311.     /**
  312.      * Get data from non filiated authors
  313.      * @param integer $limit
  314.      * @param integer $start
  315.      * @return mixed
  316.      */
  317.     public function getNonFiliatedAuthor($limit, $start) {
  318.     $this->db->limit($limit, $start);
  319.     $this->db->join('autores_filiacion', 'autores.ID_AUTOR = autores_filiacion.ID_AUTOR', 'LEFT');
  320.     $this->db->where('autores.ID_AUTOR NOT IN (SELECT DISTINCT ID_AUTOR FROM autores_filiacion)');
  321.     $query = $this->db->get('autores');
  322.     return $query->result();
  323.     }
  324.  
  325.     /**
  326.      * Count how many PPI authors are in DB
  327.      * @return mixed
  328.      */
  329.     public function getPPIAuthors() {
  330.     $query = $this->db->query("SELECT ID_AUTOR FROM autores_ppi GROUP BY ID_AUTOR");
  331.     return $query->num_rows();
  332.     }
  333.  
  334.     /**
  335.      * Count how many Censo83 are in DB
  336.      * @return mixed
  337.      */
  338.     public function getCenso83Authors() {
  339.     $query = $this->db->query("SELECT ID_AUTOR FROM autores_censo83 GROUP BY ID_AUTOR");
  340.     return $query->num_rows();
  341.     }
  342.  
  343.     /**
  344.      * Adds a new PPI to a author
  345.      * @param array $data
  346.      * @return boolean
  347.      */
  348.     public function addPPIByYear($data = array()) {
  349.     // Security fallback to be sure we run a valid query and don't get MySQL errors
  350.     if (!$data || empty($data))
  351.         return FALSE;
  352.  
  353.     //aqui debe colocarse un validador
  354.  
  355.     if ($this->db->insert($this->tbl_autores_ppi_ano, $data)) {
  356.         return TRUE;
  357.     }
  358.  
  359.     return FALSE;
  360.     }
  361.  
  362.     /**
  363.      * Funcion que permite la busqueda/consulta de autores
  364.      * @param array $data
  365.      * @param int $limit
  366.      * @param int $offset
  367.      * @param array $criteria
  368.      * @return boolean
  369.      */
  370.     public function getAllAuthorData($data = array(), $limit = 10, $offset = 0, $criteria = NULL) {
  371.     $this->db->query("SET NAMES 'utf8'");
  372.  
  373.     $this->db->select('autores.id_autor, autores.nombre, autores.apellido, autores.nacionalid');
  374.     $this->db->from('autores');
  375.     $this->db->distinct();
  376.  
  377.     if (!empty($data['nombre']) && $data['nombre'] != "") {
  378.         $this->db->like('autores.nombre', $data['nombre'], 'both');
  379.     }
  380.  
  381.     if (!empty($data['apellido']) && $data['apellido'] != "") {
  382.         $this->db->like('autores.apellido', $data['apellido'], 'both');
  383.     }
  384.  
  385.     if (!empty($data['gender']) && $data['gender'] != "") {
  386.         $this->db->or_where('autores.genero', $data['gender']);
  387.     }
  388.  
  389.     if (!empty($data['nacionalidad']) && $data['nacionalidad'] != "") {
  390.         $this->db->or_where('autores.nacionalid', $data['nacionalidad']);
  391.     }
  392.  
  393.     if (!empty($data['cedula']) && $data['cedula'] != "cedula") {
  394.         $this->db->or_where('autores.ci', $data['cedula']);
  395.     }
  396.  
  397.     if (!empty($data['fecha_nacimiento']) && $data['fecha_nacimiento'] != "fecha_nacimiento") {
  398.         $this->db->or_where('autores.fecha_naci', $data['fecha_nacimiento']);
  399.     }
  400.  
  401.     if (!empty($data['email_default']) && $data['email_default'] != "") {
  402.         $this->db->or_where('autores.email', $data['email_default']);
  403.     }
  404.  
  405.     if (!empty($data['email_alternativo']) && $data['email_alternativo'] != "") {
  406.         $this->db->or_where('autores.email_1', $data['email_alternativo']);
  407.     }
  408.  
  409.     $this->db->join($this->tbl_autores_filiacion, 'autores.id_autor = autores_filiacion.id_autor', 'left');
  410.     $this->db->join($this->tbl_filiacion, 'autores_filiacion.id_filiacion = filiacion.id_filiacion', 'left');
  411.  
  412.     if (!empty($data['ciudad']) && $data['ciudad'] != "") {
  413.         $this->db->join($this->tbl_ciudad, 'filiacion.id_ciudad = ciudades.id_ciudad', 'left');
  414.         $this->db->or_like('ciudades.ciudad', $data['ciudad'], 'both');
  415.     }
  416.  
  417.     if (!empty($data['pais']) && $data['pais'] != "") {
  418.         $this->db->join($this->tbl_pais, 'filiacion.id_pais = paises.id_pais', 'left');
  419.         $this->db->like('paises.pais', $data['pais'], 'both');
  420.     }
  421.  
  422.     $this->db->limit($limit, $offset);
  423.     $query = $this->db->get();
  424.  
  425.     if ($query->num_rows() > 0) {
  426.         return $query->result();
  427.     } else {
  428.         return FALSE;
  429.     }
  430.     }
  431.  
  432.     /**
  433.      * Contar los autores de un PPI
  434.      * @param array $data
  435.      * @return int
  436.      */
  437.     public function getCountAuthorData($data = array()) {
  438.     $this->db->select('autores.id_autor, autores.nombre, autores.apellido, autores.nacionalid');
  439.     $this->db->from('autores');
  440.     $this->db->distinct();
  441.  
  442.     if (!empty($data['nombre']) && $data['nombre'] != "") {
  443.         $this->db->like('autores.nombre', $data['nombre'], 'both');
  444.     }
  445.  
  446.     if (!empty($data['apellido']) && $data['apellido'] != "") {
  447.         $this->db->like('autores.apellido', $data['apellido'], 'both');
  448.     }
  449.  
  450.     if (!empty($data['gender']) && $data['gender'] != "") {
  451.         $this->db->or_where('autores.genero', $data['gender']);
  452.     }
  453.  
  454.     if (!empty($data['nacionalidad']) && $data['nacionalidad'] != "") {
  455.         $this->db->or_where('autores.nacionalid', $data['nacionalidad']);
  456.     }
  457.  
  458.     if (!empty($data['cedula']) && $data['cedula'] != "cedula") {
  459.         $this->db->or_where('autores.ci', $data['cedula']);
  460.     }
  461.  
  462.     if (!empty($data['fecha_nacimiento']) && $data['fecha_nacimiento'] != "fecha_nacimiento") {
  463.         $this->db->or_where('autores.fecha_naci', $data['fecha_nacimiento']);
  464.     }
  465.  
  466.     if (!empty($data['email']) && $data['email'] != "") {
  467.         $this->db->or_where('autores.email', $data['email']);
  468.     }
  469.  
  470.     if (!empty($data['email_alternativo']) && $data['email_alternativo'] != "") {
  471.         $this->db->or_where('autores.email_1', $data['email_alternativo']);
  472.     }
  473.  
  474.     $this->db->join($this->tbl_autores_filiacion, 'autores.id_autor = autores_filiacion.id_autor', 'left');
  475.     $this->db->join($this->tbl_filiacion, 'autores_filiacion.id_filiacion = filiacion.id_filiacion', 'left');
  476.  
  477.     if (!empty($data['ciudad']) && $data['ciudad'] != "") {
  478.         $this->db->join($this->tbl_ciudad, 'filiacion.id_ciudad = ciudades.id_ciudad', 'left');
  479.         $this->db->or_like('ciudades.ciudad', $data['ciudad'], 'both');
  480.     }
  481.  
  482.     if (!empty($data['pais']) && $data['pais'] != "") {
  483.         $this->db->join($this->tbl_pais, 'filiacion.id_pais = paises.id_pais', 'left');
  484.         $this->db->like('paises.pais', $data['pais'], 'both');
  485.     }
  486.  
  487.     $query = $this->db->get();
  488.  
  489.     return $query->num_rows();
  490.     }
  491.  
  492.     /**
  493.      * Obtener los detalles de un PPI dado su ID
  494.      * @param int $ppi_id
  495.      * @return boolean
  496.      */
  497.     public function getOnePPI($ppi_id) {
  498.     // Security fallback to be sure we run a valid query and don't get MySQL errors
  499.     if (!$ppi_id || empty($ppi_id))
  500.         return FALSE;
  501.  
  502.     $this->db->where('ID_AUTOR_PPI_ANO', (int) $ppi_id);
  503.     return $this->db->get($this->tbl_autores_ppi_ano)->row();
  504.     }
  505.  
  506.     /**
  507.      * Actualizar el PPI por aƱo de un autor
  508.      * @param array $data
  509.      * @param int $ppi_id
  510.      * @return boolean
  511.      */
  512.     public function UpdatePPIByYear($data = array(), $ppi_id = NULL) {
  513. //  print_r($data);
  514. //  echo $ppi_id;
  515. //  die();
  516.     // Security fallback to be sure we run a valid query and don't get MySQL errors
  517.     if (!$data || empty($data) || !$ppi_id || $ppi_id == NULL)
  518.         return FALSE;
  519.  
  520.     $this->db->where('ID_AUTOR_PPI_ANO', (int) $ppi_id);
  521.     if ($this->db->update($this->tbl_autores_ppi_ano, $data)) {
  522.         return TRUE;
  523.     }
  524.     }
  525.  
  526.     /**
  527.      * Eliminar el registro de un PPI por aƱo dado su ID
  528.      * @param int $ppi_id
  529.      * @return boolean
  530.      */
  531.     public function deletePPIByYear($ppi_id) {
  532.     // Security fallback to be sure we run a valid query and don't get MySQL errors
  533.     if (!$ppi_id || empty($ppi_id))
  534.         return FALSE;
  535.  
  536.     if ($this->db->delete($this->tbl_autores_ppi_ano, array('ID_AUTOR_PPI_ANO' => $ppi_id))) {
  537.         return TRUE;
  538.     }
  539.  
  540.     return FALSE;
  541.     }
  542.  
  543.     //metodo utilizado en controller/caffiliation.php
  544.     public function validated_delete_author_affiliation($id) {
  545.     $query = $this->db->query("SELECT ID_FILIACION FROM autores_filiacion WHERE ID_FILIACION='" . $id . "' LIMIT 1");
  546.     if ($row = $query->row())
  547.         return TRUE;
  548.     else
  549.         return FALSE;
  550.     }
  551.  
  552.     public function validated_delete_article_authors($id) {
  553.     $query = $this->db->query("SELECT ID_AUTOR FROM articulos_autores WHERE ID_AUTOR='" . $id . "' LIMIT 1");
  554.     if ($row = $query->row())
  555.         return TRUE;
  556.     else
  557.         return FALSE;
  558.     }
  559.  
  560.     public function delete_autores_ppi($id) {
  561.     $this->db->where('ID_AUTOR', $id);
  562.     return $this->db->delete('autores_ppi');
  563.     }
  564.  
  565.     public function delete_autores_censo83($id) {
  566.     $this->db->where('ID_AUTOR', $id);
  567.     return $this->db->delete('autores_censo83');
  568.     }
  569.  
  570.     public function delete_autores_ppi_aƱo($id) {
  571.     $this->db->where('ID_AUTOR', $id);
  572.     return $this->db->delete('autores_ppi_ano');
  573.     }
  574.  
  575.     public function delete_autores_filiacion($id) {
  576.     $this->db->where('ID_AUTOR', $id);
  577.     return $this->db->delete('autores_filiacion');
  578.     }
  579.  
  580.     public function validated_duplicated_year_ppi($id_author, $year) {
  581.     $query = $this->db->query("SELECT ID_AUTOR_PPI_ANO FROM autores_ppi_ano WHERE ID_AUTOR='" . $id_author . "' AND ANO='" . $year . "' LIMIT 1");
  582.     if ($row = $query->row())
  583.         return TRUE;
  584.     else
  585.         return FALSE;
  586.     }
  587.  
  588. }
  589.  
  590. /* End of file muser.php */
  591. /* Location: ./application/backend/models/muser.php */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement