Beispiel #1
0
 /**
  * Save data
  * @param $customerID
  * @return Doctrine_Record
  */
 public static function add_domain($domainame, $tldid, $isavailable, $customerid = null, $authinfo = null)
 {
     $domain = new DomainsBulk();
     $data = DomainsTlds::find($tldid);
     $domain['domain'] = $domainame;
     $domain['startingdate'] = date('Y-m-d H:i:s');
     $domain['tld_id'] = $tldid;
     $domain['sessionid'] = Zend_Session::getId();
     $domain['isavailable'] = $isavailable;
     $domain['customer_id'] = $customerid;
     $domain['authinfo'] = $authinfo;
     $domain['price'] = $isavailable ? $data['registration_price'] : $data['transfer_price'];
     $domain['cost'] = $isavailable ? $data['registration_cost'] : $data['transfer_cost'];
     return $domain->trySave();
 }
Beispiel #2
0
 /**
  *  Check the domain availability
  *  @return template
  */
 public function bulkdomainsAction()
 {
     $request = $this->getRequest();
     $session = new Zend_Session_Namespace('Default');
     $i = 0;
     try {
         $form = new Default_Form_BulkdomainsForm(array('action' => '/common/bulkdomains', 'method' => 'post'));
         if ($request->getPost()) {
             if ($form->isValid($request->getPost())) {
                 $params = $form->getValues();
                 if (!empty($params['domains'])) {
                     $checker = new Shineisp_Commons_DomainChecker();
                     $tlds = $request->getParam('tlds');
                     // Clear the temporary domains of the customer
                     if ($session->customer) {
                         $customerId = $session->customer['customer_id'];
                         DomainsBulk::findbyCustomerID($customerId)->delete();
                     } else {
                         $customerId = null;
                     }
                     $domains = explode("\n", $params['domains']);
                     foreach ($domains as $domain) {
                         foreach ($tlds as $tld) {
                             $tldinfo = DomainsTlds::getAllInfo($tld);
                             $domain = Shineisp_Commons_UrlRewrites::format($domain);
                             $domainame = $domain . "." . $tldinfo['DomainsTldsData'][0]['name'];
                             $isAvailable = $checker->checkDomainAvailability($domainame);
                             DomainsBulk::add_domain($domainame, $tld, $isAvailable, $customerId);
                         }
                     }
                     $this->_helper->redirector('bulkdomainsorder', 'common', 'default');
                 }
             }
         }
     } catch (Exception $e) {
         $this->_helper->redirector('index', 'index', 'default', array('mex' => $e->getMessage(), 'status' => 'danger'));
     }
     $this->view->form = $form;
     $this->getHelper('layout')->setLayout('1column');
 }
 /**
  * Create a new order on the fly
  */
 public function createorderAction()
 {
     $session = new Zend_Session_Namespace('Default');
     if (!empty($session->customer)) {
         $profile = $session->customer;
         // Destroy the redirect option
         unset($session->goto);
         if (empty($session->cart)) {
             $session->cart = new Cart();
         }
         // Get the temporary domains
         $domains = DomainsBulk::findbySession(Zend_Session::getId());
         if (!empty($domains)) {
             // Create the base order document
             // 				$theOrder = Orders::create($profile['customer_id']);
             foreach ($domains as $domain) {
                 $Thedomain = $domain['domain'] . "." . $domain['DomainsTlds']['DomainsTldsData'][0]['name'];
                 $action = $domain['isavailable'] ? "registerDomain" : "transferDomain";
                 $price = $domain['price'];
                 $cost = $domain['cost'];
                 $authcode = !empty($domain['authinfo']) ? $domain['authinfo'] : null;
                 $session->cart->addDomain($Thedomain, $domain['tld_id'], $action, $authcode);
             }
             // Clear the temporary list before adding the new one
             DomainsBulk::clear(Zend_Session::getId());
             // Redirect the user to the order detail page
             $this->_helper->redirector('summary', 'cart', 'default', array('mex' => 'Order created successfully', 'status' => 'success'));
         }
     } else {
         // Create the redirection
         $session->goto = array('action' => 'createorder', 'controller' => 'domainschk', 'module' => 'default', 'options' => array());
         $this->_helper->redirector('signup', 'customer', 'default', array('mex' => 'You have to login or create a new account profile to go on.', 'status' => 'success'));
     }
 }