/**
  * Get Data
  *
  * @return array value => description
  */
 function getData()
 {
     // Query HostingServiceDBO's
     $hostings = array();
     try {
         // Convery to an array: hosting ID => hosting service name
         $where = $this->fieldConfig['publicitemsonly'] ? "public='Yes'" : null;
         $hostingDBOs = load_array_HostingServiceDBO($where);
         foreach ($hostingDBOs as $hostingDBO) {
             $hostings[$hostingDBO->getID()] = $hostingDBO->getTitle();
         }
     } catch (DBNoRowsFoundException $e) {
     }
     return $hostings;
 }
 /**
  * Initialize the Page
  */
 public function init()
 {
     parent::init();
     try {
         $services = load_array_HostingServiceDBO();
     } catch (DBNoRowsFoundException $e) {
         $e->setMessage("No hosting services have been setup");
         throw $e;
     }
     // Start a new order (if necessary)
     if (!isset($_SESSION['order'])) {
         $_SESSION['order'] = new OrderDBO();
     }
     // Give the template access to the DBOs
     $this->smarty->assign_by_ref("orderDBO", $_SESSION['order']);
     // Show prices for the selected hosting package
     $HPTermWidget = $this->forms['purchasehosting']->getField("hostingterm")->getWidget();
     $serviceField = $this->forms['purchasehosting']->getField("hostingservice");
     $hservice = isset($_POST['hostingservice']) ? $serviceField->set($_POST['hostingservice']) : array_shift(load_array_HostingServiceDBO());
     $HPTermWidget->setPurchasable($hservice);
     // Give the template access to the hosting service DBO
     $this->smarty->assign_by_ref("serviceDBO", $hservice);
     // Show prices for the selected domain package
     $RDTermWidget = $this->forms['purchasehosting']->getField("registerdomainterm")->getWidget();
     $tldField = $this->forms['purchasehosting']->getField("registerdomaintld");
     $dservice = isset($_POST['registerdomaintld']) ? $tldField->set($_POST['registerdomaintld']) : array_shift(load_array_DomainServiceDBO());
     $RDTermWidget->setPurchasable($dservice);
     $TDTermWidget = $this->forms['purchasehosting']->getField("transferdomainterm")->getWidget();
     $tldField = $this->forms['purchasehosting']->getField("transferdomaintld");
     $dservice = isset($_POST['transferdomaintld']) ? $tldField->set($_POST['transferdomaintld']) : array_shift(load_array_DomainServiceDBO());
     $TDTermWidget->setPurchasable($dservice);
     // Setup the in-cart domains drop-down
     $widget = $this->forms['purchasehosting']->getField("incartdomain")->getWidget();
     $widget->setOrder($_SESSION['order']);
     if (isset($this->get['service'])) {
         // Select the hosting service and terms provided in the URL
         $this->smarty->assign("service", $this->get['service']->getID());
         $HPTermWidget->setPurchasable($this->get['service']);
     }
     if (isset($this->get['domain']) && isset($this->get['tld'])) {
         $this->smarty->assign("domain", $this->get['domain']);
         $this->smarty->assign("tld", $this->get['tld']->getTLD());
     }
 }
 /**
  * Initialize the Table
  *
  * @param array $params Parameters from the {form_table} tag
  */
 public function init($params)
 {
     global $conf;
     parent::init($params);
     // Load the HostingService Table
     try {
         // Build the table
         $services = load_array_HostingServiceDBO($where);
         foreach ($services as $dbo) {
             // Format the pricing for this hosting service
             $priceString = "";
             $prices = array_merge($dbo->getPricing("Onetime"), $dbo->getPricing("Recurring"));
             foreach ($prices as $priceDBO) {
                 $price = sprintf("%s%01.2f", $conf['locale']['currency_symbol'], $priceDBO->getPrice());
                 $priceString .= $priceDBO->getType() == "Onetime" ? sprintf("[ONETIME]: %s<br/>", $price) : sprintf("%d [MONTHS]: %s<br/>", $priceDBO->getTermLength(), $price);
             }
             // Put the row into the table
             $this->data[] = array("id" => $dbo->getID(), "title" => $dbo->getTitle(), "description" => $dbo->getDescription(), "uniqueip" => $dbo->getUniqueIP(), "pricing" => $priceString, "public" => $dbo->getPublic());
         }
     } catch (DBNoRowsFoundException $e) {
     }
 }
 /**
  * Initialize Assign Hosting Page
  */
 function init()
 {
     parent::init();
     // Set URL Fields
     $this->setURLField("account", $this->get['account']->getID());
     // Store service DBO in session
     $this->session['account_dbo'] =& $this->get['account'];
     try {
         $services = load_array_HostingServiceDBO();
     } catch (DBNoRowsFoundException $e) {
         throw new SWUserException("[THERE_ARE_NO_HOSTING_SERVICES]");
     }
     if (!isset($this->post['service'])) {
         $this->updatePrices(array_shift($services));
     }
 }