Exemplo n.º 1
0
 function testdetail($testid = 0)
 {
     save_url();
     $user = check_login12(1, 2);
     if ($this->input->post('submit_rs')) {
         redirect(base_url());
     }
     $data = array('user' => $user, 'meta_title' => 'Test Detail');
     $test = $this->mtest->get_test_detail($testid);
     if (!$test) {
         $data['error'] = 'Không có đề thi trong hệ thống';
         $data['template'] = 'home/notify';
         $this->load->view('home/frontend/layouts/home', isset($data) ? $data : NULL);
         return;
     }
     $data['test'] = $test;
     $data['test_info'] = $this->mtest->get_test_info($testid);
     if ($this->input->post('submit')) {
         $result['answer'] = $this->input->post('answer');
         $result['test'] = $data['test'];
         $responses = array("userid" => $user['id'], "testid" => $testid);
         $this->result($result, $responses);
         return;
     } else {
         $data['template'] = 'home/testdetail';
         $this->load->view('home/frontend/layouts/home', isset($data) ? $data : NULL);
     }
 }
Exemplo n.º 2
0
 function search()
 {
     save_url();
     // Luu current_url vao session
     $data = array('template' => 'frontend/home/search');
     if ($this->input->post('submit')) {
         $this->form_validation->set_rules('search', 'Mã đề hoặc Tên đề', 'required');
         if ($this->form_validation->run() == TRUE) {
             $search = $this->input->post('search');
             // lay danh sach theo category
             $list_cate = $this->mhome->get_list_cate();
             foreach ($list_cate as $key => $val) {
                 $listtest[$val['id']] = $this->mhome->search_test($search, $val['id']);
             }
             if (!$listtest) {
                 $data['error'] = 'Không có đề thi trong hệ thống';
                 $data['template'] = 'home/notify';
                 $this->load->view('frontend/layouts/home', isset($data) ? $data : NULL);
                 return;
             }
             $data['listtest'] = $listtest;
             $data['listcate'] = $list_cate;
         }
     }
     $this->load->view('frontend/layouts/home', isset($data) ? $data : NULL);
 }
Exemplo n.º 3
0
 function deletequestion($id = 0)
 {
     save_url();
     // Luu current_url vao session
     $user = check_login(3);
     $data = array('user' => $user, 'meta_title' => 'Delete Question', 'active' => 'quiz-delete', 'template' => 'delete_question');
     $quiz_info = $this->mquestion->search_question($id);
     if (!$quiz_info) {
         $data['error'] = 'Question not found in database.';
         $data['template'] = 'notify';
         $this->load->view('admin/backend/layouts/home', isset($data) ? $data : NULL);
         return;
     }
     $data['quiz_info'] = $quiz_info;
     if ($this->input->post('submit')) {
         $this->form_validation->set_rules('delete', 'Delete Radio', 'required');
         $this->form_validation->set_error_delimiters('<div class="input-notification error png_bg">', '</div>');
         if ($this->form_validation->run() == TRUE) {
             if ($this->input->post('delete') == 'yes') {
                 $this->mquestion->deletequestion($id);
                 $success = 'Bạn đã xóa câu hỏi thành công.';
             } else {
                 if ($this->input->post('delete') == 'no') {
                     $success = 'Tôi cũng nghĩ bạn không nên xóa câu hỏi này.';
                 }
             }
             $data['success'] = $success;
         }
     }
     $this->load->view('admin/backend/layouts/home', isset($data) ? $data : NULL);
 }
Exemplo n.º 4
0
 function deletesubject($id = 0)
 {
     save_url();
     // Luu current_url vao session
     $user = check_login(3);
     $data = array('user' => $user, 'meta_title' => 'Delete Subject', 'active' => 'subject-delete', 'template' => 'delete_subject');
     $subject_info = $this->msubject->search_subject($id);
     if (!$subject_info) {
         $data['error'] = 'Subject not found in database.';
         $data['template'] = 'notify';
         $this->load->view('admin/backend/layouts/home', isset($data) ? $data : NULL);
         return;
     }
     $data['subject_info'] = $subject_info;
     if ($this->input->post('submit')) {
         $this->form_validation->set_rules('delete', 'Delete Radio', 'required');
         $this->form_validation->set_error_delimiters('<div class="input-notification error png_bg">', '</div>');
         if ($this->form_validation->run() == TRUE) {
             if ($this->input->post('delete') == 'yes') {
                 $this->msubject->deletesubject($id);
                 $success = 'You have successfully deleted.';
             } else {
                 if ($this->input->post('delete') == 'no') {
                     $success = 'I also think you should not delete Subject';
                 }
             }
             $data['success'] = $success;
             $data['template'] = 'notify';
             $this->load->view('admin/backend/layouts/home', isset($data) ? $data : NULL);
             return;
         }
     }
     $this->load->view('admin/backend/layouts/home', isset($data) ? $data : NULL);
 }
Exemplo n.º 5
0
 public function index()
 {
     save_url();
     // Luu current_url vao session
     $user = check_login(3);
     $this->_data = array('category' => $this->mcategory->get_list_category(), 'template' => 'level', 'user' => $user, 'meta_title' => 'Manage Level', 'active' => 'level-add');
     $this->load->view('admin/backend/layouts/home', isset($this->_data) ? $this->_data : NULL);
 }
Exemplo n.º 6
0
 function sendRequest($pro_id = 0)
 {
     save_url();
     // Luu current_url vao session
     $user = check_login(1);
     $product = $this->input->post('product');
     // danh sach id muon trao doi.
     if ($this->issetProduct($product, 'sendRequest')) {
         $exchange_info = array('pro_id' => $pro_id, 'user_id' => $user['id'], 'pro_exchange' => json_encode($product), 'time_exchange' => date('Y-m-d h:m:s', time()));
         $this->mhome->swap_product($exchange_info);
         $data['success'] = 'Gửi yêu cầu trao đổi sản phẩm thành công';
         $this->load->view('notify_home', isset($data) ? $data : NULL);
     }
     return;
 }
Exemplo n.º 7
0
 function delete_post($post_id = 0)
 {
     save_url();
     // Luu current_url vao session
     $user = check_login(3);
     $data = array('user' => $user, 'title' => 'Xóa bài đăng');
     $check_post = $this->mmanage_product->search_post_id($post_id);
     if (!$check_post) {
         $data['error'] = 'Không có sản phẩm này.';
     } else {
         $check_active = $this->mmanage_product->check_product_active($post_id);
         if ($check_active) {
             $data['error'] = 'Bài đăng đã được duyệt. Vui lòng kiểm tra lại.';
         } else {
             $this->mmanage_product->delete_post($post_id);
             $data['success'] = 'Đã xóa sản phẩm này.';
             // CAN THONG BAO LAI CHO NGUOI DANG BAI
         }
     }
     $this->load->view('notify_admin', isset($data) ? $data : NULL);
 }
Exemplo n.º 8
0
    if (isset($_POST["tseccion"]) && !empty($_POST["tseccion"])) {
        $fields["seccion"] = $_POST["tseccion"];
    } else {
        $fields["seccion"] = "";
        $errores["seccion"] = "<font class=framefont_green>La seccion no puede estar vacia.</font>";
    }
    if (count($errores) > 0) {
        return false;
    } else {
        return true;
    }
}
//Testeamos los errores en los campos de entrada
if (testFields($errores, $fields)) {
    //Probamos a grabar el registro.
    if (save_url($fields)) {
        //Todo ok.
        $results = '<b><font color="#a6e195">La URL ha sido enviada con éxito.<br>
            En breve estudiaremos su solicitud de inclusión en el directorio</font></b>';
        //Si todo va bien eliminamos el contenido de $_POST para que los campos del formulario queden en blanco.
        unset($_POST);
    } else {
        //Error en DB contacto con webmaster.
        $results = '<b><font class="framefont_red">Error al enviar URL.</font><br>
            Si el problema persiste contacte con el administrador del sitio.</font></b>';
    }
} else {
    //Devolvemos los errores constados.
    reset($errores);
    $results = "<b><font class=framefont_green>Errores:</font><br><ul>\n";
    while (list($clave, $val) = each($errores)) {
Exemplo n.º 9
0
 function delete($id = 0)
 {
     save_url();
     // Luu current_url vao session
     $user = check_login(3);
     $data = array('user' => $user, 'active' => 'test-view', 'meta_title' => 'Delete Test', 'template' => 'backend/home/delete_test');
     $test_info = $this->mmanageTest->search_test($id);
     if (!$test_info) {
         $data['error'] = 'Test not found in database.';
         $this->load->view('admin/backend/layouts/home', isset($data) ? $data : NULL);
     } else {
         $data['user_test'] = $test_info;
         if ($this->input->post('submit')) {
             $this->form_validation->set_rules('delete', 'Delete Radio', 'required');
             $this->form_validation->set_error_delimiters('<div class="input-notification error png_bg">', '</div>');
             if ($this->form_validation->run() == TRUE) {
                 if ($this->input->post('delete') == 'yes') {
                     $this->mmanageTest->deletetest($id);
                     $data['success'] = 'Bạn đã xóa đề thi thành công.';
                 } else {
                     if ($this->input->post('delete') == 'no') {
                         $data['success'] = 'Tôi cũng nghĩ bạn không nên xóa đề thi này.';
                     }
                 }
             }
         }
         $this->load->view('admin/backend/layouts/home', isset($data) ? $data : NULL);
     }
 }
Exemplo n.º 10
0
 function delete($product_id = 1)
 {
     save_url();
     // Luu current_url vao session
     $user = check_login(1);
     $data['user'] = $user;
     $check_product = $this->mmanage_product->search_product($product_id, $user['id']);
     if (!$check_product) {
         $data['error'] = 'Product not found in database.';
         $this->load->view('notify_product', isset($data) ? $data : NULL);
     }
     $data = array('title' => 'Delete Product', 'product_info' => $check_product);
     $data['check_product'] = $check_product;
     if ($this->input->post('submit')) {
         $this->form_validation->set_rules('delete', 'Delete Radio', 'required');
         $this->form_validation->set_error_delimiters('<div style="color:red;">', '</div>');
         if ($this->form_validation->run() == TRUE) {
             if ($this->input->post('delete') == 'yes') {
                 $this->mmanage_product->delete_product($product_id);
                 $data['success'] = 'You have successfully deleted.';
             } else {
                 if ($this->input->post('delete') == 'no') {
                     $data['success'] = 'I also think you should not delete this product.';
                 }
             }
             $this->load->view('notify_product', isset($data) ? $data : NULL);
             return;
         }
     }
     $this->load->view('delete_product', isset($data) ? $data : NULL);
 }
Exemplo n.º 11
0
 function displayResult($result)
 {
     save_url();
     // Luu current_url vao session
     $user = check_login(2);
     $score = 0;
     $totalScore = 0;
     foreach ($result['test'] as $key => $value) {
         $true_ans = json_decode($value['correct'], true);
         if (!empty($result['answer'][$key])) {
             if ($value['type'] == 1) {
                 $partScore = $this->markScoreForAQuestionOTAS($result['answer'][$key], $true_ans);
             } else {
                 if ($value['type'] == 2) {
                     $partScore = $this->markScoreForAQuestionPTPS($result['answer'][$key], $true_ans);
                 } else {
                     $partScore = $this->markScoreForAQuestionATAS($result['answer'][$key], $true_ans);
                 }
             }
             $score += $partScore * $value['score'];
         }
         $totalScore += $value['score'];
     }
     if (!$this->input->post('submit_rs')) {
         $data = array('user' => $user, 'totalScore' => $totalScore, 'score' => $score, 'meta_title' => 'Result', 'template' => 'home/result', 'test' => $result['test'], 'answer_choosen' => $result['answer']);
         $this->load->view('home/frontend/layouts/home', isset($data) ? $data : NULL);
     } else {
         redirect(base_url());
     }
 }
Exemplo n.º 12
0
 function transaction_message()
 {
     save_url();
     // Luu current_url vao session
     $user = check_login(1);
     $exchange_message = $this->muser->exchange_message($user['id']);
     if (!$exchange_message) {
         $data['error'] = 'Không có thông báo giao dịch nào.';
         $this->load->view('notify_user', isset($data) ? $data : NULL);
         return;
     }
     $data = array('title' => 'Exchange product message', 'user' => $user, 'exchange_message' => $exchange_message);
     $this->load->view('exchange_message', isset($data) ? $data : NULL);
 }
Exemplo n.º 13
0
 function view_by_feild($feild_id = 0)
 {
     // Kiem tra user da login hay chua ???
     save_url();
     // Luu current_url vao session
     $user = check_login(1);
     $feild_info = $this->mfeild->search_feild($feild_id);
     if (!$feild_info) {
         $data['error'] = 'Không tìm thấy sản phẩm có thuộc tính này.';
         $this->load->view('not_found', isset($data) ? $data : NULL);
         return;
     }
     // Danh sach do lien quan
     $lienquan_product = $this->mfeild->show_product_by_type_id($feild_id, 20);
     if (!$lienquan_product) {
         $data['error'] = 'Không tìm thấy sản phẩm có thuộc tính này.';
         $this->load->view('not_found', isset($data) ? $data : NULL);
         return;
     }
     $data = array('title' => 'Xem đồ liên quan', 'feild_info' => $feild_info, 'lienquan_product' => $lienquan_product);
     $this->load->view('show_product', isset($data) ? $data : NULL);
 }
Exemplo n.º 14
0
 function delete($cate_id = 0)
 {
     save_url();
     // Luu current_url vao session
     $user = check_login(3);
     $data = array('user' => $user, 'title' => 'Delete Category');
     $cate_info = $this->mcategory->search_category($cate_id);
     if (!$cate_info) {
         $data['error'] = 'Category not found in database.';
         $this->load->view('notify_category', isset($data) ? $data : NULL);
     }
     $data['cate_info'] = $cate_info;
     if ($this->input->post('submit')) {
         $this->form_validation->set_rules('delete', 'Delete Radio', 'required');
         $this->form_validation->set_error_delimiters('<div style="color:red">', '</div>');
         if ($this->form_validation->run() == TRUE) {
             if ($this->input->post('delete') == 'yes') {
                 // XOA FEILD, PRODUCT, COMMENT
                 $this->mmanage_product->delete_product_by_categoryid($cate_id);
                 $this->mfeild->delete_feild_by_categoryid($cate_id);
                 $this->mcategory->delete_category($cate_id);
                 $success = 'You have successfully deleted.';
             } else {
                 if ($this->input->post('delete') == 'no') {
                     $success = 'I also think you should not delete Category';
                 }
             }
             $data['success'] = $success;
             $this->load->view('notify_category', isset($data) ? $data : NULL);
             return;
         }
     }
     $this->load->view('delete_category', isset($data) ? $data : NULL);
 }
Exemplo n.º 15
0
<?php

if (!empty($_POST['update-settings'])) {
    $site_title = @$_POST['site-title'];
    $site_url = @$_POST['site-url'];
    if (!empty($site_title)) {
        save_title($site_title);
    }
    if (!empty($site_url)) {
        save_url($site_url);
    }
}
?>

<div class="settings-form">
	<form method="post">
		<div><label>Site Title:</label><input type="text" value="<?php 
print getinfo('site_title');
?>
" name="site-title"  /></div>
		<div><label>Site URL:</label><input type="text" value="<?php 
print getinfo('site_url');
?>
" name="site-url"  /></div>
		
		<button type="submit" class="button" name="update-settings">
	    	<i class="icon-refresh icon-large"></i> Update
	    </button>
	</form>
</div>