Ejemplo n.º 1
0
 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));
     }
 }
Ejemplo n.º 2
0
$tpl_students = new tpl_students();
$session = new sessions();
?>

<div class="container w">
    <div class="row centered">
        <br><br>
        <h4>Students</h4>
        <hr>
        <br><br>
        <?php 
foreach ($students->find_elect() as $row) {
    ?>
            <div class="col-lg-4 form-control-row">
                <img src="<?php 
    echo site_url($row[$tpl_students->image()]);
    ?>
" 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"
Ejemplo n.º 3
0
?>
" data-halign="center"
                    data-sortable="true"> Specialty
                </th>
                <th data-field="<?php 
echo $tpl_students->elect();
?>
"
                    data-halign="center" data-sortable="true" data-formatter="operate<?php 
echo $tpl_students->elect();
?>
"> Is
                    Elect
                </th>
                <th data-field="<?php 
echo $tpl_students->image();
?>
"
                    data-formatter="operate<?php 
echo $tpl_students->image();
?>
"
                    data-events="events<?php 
echo $tpl_students->image();
?>
"
                    data-width="10" data-halign="center" data-sortable="true"> Image
                </th>
                <th
                    data-field="operate"
                    data-formatter="operateFormatter"
Ejemplo n.º 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();
 }