本文整理汇总了PHP中CommonFunctions::generateGUID方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonFunctions::generateGUID方法的具体用法?PHP CommonFunctions::generateGUID怎么用?PHP CommonFunctions::generateGUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonFunctions
的用法示例。
在下文中一共展示了CommonFunctions::generateGUID方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addAction
public function addAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$this->_helper->layout->disableLayout();
$formData = array();
$formErrors = array();
$formData = $this->getRequest()->getPost();
if ($this->getRequest()->isPost() && isset($formData['add_author']) && $formData['add_author'] == 'Add Author') {
$formData = $this->getRequest()->getPost();
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter last name";
}
if (isset($formData['emailid']) && trim($formData['emailid']) != "") {
if (!CommonFunctions::isValidEmail($formData['emailid'])) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Please enter valid email";
}
}
}
if ($formData['emailid'] != '') {
if ($this->modelAuthor->isExist('emailid="' . $formData['emailid'] . '" and parent_id!="0"')) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Email already exist";
}
}
}
if (count($formErrors) == 0) {
if ($this->getRequest()->isPost()) {
$activationCode = CommonFunctions::generateGUID();
$add_time = date('Y-m-d H:i:s');
//$formData['password']=CommonFunctions::getRandomNumberPassword(8);
$enc_password = md5($formData['password']);
$formData['parent_publisher_id'] = !empty($this->sessPublisherInfo->id) ? $this->sessPublisherInfo->id : 0;
$username_array = explode("@", $formData['emailid']);
$formData['username'] = $username_array[0];
$authorData = array('user_type' => 'author', 'parent_id' => $formData['parent_publisher_id'], 'username' => $formData['username'], 'emailid' => $formData['emailid'], 'password' => $enc_password, 'first_name' => $formData['first_name'], 'last_name' => $formData['last_name'], 'phone' => $formData['phone'], 'profile_status' => '1', 'updated_date' => date("Y-m-d H:i:s"), 'add_time' => $add_time);
$lastId = $this->modelAuthor->insert($authorData);
if ($lastId > 0) {
$this->_flashMessenger->addMessage('<div class="div-success">Author Added successfully</div>');
$this->_redirect('publisher/author/index/tab_ajax/author/');
}
}
} else {
$this->view->errorMessage = '<div class="div-error">Please enter required fields to register.</div>';
}
} else {
$formData['user_type'] = "";
$formData['first_name'] = "";
$formData['last_name'] = "";
$formData['emailid'] = "";
$formData['password'] = "";
}
$this->view->formData = $formData;
$this->view->formErrors = $formErrors;
}
示例2: createAction
public function createAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$this->_helper->layout->disableLayout();
$formData = array();
$formErrors = array();
$formData = $this->getRequest()->getPost();
//print_r($formData);exit;
if ($this->getRequest()->isPost() && isset($formData['create_group']) && $formData['create_group'] == 'Create') {
if (!isset($formData['user_type']) || trim($formData['user_type']) == "") {
$formErrors['user_type'] = "Please select user type ";
}
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter last name";
}
if (!isset($formData['emailid']) || trim($formData['emailid']) == "") {
$formErrors['emailid'] = "Please enter email";
}
/*if(!(isset($formData['password'])) || trim($formData['password'])=="")
{
$formErrors['password']="Please enter password";
}
*/
if (!CommonFunctions::isValidEmail($formData['emailid'])) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Please enter valid email";
}
}
/*if($this->modelGroup->isExist('username="'.$formData['username'].'"'))
{
if(!(array_key_exists('username',$formErrors)))
{
$formErrors['username']="Username already exist";
}
}
*/
if ($this->modelPublisher->isExist('emailid="' . $formData['emailid'] . '"') || $this->modelCompany->isExist('user_email="' . $formData['emailid'] . '"')) {
if (!array_key_exists('emailid', $formErrors)) {
$formErrors['emailid'] = "Email already exist";
}
}
if (count($formErrors) == 0) {
if ($this->getRequest()->isPost()) {
$activationCode = CommonFunctions::generateGUID();
$add_time = date('Y-m-d H:i:s');
$formData['password'] = CommonFunctions::getRandomNumberPassword(8);
$formData['publisher_author_id'] = !empty($this->parentPublisherId) ? $this->parentPublisherId : 0;
$username_array = explode("@", $formData['emailid']);
$formData['username'] = $username_array[0];
$groupUserData = array('parent_id' => $formData['publisher_author_id'], 'user_type' => $formData['user_type'], 'username' => $formData['username'], 'emailid' => $formData['emailid'], 'password' => $formData['password'], 'first_name' => $formData['first_name'], 'last_name' => $formData['last_name'], 'phone' => $formData['phone'], 'profile_status' => '1', 'updated_date' => date("Y-m-d H:i:s"), 'add_time' => $add_time);
$lastId = $this->modelPublisher->insert($groupUserData);
//$lastId=$this->modelGroup->insert($groupUserData);
if ($lastId > 0) {
$mailhost = SMTP_SERVER;
$mailconfig = array('ssl' => SMTP_SSL, 'port' => SMTP_PORT, 'auth' => SMTP_AUTH, 'username' => SMTP_USERNAME, 'password' => SMTP_PASSWORD);
$transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig);
Zend_Mail::setDefaultTransport($transport);
$message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Electronic Vendor Ltd</title>
<style type="text/css">
body{
margin:0;
padding:0px;
}
#container{
width:700px;
margin:0 auto;
}
#header{
width:700px;
float:left;
padding:40px 0 10px 0;
font-family:Arial, Helvetica, sans-serif;
color:#3A3B3F;
text-align:center;
font-size:11px;
}
#header a{
color:#3A3B3F;
font-weight:bold;
text-decoration:none;
}
#header a:hover{
color:#40BBE3;
}
#logopart
{
border:0px solid red;
width:698px;
height:140px;
background-color:#1B75BB;
margin-left:0px;
}
//.........这里部分代码省略.........
示例3: indexAction
public function indexAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$formData = array();
$formErrors = array();
if ($this->getRequest()->isPost()) {
$formData = $this->getRequest()->getPost();
//print_r($formData);exit;
//=====================START FORM VALIDATION===================================
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter your first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter your last name";
}
if (!isset($formData['user_email']) || trim($formData['user_email']) == "") {
$formErrors['user_email'] = "Please enter your email";
}
if (!isset($formData['user_password']) || trim($formData['user_password']) == "") {
$formErrors['user_password'] = "Please enter your password";
}
/*if(!(isset($formData['verify_user_password'])) || trim($formData['verify_user_password'])=="")
{
$formErrors['verify_user_password']="Please enter verify password";
}
if($formData['user_password']!=$formData['verify_user_password'])
{
$formErrors['verify_user_password']="Your password does not match";
}
*/
if (!isset($formData['agree']) || trim($formData['agree']) == "") {
$formErrors['agree'] = "Please check agree";
}
if (!CommonFunctions::isValidEmail($formData['user_email'])) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Please enter valid email";
}
}
if ($this->modelCompany->isExist('user_email="' . $formData['user_email'] . '"') || $this->modelPublisher->isExist('emailid="' . $formData['user_email'] . '"') || $this->modelGroup->isExist('emailid="' . $formData['user_email'] . '"') || $this->modelMember->isExist('emailid="' . $formData['user_email'] . '"')) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Email already exist";
}
}
//=====================END FORM VALIDATION===================================
if (count($formErrors) == 0) {
//$sessionPost = new Zend_Session_Namespace('step1Post');
//$sessionPost->formData=$formData;
//$this->_redirect('company/register/step2');
$activationCode = CommonFunctions::generateGUID();
$username_array = explode("@", $formData['user_email']);
$formData['username'] = $username_array[0];
$companyData = array('first_name' => $formData['first_name'], 'last_name' => $formData['last_name'], 'account_type' => 1, 'user_name' => $formData['username'], 'user_email' => $formData['user_email'], 'user_password' => $formData['user_password'], 'country' => $formData['country'], 'added_date' => date("Y-m-d H:i:s"), 'updated_date' => date("Y-m-d H:i:s"), 'activation_code' => $activationCode, 'status' => '0');
$lastId = $this->modelCompany->insert($companyData);
if ($lastId > 0) {
$mailhost = SMTP_SERVER;
$mailconfig = array('ssl' => SMTP_SSL, 'port' => SMTP_PORT, 'auth' => SMTP_AUTH, 'username' => SMTP_USERNAME, 'password' => SMTP_PASSWORD);
$transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig);
Zend_Mail::setDefaultTransport($transport);
$message = '<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Evendor</title>
</head>
<body style="font-family: \'Calibri\', arial;">
<div id="container" style="width:80%; margin:0 auto;">
<header id="heder">
<div style="padding:15px 0px; background:#000000;"><a href="' . $this->view->serverUrl() . $this->view->baseUrl() . '/" target="_blank"><img src="' . $this->view->serverUrl() . $this->view->baseUrl() . '/public/css/default/images/logo.png" style="border:none;" alt="E-Vendor"></a></div>
</header>
<div style="background:#656565; padding:15px; min-height:200px;">
<aside>
<p style="color:#FFBF00; font-weight:bold;">User Registration Email</p>
<p style="color:#ffffff; font-weight:bold;">Your login details given below :</p>
<p style="color:#ffffff;"><label style="color:#FFBF00; font-weight:bold; display:inline-block; width:100px;">Username:</label>' . $formData['user_email'] . '</p>
<p style="color:#ffffff;"><label style="color:#FFBF00; font-weight:bold; display:inline-block; width:100px;">Password:</label>' . $formData['user_password'] . '</p>
<BR />
<p style="color:#ffffff;">Activate your account by using given below link :</p>
<BR />
<p style="color:#ffffff;"><a href="' . $this->view->serverUrl() . $this->view->baseUrl() . '/company/register/verification/' . $activationCode . '">Account Activation Link</a></p>
<br>
<p> </p>
</aside>
</div>
<div style="background:#000000; text-align:center; color:#FFFFFF; font-size:14px; padding:15px;">
<br>
© Copyright ' . date("Y") . ' All Rights Reserved By Electronic Vendor Ltd.
</div>
</div>
</body>
</html>';
$mail = new Zend_Mail();
$mail->addTo($formData['user_email']);
$mail->setSubject("Company Registration Email");
$mail->setBodyHtml($message);
//.........这里部分代码省略.........
示例4: postAction
public function postAction()
{
// Database Object
$db = Zend_Registry::get('db');
$formData = $this->getRequest()->getPost();
//print_r($formData);
//exit;
if (is_array($formData)) {
if (get_magic_quotes_gpc()) {
$json_data = stripslashes($formData['jsondata']);
} else {
$json_data = $formData['jsondata'];
}
/********** Json Object Array ************************/
$jsonObj = json_decode($json_data);
$jsonObj = $jsonObj[0];
/********** Json Object Array ************************/
/********** Json Array ********************/
//$jsonArray = json_decode($json_data,true);
/********** Json Array *******************/
switch ($jsonObj->apicall) {
case "UserRegistration":
$Errorresponse = "";
if (!isset($jsonObj->FirstName) || trim($jsonObj->FirstName) == "" || !isset($jsonObj->LastName) || trim($jsonObj->LastName) == "" || !isset($jsonObj->EmailId) || trim($jsonObj->EmailId) == "" || !isset($jsonObj->Password) || trim($jsonObj->Password) == "") {
$Errorresponse = '[{"ParameterMissing":{';
if (!isset($jsonObj->FirstName) || trim($jsonObj->FirstName) == "") {
$Errorresponse .= '"FirstName":"Please Enter First Name",';
}
if (!isset($jsonObj->LastName) || trim($jsonObj->LastName) == "") {
$Errorresponse .= '"LastName":"Please Enter Last Name",';
}
if (!isset($jsonObj->EmailId) || trim($jsonObj->EmailId) == "") {
$Errorresponse .= '"EmailId":"Please Enter Email Id",';
}
if (!isset($jsonObj->Password) || trim($jsonObj->Password) == "") {
$Errorresponse .= '"Password":"Please Enter Password",';
}
//if(!(isset($jsonObj->Country)) || trim($jsonObj->Country)=="")
//{
//$Errorresponse.='"Country":"Please Select A Country"';
//}
$Errorresponse .= '}}]';
}
if (!empty($Errorresponse)) {
//echo $Errorresponse;
$response = '{
"Message":"All fields are compulsory.",
"error":"true"
}';
echo $response;
} else {
$sql = 'SELECT * FROM pclive_companies where user_email="' . $jsonObj->EmailId . '"';
$result = $db->query($sql);
$record = $result->FetchAll();
$sql1 = 'SELECT * FROM pclive_users where emailid="' . $jsonObj->EmailId . '"';
$result1 = $db->query($sql1);
$record1 = $result1->FetchAll();
if (count($record) > 0 || count($record1) > 0) {
$response = '{
"Message":"Email Id already exists",
"error":"true"
}';
echo $response;
} else {
$user_name = explode("@", $jsonObj->EmailId);
$user_name = $user_name[0];
$activationCode = CommonFunctions::generateGUID();
$sql = "INSERT INTO pclive_companies (parent_id,group_id,first_name,last_name,account_type,user_name,user_email,user_password,country,status,added_date,updated_date,activation_code)VALUES('0','0','" . $jsonObj->FirstName . "','" . $jsonObj->LastName . "','2','{$user_name}','" . $jsonObj->EmailId . "','" . md5($jsonObj->Password) . "','226','0', NOW(),NOW(),'" . $activationCode . "')";
$result = $db->query($sql);
if ($result) {
$apikeysql = 'SELECT * FROM pclive_apikeys ORDER BY RAND() LIMIT 0,1';
$apikeyresult = $db->query($apikeysql);
$apikeyrecord = $apikeyresult->FetchAll();
if (count($apikeyrecord) == 1) {
$response = '{
"Message":"You have registered successfully.\\n Your account activation url is sent to your email.",
"error":"false"
}';
$mailhost = SMTP_SERVER;
$mailconfig = array('ssl' => SMTP_SSL, 'port' => SMTP_PORT, 'auth' => SMTP_AUTH, 'username' => SMTP_USERNAME, 'password' => SMTP_PASSWORD);
$transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig);
Zend_Mail::setDefaultTransport($transport);
$message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Electronic Vendor Ltd</title>
</head>
<body>
<p>Your login details given below :<br></p>
<p>Username: ' . $jsonObj->EmailId . '</p>
<BR />
<p style="color:#ffffff;">Activate your account by using given below link :</p>
<BR />
<p style="color:#ffffff;"><a href="' . $this->view->serverUrl() . $this->view->baseUrl() . '/user/register/verification/' . $activationCode . '">Account Activation Link</a></p>
<br>
<p> </p>
//.........这里部分代码省略.........
示例5: createAction
public function createAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$this->_helper->layout->disableLayout();
$formData = array();
$formErrors = array();
$formData = $this->getRequest()->getPost();
//print_r($formData);exit;
if ($this->getRequest()->isPost() && isset($formData['create_member']) && $formData['create_member'] == 'Create') {
if (!isset($formData['group_id']) || empty($formData['group_id'])) {
$formErrors['group_id'] = "Please select a group";
}
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter last name";
}
if (!isset($formData['user_email']) || trim($formData['user_email']) == "") {
$formErrors['user_email'] = "Please enter email";
}
if (!isset($formData['user_password']) || trim($formData['user_password']) == "") {
$formErrors['user_password'] = "Please enter password";
}
if (!CommonFunctions::isValidEmail($formData['user_email'])) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Please enter valid email";
}
}
/*if($this->modelCompany->isExist('username="'.$formData['username'].'"'))
{
if(!(array_key_exists('username',$formErrors)))
{
$formErrors['username']="Username already exist";
}
}
*/
if ($this->modelCompany->isExistCompany('user_email="' . $formData['user_email'] . '" and (account_type="1" or account_type="3")') || $this->modelPublisher->isExist('emailid="' . $formData['user_email'] . '"')) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Email already exist for company or member of company or publisher";
}
}
if ($this->modelCompany->isExist('user_email="' . $formData['user_email'] . '" and (parent_id!="0" or group_id!="0")')) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Email already member of a group.";
}
}
if (count($formErrors) == 0) {
if ($this->getRequest()->isPost()) {
$groupName = $this->modelGroup->getInfoByGroupId($formData['group_id']);
########################## get user who are not publisher,company and member of other company ######################
$memberData = $this->modelCompany->getNonMemberUser($formData['user_email']);
if (count($memberData) > 0) {
//$groupName = $this->modelGroup->getInfoByGroupId($formData['group_id']);
$activationCode = CommonFunctions::generateGUID();
$add_time = date('Y-m-d H:i:s');
$formData['user_password'] = empty($formData['user_password']) ? CommonFunctions::getRandomNumberPassword(8) : $formData['user_password'];
$formData['company_id'] = !empty($this->sessCompanyInfo->id) ? $this->sessCompanyInfo->id : 0;
$MemberUserData = array('parent_id' => $formData['company_id'], 'group_varify_id' => $formData['group_id'], 'user_email' => $formData['user_email'], 'account_type' => 3, 'status' => '1', 'updated_date' => date("Y-m-d H:i:s"), 'activation_code' => $activationCode, 'added_date' => $add_time);
$group_id = $formData['group_id'];
$lastId = $this->modelCompany->update($MemberUserData, "id='" . $memberData[0]['id'] . "'");
if ($memberData[0]['id'] != '') {
$mailhost = SMTP_SERVER;
$mailconfig = array('ssl' => SMTP_SSL, 'port' => SMTP_PORT, 'auth' => SMTP_AUTH, 'username' => SMTP_USERNAME, 'password' => SMTP_PASSWORD);
$transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig);
Zend_Mail::setDefaultTransport($transport);
$varification_url = $this->view->serverUrl() . $this->view->baseUrl() . '/user/register/groupverification/code/' . $activationCode . '/id/' . $group_id;
$message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Electronic Vendor Ltd</title>
<style type="text/css">
body{
margin:0;
padding:0px;
}
#container{
width:700px;
margin:0 auto;
}
#header{
width:700px;
float:left;
padding:40px 0 10px 0;
font-family:Arial, Helvetica, sans-serif;
color:#3A3B3F;
text-align:center;
font-size:11px;
}
#header a{
color:#3A3B3F;
font-weight:bold;
text-decoration:none;
}
#header a:hover{
color:#40BBE3;
}
#logopart
//.........这里部分代码省略.........
示例6: indexAction
public function indexAction()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$formData = array();
$formErrors = array();
if ($this->getRequest()->isPost()) {
$formData = $this->getRequest()->getPost();
//print_r($formData);exit;
//=====================START FORM VALIDATION===================================
if (!isset($formData['first_name']) || trim($formData['first_name']) == "") {
$formErrors['first_name'] = "Please enter your first name";
}
if (!isset($formData['last_name']) || trim($formData['last_name']) == "") {
$formErrors['last_name'] = "Please enter your last name";
}
if (!isset($formData['user_name']) || trim($formData['user_name']) == "") {
$formErrors['user_name'] = "Please enter user name";
}
if (!isset($formData['user_email']) || trim($formData['user_email']) == "") {
$formErrors['user_email'] = "Please enter your email";
}
if (!isset($formData['user_password']) || trim($formData['user_password']) == "") {
$formErrors['user_password'] = "Please enter your password";
}
if (!isset($formData['user_password']) || trim($formData['user_password']) == "") {
$formErrors['user_password'] = "Please enter your password";
}
if (!isset($formData['verify_user_password']) || trim($formData['verify_user_password']) == "") {
$formErrors['verify_user_password'] = "Please enter verify password";
}
if (!isset($formData['agree']) || trim($formData['agree']) == "") {
$formErrors['agree'] = "Please check agree";
}
if ($formData['user_password'] != $formData['verify_user_password']) {
$formErrors['verify_user_password'] = "Your password does not match";
}
if (!CommonFunctions::isValidEmail($formData['user_email'])) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Please enter valid email";
}
}
if ($this->modelCandidates->isExist('user_name="' . $formData['user_name'] . '"')) {
if (!array_key_exists('user_name', $formErrors)) {
$formErrors['user_name'] = "Username already exist";
}
}
if ($this->modelCandidates->isExist('user_email="' . $formData['user_email'] . '"')) {
if (!array_key_exists('user_email', $formErrors)) {
$formErrors['user_email'] = "Email already exist";
}
}
//=====================END FORM VALIDATION===================================
if (count($formErrors) == 0) {
//======inserting data to the candidate table===============
$activationCode = CommonFunctions::generateGUID();
$activationStartTime = strtotime(date('Y-m-d H:i:s'));
$activationExpireTime = strtotime(date('Y-m-d H:i:s', strtotime("+1 days")));
//echo "TIME::::".$activationStartTime."====TIME 2:::".strtotime(date('Y-m-d H:i:s'))."===EXPIRE TIME:::".$activationExpireTime;exit;
$candidateData = array('user_name' => $formData['user_name'], 'user_email' => $formData['user_email'], 'user_password' => $formData['user_password'], 'added_date' => date("Y-m-d H:i:s"), 'updated_date' => date("Y-m-d H:i:s"), 'status' => 0, 'activation_code' => $activationCode, 'activation_start_time' => $activationStartTime, 'activation_expire_time' => $activationExpireTime);
$lastId = $this->modelCandidates->insert($candidateData);
if ($lastId) {
//======inserting data to the candidate profile table===============
$agree = isset($formData['agree']) && $formData['agree'] != "" ? 1 : 0;
$signup_newsletter = isset($formData['signup_newsletter']) && $formData['signup_newsletter'] != "" ? 1 : 0;
$notify_jobs = isset($formData['notify_jobs']) && $formData['notify_jobs'] != "" ? 1 : 0;
$profileData = array('user_id' => $lastId, 'first_name' => $formData['first_name'], 'last_name' => $formData['last_name'], 'agree' => $agree, 'signup_newsletter' => $signup_newsletter, 'notify_jobs' => $notify_jobs, 'added_date' => date("Y-m-d H:i:s"), 'updated_date' => date("Y-m-d H:i:s"));
$this->modelCandidateProfiles->insert($profileData);
$sessionPost = new Zend_Session_Namespace('step1Post');
$sessionPost->user_id = $lastId;
$this->_redirect('user/register/step2');
} else {
$this->view->errorMessage = '<div class="div-error">Sorry, unable to register, please try later.</div>';
}
} else {
$this->view->errorMessage = '<div class="div-error">Please enter email required field to register.</div>';
}
}
$this->view->formData = $formData;
$this->view->formErrors = $formErrors;
}
示例7: step2Action
public function step2Action()
{
$this->view->messages = $this->_flashMessenger->getMessages();
$sessionPost = new Zend_Session_Namespace('step1Post');
if (isset($sessionPost) && $sessionPost != null && isset($sessionPost->formData) && count($sessionPost->formData) > 0) {
//print_r($sessionPost->formData);
$step1formData = $sessionPost->formData;
$formData = array();
$formErrors = array();
$formData['business_name'] = $step1formData['business_name'];
if ($this->getRequest()->isPost()) {
$formData = $this->getRequest()->getPost();
//print_r($formData);exit;
//=====================START FORM VALIDATION===================================
if (!isset($formData['business_name']) || trim($formData['business_name']) == "") {
$formErrors['business_name'] = "Please enter your business name";
}
//=====================END FORM VALIDATION===================================
if (count($formErrors) == 0) {
//======inserting data to the candidate table===============
$activationCode = CommonFunctions::generateGUID();
$activationStartTime = strtotime(date('Y-m-d H:i:s'));
$activationExpireTime = strtotime(date('Y-m-d H:i:s', strtotime("+1 days")));
//echo "TIME::::".$activationStartTime."====TIME 2:::".strtotime(date('Y-m-d H:i:s'))."===EXPIRE TIME:::".$activationExpireTime;exit;
$compData = array('user_name' => $step1formData['user_name'], 'user_email' => $step1formData['user_email'], 'user_password' => $step1formData['user_password'], 'added_date' => date("Y-m-d H:i:s"), 'updated_date' => date("Y-m-d H:i:s"), 'status' => 1, 'activation_code' => $activationCode, 'activation_start_time' => $activationStartTime, 'activation_expire_time' => $activationExpireTime);
$lastId = $this->modelCompany->insert($compData);
if ($lastId) {
//========unset the session for step1 form data====
Zend_Session::namespaceUnset('step1Post');
//=================================================
//======inserting data to the company profile table===============
$agree = isset($step1formData['agree']) && $step1formData['agree'] != "" ? 1 : 0;
$signup_newsletter = isset($step1formData['signup_newsletter']) && $step1formData['signup_newsletter'] != "" ? 1 : 0;
$notify_jobs = isset($step1formData['notify_jobs']) && $step1formData['notify_jobs'] != "" ? 1 : 0;
$profileData = array('company_id' => $lastId, 'business_name' => $formData['business_name'], 'contact_name' => $step1formData['contact_name'], 'post_code' => $formData['post_code'], 'state' => $formData['state'], 'industry_1' => $formData['industry_1'], 'industry_2' => $formData['industry_2'], 'about_us' => $formData['about_us'], 'opening_hours' => $formData['opening_hours'], 'telephone' => $formData['telephone'], 'website' => $formData['website'], 'abn' => $formData['abn'], 'acn' => $formData['acn'], 'facebook_url' => $formData['facebook_url'], 'twitter_url' => $formData['twitter_url'], 'shifte_url' => $formData['shifte_url'], 'agree' => $agree, 'signup_newsletter' => $signup_newsletter, 'notify_jobs' => $notify_jobs, 'added_date' => date("Y-m-d H:i:s"), 'updated_date' => date("Y-m-d H:i:s"));
$profileId = $this->modelCompanyProfiles->insert($profileData);
if ($profileId > 0) {
/**** Uploading Logo File on Server*****/
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->setDestination(COMPANY_UPLOAD_DIR);
$files = $upload->getFileInfo();
if (isset($files) && count($files) > 0) {
$i = 1;
foreach ($files as $file => $info) {
if ($info['name'] != "") {
if ($upload->isValid($file)) {
try {
// upload received file(s)
$upload->receive($file);
} catch (Zend_File_Transfer_Exception $e) {
//echo $e->getMessage();//exit;
}
// so, Finally lets See the Data that we received on Form Submit
$name = $upload->getFileName($file);
$size = $upload->getFileSize($file);
# Returns the mimetype for the '$file' form element
$mimeType = $upload->getMimeType($file);
$renameFile = time() . $i . '.jpg';
$fullFilePath = COMPANY_UPLOAD_DIR . $renameFile;
//Rename uploaded file using Zend Framework
$filterFileRename = new Zend_Filter_File_Rename(array('target' => $fullFilePath, 'overwrite' => true));
$filterFileRename->filter($name);
$logoData = array('logo' => $renameFile);
$this->modelCompanyProfiles->update($logoData, 'id=' . $profileId);
}
}
$i++;
}
}
/*****End Uploading************/
}
$this->_redirect('company/register/thanks');
} else {
$this->view->errorMessage = '<div class="div-error">Please enter required fieild to register.</div>';
}
} else {
$this->view->errorMessage = '<div class="div-error">Sorry, unable to register, please try later.</div>';
}
}
$this->view->formData = $formData;
$this->view->formErrors = $formErrors;
$this->view->industryList = $this->modelIndustries->fetchAll('status=1');
} else {
$this->_flashMessenger->addMessage('<div class="div-error">Please enter required fieild to register.</div>');
$this->_redirect('company/register/');
}
}