本文整理匯總了PHP中Default_Model_Usermanagement::activateAllagencydetails方法的典型用法代碼示例。如果您正苦於以下問題:PHP Default_Model_Usermanagement::activateAllagencydetails方法的具體用法?PHP Default_Model_Usermanagement::activateAllagencydetails怎麽用?PHP Default_Model_Usermanagement::activateAllagencydetails使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Default_Model_Usermanagement
的用法示例。
在下文中一共展示了Default_Model_Usermanagement::activateAllagencydetails方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: saveupdateAction
/**
* This function is used to add/update data in database.
* @param $user_form = all form data.
*
* @return JSON success/error messages in json format.
*/
public function saveupdateAction()
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
}
$agencylistmodel = new Default_Model_Agencylist();
$user_form = new Default_Form_Usermanagement();
$user_model = new Default_Model_Usermanagement();
$logmanagermodel = new Default_Model_Logmanager();
$menumodel = new Default_Model_Menu();
$messages = $user_form->getMessages();
$actionflag = '';
$tableid = '';
$agencyuser = 'no';
if ($this->getRequest()->getPost()) {
if ($user_form->isValid($this->_request->getPost())) {
$id = $this->_request->getParam('id');
$employeeId = $this->_request->getParam('employeeId', null);
//$userfullname = $this->_request->getParam('userfullname',null);
$firstname = $this->_request->getParam('firstname', null);
$lastname = $this->_request->getParam('lastname', null);
$userfullname = $firstname . ' ' . $lastname;
$entrycomments = $this->_request->getParam("entrycomments", null);
$emailaddress = $this->_request->getParam("emailaddress", null);
$emprole = $this->_request->getParam("emprole", null);
$emplockeddate = $this->_request->getParam("emplockeddate", null);
$act_inact = $this->_request->getParam("act_inact", null);
$empreasonlocked = $this->_request->getParam("empreasonlocked", null);
$emppassword = sapp_Global::generatePassword();
$data = array('emprole' => $emprole, 'firstname' => $firstname, 'lastname' => $lastname, 'userfullname' => $userfullname, 'emailaddress' => $emailaddress, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'emppassword' => md5($emppassword), 'entrycomments' => $entrycomments, 'userstatus' => 'old');
if ($emplockeddate == '') {
unset($data['emplockeddate']);
}
if ($id != '') {
if ($act_inact != '') {
$data['isactive'] = $act_inact;
$data['emptemplock'] = $act_inact == 0 ? "1" : "0";
$agencyroles = $agencylistmodel->getagencyrole();
$userData = $user_model->getUserDataById($id);
$agencyuser = '';
$user_role = $userData['emprole'];
foreach ($agencyroles as $agrole) {
if ($agrole['id'] == $user_role) {
$agencyuser = 'yes';
}
}
if ($agencyuser == 'yes') {
$agencyData = $user_model->getAgencyData($id);
if ($act_inact == '1') {
$user_model->activateAllagencydetails($agencyData['agencyid'], $loginUserId);
if ($agencyData['isactive'] != $act_inact) {
$this->sendEMails($agencyData, 'activated');
}
} else {
$user_model->deleteAllagencydetails($agencyData['agencyid'], $loginUserId);
if ($agencyData['isactive'] != $act_inact) {
$this->sendEMails($agencyData, 'inactivated');
}
}
}
}
$where = array('id=?' => $id);
unset($data['emppassword']);
$messages['message'] = 'User updated successfully.';
$_SESSION['usermanagement_msg'] = $messages['message'];
$actionflag = 2;
} else {
$data['createdby'] = $loginUserId;
$data['createddate'] = gmdate("Y-m-d H:i:s");
$data['isactive'] = 1;
$where = '';
$messages['message'] = 'User added successfully.';
$_SESSION['usermanagement_msg'] = $messages['message'];
$actionflag = 1;
}
$Id = $user_model->SaveorUpdateUserData($data, $where);
if ($Id == 'update') {
$tableid = $id;
} else {
$employeeId = $employeeId . str_pad($Id, 4, '0', STR_PAD_LEFT);
$user_model->SaveorUpdateUserData(array('employeeId' => $employeeId), "id = " . $Id);
$tableid = $Id;
$base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
$view = $this->getHelper('ViewRenderer')->view;
$this->view->emp_name = $userfullname;
$this->view->password = $emppassword;
$this->view->emp_id = $employeeId;
$this->view->base_url = $base_url;
$text = $view->render('mailtemplates/newpassword.phtml');
$options['subject'] = APPLICATION_NAME . ' login credentials';
$options['header'] = 'Greetings from Sentrifugo';
$options['toEmail'] = $emailaddress;
$options['toName'] = $this->view->emp_name;
//.........這裏部分代碼省略.........