本文整理汇总了PHP中Employee::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::get方法的具体用法?PHP Employee::get怎么用?PHP Employee::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Employee
的用法示例。
在下文中一共展示了Employee::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_employee
public function action_employee()
{
$statuses = array('0option' => array('@value' => 'active', '$content' => 'Active'), '1option' => array('@value' => 'inactive', '$content' => 'Inactive'));
xml::to_XML($statuses, $this->xml_content->appendChild($this->dom->createElement('statuses')));
if (isset($_GET['id'])) {
$employee = new Employee($_GET['id']);
if (count($_POST)) {
$post = new Validation($_POST);
$post->filter('trim');
$employee->set($post->as_array());
$this->add_message('Employee ' . $_GET['id'] . ' information updated');
}
$this->set_formdata($employee->get());
xml::to_XML(array('statuses' => array('1option' => array('@value' => 'active', 'Active'), '2option' => array('@value' => 'inactive', 'Inactive'))), $this->xml_content);
xml::to_XML($employee->get(), $this->xml_content->appendChild($this->dom->createElement('employee')), NULL, 'id');
} elseif (count($_POST)) {
$post = new Validation($_POST);
$post->filter('trim');
$employee_id = Employee::new_employee($post->as_array());
$this->add_message($post->get('firstname') . ' (ID: ' . $employee_id . ') was added as employee');
} else {
$this->redirect();
}
}
示例2: action_index
public function action_index()
{
// Set the name of the template to use
$this->xslt_stylesheet = 'payslip';
if (!isset($_GET['employee_id']) || !isset($_GET['period']) || !preg_match('/^\\d{4}-\\d{1,2}$/', $_GET['period'])) {
throw new Kohana_exception('Invalid parameters');
}
$employee = new Employee($_GET['employee_id']);
xml::to_XML($employee->get(), $this->xml_content->appendChild($this->dom->createElement('employee')), NULL, 'id');
$where = '
employee_id = ' . intval($_GET['employee_id']) . ' AND
(
description = \'Social fees period ' . $_GET['period'] . '\' OR
description = \'Income taxes period ' . $_GET['period'] . '\' OR
(
description = \'Salary payout\' AND
MONTH(transfer_date) = ' . substr($_GET['period'], 5) . ' AND
YEAR(transfer_date) = ' . substr($_GET['period'], 0, 4) . '
)
)';
xml::to_XML(Transactions::get(NULL, 'accounting_date', $where), $this->xml_content->appendChild($this->dom->createElement('transactions')), 'transaction', 'id');
}
示例3: editEmployee
public function editEmployee()
{
$id = Input::get('editEmpID');
$employee = Employee::find($id);
$emp = Employee::get();
$isAdded = FALSE;
$validInput = TRUE;
$regex = "/^[a-zA-Z\\'\\-\\.]+( [a-zA-Z\\'\\-\\.]+)*\$/";
$regexHouse = "/[0-9a-zA-Z\\-\\s]+\$/";
$regexStreet = "/^[a-zA-Z0-9\\'\\-\\.]+( [a-zA-Z0-9\\'\\-\\.]+)*\$/";
$regexBarangay = "/^[a-zA-Z0-9\\'\\-\\.]+( [a-zA-Z0-9\\'\\-\\.]+)*\$/";
$regexCity = "/^[a-zA-Z\\'\\-]+( [a-zA-Z\\'\\-]+)*\$/";
$regexZip = "/^[0-9]+\$/";
$regexProvince = "/^[a-zA-Z\\'\\-]+( [a-zA-Z\\'\\-]+)*\$/";
if (!trim(Input::get('editFirstName')) == '' && !trim(Input::get('editLastName')) == '' && !trim(Input::get('editEmpHouseNo')) == '' && !trim(Input::get('editEmail')) == '' && !trim(Input::get('editEmpStreet')) == '' && !trim(Input::get('editEmpCity')) == '' && !trim(Input::get('editCellNo')) == '') {
$validInput = TRUE;
if (preg_match($regex, Input::get('editFirstName')) && preg_match($regex, Input::get('editLastName')) && preg_match($regexStreet, Input::get('editEmpStreet')) && !!filter_var(Input::get('editEmail'), FILTER_VALIDATE_EMAIL) && preg_match($regexHouse, Input::get('editEmpHouseNo')) && preg_match($regexCity, Input::get('editEmpCity'))) {
$validInput = TRUE;
if (!trim(Input::get('editEmpZipCode')) == '' || !trim(Input::get('editEmpProvince')) == '' || !trim(Input::get('editEmpBarangay')) == '') {
if (preg_match($regexZip, Input::get('editEmpZipCode')) || preg_match($regexProvince, Input::get('editEmpProvince')) || preg_match($regexBarangay, Input::get('editEmpBarangay'))) {
$validInput = TRUE;
} else {
$validInput = FALSE;
}
}
} else {
$validInput = FALSE;
}
} else {
$validInput = FALSE;
}
$count = 0;
$count2 = 0;
if (!($employee->strEmailAdd == trim(Input::get('editEmail')))) {
$count = DB::table('tblEmployee')->select('tblEmployee.strEmailAdd')->where('tblEmployee.strEmailAdd', '=', trim(Input::get('editEmail')))->count();
}
if (!($employee->strCellNo == trim(Input::get('editCellNo')))) {
$count2 = DB::table('tblEmployee')->select('tblEmployee.strCellNo')->where('tblEmployee.strCellNo', '=', trim(Input::get('editCellNo')))->count();
}
if ($count > 0 || $count2 > 0) {
$isAdded = TRUE;
} else {
foreach ($emp as $emp) {
if (!strcasecmp($emp->strEmployeeID, Input::get('editEmpID')) == 0 && strcasecmp($emp->strEmpFName, trim(Input::get('editFirstName'))) == 0 && strcasecmp($emp->strEmpMName, trim(Input::get('editMiddleName'))) == 0 && strcasecmp($emp->strEmpLName, trim(Input::get('editLastName'))) == 0) {
$isAdded = TRUE;
}
}
}
if ($validInput) {
if (!$isAdded) {
$employee = Employee::find($id);
$employee->strEmpFName = trim(Input::get('editFirstName'));
$employee->strEmpLName = trim(Input::get('editLastName'));
$employee->strEmpMName = trim(Input::get('editMiddleName'));
$employee->dtEmpBday = date("Y-m-d", strtotime(Input::get("editdtEmpBday")));
$employee->strSex = Input::get('editSex');
$employee->strEmpHouseNo = trim(Input::get('editEmpHouseNo'));
$employee->strEmpStreet = trim(Input::get('editEmpStreet'));
$employee->strEmpBarangay = trim(Input::get('editEmpBarangay'));
$employee->strEmpCity = trim(Input::get('editEmpCity'));
$employee->strEmpProvince = trim(Input::get('editEmpProvince'));
$employee->strEmpZipCode = trim(Input::get('editEmpZipCode'));
$employee->strRole = Input::get('editRoles');
$employee->strCellNo = trim(Input::get('editCellNo'));
$employee->strCellNoAlt = trim(Input::get('editCellNoAlt'));
$employee->strPhoneNo = trim(Input::get('editPhoneNo'));
$employee->strEmailAdd = trim(Input::get('editEmail'));
$employee->save();
return Redirect::to('/maintenance/employee?successEdit=true');
} else {
return Redirect::to('/maintenance/employee?success=duplicate');
}
} else {
return Redirect::to('/maintenance/employee?input=invalid');
}
}
示例4: array
echo $sid . " : " . $seed . "<br>";
echo $hash . "<br>";
?>
<p style="font-weight: bold;">Logging in... </p><p><?php
if ($employee->isRegistered($hash)) {
if ($employee->setSessionWith($hash)) {
echo "Success";
}
}
if (!$employee->isLoggedIn($hash)) {
echo "failed";
exit;
}
?>
</p><p style="font-weight: bold;">Update my details... </p><p><?php
$old_data = $employee->get();
echo "Before...<br><br>";
echo "<pre>";
print_r($old_data);
echo "</pre><br><br>";
$data = array();
$data['password'] = md5('new_passwd');
$data['phone_num'] = '+618-8463-2238';
$data['address'] = 'Lala Land';
$data['zip'] = '1100';
$data['state'] = 'Penang';
$new_employee = array();
if ($employee->update($data)) {
$new_employee = $employee->get();
echo "<pre>";
print_r($new_employee);
示例5: header
require_once 'includes/session.php';
require_once 'includes/db.php';
require_once 'includes/Employee.php';
require_once 'includes/Checklist.php';
if ($_SESSION['USER_GRP'] !== 1) {
header('Location: ./');
exit;
}
if (!isset($_GET['_']) || !is_numeric($_GET['_'])) {
header('Location: ./');
exit;
}
$con = connect_db();
$employee = new Employee();
$employee->id = intval($_GET['_']);
$employee->get($con);
if ($employee->un == '') {
header('Location: ./');
exit;
}
$lists = new Checklists();
$lists->get($con);
$con->close();
?>
<!DOCTYPE html>
<html>
<head>
<title>Vehicle Checklist</title>
<meta charset="utf-8" />
示例6: action_index
public function action_index()
{
// Period-stuff (Needs to be before $_POST-handling)
$year = $start_year = $current_year = date('Y', time());
$month = $start_month = $current_month = date('m', time());
foreach (Transactions::get(array('description' => 'Salary payout')) as $transaction) {
$year = $start_year = intval(substr($transaction['accounting_date'], 0, 4));
$month = $start_month = intval(substr($transaction['accounting_date'], 5, 2));
break;
}
$periods = array();
while ($year <= $current_year && $month <= $current_month) {
if ($year > $current_year) {
break;
} elseif ($year == $current_year && $month > $current_month) {
break;
}
$periods[$year . $month . 'option'] = array('@value' => $year . '-' . $month, $year . ' ' . date('F', mktime(0, 0, 0, $month, 1)));
$month++;
if ($month > 12) {
$year++;
$month = 1;
}
}
xml::to_XML($periods, $this->xml_content->appendChild($this->dom->createElement('periods')));
if (!isset($_GET['period']) || !preg_match('/^\\d{4}-\\d{1,2}$/', $_GET['period'])) {
$_GET['period'] = $start_year . '-' . $start_month;
}
$this->set_formdata(array('period' => $_GET['period']));
// End of period-stuff
if (count($_POST)) {
// Data submitted
$post = new Validation($_POST);
$post->filter('trim');
$post_array = $post->as_array();
foreach (array_keys($post_array) as $key) {
if (substr($key, 0, 13) == 'submit_button') {
$employee_id = (int) substr($key, 14);
}
}
$transaction_data = array('accounting_date' => date('Y-m-d', time()), 'transfer_date' => date('Y-m-d', time()), 'description' => 'Social fees period ' . $_GET['period'], 'journal_id' => NULL, 'vat' => 0, 'sum' => -$post_array['social_fee_cost_' . $employee_id], 'employee_id' => $employee_id);
$soc_fee = new Transaction(NULL, $transaction_data);
$transaction_data['description'] = 'Income taxes period ' . $_GET['period'];
$transaction_data['sum'] = -$post_array['income_tax_cost_' . $employee_id];
$inc_tax = new Transaction(NULL, $transaction_data);
$this->redirect();
}
// Employees_totals
$employees = array();
$where = 'description = \'Salary payout\' AND YEAR(accounting_date) = ' . substr($_GET['period'], 0, 4) . ' AND MONTH(accounting_date) = ' . substr($_GET['period'], 5);
$transactions_this_period = Transactions::get(NULL, 'accounting_date', $where);
foreach ($transactions_this_period as $transaction) {
$employee = new Employee($transaction['employee_id']);
if (!isset($employees[$transaction['employee_id']])) {
$employees[$transaction['employee_id']] = array('payout_cost' => 0, 'soc_fee_cost' => 0, 'income_tax_cost' => 0) + $employee->get();
}
$employees[$transaction['employee_id']]['payout_cost'] -= $transaction['sum'];
@(list($accounted_income_tax) = Transactions::get(NULL, 'accounting_date', ' description = \'Income taxes period ' . $_GET['period'] . '\' AND employee_id = ' . $transaction['employee_id']));
@(list($accounted_soc_fee) = Transactions::get(NULL, 'accounting_date', ' description = \'Social fees period ' . $_GET['period'] . '\' AND employee_id = ' . $transaction['employee_id']));
if ($accounted_income_tax && $accounted_soc_fee) {
// First we check the database
$employees[$transaction['employee_id']]['income_tax_cost'] = -$accounted_income_tax['sum'];
$employees[$transaction['employee_id']]['soc_fee_cost'] = -$accounted_soc_fee['sum'];
} else {
// Nothing in database, calculate
$employees[$transaction['employee_id']]['calculated'] = array();
$employees[$transaction['employee_id']]['income_tax_cost'] -= $transaction['sum'] / (100 - $employee->get('tax_level')) * 100 - $transaction['sum'];
$employees[$transaction['employee_id']]['soc_fee_cost'] -= $transaction['sum'] / (100 - $employee->get('tax_level')) * 100 * $employee->get('soc_fee_level') / 100;
}
}
// Round employee totals
foreach ($employees as $nr => $employee) {
$employees[$nr]['income_tax_cost'] = floor($employees[$nr]['income_tax_cost']);
$employees[$nr]['soc_fee_cost'] = floor($employees[$nr]['soc_fee_cost']);
}
xml::to_XML($employees, $this->xml_content->appendChild($this->dom->createElement('employees_totals')), 'employee', 'id');
// End of Employees_totals
}