コード例 #1
0
 public function find_all_students()
 {
     $this->use->use_model('data_base');
     $this->use->use_lib('table/tpl_students');
     $this->use->use_lib('table/tpl_specialty');
     $this->use->use_lib('table/tpl_college');
     $tpl = new tpl_students();
     $tpl_specialty = new tpl_specialty();
     $tpl_college = new tpl_college();
     $db = new data_base($tpl->table(), array($tpl->id(), '(select ' . $tpl_college->name() . ' from ' . $tpl_college->table() . ' where ' . $tpl_college->table() . '.' . $tpl_college->id() . ' = ' . $tpl->table() . '.' . $tpl->id_college() . ') ' . $tpl->id_college() . '_name', '(select ' . $tpl_specialty->name() . ' from ' . $tpl_specialty->table() . ' where ' . $tpl_specialty->table() . '.' . $tpl_specialty->id() . ' = ' . $tpl->table() . '.' . $tpl->id_specialty() . ') ' . $tpl->id_specialty() . '_name', $tpl->id_students(), $tpl->id_college(), $tpl->id_specialty(), $tpl->first_name(), $tpl->last_name(), $tpl->elect(), $tpl->image()));
     echo json_encode($db->get());
 }
コード例 #2
0
 public function update_specialty()
 {
     $this->use->use_model('data_base');
     $this->use->use_lib('table/tpl_specialty');
     $tpl = new tpl_specialty();
     $db = new data_base($tpl->table(), array($tpl->id_college() => $_POST['name_college_update'], $tpl->name() => $_POST['name_update']), array($tpl->id() => $_POST['id']));
     echo json_encode(array('valid' => $db->change(), 'massage' => '<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button><h4>Alert!</h4> <strong>Update success </strong></div>'));
 }
コード例 #3
0
ファイル: students.php プロジェクト: medosalahat/election
 public function get_more_election()
 {
     $this->use->use_model('data_base');
     $this->use->use_lib('table/tpl_students');
     $this->use->use_lib('table/tpl_election');
     $this->use->use_lib('table/tpl_specialty');
     $this->use->use_lib('table/tpl_college');
     $tpl = new tpl_students();
     $tpl_college = new tpl_college();
     $tpl_specialty = new tpl_specialty();
     $tpl_election = new tpl_election();
     $db = new data_base($tpl->table(), array($tpl->id(), $tpl->last_name(), $tpl->first_name(), '( select ' . $tpl_college->name() . ' from ' . $tpl_college->table() . ' where ' . $tpl_college->id() . ' = ' . $tpl->table() . '.' . $tpl->id_college() . ' ) ' . $tpl->id_college(), '( select ' . $tpl_specialty->name() . ' from ' . $tpl_specialty->table() . ' where ' . $tpl_specialty->id() . ' = ' . $tpl->table() . '.' . $tpl->id_specialty() . ' ) ' . $tpl->id_specialty(), '( select COUNT(' . $tpl_election->id() . ') from ' . $tpl_election->table() . ' where ' . $tpl_election->id_elect() . ' = ' . $tpl->table() . '.' . $tpl->id() . ' ) sum', $tpl->id_students(), $tpl->image()), array($tpl->elect() => 1), '', array('sum' => 'DESC'));
     return $db->get_where_order();
 }