public function update_students()
 {
     $this->use->use_model('data_base');
     $this->use->use_lib('table/tpl_students');
     $tpl = new tpl_students();
     $data = array($tpl->id_students() => $_POST['id_student_u'], $tpl->first_name() => $_POST['first_name_u'], $tpl->last_name() => $_POST['last_name_u'], $tpl->id_college() => $_POST['name_college_u']);
     if (!empty($_POST['password_u'])) {
         $data[$tpl->password()] = md5($_POST['password_u']);
     }
     if (!empty($_POST['name_specialty_u'])) {
         $data[$tpl->id_specialty()] = $_POST['name_specialty_u'];
     }
     $db = new data_base($tpl->table(), $data, array($tpl->id() => $_POST['id_update']));
     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>'));
 }
Exemple #2
0
                    <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>
                        )
                    </button>
                <?php 
    }
    ?>
                <span id="elect_<?php 
    echo $row[$tpl_students->id_students()];
    ?>
"></span>
            </div><!-- col-lg-4 -->
        <?php 
}
?>
    </div>
    <!-- row -->

</div><!-- container -->

<?php 
if ($session->get_login()) {
    ?>
    <script type="text/javascript">
    <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 
echo $tpl_students->last_name();
?>
" data-halign="center" data-sortable="true"> Last
                    Name
Exemple #4
0
 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();
 }