Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //view
- <?php if ($this->users->can_insert_pros()) { ?>
- <a href="#" id="insert_professional" class="button blue"><?php echo $this->lang->line('Inserir'); ?></a>
- <?php } ?>
- //controlador
- function can_insert_pros() {
- if ($this->getAdministrator() == 1)
- return true;
- if ($this->getUSRTYPE() == 2)
- return true;
- if ($this->getUSRTYPE() == 3)
- return false;
- $this->db->where(array("ENTID"=>$this->getENTID()));
- $empresa = $this->db->get("tblentity");
- if ($empresa=$empresa->row()){
- if ($empresa->ENTPROS == 0)
- return true;
- $this->db->select("ASSPROID");
- $this->db->distinct();
- $this->db->where(array("ASSPROID !="=>0,"ASSENTID"=>$this->getENTID(),"ASSSTATUS"=>"1"));
- $funcionarios = $this->db->get("tblassign");
- if ((int)$funcionarios->num_rows() < (int)$empresa->ENTPROS)
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement