示例#1
0
 public function processAction()
 {
     $uid = $this->_getParam('id') ? $this->_getParam('id') : '';
     $ec = $this->_getParam('ec') ? $this->_getParam('ec') : '';
     $promotionCode = $this->_getParam('promotionCode') ? $this->_getParam('promotionCode') : '';
     $fullName = $this->_getParam('fullName') ? $this->_getParam('fullName') : '';
     $gender = $this->_getParam('chkGender') ? $this->_getParam('chkGender') : '';
     $month = $this->_getParam('month') ? $this->_getParam('month') : '';
     $day = $this->_getParam('day') ? $this->_getParam('day') : '';
     $year = $this->_getParam('year') ? $this->_getParam('year') : '';
     $education = $this->_getParam('education') ? $this->_getParam('education') : '';
     $expense = $this->_getParam('expense') ? $this->_getParam('expense') : '';
     $company = $this->_getParam('company') ? $this->_getParam('company') : '';
     $businessType = $this->_getParam('businessType') ? $this->_getParam('businessType') : '';
     $billing = $this->_getParam('billing') ? $this->_getParam('billing') : '';
     $phone = $this->_getParam('phone') ? $this->_getParam('phone') : '';
     $fax = $this->_getParam('fax') ? $this->_getParam('fax') : '';
     $payment = $this->_getParam('payment') ? $this->_getParam('payment') : '';
     $email = $this->_getParam('email') ? $this->_getParam('email') : '';
     $newArtikel = $this->_getParam('newArtikel') ? $this->_getParam('newArtikel') : '';
     $newRegulation = $this->_getParam('newRegulation') ? $this->_getParam('newRegulation') : '';
     $newWRegulation = $this->_getParam('newWeeklyRegulation') ? $this->_getParam('newWeeklyRegulation') : '';
     $iscontact = $this->_getParam('iscontact') ? $this->_getParam('iscontact') : '';
     $aro_groups = $this->_getParam('aro_groups') ? $this->_getParam('aro_groups') : '';
     $formater = new Pandamp_Core_Hol_User();
     $obj = new Pandamp_Crypt_Password();
     $aclMan = Pandamp_Acl::manager();
     // marketing					// bonus			// corporate		    // complete         // ilb               // ild
     if ($aro_groups == 27 || $aro_groups == 39 || $aro_groups == 37 || $aro_groups == 28 || $aro_groups == 29 || $aro_groups == 30) {
         // untuk member seperti corporate, complete, ilb, dan ild
         // field fullName, birthday, gender, education, expense
         // tidak disimpan
         $id = 1 + ($uid - 1);
         for ($x = 1; $x < $id; $x++) {
             $guid = $this->_getParam('guid' . $x) ? $this->_getParam('guid' . $x) : '';
             $username = $this->_getParam('username' . $x) ? $this->_getParam('username' . $x) : '';
             $password = $this->_getParam('password' . $x) ? $this->_getParam('password' . $x) : '';
             $tblUser = new Pandamp_Modules_Identity_User_Model_User();
             $rowUser = $tblUser->find($guid)->current();
             if (!empty($rowUser)) {
                 // $rowUser->username			= $username;
                 $rowUser->password = $obj->encryptPassword($password);
                 // $rowUser->fullName			= $fullName;
                 // $rowUser->birthday			= $year.'-'.$month.'-'.$day;
                 $rowUser->indexCol = $x;
                 $rowUser->billingAddress = $billing;
                 $rowUser->phone = $phone;
                 $rowUser->fax = $fax;
                 // $rowUser->gender			= ($gender == 1)? 'L' : 'P';
                 $rowUser->email = $email;
                 $rowUser->company = $company;
                 $rowUser->newArticle = $newArtikel == 1 ? 'Y' : 'N';
                 $rowUser->weeklyList = $newWRegulation == "1" ? 'Y' : 'N';
                 $rowUser->monthlyList = $newRegulation == 1 ? 'Y' : 'N';
                 $rowUser->isContact = $iscontact == $x ? 'Y' : 'N';
                 $rowUser->packageId = $aro_groups;
                 $rowUser->promotionId = $promotionCode;
                 // $rowUser->educationId		= $education;
                 // $rowUser->expenseId			= $expense;
                 $rowUser->paymentId = $payment;
                 $rowUser->businessTypeId = $businessType;
             } else {
                 $rowUser = $tblUser->fetchNew();
                 $rowUser->username = $username;
                 $rowUser->password = $obj->encryptPassword($password);
                 // $rowUser->fullName			= $fullName;
                 // $rowUser->birthday			= $year.'-'.$month.'-'.$day;
                 $rowUser->indexCol = $x;
                 $rowUser->billingAddress = $billing;
                 $rowUser->phone = $phone;
                 $rowUser->fax = $fax;
                 // $rowUser->gender			= ($gender == 1)? 'L' : 'P';
                 $rowUser->email = $email;
                 $rowUser->company = $company;
                 $rowUser->newArticle = $newArtikel == 1 ? 'Y' : 'N';
                 $rowUser->weeklyList = $newWRegulation == "1" ? 'Y' : 'N';
                 $rowUser->monthlyList = $newRegulation == 1 ? 'Y' : 'N';
                 $rowUser->isContact = $iscontact == $x ? 'Y' : 'N';
                 $rowUser->packageId = $aro_groups;
                 $rowUser->promotionId = $promotionCode;
                 // $rowUser->educationId		= $education;
                 // $rowUser->expenseId			= $expense;
                 $rowUser->paymentId = $payment;
                 $rowUser->businessTypeId = $businessType;
             }
             $rowUser->save();
         }
         // check!!if u want to send email confirmation?
         if ($ec == 1) {
             // check disc promo
             $disc = $formater->checkPromoValidation('Disc', $aro_groups, $promotionCode, $payment);
             // check total promo
             $total = $formater->checkPromoValidation('Total', $aro_groups, $promotionCode, $payment);
             // get mail content
             $mailcontent = $formater->getMailContent('konfirmasi-email-korporasi');
             // write confirm corporate email
             $formater->_writeConfirmCorporateEmail($mailcontent, $company, $payment, $disc, $total, $this->_getParam('username1'), base64_encode(Pandamp_Lib_Formater::get_user_id($this->_getParam('username1'))), $email);
         } else {
             // activate user account
             $aReturn = $aclMan->getGroupData($aro_groups);
             $aclMan->addUser($this->_getParam('username1'), $aReturn[2]);
         }
     } else {
         $guid = $this->_getParam('guid1') ? $this->_getParam('guid1') : '';
         $username = $this->_getParam('username1') ? $this->_getParam('username1') : '';
         $password = $this->_getParam('password1') ? $this->_getParam('password1') : '';
         $tblUser = new Pandamp_Modules_Identity_User_Model_User();
         $rowUser = $tblUser->find($guid)->current();
         if (!empty($rowUser)) {
             // $rowUser->username			= $username;
             $rowUser->password = $obj->encryptPassword($password);
             $rowUser->fullName = $fullName;
             $rowUser->birthday = $year . '-' . $month . '-' . $day;
             $rowUser->phone = $phone;
             $rowUser->fax = $fax;
             $rowUser->gender = $gender == 1 ? 'L' : 'P';
             $rowUser->email = $email;
             $rowUser->company = $company;
             $rowUser->newArticle = $newArtikel == 1 ? 'Y' : 'N';
             $rowUser->weeklyList = $newWRegulation == "1" ? 'Y' : 'N';
             $rowUser->monthlyList = $newRegulation == 1 ? 'Y' : 'N';
             $rowUser->packageId = $aro_groups;
             $rowUser->promotionId = $promotionCode;
             $rowUser->educationId = $education;
             $rowUser->expenseId = $expense;
             $rowUser->paymentId = $payment;
             $rowUser->businessTypeId = $businessType;
         } else {
             $rowUser = $tblUser->fetchNew();
             $rowUser->username = $username;
             $rowUser->password = $obj->encryptPassword($password);
             $rowUser->fullName = $fullName;
             $rowUser->birthday = $year . '-' . $month . '-' . $day;
             $rowUser->phone = $phone;
             $rowUser->fax = $fax;
             $rowUser->gender = $gender == 1 ? 'L' : 'P';
             $rowUser->email = $email;
             $rowUser->company = $company;
             $rowUser->newArticle = $newArtikel == 1 ? 'Y' : 'N';
             $rowUser->weeklyList = $newWRegulation == "1" ? 'Y' : 'N';
             $rowUser->monthlyList = $newRegulation == 1 ? 'Y' : 'N';
             $rowUser->packageId = $aro_groups;
             $rowUser->promotionId = $promotionCode;
             $rowUser->educationId = $education;
             $rowUser->expenseId = $expense;
             $rowUser->paymentId = $payment;
             $rowUser->businessTypeId = $businessType;
         }
         $guid = $rowUser->save();
         if ($ec == 1) {
             // individual
             if ($aro_groups == 26) {
                 // check disc promo
                 $disc = $formater->checkPromoValidation('Disc', $aro_groups, $promotionCode, $payment);
                 // check total promo
                 $total = $formater->checkPromoValidation('Total', $aro_groups, $promotionCode, $payment);
                 // get mail content
                 $mailcontent = $formater->getMailContent('konfirmasi-email-individual');
                 // write confirm individual email
                 $formater->_writeConfirmIndividualEmail($mailcontent, $fullName, $username, $password, $payment, $disc, $total, base64_encode(Pandamp_Lib_Formater::get_user_id($username)), $email);
             } else {
                 // get mail content
                 $mailcontent = $formater->getMailContent('konfirmasi email gratis');
                 // write confirm free email
                 $aReturn = $aclMan->getGroupData($aro_groups);
                 $formater->_writeConfirmFreeEmail($mailcontent, $fullName, $username, $password, base64_encode(Pandamp_Lib_Formater::get_user_id($username)), $email, $aReturn[2]);
             }
         } else {
             // activate user account
             $aReturn = $aclMan->getGroupData($aro_groups);
             $aclMan->addUser($username, $aReturn[2]);
         }
     }
     $this->view->success = true;
 }
示例#2
0
 function signupAction()
 {
     $this->_helper->layout->setLayout('layout-hukumonlineid-daftar');
     $r = $this->getRequest();
     if ($r->isPost()) {
         $id = $r->getParam('id') ? $r->getParam('id') : '';
         $promotionCode = $r->getParam('promotionCode') ? $r->getParam('promotionCode') : '';
         $package = $r->getParam('paket') ? $r->getParam('paket') : '';
         $fullName = $r->getParam('fullName') ? $r->getParam('fullName') : '';
         $gender = $r->getParam('chkGender') ? $r->getParam('chkGender') : '';
         $month = $r->getParam('month') ? $r->getParam('month') : '';
         $day = $r->getParam('day') ? $r->getParam('day') : '';
         $year = $r->getParam('year') ? $r->getParam('year') : '';
         $education = $r->getParam('education') ? $r->getParam('education') : '';
         $expense = $r->getParam('expense') ? $r->getParam('expense') : '';
         $company = $r->getParam('company') ? $r->getParam('company') : '';
         $businessType = $r->getParam('businessType') ? $r->getParam('businessType') : '';
         $phone = $r->getParam('phone') ? $r->getParam('phone') : '';
         $fax = $r->getParam('fax') ? $r->getParam('fax') : '';
         $payment = $r->getParam('payment') ? $r->getParam('payment') : '';
         $email = $r->getParam('email') ? $r->getParam('email') : '';
         $newArtikel = $r->getParam('newArtikel') ? $r->getParam('newArtikel') : '';
         $newRegulation = $r->getParam('newRegulation') ? $r->getParam('newRegulation') : '';
         $newWRegulation = $r->getParam('newWeeklyRegulation') ? $r->getParam('newWeeklyRegulation') : '';
         $iscontact = $r->getParam('iscontact') ? $r->getParam('iscontact') : '';
         $obj = new Pandamp_Crypt_Password();
         $formater = new Pandamp_Core_Hol_User();
         $aclMan = Pandamp_Acl::manager();
         try {
             for ($x = 1; $x <= $id; $x++) {
                 $username = $r->getParam('username' . $x) ? $r->getParam('username' . $x) : '';
                 $password = $r->getParam('password' . $x) ? $r->getParam('password' . $x) : '';
                 $tblUser = new Pandamp_Modules_Identity_User_Model_User();
                 Zend_Db_Table::getDefaultAdapter()->beginTransaction();
                 $rowUser = $tblUser->fetchNew();
                 $rowUser->username = $username;
                 $rowUser->password = $obj->encryptPassword($password);
                 $rowUser->fullName = $fullName;
                 $rowUser->gender = $gender == 1 ? 'L' : 'P';
                 $rowUser->birthday = $year . '-' . $month . '-' . $day;
                 $rowUser->indexCol = $x;
                 $rowUser->phone = $phone;
                 $rowUser->fax = $fax;
                 $rowUser->email = $email;
                 $rowUser->company = $company;
                 $rowUser->newArticle = $newArtikel == 1 ? 'Y' : 'N';
                 $rowUser->weeklyList = $newWRegulation == "1" ? 'Y' : 'N';
                 $rowUser->monthlyList = $newRegulation == 1 ? 'Y' : 'N';
                 $rowUser->isContact = $iscontact == $x ? 'Y' : 'N';
                 $rowUser->packageId = $package;
                 $rowUser->promotionId = $promotionCode;
                 $rowUser->educationId = $education;
                 $rowUser->expenseId = $expense;
                 $rowUser->paymentId = $payment;
                 $rowUser->businessTypeId = $businessType;
                 $tblNumber = new Pandamp_Modules_Misc_Number_Model_GenerateNumber();
                 $rowset = $tblNumber->fetchRow();
                 $num = $rowset->user;
                 $totdigit = 5;
                 $num = strval($num);
                 $jumdigit = strlen($num);
                 $noinvoice = str_repeat("0", $totdigit - $jumdigit) . $num;
                 $rowset->user = $rowset->user += 1;
                 $tblNumber->update(array('user' => $rowset->user));
                 $rowUser->kopel = $noinvoice;
                 $rowUser->save();
                 Zend_Db_Table::getDefaultAdapter()->commit();
                 $aclMan->addUser($username, 'member_gratis');
             }
             switch ($package) {
                 case 25:
                     $mailcontent = $formater->getMailContent('konfirmasi email gratis');
                     $m = $formater->_writeConfirmFreeEmail($mailcontent, $fullName, $r->getParam('username1'), $r->getParam('password1'), base64_encode(Pandamp_Lib_Formater::get_user_id($r->getParam('username1'))), $email, 'gratis');
                     break;
                 case 26:
                     $disc = $formater->checkPromoValidation('Disc', $aclMan->getGroupIds('member_individual'), $promotionCode, $payment);
                     $total = $formater->checkPromoValidation('Total', $aclMan->getGroupIds('member_individual'), $promotionCode, $payment);
                     $mailcontent = $formater->getMailContent('konfirmasi-email-individual');
                     $m = $formater->_writeConfirmIndividualEmail($mailcontent, $fullName, $r->getParam('username1'), $r->getParam('password1'), $payment, $disc, $total, base64_encode(Pandamp_Lib_Formater::get_user_id($r->getParam('username1'))), $email);
                     break;
                 case 27:
                     $disc = $formater->checkPromoValidation('Disc', $aclMan->getGroupIds('member_corporate'), $promotionCode, $payment);
                     $total = $formater->checkPromoValidation('Total', $aclMan->getGroupIds('member_corporate'), $promotionCode, $payment);
                     $mailcontent = $formater->getMailContent('konfirmasi-email-korporasi');
                     $m = $formater->_writeConfirmCorporateEmail($mailcontent, $fullName, $company, $payment, $disc, $total, $r->getParam('username1'), base64_encode(Pandamp_Lib_Formater::get_user_id($r->getParam('username1'))), $email);
                     break;
             }
             $this->view->message = $m;
         } catch (Zend_Exception $e) {
             Zend_Db_Table::getDefaultAdapter()->rollBack();
             $this->view->message = $e->getMessage();
         }
     }
 }