Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit e30b2d93 authored by DESKTOP-POSK74F\User's avatar DESKTOP-POSK74F\User
Browse files

comment

parent a168b1d1
No related branches found
No related tags found
No related merge requests found
Showing
with 28 additions and 25 deletions
...@@ -48,7 +48,7 @@ class Company extends ExhibitionController { ...@@ -48,7 +48,7 @@ class Company extends ExhibitionController {
$data['message'] = true; $data['message'] = true;
echo json_encode($data); echo json_encode($data);
} }
//บันทึกข้อมูลที่แก้ไข
public function edit_company() public function edit_company()
{ {
$id = $this->input->post('id'); $id = $this->input->post('id');
......
...@@ -6,7 +6,7 @@ require_once dirname(__FILE__) . './ExhibitionController.php'; ...@@ -6,7 +6,7 @@ require_once dirname(__FILE__) . './ExhibitionController.php';
class Project extends ExhibitionController { class Project extends ExhibitionController {
public function show_project_manage() public function show_project_manage() //ดึงข้อมูล หน้าดรอปดาวต่างๆ
{ {
$_SESSION["sidebar"] = 'project'; $_SESSION["sidebar"] = 'project';
$this->output_admin('Project/v_project_manage'); $this->output_admin('Project/v_project_manage');
...@@ -74,7 +74,7 @@ class Project extends ExhibitionController { ...@@ -74,7 +74,7 @@ class Project extends ExhibitionController {
$data['message'] = true; $data['message'] = true;
echo json_encode($data); echo json_encode($data);
} }
//นำข้อมูลที่ดึงมาใส่
public function add_project(){ public function add_project(){
$project_name = $this->input->post('project_name'); $project_name = $this->input->post('project_name');
...@@ -89,8 +89,8 @@ class Project extends ExhibitionController { ...@@ -89,8 +89,8 @@ class Project extends ExhibitionController {
$this->load->model('project/M_project', 'project'); $this->load->model('project/M_project', 'project');
$this->project->add_project($project_name, $class_year, $detail, $company_id, $template); $this->project->add_project($project_name, $class_year, $detail, $company_id, $template); //เพิ่มเสร้จบันทึกข้อมูล
$max_id = $this->project->get_max_id()->row(); $max_id = $this->project->get_max_id()->row(); //เอาไอดีที่มากที่สุดของ project มา
// เพิ่มiรูป // เพิ่มiรูป
$folder = getcwd().'/image/project/'; $folder = getcwd().'/image/project/';
mkdir($folder.'project_'.$max_id->max_id); mkdir($folder.'project_'.$max_id->max_id);
......
...@@ -12,12 +12,12 @@ class User extends ExhibitionController { ...@@ -12,12 +12,12 @@ class User extends ExhibitionController {
$this->output_admin('User/v_user_manage'); $this->output_admin('User/v_user_manage');
} }
//ดึงข้อมูลuser //ดึงข้อมูลuser จาก M user
public function get_user() public function get_user()
{ {
$this->load->model('user/M_user', 'user'); $this->load->model('user/M_user', 'user');
$data = $this->user->get_user()->result(); $data = $this->user->get_user()->result();
echo json_encode($data); echo json_encode($data); //เอาข้อมูลไปสร้างเป็นตาราง
} }
public function show_user_create(){ public function show_user_create(){
...@@ -45,11 +45,11 @@ class User extends ExhibitionController { ...@@ -45,11 +45,11 @@ class User extends ExhibitionController {
$data['message'] = true; $data['message'] = true;
echo json_encode($data); echo json_encode($data);
} }
//ดึงข้อมูลของ id ที่เลือก
public function show_user_edit($id){ public function show_user_edit($id){
$this->load->model('user/M_user', 'user'); $this->load->model('user/M_user', 'user');
$data['user'] = $this->user->get_user_by_id($id)->row(); $data['user'] = $this->user->get_user_by_id($id)->row();
$this->output_admin('User/v_user_edit', $data); $this->output_admin('User/v_user_edit', $data); //พอดึงได้จะไปแสดงหน้าจอ user edit
} }
public function edit_user(){ public function edit_user(){
......
...@@ -284,7 +284,7 @@ $('#add-company-modal').on('shown.bs.modal', function (e) { ...@@ -284,7 +284,7 @@ $('#add-company-modal').on('shown.bs.modal', function (e) {
$('#add_company_name').val('') $('#add_company_name').val('')
}) })
//ดึงข้อมูล get com
function get_company(){ function get_company(){
$.ajax({ $.ajax({
type: 'post', type: 'post',
...@@ -295,7 +295,7 @@ function get_company(){ ...@@ -295,7 +295,7 @@ function get_company(){
} }
}) })
} }
//พอดีงข้อมูลเสร็จจะนำไปสร้างตาราง
function create_table(data){ function create_table(data){
let html_code = ''; let html_code = '';
html_code +='<table id="myTable" class="table-hover">' html_code +='<table id="myTable" class="table-hover">'
...@@ -334,7 +334,7 @@ function create_table(data){ ...@@ -334,7 +334,7 @@ function create_table(data){
$(".dataTables_info").css('clear', 'none'); $(".dataTables_info").css('clear', 'none');
$(".dataTables_info").css('padding-top', '1'); $(".dataTables_info").css('padding-top', '1');
} }
//กดปุ่ม edit เรียกฟังก์ชัน editModal ทำการ set ข้อมูลที่แก้ไขลงใน modal แล้วก็แสดง
function editModal(id, image, name){ function editModal(id, image, name){
$('#edit_id').val(id) $('#edit_id').val(id)
$('#edit_name').val(name); $('#edit_name').val(name);
...@@ -393,7 +393,7 @@ function editCompany(){ ...@@ -393,7 +393,7 @@ function editCompany(){
} }
}); });
} }
//กดปุ่ม delete จะไปเรียกฟังก์ชัน delete_company ใน controller
function deleteCompany(id){ function deleteCompany(id){
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
......
...@@ -301,11 +301,11 @@ indexImage = 1; ...@@ -301,11 +301,11 @@ indexImage = 1;
//เพิ่ม member //เพิ่ม member
function addMember(){ function addMember(){
if(index < 11){ if(index < 11){ //ไม่เกิน 10
document.querySelector("#memberList").insertAdjacentHTML("beforeend", document.querySelector("#memberList").insertAdjacentHTML("beforeend",
`<div class="member-list-child"> `<div class="member-list-child">
<input class="form-control-custom stuId" type="text" name='studId'>&nbsp; <input class="form-control-custom stuId" type="text" name='studId'>&nbsp;
<input type="text" name="member" class="form-control-custom member member-child"><button onclick="deleteItem(this)">Delete</button><div>`); <input type="text" name="member" class="form-control-custom member member-child"><button onclick="deleteItem(this)">Delete</button><div>`); //ปุ่ม delete
index++; index++;
} }
} }
...@@ -474,7 +474,7 @@ function deleteImage(dom){ ...@@ -474,7 +474,7 @@ function deleteImage(dom){
} }
indexImage-- indexImage--
} }
//ดึงข้อมูล ไปใส่ add_project ใน controlller
function addUser(){ function addUser(){
let project_name = $('#projectName').val(); let project_name = $('#projectName').val();
let classYear = $("input[name='classYear']:checked").val(); let classYear = $("input[name='classYear']:checked").val();
......
...@@ -116,8 +116,9 @@ div.dataTables_filter{ ...@@ -116,8 +116,9 @@ div.dataTables_filter{
<script> <script>
//เมื่อกดบันทึกจะเรียกฟังก์ชัน adduser
function addUser(){ function addUser(){
//เอาข้อมูลใส่ในตัวแปรแต่ละตัว
let id = $('#id').val(); let id = $('#id').val();
let first_name = $('#firstName').val(); let first_name = $('#firstName').val();
let last_name = $('#lastName').val(); let last_name = $('#lastName').val();
...@@ -132,6 +133,7 @@ function addUser(){ ...@@ -132,6 +133,7 @@ function addUser(){
type: 'POST', type: 'POST',
url: "<?php echo site_url() . '/User/edit_user'; ?>", url: "<?php echo site_url() . '/User/edit_user'; ?>",
data: { data: {
//ส่งข้อมูลไปยัง controller edit_user
'id': id, 'id': id,
'first_name': first_name, 'first_name': first_name,
'last_name': last_name, 'last_name': last_name,
......
...@@ -71,7 +71,7 @@ function get_cluster(){ ...@@ -71,7 +71,7 @@ function get_cluster(){
}) })
} }
//สร้าง table //สร้าง table จากไฟล์ get user
function create_table(data){ function create_table(data){
let html_code = ''; let html_code = '';
html_code +='<table id="myTable" class="table-hover">' html_code +='<table id="myTable" class="table-hover">'
...@@ -98,6 +98,7 @@ function create_table(data){ ...@@ -98,6 +98,7 @@ function create_table(data){
html_code +='</tbody>'; html_code +='</tbody>';
html_code +='</table>'; html_code +='</table>';
$('#create_table').html(html_code); $('#create_table').html(html_code);
//datateble ฟังก์ชันตารางเสริม
$('#myTable').DataTable({ $('#myTable').DataTable({
dom: 'frtlip', dom: 'frtlip',
aoColumnDefs: [{ aoColumnDefs: [{
...@@ -114,7 +115,7 @@ function create_table(data){ ...@@ -114,7 +115,7 @@ function create_table(data){
function deleteUser(id){ function deleteUser(id){
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: "<?php echo site_url() . '/User/delete_user'; ?>", url: "<?php echo site_url() . '/User/delete_user'; ?>", //ไปcontroller เพื่อลบข้อมูล
data: { data: {
'id': id, 'id': id,
}, },
...@@ -122,8 +123,8 @@ function deleteUser(id){ ...@@ -122,8 +123,8 @@ function deleteUser(id){
success: function(data) { success: function(data) {
console.log(data) console.log(data)
if (data.message) { if (data.message) {
toastSuccess() toastSuccess() //ลบได้จะแสดงแจ้งเตือน
get_cluster() get_cluster() //เมื่อลบข้อมูลได้ก็จะดึงตารางข้อมูลขึ้นมาใหม่
} }
else { else {
toastFail() toastFail()
......
image/project/project_49/image_0.png

133 KiB | W: | H:

image/project/project_49/image_0.png

37.9 KiB | W: | H:

image/project/project_49/image_0.png
image/project/project_49/image_0.png
image/project/project_49/image_0.png
image/project/project_49/image_0.png
  • 2-up
  • Swipe
  • Onion skin
image/project/project_50/image_0.png

133 KiB | W: | H:

image/project/project_50/image_0.png

37.9 KiB | W: | H:

image/project/project_50/image_0.png
image/project/project_50/image_0.png
image/project/project_50/image_0.png
image/project/project_50/image_0.png
  • 2-up
  • Swipe
  • Onion skin
image/project/project_51/image_0.png

72.1 KiB | W: | H:

image/project/project_51/image_0.png

37.9 KiB | W: | H:

image/project/project_51/image_0.png
image/project/project_51/image_0.png
image/project/project_51/image_0.png
image/project/project_51/image_0.png
  • 2-up
  • Swipe
  • Onion skin
image/project/project_52/image_0.png

72.1 KiB | W: | H:

image/project/project_52/image_0.png

37.9 KiB | W: | H:

image/project/project_52/image_0.png
image/project/project_52/image_0.png
image/project/project_52/image_0.png
image/project/project_52/image_0.png
  • 2-up
  • Swipe
  • Onion skin
image/project/project_53/image_0.png

37.9 KiB

image/project/project_54/image_0.png

37.9 KiB

image/project/project_55/image_0.png

37.9 KiB

image/project/project_56/image_0.png

121 KiB | W: | H:

image/project/project_56/image_0.png

37.9 KiB | W: | H:

image/project/project_56/image_0.png
image/project/project_56/image_0.png
image/project/project_56/image_0.png
image/project/project_56/image_0.png
  • 2-up
  • Swipe
  • Onion skin
image/project/project_57/image_0.png

121 KiB | W: | H:

image/project/project_57/image_0.png

37.9 KiB | W: | H:

image/project/project_57/image_0.png
image/project/project_57/image_0.png
image/project/project_57/image_0.png
image/project/project_57/image_0.png
  • 2-up
  • Swipe
  • Onion skin
image/project/project_58/image_0.png

121 KiB | W: | H:

image/project/project_58/image_0.png

37.9 KiB | W: | H:

image/project/project_58/image_0.png
image/project/project_58/image_0.png
image/project/project_58/image_0.png
image/project/project_58/image_0.png
  • 2-up
  • Swipe
  • Onion skin
image/project/project_59/image_0.png

37.9 KiB

image/project/project_60/image_0.png

37.9 KiB

image/project/project_61/image_0.png

37.9 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment