function get_nome_evento() { $aluno = new Aluno(); $aluno->set_id($this->get_id_aluno1()); $aluno->retrieve(); $nome_evento = $aluno->get_nome(); if ('s' == $this->get_iddupla()) { $aluno2 = new Aluno(); $aluno2->set_id($this->get_id_aluno2()); $aluno2->retrieve(); $nome_evento .= ' & ' . $aluno2->get_nome(); } return $nome_evento; }
function get_aluno() { if (NULL == $this->aluno) { if (NULL == $this->id_aluno) { return NULL; } $aluno = new Aluno(); $aluno->set_id($this->get_id_aluno()); $aluno->retrieve(); $this->aluno = $aluno; } return $this->aluno; }
function search($params = false) { $order_by = $this->get_key(); $order_direction = 'ASC'; $inicial = 0; $total = MAXIMO_RESULTADOS_BUSCA; if ($params !== false) { if (isset($params['order_by'])) { $order_by = $params['order_by']; } if (isset($params['order_direction'])) { $order_direction = $params['order_direction']; } if (isset($params['inicial'])) { $inicial = $params['inicial']; } if (isset($params['total'])) { $total = $params['total']; } } $objs = array(); $this->db->select(' username, email, aluno.id as id, aluno.telefone, aluno.endereco, aluno.cdate, aluno.deleted as deleted, aluno.valor_aula, usuario.nome as nome, usuario.id as id_usuario, usuario.data_nascimento, usuario.avatar as avatar, estudio.nome as estudio_nome '); $this->db->join('usuario usuario', 'usuario.id = aluno.id_usuario'); $this->db->join('estudio estudio', 'estudio.id = aluno.id_estudio'); $this->db->where('aluno.deleted', NAO); if (NULL != $this->get_id_estudio()) { $this->db->where('aluno.id_estudio', $this->get_id_estudio()); } $this->db->distinct($this->key); $this->db->order_by($order_by, $order_direction); $query = $this->db->get($this->table_name . ' aluno', $total, $inicial); if ($query->num_rows() > 0) { foreach ($query->result() as $row) { $aluno = new Aluno(); $aluno->set_id($row->id); $aluno->set_nome($row->nome); $aluno->set_id_usuario($row->id_usuario); $aluno->set_username($row->username); $aluno->set_email($row->email); $aluno->set_avatar($row->avatar); $aluno->set_telefone($row->telefone); $aluno->set_endereco($row->endereco); $aluno->set_valor_aula($row->valor_aula); $aluno->set_estudio_nome($row->estudio_nome); $aluno->set_data_nascimento($this->datas->mysql_para_normal($row->data_nascimento)); array_push($objs, $aluno); } } $query->free_result(); return $objs; }