Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once dirname(dirname(realpath(__FILE__))) . DIRECTORY_SEPARATOR . 'grupo' . DIRECTORY_SEPARATOR . 'grupo_table.php';
- /**
- * Created by JetBrains PhpStorm.
- * User: raul.silva
- * Date: 14/08/12
- * Time: 15:21
- * To change this template use File | Settings | File Templates.
- */
- class grupo extends grupo_table
- {
- protected $filiais = array();
- public function __construct($id = null)
- {
- parent::__construct($id);
- }
- public function getFiliais()
- {
- if( ! is_null($this->getId()))
- {
- require_once dirname(dirname(realpath(__FILE__))) . DIRECTORY_SEPARATOR . 'filial' . DIRECTORY_SEPARATOR . 'filial.php';
- $this->db->select(filial_table::getIdFieldName())->from(filial_table::getTableName())->where($this->id_field, $this->getId());
- $ids = $this->db->get()->result_array();
- $filiais = array();
- if(count($ids) > 0)
- {
- foreach($ids as $id)
- {
- $filiais[] = new filial($id['id_jos_atc_filial']);
- }
- }
- $this->filiais = $filiais;
- return $filiais;
- }
- return false;
- }
- public function getGrupos()
- {
- $this->db->select($this->id_field)->from($this->table_name);
- $ids = $this->db->get()->result_array();
- $id_grupos = array();
- foreach($ids as $id)
- {
- $id_grupos[] = new grupo($id['id_jos_atc_filial_grupo']);
- }
- return $id_grupos;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement