Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. //view
  2. <?php if ($this->users->can_insert_pros()) { ?>
  3. <a href="#" id="insert_professional" class="button blue"><?php  echo $this->lang->line('Inserir'); ?></a>
  4. <?php } ?>
  5.  
  6. //controlador
  7.     function can_insert_pros() {
  8.         if ($this->getAdministrator() == 1)
  9.             return true;
  10.         if ($this->getUSRTYPE() == 2)
  11.             return true;
  12.         if ($this->getUSRTYPE() == 3)
  13.             return false;
  14.         $this->db->where(array("ENTID"=>$this->getENTID()));
  15.         $empresa = $this->db->get("tblentity");
  16.         if ($empresa=$empresa->row()){
  17.             if ($empresa->ENTPROS == 0)
  18.                 return true;
  19.             $this->db->select("ASSPROID");
  20.             $this->db->distinct();
  21.             $this->db->where(array("ASSPROID !="=>0,"ASSENTID"=>$this->getENTID(),"ASSSTATUS"=>"1"));
  22.             $funcionarios = $this->db->get("tblassign");
  23.             if ((int)$funcionarios->num_rows() < (int)$empresa->ENTPROS)
  24.                 return true;
  25.         }
  26.         return false;
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement