当前位置: 首页>>代码示例>>PHP>>正文


PHP Employee::select方法代码示例

本文整理汇总了PHP中Employee::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::select方法的具体用法?PHP Employee::select怎么用?PHP Employee::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Employee的用法示例。


在下文中一共展示了Employee::select方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: lastAbsent

 /**
  * Get the last absent days
  * If the user is not absent since joining then.Joining date is last absent date
  */
 public function lastAbsent($employeeID, $type = 'days')
 {
     $absent = Attendance::where('status', '=', 'absent')->where('employeeID', '=', $employeeID)->where(function ($query) {
         $query->where('application_status', '=', 'approved')->orWhere('application_status', '=', null);
     })->orderBy('date', 'desc')->first();
     $joiningDate = Employee::select('joiningDate')->where('employeeID', '=', $employeeID)->first();
     $lastDate = date('Y-m-d');
     $old_date = isset($absent->date) ? $absent->date : $joiningDate->joiningDate;
     $diff = date_diff(date_create($old_date), date_create($lastDate));
     $difference = $diff->format('%R%a') . ' day ago';
     if ($type == 'days') {
         return $difference;
     } elseif ($type == 'date') {
         return date_create($old_date)->format('d-M-Y');
     }
 }
开发者ID:rodrigopbel,项目名称:ong,代码行数:20,代码来源:Employee.php

示例2:

require 'includes/functions.php';
include 'templates/header.php';
include 'templates/navbar.php';
$header = "accounts";
$page = "view";
include 'templates/sidebar.php';
?>
<div class="row" style="margin-right: 0">
	<div class="col-md-6 col-md-offset-3 page-wrapper">
		<h2>My Account Details</h2>
		<hr>
		<?php 
$user = User::select(array('id' => $_SESSION['user_id']));
?>
		<?php 
$emp = Employee::select(array('user_id' => $_SESSION['user_id']));
?>
		<table class="table lead">
			<tr>
				<th>Name:</th>
				<td><?php 
echo $user->full_name();
?>
</td>
			</tr>
			<tr>
				<th>Username:</th>
				<td><?php 
echo $user->username;
?>
</td>
开发者ID:vivek201,项目名称:canteen-mgmt,代码行数:31,代码来源:account.view.php

示例3:

                        // ADD THE COST TO TOTAL COST
                        $total_cost = $value * $menu_item->cost;
                    } else {
                        $alertArray['error'] = 'The items could not be ordered!';
                    }
                } else {
                    //echo "<script>alert('update')</script>";
                    if ($order->insert()) {
                        $alertArray['success'] = 'The items have been added to your orders';
                        $total_cost = $value * $menu_item->cost;
                    } else {
                        $alertArray['error'] = 'The items could not be ordered!';
                    }
                }
                if ($total_cost != 0) {
                    $user = Employee::select(array('user_id' => $session->user_id));
                    $user->balance += $total_cost;
                    $user->update('user_id');
                }
            }
        }
    }
}
include 'templates/navbar.php';
$header = "menu";
include 'templates/sidebar.php';
?>

<div class="row" style="margin-right: 0">
	<div class="col-md-6 col-md-offset-3 page-wrapper">
		
开发者ID:vivek201,项目名称:canteen-mgmt,代码行数:30,代码来源:menu.view.php

示例4: array

require 'templates/sidebar.php';
$alert_array = array();
if (isset($_POST['submit'])) {
    $employee = new Employee();
    $employee->user_id = $_GET['id'];
    $employee->validity = $_POST['validity'];
    if ($employee->update('user_id')) {
        $alert_array['success'] = 'The account was successfully updated!';
    } else {
        $alert_array['error'] = 'The account was not updated!';
    }
}
if (isset($_GET['id']) && is_int(intval($_GET['id']))) {
    $id = intval($_GET['id']);
    $user = User::select(array('id' => $id));
    $employee = Employee::select(array('user_id' => $id));
    if (!$user || !$employee) {
        redirect_to('account.view.php');
    }
    if (isset($_GET['clearBalance']) && $_GET['clearBalance'] == 'Continue') {
        if (isset($_GET['deleteOrders']) && $_GET['deleteOrders'] == 'on') {
            $orders = Order::select(array('user_id' => $user->id));
            if (is_object($orders)) {
                $orders = array($orders);
            }
            if (!$orders) {
                $alert_array['error'] = "The balance is already zero! ";
            } else {
                foreach ($orders as $order) {
                    $order->delete();
                }
开发者ID:vivek201,项目名称:canteen-mgmt,代码行数:31,代码来源:account.edit.php

示例5: redirect_to

    if ($session->permission == 'manager') {
        redirect_to('admin/');
    } elseif ($session->permission == 'staff') {
        redirect_to('staff/');
    } elseif ($session->permission == 'employee') {
        redirect_to('account.view.php');
    }
}
if (isset($_POST['submit'])) {
    $_POST['password'] = md5($_POST['password']);
    // if the username/password combination is in the database
    if ($user = User::select($_POST)) {
        // SET SESSION VARIABLE
        // ====
        if (strtolower($user->permission) == "employee") {
            $emp = Employee::select(array('user_id' => $user->id));
            if ($emp->valid_days() > 0) {
                $session->login($user);
                redirect_to("account.view.php");
            } else {
                $alertArray['error'] = "<b>Sorry!</b> Your account has been expired with a balance of Rs " . $emp->balance;
            }
        } elseif (strtolower($user->permission) == "staff") {
            $session->login($user);
            redirect_to("staff/");
        } elseif (strtolower($user->permission) == "manager") {
            $session->login($user);
            redirect_to("admin/");
        }
    } else {
        $alertArray['error'] = "<b>Sorry!</b> The username/password combination is incorrect.";
开发者ID:vivek201,项目名称:canteen-mgmt,代码行数:31,代码来源:index.php


注:本文中的Employee::select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。