本文整理匯總了PHP中Application_Model_User::getManagerUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application_Model_User::getManagerUser方法的具體用法?PHP Application_Model_User::getManagerUser怎麽用?PHP Application_Model_User::getManagerUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Application_Model_User
的用法示例。
在下文中一共展示了Application_Model_User::getManagerUser方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getmanageruserlistAction
public function getmanageruserlistAction()
{
$data = array();
$user_session = new Zend_Session_Namespace('user');
$user_id = $user_session->user_info['user_id'];
$user = new Application_Model_User();
$manager = $user->getManagerUser($user_id);
foreach ($manager as $m) {
array_push($data, array('id' => $m['id'], 'name' => $m['name']));
}
echo Zend_Json::encode($data);
exit;
}
示例2: overtimeAction
public function overtimeAction()
{
// 返回值數組
$result = array('success' => true, 'info' => '提交成功');
// 請求參數
$request = $this->getRequest()->getParams();
// 操作類型
$operate = array('new' => '新建', 'edit' => '編輯', 'delete' => '刪除');
// 操作類別(新建、更新、刪除)
$operate_type = isset($request['operate']) ? $request['operate'] : '';
$overtime = new Hra_Model_Attendance_Overtime();
if ($operate_type == 'new_hra' || $operate_type == 'new' || $operate_type == 'edit') {
$time_from = str_replace('T', ' ', $request['time_from']);
$time_to = str_replace('T', ' ', $request['time_to']);
if (date('Y-m', strtotime($time_from)) != date('Y-m', strtotime($time_to))) {
$result['success'] = false;
$request['info'] = '不允許跨月申請,請重新填寫時間!';
echo Zend_Json::encode($result);
exit;
}
// 獲取加班人員的用工形式(0:彈性,1:非彈性)
$user = new Application_Model_User();
$userInfo = $user->getEmployeeInfoById($request['apply_user']);
$userType = $userInfo['employment_type'];
$workday = new Hra_Model_Workday();
// 獲取請假區間包含的工作日天數
$overtimeInfo = $workday->getOvertimeQtyByTimeRange($userType, $request['time_from'], $request['time_to']);
$overtimeQty = $overtimeInfo['qty'];
$overtimeQty_hours = $overtimeInfo['qty_hours'];
/* echo $overtimeQty;
exit; */
// 加班類別按起始日期獲取
$overtimeType = $workday->getWorkdayType($userType, date('Y-m-d', strtotime($request['time_from'])));
if ($overtimeType == 0) {
$result['success'] = false;
$request['info'] = '工作日設置錯誤,請檢查工作日設置!';
echo Zend_Json::encode($result);
exit;
}
// 當編輯請假申請時,檢查時間是否重疊需要過濾當前加班申請ID
$filter_id = null;
if ($operate_type == 'edit') {
$filter_id = $request['id'];
}
// 檢查加班時間範圍是否正確
if ($overtimeQty > 0) {
// 檢查加班時間範圍是否跟已有申請(包括已審核和審核中的申請)重疊
if ($overtime->checkTimeOverlap($request['apply_user'], $request['time_from'], $request['time_to'], $filter_id)) {
$result['success'] = false;
$result['info'] = '時間設置錯誤,加班時間重疊,請優先處理未審申請。';
} else {
$now = date('Y-m-d H:i:s');
$user_session = new Zend_Session_Namespace('user');
$user_id = $user_session->user_info['user_id'];
// 當前申請為代申請時,獲取申請人真實部門主管
if ($request['apply_user'] != $user_id) {
// 獲取部門主管
$manager = $user->getManagerUser($request['apply_user']);
$request['review_user_1'] = $manager[0]['id'];
}
if ($request['review_user_1'] >= 0) {
$data = array('type' => $overtimeType, 'apply_user' => $request['apply_user'], 'review_user_1' => $request['review_user_1'], 'time_from' => $request['time_from'], 'time_to' => $request['time_to'], 'qty' => $overtimeQty, 'qty_hours' => $overtimeQty_hours, 'reason' => $request['reason'], 'remark' => $request['remark'], 'update_time' => $now, 'update_user' => $user_id);
/* echo '<pre>';
print_r($data);
exit; */
if ($operate_type == 'new_hra') {
// HRA手動添加
$data['state'] = 3;
$data['create_time'] = $now;
$data['create_user'] = $user_id;
$data['review_info'] = $now . ': ' . $user_session->user_info['user_name'] . ' [手動添加]';
try {
$overtime_id = $overtime->insert($data);
echo Zend_Json::encode($result);
exit;
} catch (Exception $e) {
$result['success'] = false;
$result['info'] = $e->getMessage();
}
} else {
if ($operate_type == 'new') {
$data['create_time'] = $now;
$data['create_user'] = $user_id;
$data['review_info'] = $now . ': ' . $user_session->user_info['user_name'] . ' [新建]';
try {
$overtime_id = $overtime->insert($data);
} catch (Exception $e) {
$result['success'] = false;
$result['info'] = $e->getMessage();
}
} else {
$overtime_id = $request['id'];
$review_info = $now . ': ' . $user_session->user_info['user_name'] . ' [修改]';
$overtimeData = $overtime->getData(null, $overtime_id);
$data['review_info'] = $overtimeData['review_info'] . '<br>' . $review_info;
$data['state'] = 0;
$data['review_time_1'] = null;
//$data['review_time_2'] = null;
$data['release_time'] = null;
try {
//.........這裏部分代碼省略.........