本文整理汇总了PHP中Result::updateResult方法的典型用法代码示例。如果您正苦于以下问题:PHP Result::updateResult方法的具体用法?PHP Result::updateResult怎么用?PHP Result::updateResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Result
的用法示例。
在下文中一共展示了Result::updateResult方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Result
function is_valid_casual_leave($emp_id, $leave_start_date, $leave_end_date)
{
$result = new Result();
// check if leave is comming into already taken leaves period
$this->load->model('leave/leave_helper', 'lh');
$clash_verification = $this->lh->verify_leaves_period($emp_id, $leave_start_date, $leave_end_date);
$result->updateResult($clash_verification);
// check if valid balance of casual leaves
$avail_bal = $this->get_casual_leave_balance($emp_id);
$applied_period = strtotime($leave_end_date) - strtotime($leave_start_date);
$applied_period = floor($applied_period / (60 * 60 * 24)) + 1;
if ($avail_bal < $applied_period) {
$result->setResult(FALSE);
$error = "Your leave length is more than available balance. " . "Your available casual leave balance is " . $avail_bal;
$result->addError($error);
}
// check for maximum allowed casual leaves in one stretch
if ($applied_period > 5) {
$result->setResult(FALSE);
$error = "You can take atmost 5 casual leaves in one stretch.";
$result->addError($error);
}
return $result;
}
示例2: Result
function is_valid_restricted_leave($emp_id, $leave_date)
{
$result = new Result();
// modify date to match db date format
$leave_date = date('Y-m-d', strtotime($leave_date));
// check if restricted holiday available
$sql = "SELECT * FROM " . Leave_constants::$TABLE_RESTRICTED_HOLIDAYS . " WHERE holiday_date = '{$leave_date}'";
$query = $this->db->query($sql);
if ($query->num_rows() == 0) {
$result->setResult(FALSE);
$result->addError("No restricted holiday available.");
}
// check if leave is comming into already taken leaves period
$this->load->model('leave/leave_helper', 'lh');
$clash_verification = $this->lh->verify_leaves_period($emp_id, $leave_date, $leave_date);
$result->updateResult($clash_verification);
// check if balance for leave available
$balance = $this->get_restricted_leave_balance($emp_id);
if ($balance < 1) {
$result->setResult(FALSE);
$result->addError("Your don't have restricted leaves left.");
}
return $result;
}
示例3: Result
function check_suffix()
{
// result to return
$result = new Result();
$result->updateResult($this->check_suffix_with_casual_leave());
if (!$result->getResult()) {
return $result;
}
$result->updateResult($this->check_suffix_with_restricted_leave());
if (!$result->getResult()) {
return $result;
}
return $result;
}