Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit 313896e3 authored by Passtaa's avatar Passtaa
Browse files

Nothing

parent 1f7b9a78
No related branches found
No related tags found
No related merge requests found
<?php <?php
defined('BASEPATH') or exit('No direct script access allowed'); defined('BASEPATH') or exit('No direct script access allowed');
class Prasobsuk_controller extends CI_Controller class Prasobsuk_controller extends CI_Controller
{ {
public function index() public function index()
{ {
$this->load->library('Pdf'); // $data = array(
$person_get_data = $this->IPS_model->get_join( // 'page_title' => 'Prasobsuk',
'ips_personnel', // 'page_content' => $this->load->view('Demo/v_prasobsuk', '', TRUE)
'', //colum in database // );
array(
'p_id' => $_SESSION['data_user_login']->p_id, // $this->load->view('main', $data);
), //where // }
array( // public function add_dpm()
'ips_address' => 'ips_address.adr_id=ips_personnel.p_id', // {
) //table to join // $data_dpm = array(
)->result(); //getjoin // 'dpm_name' => $this->input->post('dpm_name'),
// 'dpm_name_eng' => $this->input->post('dpm_name_eng'),
$person_get_edu_data = $this->IPS_model->get_join( // 'dpm_status' => 1
'ips_education_bg', // );
'', //colum in database // $this->IPS_model->insert('ips_department', $data_dpm);
array( // $this->output->set_content_type('appication/json')->set_output(json_encode(['status' => 1, 'msg' => 'บันทึกสำเร็จ']));
'edu_p_id' => $_SESSION['data_user_login']->p_id,
), //where // $arr = array(30,3,1,5,18);
array( // $arr = array(1,6, 8,4,16);
'ips_personnel' => 'ips_personnel.p_id=ips_education_bg.edu_p_id',
) //table to join // // Coding back-end 02 here!!!!
)->result(); //getdata // $max = max($arr);
// $min = min($arr);
$person_get_previous_work_data = $this->IPS_model->get_join( // $sum_prime_number = 0;
'ips_previous_work', // $temp = 0;
'', //colum in database // echo "List of Numbers => ";
array( // for ($i = 0; $i <= sizeof($arr)-1; $i++) { //1 2 3 4 5 6 7 8 9 10
'pw_p_id' => $_SESSION['data_user_login']->p_id, // if ($i == 0) {
'pw_status' => 1, // echo $arr[$i];
), //where // }else{
array( // echo " , ".$arr[$i];
'ips_personnel' => 'ips_personnel.p_id=ips_previous_work.pw_p_id', // }
) //table to join // }
)->result(); //getdata // echo "<br>";
// echo "Missing Numbers => ";
$person_get_working_experience_data = $this->IPS_model->get_join( // $size_missing = 0;
'ips_working_experience', // for ($i = 1; $i <= $max; $i++) { //1 2 3 4 5 6 7 8 9 10
'', //colum in database // $size_missing++;
array( // for ($j = 0; $j <= count($arr) - 1; $j++) { // 10 ,1 ,6 ,8, 5
'w_p_id' => $_SESSION['data_user_login']->p_id, // if ($arr[$j] == $i) {
'w_status' => 1, // $temp++;
), //where // }
array( // }
'ips_department' => 'ips_department.dpm_id=ips_working_experience.w_dpm_id', // if ($temp != 1) {
) //table to join // if($i == 2){
)->result(); //getjoin // echo $i;
// }else{
$person_get_train_data = $this->IPS_model->get_join( // echo " , ".$i;
'ips_train', // }
'', //colum in database // }
array( // $temp = 0;
't_p_id' => $_SESSION['data_user_login']->p_id, // }
't_status' => 1, // echo "<br>";
), //where // echo "Missing Prime Numbers => ";
array( // for($i=1; $i<=$size_missing;$i++){
'ips_personnel' => 'ips_personnel.p_id=ips_train.t_p_id', // $count=0;
) //table to join // for($j=1;$j<=$i;$j++){
)->result(); //getjoin // if($i%$j==0){
$get_data_person['person'] = $person_get_data[0]; // $count++;
$get_data_person['education'] = $person_get_edu_data; // }
$get_data_person['p_work'] = $person_get_previous_work_data; // }
$get_data_person['work'] = $person_get_working_experience_data; // if($count==2){
$get_data_person['train'] = $person_get_train_data; // if($i == 2){
$data['page_content'] = $this->load->view('Profile/profile', $get_data_person, TRUE); // echo $i;
$data['page_title'] = "ข้อมูลส่วนตัว"; // $sum_prime_number = $sum_prime_number+$i;
// $data['page_content'] = $this->load->view('Demo/v_nontakorn', '', TRUE); // }else{
// $data['page_title'] = "จัดการข้อมูลบุคลากร"; // echo " , ".$i;
$this->load->view('Demo/v_prasobsuk',$data); // $sum_prime_number = $sum_prime_number+$i;
// }
// }
// echo "<br>";
// //$date_list = array('02-03-2023', '01-03-2023', '03-03-2023', '05-03-2023', '04-03-2023');
// $date_list = array('02-03-2022', '01-03-2022', '03-03-2022', '02-09-2021', '02-03-2022');
// // Coding back-end 01 here!!!!
// $max_date = 0;
// $min_date = 0;
// $max_index = 0;
// $min_index = 0;
// for ($i = 0; $i < count($date_list); $i++) {
// if ($i == 0) {
// $max_date = strtotime($date_list[$i]);
// $min_date = strtotime($date_list[$i]);
// $max_index = $i;
// $min_index = $i;
// }
// if ($max_date < strtotime($date_list[$i])) {
// $max_date = strtotime($date_list[$i]);
// $max_index = $i;
// }
// if ($min_date > strtotime($date_list[$i])) {
// $min_date = strtotime($date_list[$i]);
// $min_index = $i;
// }
// }
// $ymd = DateTime::createFromFormat('d-m-Y', $date_list[$max_index])->format('D d F '); //D วันในภาษาอังกฤษ F เดือนภาษาอังกฤษ d วันที่
// echo "Max. date = " . $ymd;
// $ymd = DateTime::createFromFormat('d-m-Y', $date_list[$max_index])->format(' Y') + 543;
// echo $ymd . "<br>";
// $ymd = DateTime::createFromFormat('d-m-Y', $date_list[$min_index])->format('D d F ');
// echo "Min. date = " . $ymd;
// $ymd = DateTime::createFromFormat('d-m-Y', $date_list[$min_index])->format(' Y') + 543;
// echo $ymd . "<br>";
// $date1 = date_create_from_format('d-m-Y', $date_list[$max_index]);
// $date2 = date_create_from_format('d-m-Y', $date_list[$min_index]);
// echo $date1->format("m d h i s ");;
// $diff = date_diff($date1, $date2);
// echo $diff->format("%a days"); //%a จำนวนวัน หรือใช้%Y %m %d
// // Coding back-end 01 here!!!!
// }
// // $boolean = false;
// // for($i=2;$i<=$size_missing;$i++){
// // $boolean = true;
// // for($j=2;$j<$i;$j++){
// // if($i % $j == 0){
// // $boolean = false;
// // break;
// // }
// // }
// // if($boolean == true){
// // if($i == 2){
// // echo $i;
// // }else{
// // echo " , ".$i;
// // $sum_prime_number = $sum_prime_number+$i;
// // }
// // }
// // }
// echo "<br>";
// echo "Sum of Prime Numbers => ".$sum_prime_number;
// // $arr = array(30,3,1,5,18);
// $arr = array(1,6,8,4,16);
// // Coding back-end 02 here!!!!
// $max = max($arr);
// $min = min($arr);
// echo $max;
// $sum_prime_number = 0;
// $temp = 0;
// echo "List of Numbers => ";
// for ($i = 0; $i <= sizeof($arr)-1; $i++) { //1 2 3 4 5 6 7 8 9 10
// if ($i == 0) {
// echo $arr[$i];
// }else{
// echo " , ".$arr[$i];
// }
// }
// echo "<br>";
// echo "Missing Numbers => ";
// $size_missing = 0;
// for ($i = 1; $i <= $max; $i++) { //1 2 3 4 5 6 7 8 9 10
// $size_missing++;
// for ($j = 0; $j <= count($arr) - 1; $j++) { // 10 ,1 ,6 ,8, 5
// if ($arr[$j] == $i) {
// $temp++;
// }
// }
// if ($temp != 1) {
// if($i == 2){
// echo $i;
// }else{
// echo " , ".$i;
// }
// }
// $temp = 0;
// }
// echo "<br>";
// echo "Missing Prime Numbers => ";
// for($i=1; $i<=$size_missing;$i++){
// $count=0;
// for($j=1;$j<=$i;$j++){
// if($i%$j==0){
// $count++;
// }
// }
// if($count==2){
// if($i == 2){
// echo $i;
// $sum_prime_number = $sum_prime_number+$i;
// }else{
// echo " , ".$i;
// $sum_prime_number = $sum_prime_number+$i;
// }
// }
// // echo "<br>";
// }
// echo "<br>";
// echo "Sum of Prime Numbers => ".$sum_prime_number;
// $dob = array('21-03-2019', '31-08-1992', '15-04-1998', '12-02-1994', '23-01-1996');
// // Coding back-end 02 here!!!!
// $max_date = 0;
// $min_date = 0;
// $max_index = 0;
// $min_index = 0;
// $max = max($dob);
// $date = 0;
// echo "List of DOB => ";
// for($i=0; $i < count($dob);$i++){
// if($i==0){
// echo $dob[$i];
// }else{
// echo " , $dob[$i]";
// }
// }
// echo "<br>";
// for ($i = 0; $i < count($dob); $i++) {
// if ($i == 0) {
// $max_date = strtotime($dob[$i]);
// $min_date = strtotime($dob[$i]);
// $max_index = $i;
// $min_index = $i;
// }
// if ($max_date < strtotime($dob[$i])) {
// $max_date = strtotime($dob[$i]);
// $max_index = $i;
// }
// if ($min_date > strtotime($dob[$i])) {
// $min_date = strtotime($dob[$i]);
// $min_index = $i;
// }
// }
// echo "List of Age = ";
// $date = date_create_from_format('d-m-Y', $dob[0]);
// $diff = date_diff($date,date_create('now'));
// echo $diff->format("%y ");
// $date = date_create_from_format('d-m-Y', $dob[1]);
// $diff = date_diff($date,date_create('now'));
// echo $diff->format("%y ");
// $date = date_create_from_format('d-m-Y', $dob[2]);
// $diff = date_diff($date,date_create('now'));
// echo $diff->format("%y ");
// $date = date_create_from_format('d-m-Y', $dob[3]);
// $diff = date_diff($date,date_create('now'));
// echo $diff->format("%y ");
// $date = date_create_from_format('d-m-Y', $dob[4]);
// $diff = date_diff($date,date_create('now'));
// echo $diff->format("%y ");
// echo "<br>";
// $date1 = date_create_from_format('d-m-Y', $dob[$max_index]);
// $date2 = date_create_from_format('d-m-Y', $dob[$min_index]);
// $diffmin = date_diff($date1,date_create('now'));
// $diffmax = date_diff($date2,date_create('now'));
// // echo $diff->format("%y "); //%a จำนวนวัน หรือใช้%Y %m %d
// $ymd = DateTime::createFromFormat('d-m-Y', $dob[$min_index])->format('D d F ');
// echo $diffmax->format("Max Age = %y ( $ymd ");
// $ymd = DateTime::createFromFormat('d-m-Y', $dob[$min_index])->format(' Y') + 543;
// echo "$ymd ) <br>";
// $ymd = DateTime::createFromFormat('d-m-Y', $dob[$max_index])->format('D d F '); //D วันในภาษาอังกฤษ F เดือนภาษาอังกฤษ d วันที่
// echo $diffmin->format("Max Age = %y ( $ymd ");
// $ymd = DateTime::createFromFormat('d-m-Y', $dob[$max_index])->format(' Y') + 543;
// echo "$ymd ) <br>";
// $sum_prime_number = 0;
// for($i=0; $i < 5;$i++){
// $count=0;
// for($j=1;$j<=$i;$j++){
// if($i%$j==0){
// $count++;
// }
// }
// if($count==2){
// if($i == 2){
// echo $i;
// $sum_prime_number = $sum_prime_number+$i;
// }else{
// echo " , ".$i;
// $sum_prime_number = $sum_prime_number+$i;
// }
// }
// // echo "<br>";
// }
// echo "Sum of Prime Numbers in Age List => $sum_prime_number <br>";
// // Coding back-end 02 here!!!!
// for($i=0; $i< count($new_data); $i++){
// // echo "&nbsp $c. $check[$i] = $word1 <br>";
// // $c++;
// }
// for($i=0; $i< count($check); $i++){
// for($j=1; $j< count($check); $j++){
// if(str){
// $new_data[$i] = $check[$i];
// }
// }
// $c++;
// }
// for($i=0; $i< count($new_data); $i++){
// echo $new_data[$i]."<br>";
// }
// $max = max($age);
// $min = min($age);
// $sum_prime_number = 0;
// $mod1 = 0;
// $mod2 = 0;
// for ($i = 0; $i < count($age); $i++) {
// $count=0;
// for($j=1;$j<=$i+1;$j++){
// $mod1 = $age[$i] ;
// // $mod2 = $age[$i] ;
// if($mod1 % $age[$i] == 0){
// $count++;
// }
// // echo $mod1;
// }
// if($count==2){
// if($i == 2){
// echo $age[$i];
// $sum_prime_number = $sum_prime_number+$age[$i];
// }else{
// echo " , ".$age[$i];
// $sum_prime_number = $sum_prime_number+$age[$i];
// }
// }
// }
$arr1 = array("National Top Five Institute in Digital Technology and Smart System driving the EEC and the Eastern Part of Thailand");
$arr2 = array("one of the five faculties in the country dedicated to civilized digital technology and smart systems graduates");
$arr3 = array("TO PROPEL THE EEC AND THE EASTERN REGION");
// Coding back-end 01 here!!!!
$str1 = implode(" ", $arr1);
$str2 = implode(" ", $arr2);
$str3 = implode(" ", $arr3);
$allstr = $str1." ".$str2." ".$str3;
$All = strtoupper($allstr);
$total = str_word_count($str1)+ str_word_count($str2) + str_word_count($str3);
echo "Firt String = $str1 <br>";
echo "Second String = $str2 <br>";
echo "Third String = $str3 <br>";
echo "Total words = $total <br>";
echo "Group by words : <br>";
$check = explode(" ",$All);
$new_data = array_unique($check);
$New = array_count_values($check);
// print_r($New);
$i = 0;
$c=1;
foreach($New as$index=> $value){
echo "&nbsp $c. " .$index." = " .$value. "<br>";
$c++;
}
} }
} }
\ No newline at end of file
<?php <div class="card">
//============================================================+ <div class="card-body">
// File name : example_002.php <h4 class="card-title"> Add Department </h4>
// Begin : 2008-03-04 <!-- sample modal content -->
// Last Update : 2013-05-14 <div class="modal fade" id="modal_dpm" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
// aria-hidden="true">
// Description : Example 002 for TCPDF class <div class="modal-dialog modal-lg">
// Removing Header and Footer <div class="modal-content">
// <form id="form_add_dpm" method="post">
// Author: Nicola Asuni <div class="modal-header">
// <h4 class="modal-title" id="myLargeModalLabel">เพิ่มแผนก</h4>
// (c) Copyright: <button type="button" class="close" data-bs-dismiss="modal" aria-hidden="true">×</button>
// Nicola Asuni </div>
// Tecnick.com LTD <div class="modal-body">
// www.tecnick.com <div class="row form-group">
// info@tecnick.com <div class="col-sm-5">
//============================================================+ <label for="dpm_name" class="form-label">ชื่อแผนก</label><span class="text-danger">
*</span>
/** <input type="text" class="form-control" id="dpm_name" placeholder="ชื่อแผนก"
* Creates an example PDF TEST document using TCPDF name="dpm_name" required>
* @package com.tecnick.tcpdf </div>
* @abstract TCPDF - Example: Removing Header and Footer <div class="col-sm-5">
* @author Nicola Asuni <label for="dpm_name_eng" class="form-label">ชื่อแผนกภาษาอังกฤษ</label><span
* @since 2008-03-04 class="text-danger">
*/ *</span>
// create new PDF document <input type="text" class="form-control" id="dpm_name_eng"
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); placeholder="ชื่อแผนกภาษาอังกฤษ" name="dpm_name_eng" required>
</div>
// set document information </div>
$pdf->SetCreator(PDF_CREATOR); </div>
$pdf->SetAuthor('Nicola Asuni'); <div class="modal-footer">
$pdf->SetTitle('CV Document'); <button onclick="reset_modal()" type="reset" style="background-color:#696969;"
$pdf->SetSubject('TCPDF Tutorial'); class="btn waves-effect waves-light text-white" data-bs-dismiss="modal"
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); data-bs-reset="modal" value="ยกเลิก">ยกเลิก</button>
<button id="submit" class="btn btn-success" type="submit" value="บันทึก"
// remove default header/footer name="upload">บันทึก</button>
$pdf->setPrintHeader(false); </div>
$pdf->setPrintFooter(false); </form>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
// --------------------------------------------------------- </div><!-- /.modal -->
<button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#modal_dpm">Add Department</button>
// set font </div>
$fontname = TCPDF_FONTS::addTTFfont(dirname(__FILE__) . '/../../libraries/fonts/THSarabun Bold.ttf', 'TrueTypeUnicode', '', 96); </div>
// use the font <script>
$pdf->SetFont($fontname, '', 14, '', false); function reset_modal() {
$('#dpm_name').val('');
// add a page $('#dpm_name_eng').val('');
$pdf->AddPage();
//SET BACKGROUND
$pdf->SetFillColor(33, 17, 0, 0);
$pdf->Rect(-140, 0, $pdf->getPageWidth(), $pdf->getPageHeight(), 'F', ""); //DF มีขอบ F แบบไม่มีขอบ
// Image example with resizing
$pdf->Image(dirname(__FILE__) . '/../../../assets/images/profile/' . $person->p_photo_person, 0, 0, 70, 70, 'JPG', '', '', false, 150, '', false, false, 0, false, false, false);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// $img = '<img src=' . dirname(__FILE__) . '/../../assets/images/profile/"class="img-circle" width="100" height="100">';
// $test = '<h1>Welcome to <a href="http://www.tcpdf.org" style="text-decoration:none;background-color:#CC0000;color:black;">&nbsp;<span style="color:black;">TC</span><span style="color:white;">PDF</span>&nbsp;</a>!</h1>';
$left = '<div></div>';
$underline = '<div>_________________________________________________________________</div>';
$name = '<div style="font-size:40">' . $person->p_first_name . '<br>' . $person->p_last_name . '</div>';
// $right1 = '<h1 style="font-size:20">ABOUT ME</h1><br>';
// $right = '<div style="font-size:15">' . $right1 . 'ที่อยู่บ้านเลขที่ 10 ตำบลโคกเพลาะ อำเภอพนัสนิคม จังหวัดชลบุรี</div>
// ______________________________________________________________________________
// <div style="font-size:20">WORK EXPERIENCE
// <div style="font-size:13;">Dev
// <div style="font-size:13;color:gray;">BUU
// <div style="font-size:13">พฤศจิกายน 2562 - ธันวาคม 2566
// <div style="font-size:13;color:black;">Dev
// <div style="font-size:13">BUU
// <div style="font-size:13">พฤศจิกายน 2562 - ธันวาคม 2566
// </div>
// </div>
// </div>
// </div>
// </div>
// </div>
// </div>';
//EDU
$edu_exp = '';
foreach ($education as $key => $value) {
if ($value->edu_priority > 0) {
$edu_exp .= '<div style="font-size:15;color:#0a0543;">' . strval($value->edu_start_year + 543) . ' - ' . strval($value->edu_graduated_year + 543);
$edu_exp .= '<div style="font-size:13;color:#000033;">'. $value->edu_level. ' | ' . $value->edu_certificate ;
$edu_exp .= '<div style="font-size:13;color:#000033;">' . $value->edu_graduated.' | ' . $value->edu_academy;
} }
}
// foreach ($education as $key => $value) {
// $edu_exp .= '</div>';
// }
// $edu_exp='<div style="font-size:20">EDUCATION'.$edu_exp.'</div>';
$edu_exp = '<div style="font-size:20">EDUCATION' . $edu_exp;
///end EDU
$('#form_add_dpm').submit(function(event) {
//จัดข้อมูล Working exp// event.preventDefault();
$work_exp = ''; $.ajax({
foreach ($p_work as $key => $value) { url: 'Prasobsuk_controller/add_dpm',
$work_exp .= '<div style="font-size:15;color:#0a0543;">' . strval($value->pw_join_year + 543) . ' - ' . strval($value->pw_exit_year + 543); method: 'post',
$work_exp .= '<div style="font-size:13;color:#000033;">'. $value->pw_position.' | ' . $value->pw_company; data: {
// $work_exp .= '<div style="font-size:13;color:#5C5B5B;">บริษัท: ' . $value->pw_company; dpm_name: $('#dpm_name').val(),
$work_exp .= '<div style="font-size:11;color:#5C5B5B;">' . $value->pw_job_des; dpm_name_eng: $('#dpm_name_eng').val()
} },
// foreach ($p_work as $key => $value) { success: function(result) {
// $work_exp .= '</div>'; reset_modal();
// } $("#modal_dpm").modal('hide');
// $work_exp='<div style="font-size:20">WORK EXPERIENCE'.$work_exp.'</div>';
$work_exp = '<br>_________________________________________________________________<div style="font-size:20;color:black;">WORK EXPERIENCE' . $work_exp;
$column_right = $edu_exp . $work_exp;
foreach ($p_work as $key => $value) {
$column_right .= '</div>';
} }
foreach ($education as $key => $value) { });
$column_right .= '</div>'; });
} </script>
//////////// Colum Basic /////////////// \ No newline at end of file
//get แกน y
$y = $pdf->getY();
//get write the first column
$pdf->writeHTMLCell(65, '', '', $y, $left, 0, 0, 0, true, '', true);
// write the second column
// $pdf->writeHTMLCell(155, '', 75, 120, $work_exp, 0, 0, 0, true, '', true);
// $pdf->writeHTMLCell(155, '', 75, 70, $underline, 0, 0, 0, true, '', true);
$pdf->writeHTMLCell(65, '', '', $y + 70, $name, 0, 0, 0, true, '', true);
$pdf->writeHTMLCell(180, '', 80, 5, $column_right, 0, 0, 0, true, '', true);
// $pdf->writeHTMLCell(155, '', 75, 70, $underline, 0, 0, 0, true, '', true);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('CV.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment