diff --git a/html/exhi/application/controllers/Project.php b/html/exhi/application/controllers/Project.php index 30c363030f19f88bbea0c31971d0d15deedbd5c9..0b9060086ef8abe651bd7628982bef4770839cb7 100644 --- a/html/exhi/application/controllers/Project.php +++ b/html/exhi/application/controllers/Project.php @@ -263,15 +263,38 @@ class Project extends Exhibition_Controller { $this->load->model('project_tag/M_project_tag','project_tag'); $this->load->model('detail/M_detail','detail'); $this->load->model('member/M_member','member'); - + $this->load->model('cluster/M_cluster','cluster'); + $this->load->model('team/M_team','team'); + $this->load->model('instructor/M_instructor','instructor'); + $path_old = ''; + $project = $this->project->get_project_by_id($id)->row(); + if($project->cluster_id != 0){ + $select_old = $this->cluster->get_cluster_by_id($project->cluster_id)->row(); + $path_old = '/project/year_'.$project->date.'/y2/'.$select_old->name.'/'; + }else if($project->team_id != 0){ + $select_old = $this->team->get_team_by_id($project->team_id)->row(); + $path_old = '/project/year_'.$project->date.'/y3/'.$select_old->name.'/'; + }else{ + $path_old = '/project/year_'.$project->date.'/y4/'.$_SESSION['student_id'].'/'; + } + $path_save_image = ''; if($graduation != 4){ $path_save_image = getcwd().'/project/year_'.$year.'/y'.$graduation.'/'.$select_text.'/'; - $path = 'project/year_'.$year.'/y'.$graduation.'/'.$select_text.'/'; + $path = '/project/year_'.$year.'/y'.$graduation.'/'.$select_text.'/'; }else{ $path_save_image = getcwd().'/project/year_'.$year.'/y'.$graduation.'/'.$_SESSION['student_id'].'/'; - $path = 'project/year_'.$year.'/y'.$graduation.'/'.$_SESSION['student_id'].'/'; + $path = '/project/year_'.$year.'/y'.$graduation.'/'.$_SESSION['student_id'].'/'; } + $check_path_old = true; + if($path_old != $path){ + if(file_exists($path_save_image)){ + $data['message'] = false; + } + }else{ + $check_path_old = true; + } + if($data['message'] == true){ if($graduation == 2){ $this->project->update_project_cluster($name, $name_en, $year, $company, $select, $path.$image_logo, $path.$image_cover, $id); @@ -284,13 +307,51 @@ class Project extends Exhibition_Controller { foreach ($tags as $tag){ $this->project_tag->insert_project_tag($id, $tag); } - + $files = glob(getcwd().$path.'*'); // get all file names foreach($files as $file){ // iterate files if(is_file($file)) { unlink($file); // delete file } } + + if($check_path_old == true){ + if(!file_exists(getcwd().'/project/year_'.$year)){ + $folder_project = getcwd().'/project/'; + mkdir($folder_project.'year_'.$year); + $folder_yesr = getcwd().'/project/year_'.$year.'/'; + mkdir($folder_yesr.'y'.$graduation); + $folder_graduation = getcwd().'/project/year_'.$year.'/y'.$graduation.'/'; + if($graduation == 2 || $graduation == 3){ + mkdir($folder_graduation.$select_text); + }else{ + mkdir($folder_graduation.$_SESSION['student_id']); + } + }else if(!file_exists(getcwd().'/project/year_'.$year.'/y'.$graduation)){ + $folder_yesr = getcwd().'/project/year_'.$year.'/'; + mkdir($folder_yesr.'y'.$graduation); + $folder_graduation = getcwd().'/project/year_'.$year.'/y'.$graduation.'/'; + if($graduation == 2 || $graduation == 3){ + mkdir($folder_graduation.$select_text); + }else{ + mkdir($folder_graduation.$_SESSION['student_id']); + } + }else{ + $folder_graduation = getcwd().'/project/year_'.$year.'/y'.$graduation.'/'; + if($graduation == 2 || $graduation == 3){ + if(!file_exists($folder_graduation.$select_text)){ + mkdir($folder_graduation.$select_text); + } + }else{ + if(!file_exists(getcwd().'/project/year_'.$year.'/y'.$graduation)){ + if(!file_exists($folder_graduation.$_SESSION['student_id'])){ + mkdir($folder_graduation.$_SESSION['student_id']); + } + } + } + } + } + file_put_contents($path_save_image.$image_logo, $base64_decode_logo); file_put_contents($path_save_image.$image_cover, $base64_decode_cover); @@ -322,13 +383,26 @@ class Project extends Exhibition_Controller { $data_image_member = $members[$i]['value']; $select = $members[$i]['select']; $this->member->insert_member($path.$image_member, $select, $id); - if($data_image1){ + if($data_image_member){ $base64_decode_image_member = base64_decode($data_image_member); file_put_contents($path_save_image.$image_member, $base64_decode_image_member); } } } + + if($path_old != $path){ + if(file_exists($path_save_image)){ + $files = glob(getcwd().$path_old.'/*'); // get all file names + foreach($files as $file){ // iterate files + if(is_file($file)) { + unlink($file); // delete file + } + } + rmdir(getcwd().$path_old); + } + } } + echo json_encode($data); } diff --git a/html/exhi/application/views/project/v_project_create.php b/html/exhi/application/views/project/v_project_create.php index 234343d79e055cfe3ec5354ecdd585543177f2ca..8e44d6a36ac122ba8934f28a23a87b103cdfeef4 100644 --- a/html/exhi/application/views/project/v_project_create.php +++ b/html/exhi/application/views/project/v_project_create.php @@ -66,6 +66,12 @@ label{ .filepond--root .filepond--drop-label { height: auto; } +.note-editable { + font-family: 'Sarabun', sans-serif; + text-align: left !important; + height: 350px !important; + +} </style> <div class="content-wrapper h-100"> <div class="content-header"> @@ -579,11 +585,16 @@ function chose_template(){ index++ $('.summernote').summernote({ height: 300, + fontNames: ['Sarabun','sans-serif'], + fontNamesIgnoreCheck: ['Sarabun','sans-serif'], toolbar: [ ['style', ['bold', 'italic']], ['color', ['color']], ['para', ['ul', 'ol', 'paragraph']], - ] + ['fontsize', ['fontsize']], + ['fontname', ['fontname']], + ], + fontSizes: ['8','9','10','11','12','14','16','18','20','22','24', '36', '48' , '64', '82', '150'] }); $('#modal_detail').modal('hide') } diff --git a/html/exhi/application/views/project/v_project_create_user.php b/html/exhi/application/views/project/v_project_create_user.php index fb94131e38f1b78081d96e97b9ae038760f31490..537c5a9ec741ee6a7a9bd5e4b60de6b7ac6a7241 100644 --- a/html/exhi/application/views/project/v_project_create_user.php +++ b/html/exhi/application/views/project/v_project_create_user.php @@ -66,6 +66,13 @@ label{ .filepond--root .filepond--drop-label { height: auto; } +.note-editable { + font-family: 'Sarabun', sans-serif; + font-size: 16px !important; + text-align: left !important; + height: 350px !important; + +} </style> <div class="content-wrapper h-100"> <div class="content-header"> @@ -579,11 +586,16 @@ function chose_template(){ index++ $('.summernote').summernote({ height: 300, + fontNames: ['Sarabun','sans-serif'], + fontNamesIgnoreCheck: ['Sarabun','sans-serif'], toolbar: [ ['style', ['bold', 'italic']], ['color', ['color']], ['para', ['ul', 'ol', 'paragraph']], - ] + ['fontsize', ['fontsize']], + ['fontname', ['fontname']], + ], + fontSizes: ['8','9','10','11','12','14','16','18','20','22','24', '36', '48' , '64', '82', '150'] }); $('#modal_detail').modal('hide') } diff --git a/html/exhi/application/views/project/v_project_edit.php b/html/exhi/application/views/project/v_project_edit.php index cdb1df7b0fef8cbda6217e68156464711791949c..de2cd6ac520e049bfe895a4d47f95f39621fc925 100644 --- a/html/exhi/application/views/project/v_project_edit.php +++ b/html/exhi/application/views/project/v_project_edit.php @@ -68,6 +68,12 @@ label{ display: inline; /* font-weight: bold; */ } +.note-editable { + font-family: 'Sarabun', sans-serif; + text-align: left !important; + height: 350px !important; + +} </style> <div class="content-wrapper h-100"> <div class="content-header"> @@ -116,7 +122,7 @@ label{ <div class="form-group"> <label class="form-label">มกุล </label> <select class="form-control select-require" id="cluster_select"> - <option value="" selected disabled></option> + <option value="" selected disabled>กรุณาเลือกมกุล</option> <?php foreach($clusters as $cluster){ ?> <option value="<?php echo $cluster->cluster_id ?>" <?php echo $cluster->cluster_id == $project->cluster_id ? 'selected' : '' ?>><?php echo $cluster->name ?></option> <?php } ?> @@ -127,7 +133,7 @@ label{ <div class="form-group"> <label class="form-label">ทีม </label> <select class="form-control select-require" id="team_select"> - <option value="" selected disabled></option> + <option value="" selected disabled>กรุณาเลือกทีม</option> <?php foreach($teams as $team){ ?> <option value="<?php echo $team->team_id ?>" <?php echo $team->team_id == $project->team_id ? 'selected' : '' ?>><?php echo $team->name ?></option> <?php } ?> @@ -138,7 +144,7 @@ label{ <div class="form-group"> <label class="form-label">อาจารย์ที่ปรึกษา </label> <select class="form-control select-require" id="instructor_select"> - <option value="" selected disabled></option> + <option value="" selected disabled>กรุณาเลือกอาจารย์ที่ปรึกษา</option> <?php foreach($instructors as $instructor){ ?> <option value="<?php echo $instructor->instructor_id ?>" <?php echo $instructor->instructor_id == $project->instructor_id ? 'selected' : '' ?>><?php echo $instructor->name ?></option> <?php } ?> @@ -409,8 +415,18 @@ $(document).ready(function() { $("#muti").select2().on('select2:open', () => { $(".select2-results:not(:has(a))").append('<a href="#" class="add-tag" onclick="open_modal_tag()"><i class="fas fa-plus-circle"></i> เพิ่มหมวดหมู่</a>') }) - document.getElementById("instructor").style.display = "none" - document.getElementById("team").style.display = "none" + let cluster_id = '<?php echo $project->cluster_id ?>' + let team_id = '<?php echo $project->team_id ?>' + let instructor_id = '<?php echo $project->instructor_id ?>' + if(cluster_id == 0){ + document.getElementById("cluster").style.display = "none" + } + if(team_id == 0){ + document.getElementById("team").style.display = "none" + } + if(instructor_id == 0){ + document.getElementById("instructor").style.display = "none" + } get_project_detail_member() }); @@ -547,11 +563,16 @@ function set_detail(details){ $('.summernote').summernote({ height: 300, + fontNames: ['Sarabun','sans-serif'], + fontNamesIgnoreCheck: ['Sarabun','sans-serif'], toolbar: [ ['style', ['bold', 'italic']], ['color', ['color']], ['para', ['ul', 'ol', 'paragraph']], - ] + ['fontsize', ['fontsize']], + ['fontname', ['fontname']], + ], + fontSizes: ['8','9','10','11','12','14','16','18','20','22','24', '36', '48' , '64', '82', '150'] }); $('#modal_detail').modal('hide') } @@ -601,7 +622,7 @@ function set_member(members, users){ const obj = { member_index: member_index, value: '', - select: '' + select: member.user_id } image_member.on('addfile', (error, file) => { obj.value = file.getFileEncodeBase64String() @@ -740,11 +761,16 @@ function chose_template(){ index++ $('.summernote').summernote({ height: 300, + fontNames: ['Sarabun','sans-serif'], + fontNamesIgnoreCheck: ['Sarabun','sans-serif'], toolbar: [ ['style', ['bold', 'italic']], ['color', ['color']], ['para', ['ul', 'ol', 'paragraph']], - ] + ['fontsize', ['fontsize']], + ['fontname', ['fontname']], + ], + fontSizes: ['8','9','10','11','12','14','16','18','20','22','24', '36', '48' , '64', '82', '150'] }); $('#modal_detail').modal('hide') } @@ -870,6 +896,8 @@ function update_projecct(){ let member = data_member let image_logo = data_circle let image_cover = data_cover + console.log('ttt') + console.log(member) if(graduation == 2){ select = $('#cluster_select').val() select_text = $("#cluster_select option:selected").text(); diff --git a/html/exhi/application/views/project/v_project_edit_user.php b/html/exhi/application/views/project/v_project_edit_user.php index f0c713a610313ec070e380703b03a626ed2176ef..d099b48e747bfa214bec66fb8e322bfedf7cd215 100644 --- a/html/exhi/application/views/project/v_project_edit_user.php +++ b/html/exhi/application/views/project/v_project_edit_user.php @@ -68,6 +68,12 @@ label{ display: inline; /* font-weight: bold; */ } +.note-editable { + font-family: 'Sarabun', sans-serif; + text-align: left !important; + height: 350px !important; + +} </style> <div class="content-wrapper h-100"> <div class="content-header"> @@ -409,8 +415,18 @@ $(document).ready(function() { $("#muti").select2().on('select2:open', () => { $(".select2-results:not(:has(a))").append('<a href="#" class="add-tag" onclick="open_modal_tag()"><i class="fas fa-plus-circle"></i> เพิ่มหมวดหมู่</a>') }) - document.getElementById("instructor").style.display = "none" - document.getElementById("team").style.display = "none" + let cluster_id = '<?php echo $project->cluster_id ?>' + let team_id = '<?php echo $project->team_id ?>' + let instructor_id = '<?php echo $project->instructor_id ?>' + if(cluster_id == 0){ + document.getElementById("cluster").style.display = "none" + } + if(team_id == 0){ + document.getElementById("team").style.display = "none" + } + if(instructor_id == 0){ + document.getElementById("instructor").style.display = "none" + } get_project_detail_member() }); @@ -547,11 +563,16 @@ function set_detail(details){ $('.summernote').summernote({ height: 300, + fontNames: ['Sarabun','sans-serif'], + fontNamesIgnoreCheck: ['Sarabun','sans-serif'], toolbar: [ ['style', ['bold', 'italic']], ['color', ['color']], ['para', ['ul', 'ol', 'paragraph']], - ] + ['fontsize', ['fontsize']], + ['fontname', ['fontname']], + ], + fontSizes: ['8','9','10','11','12','14','16','18','20','22','24', '36', '48' , '64', '82', '150'] }); $('#modal_detail').modal('hide') } @@ -601,7 +622,7 @@ function set_member(members, users){ const obj = { member_index: member_index, value: '', - select: '' + select: member.user_id } image_member.on('addfile', (error, file) => { obj.value = file.getFileEncodeBase64String() @@ -740,11 +761,16 @@ function chose_template(){ index++ $('.summernote').summernote({ height: 300, + fontNames: ['Sarabun','sans-serif'], + fontNamesIgnoreCheck: ['Sarabun','sans-serif'], toolbar: [ ['style', ['bold', 'italic']], ['color', ['color']], ['para', ['ul', 'ol', 'paragraph']], - ] + ['fontsize', ['fontsize']], + ['fontname', ['fontname']], + ], + fontSizes: ['8','9','10','11','12','14','16','18','20','22','24', '36', '48' , '64', '82', '150'] }); $('#modal_detail').modal('hide') } diff --git a/html/exhi/application/views/template/now-ui-kit/frontend_css.php b/html/exhi/application/views/template/now-ui-kit/frontend_css.php index 5dcfb82b08cd6538cd3041eb4a2f307b90b0eac4..93762ca4f7faa6264f6187308c0a015eef080909 100644 --- a/html/exhi/application/views/template/now-ui-kit/frontend_css.php +++ b/html/exhi/application/views/template/now-ui-kit/frontend_css.php @@ -2,7 +2,5 @@ body{ /* font-family: 'Sarabun', sans-serif; */ } - - </style> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.css"> diff --git a/html/exhi/assets/plugins/Sarabun-Thin.ttf b/html/exhi/assets/plugins/Sarabun-Thin.ttf new file mode 100644 index 0000000000000000000000000000000000000000..cdaabcb4b8a2fb9b76c1335021e2e76e4871a0f4 Binary files /dev/null and b/html/exhi/assets/plugins/Sarabun-Thin.ttf differ diff --git a/html/exhi/assets/plugins/THSarabun.ttf b/html/exhi/assets/plugins/THSarabun.ttf new file mode 100644 index 0000000000000000000000000000000000000000..23dd82b13631fc7956f6fb5537df75bfb776f1a6 Binary files /dev/null and b/html/exhi/assets/plugins/THSarabun.ttf differ