function Render() { $action = null; $item = _("item"); if ($this->form) { $action = $this->form->getAction(); $item = $this->form->model_name_s; } else { $action = getpost_single('action'); } if ($action == 'list') { ?> <div> <a href="<?php echo $_SERVER['PHP_SELF'] . $this->form->gen_AllGetParams(array($this->form->prefix . 'action' => 'ask-add')); ?> "><?php echo str_params(_("Add a new %1"), array($item), 1); ?> </a> </div> <?php } }
<?php require "./lib/defines.php"; require "a2blib/Misc.inc.php"; $err_type = getpost_single('err_type'); $c = getpost_single('c'); if (!isset($err_type)) { $err_type = 0; } //Error Type == 0 Mean Critical Error dont need to show left menu. //Error Type == 1 Mean User generated error.and it will show menu to him too. if ($err_type == 0) { $popup_select = 1; } else { require "./lib/module.access.php"; } if (!isset($c)) { $c = "0"; } $error["0"] = gettext("ERROR : ACCESS REFUSED"); $error["syst"] = gettext("Sorry a problem occur on our system, please try later!"); $error["errorpage"] = gettext("There is an error on this page!"); $error["accessdenied"] = gettext("Sorry, you don t have access to this page !"); $error["construction"] = gettext("Sorry, this page is in construction !"); $error["ERR-0001"] = gettext("Invalid User Id !"); $error["ERR-0002"] = gettext("No such card number found. Please check your card number!"); ?> <html><head> <title>..:: <?php echo _("Error"); ?>
/** Called by the framework when we have requested an 'object-edit' */ public function PerformObjEdit(&$form) { $DBHandle = $form->a2billing->DBHandle(); $oeaction = getpost_single($this->fieldname . '_action'); $oeid = getpost_single($this->localkey); $dbg_elem = new DbgElem(); if ($form->FG_DEBUG > 0) { $form->pre_elems[] =& $dbg_elem; } switch ($oeaction) { case 'add': $QUERY = str_dbparams($DBHandle, "INSERT INTO {$this->reftable} ({$this->refid}, {$this->refname}) VALUES(%1, %2);", array($oeid, getpost_single($this->fieldname . '_new' . $this->refname))); $dbg_elem->content .= "Query: " . htmlspecialchars($QUERY) . "\n"; $res = $DBHandle->Execute($QUERY); if (!$res) { $form->pre_elems[] = new ErrorElem(str_params(_("Cannot insert new %1"), array($this->fieldtitle), 1)); $dbg_elem->content .= "Query failed: {$DBHanlde->ErrorMsg}(); \n"; } else { $dbg_elem->content .= "Item added!"; } break; case 'delete': if ($this->refkey != NULL) { $QUERY = str_dbparams($DBHandle, "DELETE FROM {$this->reftable} WHERE {$this->refkey} = %1 ;", array(getpost_single($this->fieldname . '_del'))); } else { $QUERY = str_dbparams($DBHandle, "DELETE FROM {$this->reftable} WHERE {$this->refid} = %1 AND {$this->refname} = %2 ;", array(getpost_single($this->fieldname . '_del'), getpost_single($this->fieldname . '_del2'))); } $dbg_elem->content .= "Query: " . htmlspecialchars($QUERY) . "\n"; $res = $DBHandle->Execute($QUERY); if (!$res) { $form->pre_elems[] = new ErrorElem(str_params(_("Cannot delete %1"), array($this->fieldtitle), 1)); $dbg_elem->content .= "Query failed: {$DBHanlde->ErrorMsg}(); \n"; } else { $dbg_elem->content .= "Item deleted!"; } break; default: $dbg_elem->content .= "Unknown action {$oeaction}"; } return 'ask-edit'; }