Source for file tangra_module_license_dbc.class.php
Documentation is available at tangra_module_license_dbc.class.php
* Contains class Tangra_Module_DBC
* @subpackage modules_manager
require_once(TANGRA_MAIN_DIR. 'interfaces/i_db_storable.class.php');
require_once('tangra_module_license.class.php');
* Tangra_Module_License_DBC
* @subpackage modules_manager
* @param DB_Connection $dbc
* @return integer On success returns module ID, on failure - false
public function save(DB_Connection $dbc) {
* @param DB_Connection $dbc
* @return integer On success returns module ID, on failure - false
public function load_by_id(DB_Connection $dbc, $id) {
$rez = $dbc->execute($sql);
$rez_obj = $rez->fetch_object();
* Inserts DB record for license
* @param DB_Connection $dbc
* @return integer On success returns module ID, on failure - false
protected function insert(DB_Connection $dbc) {
$id = $dbc->generate_id('tmods_licenses_seq');
$sql = "insert into tmods_licenses (id, ".
throw new TE_Exception('ID not generated - tmods_licenses_seq');
* Updated license DB record
* @param DB_Connection $dbc
* @return integer On success returns module ID, on failure - false
protected function update(DB_Connection $dbc) {
$sql = "update tmods_licenses set ".
* @return string SQL statement
$sql = "select id, name, foss from tmods_licenses order by name asc";
* Gets count SQL for grid
* @return string SQL statement
$sql = "select count(id) as total_rows from tmods_licenses";
* Loads options labels map for form_field_select
* @param DB_Connection $dbc
$sql = "select id, name from tmods_licenses order by id asc";
$rez = $dbc->execute($sql);
while($rez_obj = $rez->fetch_object()) {
$ret['ol_map'][$rez_obj->ID] = $rez_obj->NAME;
* Checks if HID is unique
* @param DB_Connection $dbc
* @param string $hid HID to check if exists
* @param integer $id ID of current category
public static function is_unique_hid(DB_Connection $dbc, $hid, $id = 0) {
$sql = "select id from tmods_licenses where hid = '$hid' and id <> $id";
$rez = $dbc->execute($sql);
* @param DB_Connection $dbc
* @return integer On success returns module ID, on failure - false
public function load_by_hid(DB_Connection $dbc, $hid) {
$sql = "select id from tmods_licenses where hid = '$hid'";
$rez = $dbc->execute($sql);
$rez_obj = $rez->fetch_object();
|