Gitlab@Informatics
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IV PERSON SYSTEM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
62160158
IV PERSON SYSTEM
Commits
73d13b8a
Commit
73d13b8a
authored
3 years ago
by
62160112
Browse files
Options
Downloads
Patches
Plain Diff
Update Supavich_controller.php
parent
b02f0a78
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
html/team0/application/controllers/Demo/Supavich_controller.php
+0
-141
0 additions, 141 deletions
...eam0/application/controllers/Demo/Supavich_controller.php
with
0 additions
and
141 deletions
html/team0/application/controllers/Demo/Supavich_controller.php
+
0
−
141
View file @
73d13b8a
...
...
@@ -145,145 +145,4 @@ class Supavich_controller extends CI_Controller {
}
}
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()
// {
// $filename = "default.jpg";
// // Check form submit or not
// if ($this->input->post('upload') != NULL) :
// $data = array();
// if (isset($_FILES['pic']['name'])) :
// // Set preference
// $config['upload_path'] = 'assets/images/profile';
// $config['allowed_types'] = 'jpg|jpeg';
// $config['max_size'] = '2048'; // max_size in kb
// $config['file_name'] = $_FILES['pic']['name'];
// // Load upload library
// $this->load->library('upload', $config);
// // File upload
// if ($this->upload->do_upload('pic')) :
// // Get data about the file
// $uploadData = $this->upload->data();
// $filename = $uploadData['file_name'];
// $data['response'] = 'successfully uploaded ' . $filename;
// else :
// $data['response'] = 'failedsA';
// endif;
// else :
// $data['response'] = 'failedsB';
// endif;
// endif;
// // var_dump($uploadData);
// // var_dump($this->input->post('p_id_photo'));
// $data_photo = array(
// 'p_photo_person' => $this->input->post('p_photo_person')
// );
// $where_photo = array(
// 'p_id' => $this->input->post('p_id_photo')
// );
// $this->IPS_model->update('ips_personnel', $data_photo, $where_photo);
// // unset($_SESSION['p_photo_person']);
// // var_dump($filename);
// // var_dump($data['response']);
// // $_SESSION['p_photo_person'] = $this->input->post('p_photo_person');
// $this->output->set_content_type('appication/json')->set_output(json_encode(['status' => 1, 'msg' => 'บันทึกสำเร็จ']));
// }
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment