/** * the getList method is used to * pupolate the listing table */ public function getList($id = "", $pg) { $purl = array(); if (isset($_GET['url'])) { $purl = $_GET['url']; $purl = rtrim($purl); $purl = explode('/', $_GET['url']); } else { $purl = null; } if (!isset($purl['2'])) { $pn = 1; } else { $pn = $purl['2']; } global $database; $resultEmployee = $database->db_query("SELECT * FROM employee"); $pagin = new Pagination(); //create the pagination object; $pagin->nr = $database->dbNumRows($resultEmployee); $pagin->itemsPerPage = 20; $customers = Employee::find_by_sql("SELECT * FROM employee " . $pagin->pgLimit($pn)); $index_array = array("myemployee" => $customers, "mypagin" => $pagin->render($pg)); return $index_array; return $index_array; }
public function getData() { global $database; $depts = Department::find_all(); $role = Roles::find_all(); $country = Country::find_all(); $vendors = Vendor::find_all(); $zone = Zone::find_by_sql("SELECT * FROM zone"); $techEmp = Employee::find_by_sql("SELECT * FROM employee WHERE emp_dept='5'"); $startups = array("departs" => $depts, "country" => $country, "zone" => $zone, "vendors" => $vendors, "role" => $role, "techemp" => $techEmp); return $startups; }
/** * the getList method is used to * pupolate the listing table */ public function getList($id = "", $pg) { $purl = array(); if (isset($_GET['url'])) { $purl = $_GET['url']; $purl = rtrim($purl); $purl = explode('/', $_GET['url']); } else { $purl = null; } if (!isset($purl['2'])) { $pn = 1; } else { $pn = $purl['2']; } $empname = ""; $empdept = ""; $emppost = ""; /** * of all the filter fields if only one field is set */ $filterResult = ""; if (isset($_POST['empname']) && !empty($_POST['empname'])) { $empname .= " AND emp_fname = '" . $_POST['empname'] . "' OR emp_lname = '" . $_POST['empname'] . "' "; } if (isset($_POST['empdept']) && !empty($_POST['empdept'])) { $empdept .= " AND emp_dept='" . $_POST['empdept'] . "' "; } if (isset($_POST['emppost']) && !empty($_POST['emppost'])) { $emppost .= " AND emp_post='" . $_POST['emppost'] . "' "; } $filterResult .= " WHERE id !='' " . $empname . $empdept . $emppost; global $database; $resultEmployee = $database->db_query("SELECT * FROM employee"); $pagin = new Pagination(); //create the pagination object; $pagin->nr = $database->dbNumRows($resultEmployee); $pagin->itemsPerPage = 50; $customers = Employee::find_by_sql("SELECT * FROM employee " . $filterResult . " ORDER BY id DESC "); $index_array = array("myemployee" => $customers, "mypagin" => $pagin->render($pg)); return $index_array; }
/** * load initail data for support ticket form needed during * creating and editing support ticket * data */ public function getData() { global $database; $depts = Department::find_all(); $role = Roles::find_all(); $country = Country::find_all(); $vendors = Vendor::find_all(); $myproducts = Cproduct::find_all(); /** * issues may arise that when database * is cleared emp_dept may not be 5 */ $techEmployee = Employee::find_by_sql("SELECT * FROM employee WHERE emp_dept = 5"); $zone = Zone::find_by_sql("SELECT * FROM zone"); $startups = array("departs" => $depts, "country" => $country, "zone" => $zone, "vendors" => $vendors, "role" => $role, "myproducts" => $myproducts, "techstaff" => $techEmployee); return $startups; }
/** * load initail data for support ticket form needed during * creating and editing support ticket * data */ public function getData() { global $database; $depts = Department::find_all(); $role = Roles::find_all(); $country = Country::find_all(); $vendors = Vendor::find_all(); $myproducts = Cproduct::find_all(); $lastSignoff = array_shift($database->fetch_assoc($database->db_query("SELECT MAX(id) as lastID, prod_id FROM sign_off_form "))); $lastWorkSheet = array_shift($database->fetch_assoc($database->db_query("SELECT MAX(id) as lastID, prod_id FROM work_sheet_form "))); /** * issues may arise that when database * is cleared emp_dept may not be 5 */ $clients = Client::find_all(); // print_r($clients); $techEmployee = Employee::find_by_sql("SELECT * FROM employee WHERE emp_dept = 5"); $zone = Zone::find_by_sql("SELECT * FROM zone"); $startups = array("clients" => $clients, "departs" => $depts, "country" => $country, "zone" => $zone, "vendors" => $vendors, "role" => $role, "myproducts" => $myproducts, "techstaff" => $techEmployee, "lastsf" => $lastSignoff, "lastws" => $lastWorkSheet); return $startups; }
$per_page = JOBS_PER_SEARCH; $total_count = Employee::count_all_deactive(); $smarty->assign('total_count', $total_count); $smarty->assign('page', $page); $pagination = new Pagination($page, $per_page, $total_count); $smarty->assign('previous_page', $pagination->previous_page()); $smarty->assign('has_previous_page', $pagination->has_previous_page()); $smarty->assign('total_pages', $pagination->total_pages()); $smarty->assign('has_next_page', $pagination->has_next_page()); $smarty->assign('next_page', $pagination->next_page()); $offset = $pagination->offset(); $sql = " SELECT * FROM " . TBL_EMPLOYEE; $sql .= " WHERE is_active ='N' "; $sql .= " LIMIT {$per_page} "; $sql .= " OFFSET {$offset} "; $lists = Employee::find_by_sql($sql); $manage_lists = array(); if ($lists && is_array($lists)) { $i = 1; foreach ($lists as $list) { $manage_lists[$i]['id'] = $list->id; $manage_lists[$i]['employee_id'] = $list->id; $manage_lists[$i]['username'] = $list->username; $manage_lists[$i]['email_address'] = $list->email_address; $manage_lists[$i]['date_register'] = strftime(DATE_FORMAT, strtotime($list->date_register)); $manage_lists[$i]['last_login'] = strftime(DATE_FORMAT, strtotime($list->last_login)); $manage_lists[$i]['is_active'] = $list->is_active; $manage_lists[$i]['job_status'] = $list->employee_status; $i++; } $smarty->assign('manage_lists', $manage_lists);