/** * Initialize the Table * * @param array $params Parameters from the {form_table} tag */ public function init($params) { parent::init($params); // Build an DomainPurchase filter $where = isset($this->accountID) ? sprintf("accountid='%d'", $this->accountID) : null; // Load the DomainPurchase Table try { $purchases = load_array_DomainServicePurchaseDBO($where); // Build the table foreach ($purchases as $dbo) { // Put the row into the table $this->data[] = array("id" => $dbo->getID(), "fulldomainname" => $dbo->getFullDomainName(), "term" => $dbo->getTerm(), "date" => $dbo->getDate(), "expiredate" => $dbo->getExpireDate(), "nextbillingdate" => $dbo->getNextBillingDate()); } } catch (DBNoRowsFoundException $e) { } }
/** * Initialize the Table * * @param array $params Parameters from the {form_table} tag */ public function init($params) { parent::init($params); // Load the Domain Table try { $domains = load_array_DomainServicePurchaseDBO($where); // Build the table foreach ($domains as $dbo) { if ($this->statusFlag == "active" && !$dbo->isExpired() || $this->statusFlag == "expired" && $dbo->isExpired()) { // Skip continue; } // Put the row into the table $this->data[] = array("id" => $dbo->getID(), "tld" => $dbo->getTLD(), "accountid" => $dbo->getAccountID(), "domainname" => $dbo->getDomainName(), "fulldomainname" => $dbo->getFullDomainName(), "accountname" => $dbo->getAccountName(), "date" => $dbo->getDate(), "term" => $dbo->getTerm(), "expiredate" => $dbo->getExpireDate()); } } catch (DBNoRowsFoundException $e) { } }
/** * Get Domain Service Purchases for this Account * * return array Array of DomainServicePurchaseDBO's for this account */ function getDomainServices() { try { return load_array_DomainServicePurchaseDBO("accountid=" . intval($this->getID())); } catch (DBNoRowsFoundException $e) { return array(); } }
/** * Delete DomainServiceDBO from database * * @param DomainServiceDBO &$dbo DomainServiceDBO to delete * @return boolean True on success */ function delete_DomainServiceDBO(&$dbo) { $DB = DBConnection::getDBConnection(); // Verify that no purchases exist try { $tld = $dbo->getTLD(); load_array_DomainServicePurchaseDBO("tld = '" . $dbo->getTLD() . "'"); // Can not delete domain service if any purchases exist throw new DBException("[PURCHASES_EXIST]"); } catch (DBNoRowsFoundException $e) { } // Build SQL $sql = $DB->build_delete_sql("domainservice", "tld = " . $DB->quote_smart($dbo->getTLD())); // Run query if (!mysql_query($sql, $DB->handle())) { throw new DBException(mysql_error($DB->handle())); } // Delete all prices belonging to the deleted domain service. $domainPrices = new DomainServicePriceDBO(); $domainPrices->setTLD($tld); deleteAll_DomainServicePriceDBO($domainPrices); }