<?php

//$job_id_h = !empty($_GET['job_id']) ? ($_GET['job_id']) : null;
//$bu_org_id_h = !empty($_GET['bu_org_id']) ? ($_GET['bu_org_id']) : null;
//$position_id_h = !empty($_GET['position_id']) ? ($_GET['position_id']) : null;
//$approval_limit_assignment_object = [];
//
//if (!(empty($search_result))) {
// foreach ($search_result as $object) {
//  array_push($approval_limit_assignment_object, $object);
// }
// if (!empty($pagination)) {
//  $pagination->setProperty('_path', 'form');
//  $pagination_statement = $pagination->show_pagination();
// }
//} else if (!(empty($$class))) {
// array_push($approval_limit_assignment_object, $$class);
//} else {
// $approval_limit_assignment = new mdm_approval_limit_assignment;
// array_push($approval_limit_assignment_object, $approval_limit_assignment);
//}
?>

<?php

if (!empty($_GET['option_line_code'])) {
 $option_line_code_h = $_GET['option_line_code'];
 $calendar_object = gl_calendar::find_by_optionLineCode($option_line_code_h);
} else {
 $option_line_code_h = null;
}

$job_id_h = !empty($_GET['job_id']) ? ($_GET['job_id']) : null;
$bu_org_id_h = !empty($_GET['bu_org_id']) ? ($_GET['bu_org_id']) : null;
$position_id_h = !empty($_GET['position_id']) ? ($_GET['position_id']) : null;

$hras = new hr_approval_limit_assignment();
$hras->position_id = $position_id_h;
$hras->job_id = $job_id_h;
$hras->bu_org_id = $bu_org_id_h;

$approval_limit_assignment_object = $hras->findBy_params();

if (empty($approval_limit_assignment_object)) {
 $approval_limit_assignment_object = [new hr_approval_limit_assignment()];
}

$pageno = !empty($_GET['pageno']) ? $_GET['pageno'] : 1;
$per_page = !empty($_GET['per_page']) ? $_GET['per_page'] : 10;
$total_count = count($approval_limit_assignment_object);
$pagination = new pagination($pageno, $per_page, $total_count);
$pagination->setProperty('_path', 'form');
$position = ($pageno - 1) * $per_page;

pa($approval_limit_assignment_object);
?>