本文整理汇总了PHP中Controller_Base::has_access方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller_Base::has_access方法的具体用法?PHP Controller_Base::has_access怎么用?PHP Controller_Base::has_access使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller_Base
的用法示例。
在下文中一共展示了Controller_Base::has_access方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_edit
public function action_edit($id = null)
{
parent::has_access("create_employee");
is_null($id) and Response::redirect('employees/view' . $id);
if (!($bank = Model_Bank::find('first', array('where' => array('employee_id' => $id))))) {
Session::set_flash('error', 'Could not find user #' . $id);
Response::redirect('employees/view/' . $id);
}
if (Input::method() == 'POST') {
$bank->account_no = Input::post('account_no');
$bank->account_type = Input::post('account_type');
$bank->branch = Input::post('branch');
$bank->city = Input::post('city');
$bank->state = Input::post('state');
$bank->ifsc_code = Input::post('ifsc_code');
$bank->payment_type = Input::post('payment_type');
if ($bank->save()) {
Session::set_flash('success', 'Updated bank details #' . $id);
Response::redirect('employees/view/' . $id);
} else {
Session::set_flash('error', 'Could not update bank #' . $id);
}
}
$this->template->title = "Banks";
$this->template->content = View::forge('banks/edit');
}
示例2: action_process
public function action_process($month = null, $year = null)
{
parent::has_access("add_salary");
(is_null($month) or is_null($year)) and Response::redirect('salaries');
if ($month == 1) {
$m = 12;
$y = $year - 1;
} else {
$m = $month - 1;
$y = $year;
}
$salaries = Model_Salary::find('all', array('where' => array(array('month' => $m), array('year' => $y))));
$data['month'] = $month;
$data['year'] = $year;
foreach ($salaries as $salary) {
$emp = new Model_Salary();
$emp->employee_id = $salary->employee_id;
$emp->month = $month;
$emp->year = $year;
$emp->lock = 'false';
$emp->pf_applicable = $salary->pf_applicable;
$emp->gross = $salary->gross;
$emp->sdxo = $salary->sdxo;
$emp->pf_adjust = $salary->pf_adjust;
$emp->basic = $salary->basic;
$emp->hra = $salary->hra;
$emp->lta = $salary->lta;
$emp->medical = $salary->medical;
$emp->travel = $salary->travel;
$emp->pf_value = $salary->pf_value;
$emp->credit_other = $salary->credit_other;
$emp->bonus1 = $salary->bonus1;
$emp->bonus2 = $salary->bonus2;
$emp->allowance1 = $salary->allowance1;
$emp->leave = $salary->leave;
$emp->allowance2 = $salary->allowance2;
$emp->allowance3 = $salary->allowance3;
$emp->credit_total = $salary->credit_total;
$emp->income_tax = $salary->income_tax;
$emp->professional_tax = $salary->professional_tax;
$emp->deduction1 = $salary->deduction1;
$emp->deduction2 = $salary->deduction2;
$emp->deduction3 = $salary->deduction3;
$emp->total_debit = $salary->total_debit;
$emp->net = $salary->net;
$emp->sick_balance = 0;
$emp->vacation_balance = 0;
$emp->save();
}
Response::redirect('salaries');
}
示例3: action_delete
public function action_delete($id = null)
{
parent::has_access("add_leave");
is_null($id) and Response::redirect('leaves');
if ($leave = Model_Leave::find($id)) {
$leave->delete();
Session::set_flash('success', 'Deleted leave #' . $id);
} else {
Session::set_flash('error', 'Could not delete leave #' . $id);
}
Response::redirect('leaves/view/' . $leave->employee_id);
}
示例4: action_delete
public function action_delete($id = null)
{
parent::has_access("archive_employee");
is_null($id) and Response::redirect('employees');
if ($employee = Model_Employee::find($id)) {
$employee->activity_status = "delete";
if ($employee->save()) {
Session::set_flash('success', 'Deleted employee #' . $id);
} else {
Session::set_flash('error', 'Could not delete employee #' . $id);
}
} else {
Session::set_flash('error', 'Could not find employee #' . $id);
}
if ($salaries = Model_Salary::find('all', array('where' => array('employee_id' => $id)))) {
foreach ($salaries as $salary) {
$salary->lock = "delete";
$salary->save();
}
} else {
// Session::set_flash('error', 'Could not delete employee #' . $id);
}
Response::redirect('employees/viewarchive');
}
示例5: action_delete
public function action_delete($id = null)
{
parent::has_access("add_user");
is_null($id) and Response::redirect('users');
if ($user = Model_User::find($id)) {
$user->delete();
Session::set_flash('success', 'Deleted user #' . $id);
} else {
Session::set_flash('error', 'Could not delete user #' . $id);
}
Response::redirect('users');
}