Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit b02f0a78 authored by 62160112's avatar 62160112
Browse files

ส่วนลบในการจัดการ department

parent 6db4f56f
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,10 @@ class Supavich_controller extends CI_Controller { ...@@ -15,7 +15,10 @@ class Supavich_controller extends CI_Controller {
'ips_address' => 'ips_address.adr_id=ips_personnel.p_id', 'ips_address' => 'ips_address.adr_id=ips_personnel.p_id',
) //table to join ) //table to join
)->result(); //getjoin )->result(); //getjoin
$dpm = $this->IPS_model->get_join(
'ips_department',
'', //colum in database
)->result();
$person_get_edu_data = $this->IPS_model->get_join( $person_get_edu_data = $this->IPS_model->get_join(
'ips_education_bg', 'ips_education_bg',
'', //colum in database '', //colum in database
...@@ -63,9 +66,9 @@ class Supavich_controller extends CI_Controller { ...@@ -63,9 +66,9 @@ class Supavich_controller extends CI_Controller {
) //table to join ) //table to join
)->result(); //getjoin )->result(); //getjoin
$working_exp_resume = $this->IPS_model->get_working_exp_resume()->result(); // $working_exp_resume = $this->IPS_model->get_working_exp_resume()->result();
$get_data_person['dpm'] = $dpm;
$get_data_person['working_resume'] = $working_exp_resume; // $get_data_person['working_resume'] = $working_exp_resume;
$get_data_person['person'] = $person_get_data[0]; $get_data_person['person'] = $person_get_data[0];
$get_data_person['education'] = $person_get_edu_data; $get_data_person['education'] = $person_get_edu_data;
$get_data_person['p_work'] = $person_get_previous_work_data; $get_data_person['p_work'] = $person_get_previous_work_data;
...@@ -102,6 +105,141 @@ class Supavich_controller extends CI_Controller { ...@@ -102,6 +105,141 @@ class Supavich_controller extends CI_Controller {
$this->output->set_content_type('application/json')->set_output(json_encode($json)); $this->output->set_content_type('application/json')->set_output(json_encode($json));
} }
public function get_dpm()
{
$department = $this->IPS_model->get_join(
'ips_department',
'', //colum in database
)->result();
$data['dpm'] = $department;
$json['html'] = $this->load->view('Demo/v_supavich', $data, TRUE);
$this->output->set_content_type('application/json')->set_output(json_encode($json));
}
public function delete_dpm()
{
$get_working_active = $this->IPS_model->get_data('ips_working_experience', array('w_dpm_id' => $this->input->post('dpm_id'), 'w_status' => 1));
$get_working_deactive = $this->IPS_model->get_data('ips_working_experience', array('w_dpm_id' => $this->input->post('dpm_id'), 'w_status' => 0));
if(sizeof($get_working_deactive) > 0 && sizeof($get_working_active) == 0)
{
$data = array(
'dpm_status' => "0"
);
$where = array(
'dpm_id' => $this->input->post('dpm_id')
);
$this->IPS_model->update('ips_department', $data, $where);
$this->output->set_content_type('appication/json')->set_output(json_encode(['status' => 1, 'msg' => 'บันทึกสำเร็จ']));
}
else if(sizeof($get_working_active) > 0)
{
$this->output->set_content_type('appication/json')->set_output(json_encode(['status' => 2, 'msg' => 'บันทึกไม่สำเร็จ']));
}
else if(sizeof($get_working_active) == 0 && sizeof($get_working_deactive) == 0)
{
$array_where = array(
'dpm_id' => $this->input->post('dpm_id')
);
$this->IPS_model->delete('ips_department', $array_where);
$this->output->set_content_type('appication/json')->set_output(json_encode(['status' => 1, 'msg' => 'บันทึกสำเร็จ']));
}
}
public function ex01()
{
$date_list = array('02-03-2022', '01-03-2022', '03-03-2022', '02-09-2021', '02-03-2022');
usort($date_list, function($a, $b) {
$dateTimestamp1 = strtotime($a);
$dateTimestamp2 = strtotime($b);
return $dateTimestamp1 < $dateTimestamp2 ? -1: 1;
});
$date_min = strval($date_list[0]);
$date_max = strval($date_list[count($date_list) - 1]);
$min_diff = new DateTime($date_min);
$max_diff = new DateTime($date_max);
$get_year_max = $max_diff->format("Y");
$get_year_max = $get_year_max+543;
$get_year_min = $min_diff->format("Y");
$get_year_min = $get_year_min+543;
echo 'Max. date = ' . date_format($max_diff, 'D d F') . " " . $get_year_max;
echo '<br/>';
echo 'Min. date = ' . date_format($min_diff, 'D d F') . " " . $get_year_min;
echo '<br/>';
echo 'Difference Between Max and Min Date = ' . $min_diff->diff($max_diff)->days;
}
public function ex02()
{
//$arr = array(30,3,1,5,18);
$arr = array(1,6,8,4,16);
// Coding back-end 02 here!!!!
$max_arr = max($arr);
$min_arr = min($arr);
$arr_size = sizeof($arr);
$missing = "";
$prime = "";
$sum_prime = 0;
for($i=$min_arr;$i<=$max_arr;$i++)
{
for($j=0;$j<$arr_size;$j++)
{
if($i == $arr[$j])
{
break;
}
else
{
if($j == $arr_size-1)
{
if($i != $arr[$j])
{
$missing .= $i . ",";
}
}
}
}
$check = 0;
if($i !== 1)
{
$check = 1;
for ($k = 2; $k <= $i/$k; $k++)
{
if ($i % $k == 0)
{
$check = 0;
break;
}
}
}
if($check == 1)
{
$prime .= $i . ",";
$sum_prime += $i;
}
}
echo 'List of Numbers => ';
for($k=0;$k<$arr_size;$k++)
{
if($k == 0)
{
echo $arr[$k];
}
else
{
echo ','.$arr[$k];
}
}
$missing = substr_replace($missing ,"", -1);
$prime = substr_replace($prime ,"", -1);
echo '<br>';
echo 'Missing Numbers => ' . $missing;
echo '<br>';
echo 'Missing Prime Numbers => ' . $prime;
echo '<br>';
echo "Sum of Prime Number is => " . $sum_prime;
// Coding back-end 02 here!!!!
}
// public function better_edit() // public function better_edit()
// { // {
// $filename = "default.jpg"; // $filename = "default.jpg";
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment