📄 class.formhandler.inc.php
字号:
//This variable define the text that you should put over the table . //To explain what to do or how is works ;) var $FG_INTRO_TEXT_EDITION="You can modify, through the following form, the different properties of your #FG_INSTANCE_NAME#<br>"; var $FG_INTRO_TEXT_ASK_DELETION = "If you really want remove this #FG_INSTANCE_NAME#, click on the delete button."; //var $FG_INTRO_TEXT_DELETION = "One #FG_INSTANCE_NAME# of the %table table has been deleted. <br> (Record with the id : %id)"; var $FG_INTRO_TEXT_DELETION = "A #FG_INSTANCE_NAME# has been deleted!"; var $FG_INTRO_TEXT_ADD = "you can add easily a new #FG_INSTANCE_NAME#.<br>Fill the following fields and confirm by clicking on the button add."; var $FG_INTRO_TEXT_ADITION = "Add a \"#FG_INSTANCE_NAME#\" now."; var $FG_TEXT_ADITION_CONFIRMATION = "Your new #FG_INSTANCE_NAME# has been inserted. <br>"; var $FG_TEXT_ERROR_DUPLICATION = "You cannot choose more than one !"; // ------------------- ## BUTTON/IMAGE SECTION ## ------------------- var $FG_BUTTON_ADITION_SRC = "Images_Path/en/continue_boton.gif"; var $FG_BUTTON_EDITION_SRC = "Images_Path/en/continue_boton.gif"; var $FG_BUTTON_ADITION_BOTTOM_TEXT = ""; var $FG_BUTTON_EDITION_BOTTOM_TEXT = ""; var $FG_ADDITIONAL_FUNCTION_AFTER_ADD = ''; var $FG_ADDITIONAL_FUNCTION_BEFORE_DELETE = ''; var $FG_ADDITIONAL_FUNCTION_AFTER_DELETE = ''; var $FG_ADDITIONAL_FUNCTION_AFTER_EDITION = ''; var $FG_TABLE_ALTERNATE_ROW_COLOR = array(); var $FG_TABLE_DEFAULT_ORDER = "id"; var $FG_TABLE_DEFAULT_SENS = "ASC"; // Delete Foreign Keys or not // if it is set to true and confirm flag is true confirm box will be showed. var $FG_FK_DELETE_ALLOWED = false; // if it is set to true and Allowed flag is true all dependent records will be deleted. var $FG_FK_DELETE = false; // Foreign Key Tables var $FG_FK_TABLENAMES = array(); //Foreign Key Field Names var $FG_FK_EDITION_CLAUSE = array(); //Foreign Key Delete Message Display, it will display the confirm delete dialog if there is some //some detail table exists. depends on the values of FG_FK_DELETE_ALLOWED var $FG_FK_DELETE_CONFIRM = false; //Foreign Key Records Count var $FG_FK_RECORDS_COUNT = 0; //Foreign Key Exists so Warn only not to delete ,,Boolean var $FG_FK_WARNONLY = false; //is Child Records exists var $FG_ISCHILDS = true; // Delete Message for FK var $FG_FK_DELETE_MESSAGE = "Are you sure to delete all records connected to this instance."; //To enable Disable Selection List var $FG_DISPLAY_SELECT = false; //Selection List Field Name to get from Database var $FG_SELECT_FIELDNAME = ""; //Configuration Key value Field Name var $FG_CONF_VALUE_FIELDNAME = ""; //***************************** // For Pre Selected Delete //Pre Selected Records Count var $FG_PRE_COUNT = 0; //***************************** //This variable define the width of the HTML table var $FG_HTML_TABLE_WIDTH="95%"; // text for multi-page navigation. var $lang = array('strfirst' => '<< First', 'strprev' => '< Prev', 'strnext' => 'Next >', 'strlast' => 'Last >>' ); var $logger = null; var $FG_ENABLE_LOG = ENABLE_LOG; // ---------------------------------------------- // CLASS CONSTRUCTOR : FormHandler // @public // @returns void // @ $tablename + $instance_name // ---------------------------------------------- function FormHandler ($tablename=null, $instance_name=null, $action=null) { $this->FG_TABLE_NAME = $tablename; $this->FG_INSTANCE_NAME = $instance_name; if ($this->FG_DEBUG) echo "".$this -> Host.""; $this -> set_regular_expression(); $this->_action = $action ? $action : $_SERVER['PHP_SELF']; //$this->_vars =& $_GET; $this->_vars = array_merge($_GET, $_POST); //error_log(print_r($this->_vars,1), 3, "/tmp/my-errors.log"); $this -> def_list(); //initializing variables with gettext $this -> CV_NO_FIELDS = gettext("THERE IS NO RECORD !!!"); $this -> CV_TEXT_TITLE_ABOVE_TABLE = gettext("DIRECTORY"); $this -> FG_FILTER_SEARCH_TOP_TEXT = gettext("Define criteria to make a precise search"); $this -> FG_INTRO_TEXT = gettext("You can browse through our")." #FG_INSTANCE_NAME# ".gettext("and modify their different properties<br>"); $this -> FG_DELETE_ALT = gettext("Delete this record"); $this -> FG_EDIT_ALT = gettext("Edit this record"); $this -> FG_ADITION_GO_EDITION_MESSAGE = gettext("The document has been created correctly. Now, you can define the different tariff that you want to associate."); $this -> FG_INTRO_TEXT_EDITION = gettext("You can modify, through the following form, the different properties of your")." #FG_INSTANCE_NAME#<br>"; $this -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this")." #FG_INSTANCE_NAME#, ".gettext("Click on the delete button."); //$this -> FG_INTRO_TEXT_DELETION = gettext("One")." #FG_INSTANCE_NAME# ".gettext("of the %table table has been deleted. <br> (Record with the id")." : %id)"; $this -> FG_INTRO_TEXT_DELETION = gettext("One")." #FG_INSTANCE_NAME# ".gettext("has been deleted!"); $this -> FG_INTRO_TEXT_ADD = gettext("you can add easily a new")." #FG_INSTANCE_NAME#.<br>".gettext("Fill the following fields and confirm by clicking on the button add."); $this -> FG_INTRO_TEXT_ADITION = gettext("Add a")." \"#FG_INSTANCE_NAME#\" ".gettext("now."); $this -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." #FG_INSTANCE_NAME# ".gettext("has been inserted. <br>"); $this -> FG_TEXT_ERROR_DUPLICATION = gettext("You cannot choose more than one !"); $this -> FG_FK_DELETE_MESSAGE = gettext("Are you sure to delete all records connected to this instance."); $this -> FG_EDIT_PAGE_CONFIRM_BUTTON = gettext("CONFIRM DATA"); $this -> FG_DELETE_PAGE_CONFIRM_BUTTON = gettext('DELETE'); $this -> FG_ADD_PAGE_CONFIRM_BUTTON = gettext('CONFIRM DATA'); if($this -> FG_ENABLE_LOG == 1) { $this -> logger = new Logger(); } } function setDBHandler ($DBHandle=null){ $this->DBHandle = $DBHandle; } /** * Perform the execution of some actions to prepare the form generation * @public */ function init () { global $_SERVER; if($_GET["section"]!="") { $section = $_GET["section"]; $_SESSION["menu_section"] = $section; } else { $section = $_SESSION["menu_section"]; } $this -> FG_EDITION_LINK = $_SERVER['PHP_SELF']."?form_action=ask-edit&id="; $this -> FG_DELETION_LINK = $_SERVER['PHP_SELF']."?form_action=ask-delete&id="; $this -> FG_DELETE_ALT = gettext("Delete this ").$this -> FG_INSTANCE_NAME; $this -> FG_EDIT_ALT = gettext("Edit this ").$this -> FG_INSTANCE_NAME; $this -> FG_INTRO_TEXT = str_replace('#FG_INSTANCE_NAME#', $this -> FG_INSTANCE_NAME, $this -> FG_INTRO_TEXT); $this -> FG_INTRO_TEXT_EDITION = str_replace('#FG_INSTANCE_NAME#', $this -> FG_INSTANCE_NAME, $this -> FG_INTRO_TEXT_EDITION); $this -> FG_INTRO_TEXT_ASK_DELETION = str_replace('#FG_INSTANCE_NAME#', $this -> FG_INSTANCE_NAME, $this -> FG_INTRO_TEXT_ASK_DELETION); $this -> FG_INTRO_TEXT_DELETION = str_replace('#FG_INSTANCE_NAME#', $this -> FG_INSTANCE_NAME, $this -> FG_INTRO_TEXT_DELETION); $this -> FG_INTRO_TEXT_ADD = str_replace('#FG_INSTANCE_NAME#', $this -> FG_INSTANCE_NAME, $this -> FG_INTRO_TEXT_ADD); $this -> FG_INTRO_TEXT_ADITION = str_replace('#FG_INSTANCE_NAME#', $this -> FG_INSTANCE_NAME, $this -> FG_INTRO_TEXT_ADITION); $this -> FG_TEXT_ADITION_CONFIRMATIONi = str_replace('#FG_INSTANCE_NAME#', $this -> FG_INSTANCE_NAME, $this -> FG_TEXT_ADITION_CONFIRMATION); $this -> FG_FILTER_SEARCH_TOP_TEXT = gettext("Define criteria to make a precise search"); //$this -> FG_TABLE_ALTERNATE_ROW_COLOR[] = "#E2E2D3"; //$this -> FG_TABLE_ALTERNATE_ROW_COLOR[] = "#F0F0E8"; $this -> FG_TABLE_ALTERNATE_ROW_COLOR[] = "#F2F2EE"; $this -> FG_TABLE_ALTERNATE_ROW_COLOR[] = "#FCFBFB"; $this -> FG_TOTAL_TABLE_COL = $this -> FG_NB_TABLE_COL; if ($this -> FG_DELETION || $this -> FG_EDITION || $this -> FG_OTHER_BUTTON1 || $this -> FG_OTHER_BUTTON2) $this -> FG_TOTAL_TABLE_COL++; } /** * Define the list * @public */ function def_list () { $this -> tablelist['billtype']["1"] = array( gettext("ONESHOT"), "1"); $this -> tablelist['billtype']["2"] = array( gettext("PER MINUTE"), "2"); $this -> tablelist['status_trans']["1"] = array( gettext("IN PROCESS"), "1"); $this -> tablelist['status_trans']["2"] = array( gettext("WORKING"), "2"); $this -> tablelist['status_trans']["3"] = array( gettext("ISSUE"), "3"); $this -> tablelist['status_number']["1"] = array( gettext("ALRIGHT"), "1"); $this -> tablelist['status_number']["2"] = array( gettext("NOT USED"), "2"); $this -> tablelist['status_number']["3"] = array( gettext("NO ATTRIBUED"), "3"); $this -> tablelist['status_number']["4"] = array( gettext("WORK IN PROCESS"), "4"); $this -> tablelist['status_newsolution']["1"] = array( gettext("CREATION"), "1"); $this -> tablelist['status_newsolution']["2"] = array( gettext("IN PROCESS"), "2"); $this -> tablelist['status_newsolution']["3"] = array( gettext("IVR INTREGRATION"), "3"); $this -> tablelist['status_newsolution']["4"] = array( gettext("CLOSE"), "4"); $this -> tablelist['solution_priority']["1"] = array( gettext("URGENT"), "1"); $this -> tablelist['solution_priority']["2"] = array( gettext("NORMAL"), "2"); $this -> tablelist['solution_priority']["3"] = array( gettext("LOW"), "3"); $this -> tablelist['status_newsolution_followup']["1"] = array( gettext("NEW"), "1"); $this -> tablelist['status_newsolution_followup']["2"] = array( gettext("UPDATE"), "2"); $this -> tablelist['status_newsolution_followup']["3"] = array( gettext("ANSWER"), "3"); $this -> tablelist['status_newsolution_followup']["4"] = array( gettext("ASSIGN"), "4"); $this -> tablelist['status_newsolution_followup']["5"] = array( gettext("CLOSE"), "5"); $this -> tablelist['status_list']["1"] = array( gettext("INSERTED"), "1"); $this -> tablelist['status_list']["2"] = array( gettext("ENABLE"), "2"); $this -> tablelist['status_list']["3"] = array( gettext("DISABLE"), "3"); $this -> tablelist['status_list']["4"] = array( gettext("FREE"), "4"); $this -> tablelist['media_list']["P"] = array( gettext("PHONE"), "1"); $this -> tablelist['media_list']["SMS"] = array( gettext("SMS"), "2"); $this -> tablelist['validity_list']["1"] = array( gettext("CODE VALID 1 TIME"), "1"); $this -> tablelist['validity_list']["2"] = array( gettext("CODE VALID 2 TIMES"), "2"); $this -> tablelist['validity_list']["3"] = array( gettext("CODE VALID 3 TIMES"), "3"); $this -> tablelist['validity_list']["4"] = array( gettext("CODE VALID 4 TIMES"), "4"); $this -> tablelist['validity_list']["5"] = array( gettext("CODE VALID 5 TIMES"), "5"); $this -> tablelist['validity_list']["6"] = array( gettext("CODE VALID 6 TIMES"), "6"); $this -> tablelist['validity_list']["7"] = array( gettext("CODE VALID 7 TIMES"), "7"); $this -> tablelist['validity_list']["8"] = array( gettext("CODE VALID 8 TIMES"), "8"); $this -> tablelist['validity_list']["9"] = array( gettext("CODE VALID 9 TIMES"), "9"); $this -> tablelist['validity_list']["10"] = array( gettext("CODE VALID 10 TIMES"), "10"); $this -> tablelist['nbcode_list']["1"] = array( "1 ".gettext("CODE"), "1"); $this -> tablelist['nbcode_list']["2"] = array( "2 ".gettext("CODES"), "2"); $this -> tablelist['nbcode_list']["3"] = array( "3 ".gettext("CODES"), "3"); $this -> tablelist['nbcode_list']["4"] = array( "4 ".gettext("CODES"), "4"); $this -> tablelist['nbcode_list']["5"] = array( "5 ".gettext("CODES"), "5"); } function &getProcessed() { foreach ($this->_vars as $key => $value) { $this->_processed[$key] = $this -> sanitize_data($value); } return $this->_processed; } function sanitize_data($data){ if(is_array($data)){ return $data; //Need to sanatize this later } $lowerdata = strtolower ($data); $data = str_replace('--', '', $data); $data = str_replace("'", '', $data); $data = str_replace('=', '', $data); $data = str_replace(';', '', $data); //$lowerdata = str_replace('table', '', $lowerdata); //$lowerdata = str_replace(' or ', '', $data); if (!(strpos($lowerdata, ' or 1')===FALSE)){ return false;} if (!(strpos($lowerdata, ' or true')===FALSE)){ return false;} if (!(strpos($lowerdata, 'table')===FALSE)){ return false;} return $data; } // ---------------------------------------------- // RECIPIENT METHODS // ---------------------------------------------- /** * Adds a "element" to the FG_TABLE_COL. Returns void. * @public * @ 1. $displayname * @ 2. $fieldname * @ 3. $colpercentage * @ 4. $textalign * @ 5 .$sort * @ 6. $char_limit * @ 7. $lie_type ("lie", "list") , where lie is used for sql. ( TODO : any reason to keep lie instead of sql ?.) * @ 8. $lie_with (SQL query with the tag '%1' || a defined list: $tablelist["nbcode"] ) * OLD * @ 8. $lie_with tablename * @ 9. $lie_fieldname * @ 10. $lie_clause * @ 11. $lie_display * @ 12. $function render */ function AddViewElement($displayname, $fieldname, $colpercentage, $textalign='center', $sort='sort', $char_limit = null, $lie_type = null, $lie_with = null, $lie_fieldname = null, $lie_clause = null, $lie_display = null, $myfunc = null, $link_file = null) { $cur = count($this->FG_TABLE_COL); $this->FG_TABLE_COL[$cur] = array($displayname, $fieldname, $colpercentage, $textalign, $sort, $char_limit, $lie_type, $lie_with, $lie_fieldname , $lie_clause , $lie_display, $myfunc , $link_file); $this->FG_NB_TABLE_COL = count($this->FG_TABLE_COL); } //---------------------------------------------------- // Method to Add the Field which will be included in the export file //---------------------------------------------------- /* Add Field to FG_EXPORT_COL array, Returns Void *fieldname is the Field Name which will be included in the export file */ function FieldExportElement($fieldname) { if(strlen($fieldname)>0) { $this->FG_EXPORT_FIELD_LIST = $fieldname; } } /** * Sets Query fieldnames for the View module * @public * @ $col_query , option to append id ( by default ) */ function FieldViewElement ($fieldname,$add_id = 1) { $this->FG_COL_QUERY = $fieldname; // For each query we need to have the ID at the lenght FG_NB_TABLE_COL if ($add_id) $this->FG_COL_QUERY .= ", ".$this->FG_TABLE_ID; } function Is_EDITION() { $this->FG_EDITION = true; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -