public function get_info() { $session = new session_students(); $id_students = $session->Get_id_user(); $db = new data_base(tpl_students::students(), array(tpl_students::id(), tpl_students::first_name(), tpl_students::last_name(), tpl_students::email(), tpl_students::id_college(), tpl_students::id_specialty(), tpl_students::id_supervisor(), tpl_students::id_university(), data_base::select_multiple_table(tpl_college::college(), tpl_college::college() . '.' . tpl_college::id(), tpl_students::students() . '.' . tpl_students::id_college(), tpl_college::name(), tpl_college::college() . '_' . tpl_college::name()), data_base::select_multiple_table(tpl_supervisor::supervisor(), tpl_supervisor::supervisor() . '.' . tpl_supervisor::id(), tpl_students::students() . '.' . tpl_students::id_supervisor(), tpl_supervisor::name(), tpl_supervisor::supervisor() . '_' . tpl_supervisor::name()), data_base::select_multiple_table(tpl_specialty::specialty(), tpl_specialty::specialty() . '.' . tpl_specialty::id(), tpl_students::students() . '.' . tpl_students::id_specialty(), tpl_specialty::name(), tpl_specialty::specialty() . '_' . tpl_specialty::name()), data_base::select_multiple_table(tpl_university::university(), tpl_university::university() . '.' . tpl_university::id(), tpl_students::students() . '.' . tpl_students::id_university(), tpl_university::name(), tpl_university::university() . '_' . tpl_university::name())), array(tpl_students::id() => $id_students)); return $db->get_where(); }
public function update_image_students() { $this->use->use_model('data_base'); $this->use->use_lib('table/tpl_students'); $this->use->use_lib('system/image/class_upload_image'); $tpl = new tpl_students(); $image = new class_upload_image('image_students_update', 'include/img/student'); if ($image->get_type() == 'image/png' || $image->get_type() == 'image/jpeg') { if ($image->get_error()) { $image_path = $image->move_file(); if ($image_path == false) { echo json_encode(array('valid' => false)); } else { $db = new data_base($tpl->table(), array($tpl->image() => $image_path), array($tpl->id() => $_POST['id_image_update'])); if ($db->change()) { echo json_encode(array('valid' => true, 'image' => $image_path)); } else { echo json_encode(array('valid' => false)); } } } else { echo json_encode(array('valid' => false)); } } else { echo json_encode(array('valid' => false)); } }
public function ajax_find_students() { $db = new data_base(tpl_students::students(), array(tpl_students::id(), tpl_students::first_name(), tpl_students::last_name(), tpl_students::id_specialty(), tpl_students::id_college(), data_base::select_multiple_table(tpl_specialty::specialty(), tpl_specialty::specialty() . '.' . tpl_specialty::id(), tpl_students::students() . '.' . tpl_students::id_specialty(), tpl_specialty::name(), tpl_specialty::specialty() . '_' . tpl_specialty::name()), data_base::select_multiple_table(tpl_college::college(), tpl_college::college() . '.' . tpl_college::id(), tpl_students::students() . '.' . tpl_students::id_college(), tpl_college::name(), tpl_college::college() . '_' . tpl_specialty::name())), array(tpl_students::id_specialty() => $_GET['id'])); echo json_encode($db->get_where()); }
data-halign="center" data-sortable="true"> name </th> <th data-field="<?php echo tpl_university::phone(); ?> " data-halign="center" data-sortable="true"> phone </th> <th data-field="<?php echo tpl_university::address(); ?> " data-halign="center" data-sortable="true"> address </th> <th data-field="<?php echo tpl_students::students() . '_' . tpl_students::id(); ?> " data-halign="center" data-formatter="operate<?php echo tpl_university::university(); ?> " data-sortable="true"># students </th> </tr> </thead> </table> </div> </div> <div class="col-sm-6">
public function count_students() { $db = new data_base(tpl_students::students(), array(tpl_students::id())); return count($db->get()); }
public function ajax_find_students() { $db = new data_base(tpl_models::models(), array(tpl_models::id(), tpl_models::id_companies(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::first_name(), tpl_students::students() . '_' . tpl_students::first_name()), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::last_name(), tpl_students::students() . '_' . tpl_students::last_name()), data_base::select_multiple_table(tpl_supervisor::supervisor(), tpl_supervisor::supervisor() . '.' . tpl_supervisor::id(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::id_supervisor()), tpl_supervisor::name(), tpl_supervisor::supervisor() . '_' . tpl_supervisor::name()), data_base::select_multiple_table(tpl_university::university(), tpl_university::university() . '.' . tpl_university::id(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::id_supervisor()), tpl_university::name(), tpl_university::university() . '_' . tpl_university::name()), data_base::select_multiple_table(tpl_college::college(), tpl_college::college() . '.' . tpl_college::id(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::id_supervisor()), tpl_college::name(), tpl_college::college() . '_' . tpl_college::name()), data_base::select_multiple_table(tpl_specialty::specialty(), tpl_specialty::specialty() . '.' . tpl_specialty::id(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::id_supervisor()), tpl_specialty::name(), tpl_specialty::specialty() . '_' . tpl_specialty::name()), data_base::select_multiple_table(tpl_department::department(), tpl_department::department() . '.' . tpl_department::id(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::id_supervisor()), tpl_department::name(), tpl_department::department() . '_' . tpl_department::name()), data_base::select_multiple_table(tpl_section::section(), tpl_section::section() . '.' . tpl_section::id(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::id_supervisor()), tpl_section::name(), tpl_section::section() . '_' . tpl_section::name())), array(tpl_models::id_companies() => $_GET['id'])); echo json_encode($db->get_where()); }
<div id="toolbar"> <button id="add_new_students" class="btn btn-success btn-xs">New</button> </div> <div class="table-responsive"> <table id="table" data-toggle="table" data-url="<?php echo site_url('admin/find_all_Students_table_ajax'); ?> " data-cache="false" data-height="400" data-show-refresh="true" data-show-toggle="true" data-show-columns="true" data-pagination="true" data-page-list="[5, 10, 20, 50, 100, 200]" data-search="true" data-flat="true" data-toolbar="#toolbar"> <thead> <tr> <th data-field="<?php echo $tpl_students->id(); ?> " data-halign="center" data-sortable="true"> ID</th> <th data-field="<?php echo $tpl_students->id_students(); ?> " data-halign="center" data-sortable="true"> ID Student </th> <th data-field="<?php echo $tpl_students->first_name(); ?> " data-halign="center" data-sortable="true"> First Name </th> <th data-field="<?php
</div> <div class="modal-body"> <form class="form" id="update_password_form" method="post" action="<?php echo site_url('admin/' . tpl_students::students() . '/update_password'); ?> "> <div class="form-group"> <input type="hidden" name="<?php echo tpl_students::students() . '_' . tpl_students::id() . '_update_password'; ?> " id="<?php echo tpl_students::students() . '_' . tpl_students::id() . '_update_password'; ?> " value=""/> </div> <div class="form-group"> <label for="">New Password <?php echo tpl_students::students(); ?> : </label> <input type="text" class="form-control" id="<?php echo tpl_students::students() . '_' . tpl_students::password() . '_update_password'; ?> "
" class="img-responsive"/> <h4><?php echo $row[$tpl_students->first_name()] . ' ' . $row[$tpl_students->first_name()]; ?> </h4> <p><?php echo $row[$tpl_students->id_college()]; ?> .</p> <?php if ($session->get_login()) { ?> <button class="btn btn-primary btn-block elect_student" data-id-student="<?php echo $row[$tpl_students->id()]; ?> ">Elect </button> <?php } else { ?> <button class="btn btn-success btn-block first_login" data-id-student="<?php echo $row[$tpl_students->id()]; ?> ">Elect ( <small> <li class="glyphicon glyphicon-log-in"></li> SingIn </small>
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(); }
public function find_supervisor() { if (isset($_POST[tpl_students::id() . '_' . tpl_students::students()])) { $id = $_POST[tpl_students::id() . '_' . tpl_students::students()]; if (!empty($id)) { $db = new data_base(tpl_students::students(), array(tpl_students::id(), tpl_students::id_supervisor(), data_base::select_multiple_table(tpl_supervisor::supervisor(), tpl_supervisor::supervisor() . '.' . tpl_supervisor::id(), tpl_students::students() . '.' . tpl_students::id_supervisor(), tpl_supervisor::name(), tpl_supervisor::supervisor() . '_' . tpl_supervisor::name())), array(tpl_students::status() => 1, tpl_students::id() => $id)); $data = $db->get_where(); $w = '<option></option>'; foreach ($data as $row) { $w = $w . '<option value="' . $row[tpl_students::id_supervisor()] . '">' . $row[tpl_supervisor::supervisor() . '_' . tpl_supervisor::name()] . '</option>'; } echo $w; } else { echo 'error empty'; die; } } else { echo 'error isset'; exit; } }
?> </h4> <table class="table table-bordered"> <thead> <tr> <td>onus name</td> <td>onus description</td> <td>degree name</td> </tr> </thead> <tbody> <?php foreach ($lib->info_onus_designate($row[tpl_students::id()]) as $rows) { ?> <tr> <td><?php echo $rows[tpl_onus::onus() . '_' . tpl_onus::name()]; ?> </td> <td><?php echo $rows[tpl_onus::onus() . '_' . tpl_onus::description()]; ?> </td> <td><?php echo $rows[tpl_degree::degree() . '_' . tpl_degree::name()]; ?> </td> </tr>
public function find_models() { $db = new data_base(tpl_models::models(), array(tpl_models::id(), data_base::select_multiple_table(tpl_students::students(), tpl_students::students() . '.' . tpl_students::id(), tpl_models::models() . '.' . tpl_models::id_student(), tpl_students::first_name(), tpl_students::students() . '_' . tpl_students::first_name())), array(tpl_models::active() => 1)); $data = $db->get(); $w = ''; foreach ($data as $row) { $w = $w . '<option value="' . $row[tpl_models::id()] . '">' . $row[tpl_students::students() . '_' . tpl_students::first_name()] . '</option>'; } return $w; }
public function update_status() { $id = $_POST[tpl_students::students() . '_' . tpl_students::id()]; $status = $_POST[tpl_students::students() . '_' . tpl_students::status()]; $db = new data_base(tpl_students::students(), array(tpl_students::status() => $status), array(tpl_students::id() => $id)); $results = $db->change(); $status_data = $status == 1 ? 'active' : 'dative'; if ($results) { echo json_encode(array('valid' => 1, 'title' => 'Successfully !!', 'massage' => 'I\'ve been Update ' . $status_data)); } else { echo json_encode(array('valid' => 0, 'title' => 'Oops !!', 'massage' => 'Was not Update ' . $status_data . ', please try again')); } }