本文整理汇总了PHP中Application_Model_User::fetchRow方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_User::fetchRow方法的具体用法?PHP Application_Model_User::fetchRow怎么用?PHP Application_Model_User::fetchRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application_Model_User
的用法示例。
在下文中一共展示了Application_Model_User::fetchRow方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkUserActiveStatus
public function checkUserActiveStatus($options, $identityColumn)
{
$usersNs = new Zend_Session_Namespace("members");
$user = new Application_Model_User();
$RES = $user->fetchRow("{$identityColumn}='{$options['email']}' and status ='active'");
if ($RES != false) {
$usersNs->userObj = serialize($RES);
$usersNs->userId = $RES->getId();
$usersNs->userEmail = $RES->getEmail();
$usersNs->userFullName = $RES->getFirstName() . " " . $RES->getLastName();
$usersNs->userFirstName = $RES->getFirstName();
$usersNs->userUsername = $RES->getUsername();
//$usersNs->setExpirationSeconds(15);
//setcookie("userName", $RES->getUsername(), time()+3600); /* expire in 1 hour */
/*--------- START CHECK USER PERSONAL IMAGE DIRECTORY -----------*/
//$this->createUserDrectory($usersNs->userUsername);
/*--------- END CHECK USER PERSONAL IMAGE DIRECTORY ------------*/
$user_level = new Application_Model_UserLevel();
$user_level_res = $user_level->find($RES->getUserLevelId());
if ($user_level_res->getStatus() != "active") {
Zend_Session::namespaceUnset("members");
$auth = $this->getInstance();
$auth->clearIdentity();
return false;
}
$usersNs->userType = $user_level_res->getIdentifire();
$usersNs->userTypeLabel = $user_level_res->getLabel();
return true;
} else {
$this->doLogout();
return false;
}
}
示例2: registerAction
function registerAction()
{
$user = new Application_Model_User();
$this->view->form = new Application_Form_Register();
if ($this->_request->isPost()) {
Zend_Loader::loadClass('Zend_Filter_StripTags');
$filter = new Zend_Filter_StripTags();
$name = trim($filter->filter($this->_request->getPost('name')));
$pass = trim($filter->filter($this->_request->getPost('pass')));
$email = trim($filter->filter($this->_request->getPost('email')));
$pass = md5($pass);
$userRow = $user->fetchRow($user->select()->where('name = ?', $name));
//$userArray = $userRow->toArray();
if ($userRow != '') {
echo "User name already exist";
} else {
$userRow = $user->fetchRow($user->select()->where('email = ?', $email));
//$userArray = $userRow->toArray();
if ($userRow != '') {
echo "Email already exist";
} else {
if ($this->view->form->isValid($this->getRequest()->getPost())) {
$hash = md5(microtime());
$mail = new Zend_Mail();
$mail->setBodyText('Hello
Your email regisrated on website spitfire.mydev.org.ua
to confirm your account click link bellow
http://spitfire.mydev.org.ua/register/confirmuser/&hash=<');
$mail->setFrom('spitfire.net@gmail.com', 'Some Sender');
$mail->addTo('spitfire.ukr@gmail.com', 'Some Sender');
$mail->setSubject('TestSubject');
$mail->send();
if ($name != '' && $pass != '') {
$data = array('name' => $name, 'email' => $email, 'pass' => $pass);
$user->insert($data);
$this->_redirect('/');
return;
}
} else {
echo "Captcha wrong";
}
}
}
}
}
示例3: errorAction
public function errorAction()
{
//$this->_helper->layout->setLayout('home-layout');
$errors = $this->_getParam('error_handler');
$flag = true;
switch ($errors->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
//var_dump($this->_getParam('controller'));
$userM = new Application_Model_User();
$user = $userM->fetchRow("username='{$this->_getParam('controller')}'");
if ($user !== false) {
$flag = false;
//Forward to the controller
$this->_forward('index', 'profile', 'default', array('id' => $user->getId()));
}
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
$this->getResponse()->setHttpResponseCode(404);
$this->view->message = 'Page not found';
break;
default:
// application error
$this->getResponse()->setHttpResponseCode(500);
$this->view->message = 'Application error';
break;
}
// Log exception, if logger available
if ($log = $this->getLog()) {
$log->crit($this->view->message, $errors->exception);
}
// conditionally display exceptions
//var_dump($this->getInvokeArg('displayExceptions'));
if ($this->getInvokeArg('displayExceptions') == true) {
$this->view->exception = $errors->exception;
}
$this->view->request = $errors->request;
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
$this->view->error_flag = $config->error_flag;
//Mail
$options['message'] = $this->view->message;
if ($this->getInvokeArg('displayExceptions') == true) {
$options['exception'] = $this->view->exception->getMessage();
$options['traceString'] = $this->view->exception->getTraceAsString();
}
$options['params'] = $this->view->request->getParams();
$options['requesturi'] = $this->view->request->getRequestUri();
$options['siteurl'] = Zend_Registry::get('siteurl');
$mail = new Base_Mail();
if ($flag == true) {
$mail->sendErrorMail($options);
}
}
示例4: updateAction
/**
* Método utilizado para editar Users, testando a existência de uma requisão do tipo POST.
* Seus valores são resgatados validados e atualizados no banco de dados.
* @param int $id
* @method updateAction
* @access public
* @return resource
*/
public function updateAction()
{
$form = new Application_Form_User();
$form->setAction('/user/update');
$users = new Application_Model_User();
if ($this->_request->isPost()) {
if ($form->isValid($this->_request->getPost())) {
$values = $form->getValues();
$users->update($values, 'id = ' . $values['id']);
$this->_redirect('/user/retrieve');
}
} else {
$id = $this->_getParam('id');
$user = $users->fetchRow("id ={$id}")->toArray();
$form->populate($user);
}
$this->view->form = $form;
}
示例5: getReviewUserInfo
public function getReviewUserInfo($type, $file_id)
{
$reviewerInfo = array();
$sql = $this->select()->from($this, array('plan_user' => new Zend_Db_Expr("GROUP_CONCAT(plan_user SEPARATOR ',')")))->where("type = '" . $type . "' and file_id = " . $file_id)->group("file_id");
if ($this->fetchAll($sql)->count() > 0) {
$data = $this->fetchRow($sql)->toArray();
$reviewers = array_unique(explode(',', $data['plan_user']));
$user = new Application_Model_User();
foreach ($reviewers as $r) {
$userData = $user->fetchRow("employee_id = " . $r)->toArray();
$user_id = $userData['id'];
$userInfo = $user->getEmployeeInfoById($user_id);
$user_email = $userInfo['email'];
array_push($reviewerInfo, array('user_id' => $user_id, 'email' => $user_email));
}
}
return $reviewerInfo;
}
示例6: changepermissionAction
function changepermissionAction()
{
$this->view->title = "Change user permission";
$user = new Application_Model_User();
$id = (int) $this->_request->getParam('id');
$userRow = $user->fetchRow($user->select()->where('id = ?', $id));
$userArray = $userRow->toArray();
if ($userArray['permission'] == 0) {
$insertValue = "1";
}
if ($userArray['permission'] == 1) {
$insertValue = "0";
}
$data = array('permission' => $insertValue);
$where = 'id = ' . $id;
$user->update($data, $where);
$this->_redirect('/users');
return;
}
示例7: reviewAction
public function reviewAction()
{
// 返回值数组
$result = array('success' => true, 'info' => '审核成功');
$request = $this->getRequest()->getParams();
/* echo '<pre>';
print_r($request);
exit; */
$review_id = isset($request['review_id']) ? $request['review_id'] : null;
$review_operate = isset($request['review_operate']) ? $request['review_operate'] : null;
$review_current_step = isset($request['review_current_step']) ? $request['review_current_step'] : null;
// 当前阶段(review表ID)
$review_last_step = isset($request['review_last_step']) ? $request['review_last_step'] : null;
// 是否当前阶段为最后一阶段
$review_to_finish = isset($request['review_to_finish']) ? $request['review_to_finish'] : null;
// 是否批准后当前阶段结束
$review_next_step = isset($request['review_next_step']) ? $request['review_next_step'] : null;
// 下一阶段(review表ID)
$review_remark = isset($request['review_remark']) ? $request['review_remark'] : null;
if ($review_id && $review_operate) {
$now = date('Y-m-d H:i:s');
$user_session = new Zend_Session_Namespace('user');
$user_id = $user_session->user_info['user_id'];
// 评审意见
$review_info = '意见: ' . $review_remark;
$invoice = new Erp_Model_Purchse_Invoice();
$invoiceItems = new Erp_Model_Purchse_Invoiceitems();
$user = new Application_Model_User();
$review = new Dcc_Model_Review();
$employee = new Hra_Model_Employee();
$invoiceData = $invoice->getData(null, $review_id);
// 更新审核状态及审核意见
if ($review_operate == 'no') {
// 更新采购申请状态
$review_info = $now . ': ' . $user_session->user_info['user_name'] . ' [审核-拒绝] [' . $review_info . ']';
$data = array('state' => 1, 'review_info' => $invoiceData['review_info'] . '<br>' . $review_info);
// 更新订单状态
$invoice->update($data, "id = " . $review_id);
// 删除当前申请的审核配置
$review->delete("type = 'purchse_invoice_add' and file_id = " . $review_id);
// 发送邮件通知申请人
$reviewResult = '<font style="color: #FF0000"><b>拒绝</b></font>';
$mail = new Application_Model_Log_Mail();
$applyEmployeeData = $user->fetchRow("id = " . $invoiceData['create_user'])->toArray();
$applyEmployee = $employee->fetchRow("id = " . $applyEmployeeData['employee_id'])->toArray();
$to = $applyEmployee['email'];
// 获取币种信息
$currency = new Erp_Model_Setting_Currency();
$currencyInfo = $currency->getInfoByCode($invoiceData['currency']);
$total = $invoiceData['total'];
if ($invoiceData['currency'] != 'CNY') {
$total = $invoiceData['forein_total'];
}
$mailContent = '<div>采购发票审核:</div>
<div>
<p><b>审核人:</b>' . $user_session->user_info['user_name'] . '</p>
<p><b>审核结果:</b>' . $reviewResult . '</p>
<p><b>审核意见:</b>' . $review_remark . '</p>
<p><b>发票号:</b>' . $invoiceData['number'] . '</p>
<p><b>申请人:</b>' . $invoiceData['creater'] . '</p>
<p><b>金额:</b><a style="color: #467500;font-weight: bold;">' . $currencyInfo['symbol'] . $total . '</a></p>
<p><b>备注:</b>' . $invoiceData['remark'] . '</p>
<p><b>申请时间:</b>' . $invoiceData['create_time'] . '</p>
<p><b>更新时间:</b>' . $invoiceData['update_time'] . '</p>
<hr>
<p><b>审核日志:</b></p><p>' . $invoiceData['review_info'] . '</p>
</div>';
$mailData = array('type' => '消息', 'subject' => '采购发票-审核', 'to' => $to, 'cc' => $user_session->user_info['user_email'], 'user_id' => $invoiceData['create_user'], 'content' => $mailContent, 'add_date' => $now);
try {
// 记录邮件日志并发送邮件
$mail->send($mail->insert($mailData));
} catch (Exception $e) {
$result['success'] = false;
$result['info'] = $e->getMessage();
}
} else {
$help = new Application_Model_Helpers();
$review_info = $now . ': ' . $user_session->user_info['user_name'] . ' [审核-批准] [' . $review_info . ']';
$invoiceUpdateData = array('review_info' => $invoiceData['review_info'] . '<br>' . $review_info);
$reviewData = $review->fetchRow("id = " . $review_current_step)->toArray();
$actual_user = $reviewData['actual_user'] == '' ? $user_session->user_info['employee_id'] : $reviewData['actual_user'] . ',' . $user_session->user_info['employee_id'];
$data = array('actual_user' => $actual_user, 'finish_time' => $now, 'finish_flg' => 1);
// 当前审核阶段为最后一阶段
if ($review_last_step == 1) {
// 当前阶段已完结
if ($review_to_finish == 1) {
$data = array('actual_user' => $actual_user, 'finish_time' => $now, 'finish_flg' => 1);
$reviewResult = '<font style="color: #006400"><b>发布</b></font>';
// 发布
// 更新申请状态
$invoiceUpdateData['state'] = 2;
$invoiceUpdateData['release_time'] = $now;
// 更新审核记录表
$review->update($data, "id = " . $review_current_step);
$mail = new Application_Model_Log_Mail();
$applyEmployeeData = $user->fetchRow("id = " . $invoiceData['create_user'])->toArray();
$applyEmployee = $employee->fetchRow("id = " . $applyEmployeeData['employee_id'])->toArray();
$to = $applyEmployee['email'];
// 获取币种信息
$currency = new Erp_Model_Setting_Currency();
//.........这里部分代码省略.........
示例8: sendMailToStep
public function sendMailToStep($mailTo, $mailData)
{
$result = array('success' => true, 'info' => '发送成功');
$user = new Application_Model_User();
$employee = new Hra_Model_Employee();
// 检查是否有接收人
if (count($mailTo)) {
$toAddress = array();
$toIds = array();
foreach ($mailTo as $employeeId) {
$em = $employee->getInfoById($employeeId);
array_push($toAddress, $em['email']);
$u = $user->fetchRow("employee_id = " . $employeeId)->toArray();
array_push($toIds, $u['id']);
}
$mail = new Application_Model_Log_Mail();
$mailData['to'] = implode(',', $toAddress);
$mailData['user_id'] = implode(',', $toIds);
try {
// 记录邮件日志并发送邮件
$mail->send($mail->insert($mailData));
} catch (Exception $e) {
$result['success'] = false;
$result['info'] = $e->getMessage();
}
} else {
$result['success'] = false;
$result['info'] = '邮件通知没有接受对象';
}
return $result;
}
示例9: reviewAction
public function reviewAction()
{
// 返回值数组
$result = array('success' => true, 'info' => '审核成功');
$request = $this->getRequest()->getParams();
$review_id = isset($request['review_id']) ? $request['review_id'] : null;
//$review_type_id = isset($request['review_type_id']) ? $request['review_type_id'] : null;
$review_operate = isset($request['review_operate']) ? $request['review_operate'] : null;
$review_current_step = isset($request['review_current_step']) ? $request['review_current_step'] : null;
// 当前阶段(review表ID)
$review_last_step = isset($request['review_last_step']) ? $request['review_last_step'] : null;
// 是否当前阶段为最后一阶段
$review_to_finish = isset($request['review_to_finish']) ? $request['review_to_finish'] : null;
// 是否批准后当前阶段结束
$review_next_step = isset($request['review_next_step']) ? $request['review_next_step'] : null;
// 下一阶段(review表ID)
$review_remark = isset($request['review_remark']) ? $request['review_remark'] : null;
$review_transfer_user = isset($request['review_transfer_user']) ? $request['review_transfer_user'] : null;
//转审人
$review_transfer = $request['review_transfer'] == 1 ? true : false;
if ($review_id && $review_operate) {
$transfer = new Erp_Model_Purchse_Transfer();
$now = date('Y-m-d H:i:s');
$user_session = new Zend_Session_Namespace('user');
$user_id = $user_session->user_info['user_id'];
$employee_id = $user_session->user_info['employee_id'];
// 评审意见
$review_info = '意见: ' . $review_remark;
$req = new Erp_Model_Purchse_Req();
$user = new Application_Model_User();
$review = new Dcc_Model_Review();
$employee = new Hra_Model_Employee();
$reqData = $req->getData(null, $review_id);
// 更新审核状态及审核意见
if ($review_operate == 'transfer') {
// 转审
$review_info = $reqData['review_info'] . '<br>' . $now . ': ' . $user_session->user_info['user_name'] . ' [审核-转审] [' . $review_info . ']';
$req->update(array('review_info' => $review_info), "id = " . $review_id);
$reviewState = $review->fetchRow("type = 'purchse_req_add' and finish_flg = 0 and file_id = " . $review_id, "id")->toArray();
// 转审对象
$transferUserInfo = $user->getEmployeeInfoById($review_transfer_user);
$reviewUsers = $reviewState['plan_user'];
$reviewUserArr = explode(',', $reviewUsers);
$reviewer = array();
if ($reviewState['method'] == 2) {
// 任意: 直接替换审核人为转审对象
foreach ($reviewUserArr as $review_user) {
if ($review_user == $employee_id) {
array_push($reviewer, $transferUserInfo['id']);
}
}
} else {
// 全部: 替换当前审核人为转审对象,其余审核人保留
foreach ($reviewUserArr as $review_user) {
if ($review_user == $employee_id) {
array_push($reviewer, $transferUserInfo['id']);
} else {
if (!in_array($review_user, $reviewer)) {
array_push($reviewer, $review_user);
}
}
}
}
$reviewerstr = implode(',', $reviewer);
$review->update(array('plan_user' => $reviewerstr), "id = " . $reviewState['id']);
// 发送邮件通知制单人
$reviewResult = '<font style="color: #FF0000"><b>转审</b></font>';
$mail = new Application_Model_Log_Mail();
$to = $transferUserInfo['email'];
$mailContent = '<div>采购申请审核:</div>
<div>
<p><b>审核人:</b>' . $user_session->user_info['user_name'] . '</p>
<p><b>审核结果:</b>' . $reviewResult . '</p>
<p><b>审核意见:</b>' . $review_remark . '</p>
<p><b>申请单号:</b>' . $reqData['number'] . '</p>
<p><b>申请部门:</b>' . $reqData['dept'] . '</p>
<p><b>申请人:</b>' . $reqData['apply_user_name'] . '</p>
<p><b>制单人:</b>' . $reqData['creater'] . '</p>
<p><b>类别:</b>' . $reqData['type'] . '</p>
<p><b>事由:</b>' . $reqData['reason'] . '</p>
<p><b>金额:</b><a style="color: #467500;font-weight: bold;">¥' . round($reqData['total'], 2) . '</a></p>
<p><b>备注:</b>' . $reqData['remark'] . '</p>
<p><b>制单时间:</b>' . $reqData['create_time'] . '</p>
<p><b>更新时间:</b>' . $reqData['update_time'] . '</p>
<hr>
<p><b>审核日志:</b></p><p>' . $reqData['review_info'] . '</p>
</div>';
$mailData = array('type' => '消息', 'subject' => '采购申请-转审', 'to' => $to, 'cc' => $user_session->user_info['user_email'], 'user_id' => $user_session->user_info['user_id'], 'content' => $mailContent, 'add_date' => $now);
try {
// 记录邮件日志并发送邮件
$mail->send($mail->insert($mailData));
} catch (Exception $e) {
$result['success'] = false;
$result['info'] = $e->getMessage();
}
} else {
if ($review_operate == 'no') {
// 更新采购申请状态
$review_info = $now . ': ' . $user_session->user_info['user_name'] . ' [审核-拒绝] [' . $review_info . ']';
$data = array('state' => 1, 'transfer_description' => null, 'review_info' => $reqData['review_info'] . '<br>' . $review_info);
//.........这里部分代码省略.........
示例10: reviewAction
public function reviewAction()
{
// 返回值数组
$result = array('success' => true, 'info' => '审核成功');
$request = $this->getRequest()->getParams();
$review_type = isset($request['review_type']) ? $request['review_type'] : null;
$review_step = isset($request['review_step']) ? $request['review_step'] : null;
$review_id = isset($request['review_id']) ? $request['review_id'] : null;
$review_operate = isset($request['review_operate']) ? $request['review_operate'] : null;
$review_remark = isset($request['review_remark']) ? $request['review_remark'] : null;
if ($review_id && $review_type) {
$now = date('Y-m-d H:i:s');
$user_session = new Zend_Session_Namespace('user');
$user_id = $user_session->user_info['user_id'];
// 评审意见
$review_info = '意见: ' . $review_remark;
$user = new Application_Model_User();
$review = new Dcc_Model_Review();
$employee = new Hra_Model_Employee();
if ($review_type == 'vacation') {
$vacation = new Hra_Model_Attendance_Vacation();
$vacationData = $vacation->getData(null, $review_id);
if ($review_operate == 'no') {
// 拒绝
$review_info = $now . ': ' . $user_session->user_info['user_name'] . ' [审核-拒绝] [' . $review_info . ']';
$timeType = 'review_time_1';
if ($vacationData['review_time_1']) {
$timeType = 'review_time_2';
}
$data = array('state' => 1, $timeType => date('Y-m-d H:i:s'), 'review_info' => $vacationData['review_info'] . '<br>' . $review_info);
$vacation->update($data, "id = " . $review_id);
// 删除当前申请的审核配置
$review->delete("type = 'attendance_vacation' and file_id = " . $review_id);
// 调休假申请被拒绝后:还原对调加班时间的调休状态
if ($vacationData['type'] == 8) {
$overtimeIdArr = explode(',', $vacationData['exchange_overtime_ids']);
$overtime = new Hra_Model_Attendance_Overtime();
foreach ($overtimeIdArr as $overtimeId) {
$overtime->update(array('exchange' => 0), "id = " . $overtimeId);
}
}
// 发送邮件通知申请人
$reviewResult = '<font style="color: #FF0000"><b>拒绝</b></font>';
$mail = new Application_Model_Log_Mail();
$applyEmployeeData = $user->fetchRow("id = " . $vacationData['create_user'])->toArray();
$applyEmployee = $employee->fetchRow("id = " . $applyEmployeeData['employee_id'])->toArray();
$to = $applyEmployee['email'];
$mailContent = '<div>请假申请审核:</div>
<div>
<p><b>审核人:</b>' . $user_session->user_info['user_name'] . '</p>
<p><b>审核结果:</b>' . $reviewResult . '</p>
<p><b>审核意见:</b>' . $review_remark . '</p>
<p><b>申请人:</b><a style="color:#008B00;font-weight: bold;">' . $vacationData['apply_user_name'] . '</a></p>
<p><b>请假类别:</b>' . $vacationData['type_name'] . '</p>
<p><b>请假时间:</b><a style="color:#008B00;font-weight: bold;">' . $vacationData['time_from'] . '</a> 至 <a style="color:#008B00;font-weight: bold;">' . $vacationData['time_to'] . '</a></p>
<p><b>代理人:</b>' . $vacationData['agent_name'] . '</p>
<p><b>事由:</b>' . $vacationData['reason'] . '</p>
<p><b>工作交接:</b>' . $vacationData['work'] . '</p>
<p><b>备注:</b>' . $vacationData['remark'] . '</p>
<p><b>创建人:</b>' . $vacationData['creater'] . '</p>
<p><b>申请时间:</b>' . $vacationData['create_time'] . '</p>
<hr>
<p><b>审核日志:</b></p><p>' . $data['review_info'] . '</p>
</div>';
$mailData = array('type' => '消息', 'subject' => '请假申请-审核', 'to' => $to, 'user_id' => $vacationData['create_user'], 'content' => $mailContent, 'add_date' => $now);
try {
// 记录邮件日志并发送邮件
$mail->send($mail->insert($mailData));
} catch (Exception $e) {
$result['success'] = false;
$result['info'] = $e->getMessage();
}
} else {
// 批准
$review_info = $now . ': ' . $user_session->user_info['user_name'] . ' [审核-批准] [' . $review_info . ']';
$reviewResult = '<font style="color: #006400"><b>批准</b></font>';
$updateData = array();
$toArr = array();
$subject = '审核';
$mailCc = null;
if ($review_step == 'review_1') {
$step_name = '审核人1';
if ($vacationData['review_user_2'] > 0 && $vacationData['review_time_1'] == '') {
// 二级审核,当前申请批准后进入第二级审核
array_push($toArr, $vacationData['review_employee_2_id']);
$updateData = array('review_time_1' => $now, 'review_info' => $vacationData['review_info'] . '<br>' . $review_info);
} else {
// 一级审核,当前申请批准后进入HRA审核
$member = new Admin_Model_Member();
$hraAdminUserArr = $member->getMemberWithNoManagerByName('人事主管');
$hraEmployeeIdArr = array();
foreach ($hraAdminUserArr as $hra) {
$hra_info = $user->getEmployeeInfoById($hra['user_id']);
array_push($toArr, $hra_info['id']);
}
if (isset($vacationData['manager_id']) && $vacationData['manager_id'] != '') {
array_push($toArr, $vacationData['manager_id']);
}
$updateData = array('state' => 2, 'review_time_1' => $now, 'review_info' => $vacationData['review_info'] . '<br>' . $review_info);
}
//.........这里部分代码省略.........
示例11: adminLoginAction
function adminLoginAction()
{
$this->view->title = "Login";
$form = new Application_Form_UserLoginForm();
$this->view->form = $form;
// Post and validation section
if (!$this->_request->isPost()) {
return;
}
$formData = $this->_request->getPost();
if (!$form->isValid($formData)) {
return;
}
$email = $formData['email'];
$password = $formData['password'];
//$password = md5($formData['password']);
$this->authAdapter->setTableName('users')->setIdentityColumn('email')->setCredentialColumn('pwd')->setIdentity($email)->setCredential($password);
$auth = Zend_Auth::getInstance();
$result = $this->authAdapter->authenticate();
if ($result->isValid()) {
$data = $this->authAdapter->getResultRowObject(null, 'pwd');
$auth->getStorage()->write($data);
//fetch user info
$user = new Application_Model_User();
$select = $user->select(array('user_id', 'user_name'))->where('email = ?', $email);
$row = $user->fetchRow($select);
$this->user_session = new Zend_Session_Namespace('user_session');
// default namespace
$this->user_session->user_name = $row->user_name;
$this->user_session->user_id = $row->user_id;
$this->_redirect('/admin/index');
} else {
$this->view->msg = "<div class='alert alert-danger'> Invalid User Name or Passowrd </div>";
$this->view->form = $form;
}
}
示例12: reviewAction
public function reviewAction()
{
// 返回值数组
$result = array('success' => true, 'info' => '审核成功');
$request = $this->getRequest()->getParams();
$review_id = isset($request['review_id']) ? $request['review_id'] : null;
$review_operate = isset($request['review_operate']) ? $request['review_operate'] : null;
$review_current_step = isset($request['review_current_step']) ? $request['review_current_step'] : null;
// 当前阶段(review表ID)
$review_last_step = isset($request['review_last_step']) ? $request['review_last_step'] : null;
// 是否当前阶段为最后一阶段
$review_to_finish = isset($request['review_to_finish']) ? $request['review_to_finish'] : null;
// 是否批准后当前阶段结束
$review_next_step = isset($request['review_next_step']) ? $request['review_next_step'] : null;
// 下一阶段(review表ID)
$review_remark = isset($request['review_remark']) ? $request['review_remark'] : null;
$review_transfer_user = isset($request['review_transfer_user']) ? $request['review_transfer_user'] : null;
//转审人
if ($review_id && $review_operate) {
$now = date('Y-m-d H:i:s');
$user_session = new Zend_Session_Namespace('user');
$user_id = $user_session->user_info['user_id'];
$employee_id = $user_session->user_info['employee_id'];
// 评审意见
$review_info = '意见: ' . $review_remark;
$price = new Erp_Model_Sale_Price();
$user = new Application_Model_User();
$review = new Dcc_Model_Review();
$employee = new Hra_Model_Employee();
$priceData = $price->getData(null, $review_id);
// 更新审核状态及审核意见
if ($review_operate == 'transfer') {
// 转审
$tmp = $priceData['review_info'] != '' ? $priceData['review_info'] . '<br>' : '';
$review_info = $tmp . $now . ': ' . $user_session->user_info['user_name'] . ' [审核-转审] [' . $review_info . ']';
$price->update(array('review_info' => $review_info), "id = " . $review_id);
$reviewState = $review->fetchRow("type = 'sale_price_add' and finish_flg = 0 and file_id = " . $review_id, "id")->toArray();
// 转审对象
$transferUserInfo = $user->getEmployeeInfoById($review_transfer_user);
$reviewUsers = $reviewState['plan_user'];
$reviewUserArr = explode(',', $reviewUsers);
$reviewer = array();
if ($reviewState['method'] == 2) {
// 任意: 直接替换审核人为转审对象
foreach ($reviewUserArr as $review_user) {
if ($review_user == $employee_id) {
array_push($reviewer, $transferUserInfo['id']);
}
}
} else {
// 全部: 替换当前审核人为转审对象,其余审核人保留
foreach ($reviewUserArr as $review_user) {
if ($review_user == $employee_id) {
array_push($reviewer, $transferUserInfo['id']);
} else {
if (!in_array($review_user, $reviewer)) {
array_push($reviewer, $review_user);
}
}
}
}
$reviewerstr = implode(',', $reviewer);
$review->update(array('plan_user' => $reviewerstr), "id = " . $reviewState['id']);
// 发送邮件通知制单人
$reviewResult = '<font style="color: #FF0000"><b>转审</b></font>';
$mail = new Application_Model_Log_Mail();
$to = $transferUserInfo['email'];
$mailContent = '<div>销售价格申请审核:</div>
<div>
<p><b>审核人:</b>' . $user_session->user_info['user_name'] . '</p>
<p><b>审核结果:</b>' . $reviewResult . '</p>
<p><b>审核意见:</b>' . $review_remark . '</p>
<p><b>申请单号:</b>' . $priceData['number'] . '</p>
<p><b>申请人:</b>' . $priceData['creater'] . '</p>
<p><b>描述:</b>' . $priceData['description'] . '</p>
<p><b>备注:</b>' . $priceData['remark'] . '</p>
<hr>
<p><b>审核日志:</b></p><p>' . $priceData['review_info'] . '</p>
</div>';
$mailData = array('type' => '消息', 'subject' => '销售价格申请-转审', 'to' => $to, 'cc' => $user_session->user_info['user_email'], 'user_id' => $user_session->user_info['user_id'], 'content' => $mailContent, 'add_date' => $now);
try {
// 记录邮件日志并发送邮件
$mail->send($mail->insert($mailData));
} catch (Exception $e) {
$result['success'] = false;
$result['info'] = $e->getMessage();
}
} else {
if ($review_operate == 'no') {
// 更新申请状态
$review_info = $now . ': ' . $user_session->user_info['user_name'] . ' [审核-拒绝] [' . $review_info . ']';
$tmp = $priceData['review_info'] != '' ? $priceData['review_info'] . '<br>' : '';
$data = array('state' => 1, 'review_info' => $tmp . $review_info);
$price->update($data, "id = " . $review_id);
// 删除当前申请的审核配置
$review->delete("type = 'sale_price_add' and file_id = " . $review_id);
// 发送邮件通知制单人
$reviewResult = '<font style="color: #FF0000"><b>拒绝</b></font>';
$mail = new Application_Model_Log_Mail();
$applyEmployeeData = $user->fetchRow("id = " . $priceData['create_user'])->toArray();
//.........这里部分代码省略.........
示例13: editcatalogAction
public function editcatalogAction()
{
// 返回值数组
$result = array('success' => true, 'info' => '编辑成功');
$now = date('Y-m-d H:i:s');
$user_session = new Zend_Session_Namespace('user');
$user_id = $user_session->user_info['user_id'];
$request = $this->getRequest()->getParams();
$attribute = isset($request['attribute']) ? $request['attribute'] : false;
$catalog = new Product_Model_Catalog();
if ($attribute) {
$catalog_id = isset($request['id']) ? $request['id'] : null;
$code = isset($request['code']) ? $request['code'] : null;
$code_old = isset($request['code_old']) ? $request['code_old'] : null;
$stage_id = isset($request['stage_id']) && $request['stage_id'] != '' ? $request['stage_id'] : null;
$remark = isset($request['remark']) ? $request['remark'] : null;
$date_dvt = isset($request['date_dvt']) && $request['date_dvt'] != '' ? $request['date_dvt'] : null;
$qa1_date = isset($request['qa1_date']) && $request['qa1_date'] != '' ? $request['qa1_date'] : null;
$qa2_date = isset($request['qa2_date']) && $request['qa2_date'] != '' ? $request['qa2_date'] : null;
$evt_date = isset($request['evt_date']) && $request['evt_date'] != '' ? $request['evt_date'] : null;
$mass_production_date = isset($request['mass_production_date']) && $request['mass_production_date'] != '' ? $request['mass_production_date'] : null;
if ($catalog_id && $code) {
if ($catalog->fetchAll("id != " . $catalog_id . " and code = '" . $code . "'")->count() == 0) {
$data = array('code' => $code, 'code_old' => $code_old, 'stage_id' => $stage_id, 'remark' => $remark, 'date_dvt' => $date_dvt, 'qa1_date' => $qa1_date, 'qa2_date' => $qa2_date, 'evt_date' => $evt_date, 'mass_production_date' => $mass_production_date, 'update_time' => $now, 'update_user' => $user_id);
$where = "id = " . $catalog_id;
try {
$catalog->update($data, $where);
} catch (Exception $e) {
$result['success'] = false;
$result['info'] = $e->getMessage();
echo Zend_Json::encode($result);
exit;
}
} else {
$result['success'] = false;
$result['info'] = '代码重复,请重新分配';
echo Zend_Json::encode($result);
exit;
}
} else {
$result['success'] = false;
$result['info'] = '信息不完整,编辑失败!';
}
} else {
$operate = isset($request['operate']) ? $request['operate'] : null;
$review = isset($request['review']) ? $request['review'] : null;
$id = isset($request['id']) ? $request['id'] : null;
$ids = isset($request['ids']) ? $request['ids'] : null;
$active = isset($request['active']) ? $request['active'] : null;
$active = $active == 'on' ? 1 : 0;
$description = isset($request['description']) ? $request['description'] : null;
$remark = isset($request['remark']) ? $request['remark'] : null;
$code_customer = isset($request['code_customer']) ? trim($request['code_customer']) : null;
$model_customer = isset($request['model_customer']) ? trim($request['model_customer']) : null;
$description_customer = isset($request['description_customer']) ? $request['description_customer'] : null;
$type_id = isset($request['type_id']) ? $request['type_id'] : null;
$type_id = isset($request['type_id']) ? $request['type_id'] : null;
$series_id = isset($request['series_id']) ? $request['series_id'] : null;
$series_id = isset($request['series_id']) ? $request['series_id'] : null;
$developmode_id = isset($request['developmode_id']) ? $request['developmode_id'] : null;
$model_standard = isset($request['model_standard']) ? trim($request['model_standard']) : null;
$model_internal = isset($request['model_internal']) ? trim($request['model_internal']) : null;
if ($operate == 'delete' && $id) {
// 删除
try {
if ($catalog->fetchAll("id = " . $id . " and auditor_id is not null")->count() == 1) {
$catalogData = $catalog->fetchRow("id = " . $id)->toArray();
$catalog->update(array('delete' => 1, 'review_info' => $catalogData['review_info'] . '<br>' . $now . ': ' . $user_session->user_info['user_name'] . ' [删除]'), "id = " . $id);
} else {
$catalog->delete("id = " . $id);
$review = new Dcc_Model_Review();
$review->delete("type = 'product_add' and file_id = " . $id);
}
} catch (Exception $e) {
$result['success'] = false;
$result['info'] = $e->getMessage();
echo Zend_Json::encode($result);
exit;
}
} else {
if ($operate == 'disable' && $ids) {
// 作废
$idArr = explode(',', $ids);
foreach ($idArr as $id) {
try {
if ($catalog->fetchAll("id = " . $id . " and active = 1")->count() == 1) {
$catalogData = $catalog->fetchRow("id = " . $id)->toArray();
$catalog->update(array('active' => 0, 'review_info' => $catalogData['review_info'] . '<br>' . $now . ': ' . $user_session->user_info['user_name'] . ' [作废]'), "id = " . $id);
}
} catch (Exception $e) {
$result['success'] = false;
$result['info'] = $e->getMessage();
echo Zend_Json::encode($result);
exit;
}
}
} else {
if ($operate == 'enable' && $ids) {
// 启用
$idArr = explode(',', $ids);
//.........这里部分代码省略.........