/** * Get Data * * @return array value => description */ function getData() { // Query ProductDBO's $products = array(); try { $productDBOs = load_array_ProductDBO(); // Convery to an array: product ID => product name foreach ($productDBOs as $productDBO) { $products[$productDBO->getID()] = $productDBO->getName(); } } catch (DBNoRowsFoundException $e) { } return $products; }
/** * Initialize Assign Product Page */ function init() { parent::init(); // Set URL Fields $this->setURLField("account", $this->get['account']->getID()); // Store service DBO in session $this->session['account_dbo'] = $dbo; try { $products = load_array_ProductDBO(); } catch (DBNoRowsFoundException $e) { throw new SWUserException("[THERE_ARE_NO_PRODUCTS]"); } if (!isset($this->post['product'])) { $this->updatePrices(array_shift($products)); } }
/** * Initialize the Table * * @param array $params Parameters from the {form_table} tag */ public function init($params) { global $conf; parent::init($params); // Load the Product Table try { // Build the table $products = load_array_ProductDBO($where); foreach ($products 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(), "name" => $dbo->getName(), "description" => $dbo->getDescription(), "pricing" => $priceString, "public" => $dbo->getPublic()); } } catch (DBNoRowsFoundException $e) { } }