示例#1
0
文件: Question.php 项目: gaiius/SunQA
 function ajax()
 {
     if (!$this->input->is_ajax_request()) {
         exit('No direct script access allowed');
     } else {
         $table = '' . DBPREFIX . 'question';
         $primaryKey = 'id_question';
         $columns = array(array('db' => 'id_question', 'dt' => 'id_question'), array('db' => 'username', 'dt' => 'username'), array('db' => 'subject', 'dt' => 'subject'), array('db' => 'category_name', 'dt' => 'category_name'), array('db' => 'question_date', 'dt' => 'question_date', 'formatter' => function ($date) {
             return dateHourIconPrivate($date);
         }), array('db' => 'id_question', 'dt' => 'action', 'formatter' => function ($id) {
             return '<a href="' . base_url('' . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/view/' . $id) . '" target="_blank" class="btn btn-info btn-xs">View</a> <a href="' . base_url('' . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/update/' . $id) . '" class="btn btn-primary btn-xs">Update</a> <a href="' . base_url('' . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/delete/' . $id) . '" class="btn btn-danger btn-xs">Delete</a>';
         }));
         $joinQuery = "FROM `" . DBPREFIX . "question` JOIN `" . DBPREFIX . "user` ON `" . DBPREFIX . "question`.`user_id`=`" . DBPREFIX . "user`.`id_user` JOIN `" . DBPREFIX . "category` ON `" . DBPREFIX . "question`.`category_id`=`" . DBPREFIX . "category`.`id_category`";
         $sql_details = array('user' => $this->db->username, 'pass' => $this->db->password, 'db' => $this->db->database, 'host' => $this->db->hostname);
         $this->output->set_content_type('application/json')->set_output(json_encode(Datatables_join::simple($_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery), JSON_PRETTY_PRINT));
     }
 }
示例#2
0
文件: Sessions.php 项目: gaiius/SunQA
 function ajax()
 {
     if (!$this->input->is_ajax_request()) {
         exit('No direct script access allowed');
     } else {
         $table = '' . DBPREFIX . 'session';
         $primaryKey = 'id';
         $columns = array(array('db' => 'id', 'dt' => 'id'), array('db' => 'ip_address', 'dt' => 'ip_address'), array('db' => 'timestamp', 'dt' => 'timestamp', 'formatter' => function ($str) {
             return dateHourIconPrivate(date('Y-m-d H:i:s', $str));
         }), array('db' => 'data', 'dt' => 'data', 'formatter' => function ($str) {
             return '<textarea style="margin: 0px;height: 150px;width: 350px;">' . preg_replace("/[s:]+[0-9]+[:]/", '', preg_replace("/^.+\n/", "", str_replace(';', "\n", str_replace('|', ' : ', $str)))) . '</textarea>';
         }), array('db' => 'id', 'dt' => 'action', 'formatter' => function ($id) {
             return '<a href="' . base_url('' . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/delete/' . $id) . '" class="btn btn-danger btn-xs">Delete</a>';
         }));
         $sql_details = array('user' => $this->db->username, 'pass' => $this->db->password, 'db' => $this->db->database, 'host' => $this->db->hostname);
         $this->output->set_content_type('application/json')->set_output(json_encode(Datatables::simple($_GET, $sql_details, $table, $primaryKey, $columns), JSON_PRETTY_PRINT));
     }
 }
示例#3
0
文件: index.php 项目: gaiius/SunQA
                                        <td><?php 
    echo dateHourIconPrivate($user->last_login);
    ?>
</td>
                                    </tr>
                                    <tr>
                                        <td>Last IP</td>
                                        <td><?php 
    echo $user->last_ip;
    ?>
</td>
                                    </tr>
                                    <tr>
                                        <td>Modified</td>
                                        <td><?php 
    echo dateHourIconPrivate($user->modified);
    ?>
</td>
                                    </tr>
                                    <tr>
                                        <td>Lost Password</td>
                                        <td><?php 
    if ($user->lost_password != NULL) {
        ?>
                                                <?php 
        echo $user->lost_password;
        ?>
                                            <?php 
    } else {
        ?>
                                                <i>Nothing</i>