⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class.formhandler.inc.php

📁 asterisk 計費模塊
💻 PHP
📖 第 1 页 / 共 5 页
字号:
	function Is_DELETION() {		$this->FG_DELETION = true;	}	/**     * Sets the TEXT to display above the records displayed     * @public   -  @string     */	function set_toptext ($text=null){		if (isset($text)){			$this->FG_INTRO_TEXT= gettext("You can browse through our ").$text.gettext(" and modify their different properties<br>");		}else{			$this->FG_INTRO_TEXT= gettext("You can browse through our ").$this->FG_INSTANCE_NAME.gettext(" and modify their different properties<br>");		}	}	/**     * Sets the HIDDEN value for the FORM     * @public   -  @string     */	function set_hidden_value ($query_adition_hidden_fields, $query_adition_hidden_value, $query_sql_hidden){	 	$this->FG_QUERY_ADITION_HIDDEN_FIELDS = $query_adition_hidden_fields;		$this->FG_QUERY_ADITION_HIDDEN_VALUE = $query_adition_hidden_value;		$this->FG_QUERY_SQL_HIDDEN = $query_sql_hidden;	}	/**     * Sets the ALT of the button view     * @public   -  @string     */	function set_alttext ($alttext_edit=null, $alttext_delete=null){		if (isset($alttext_edit)){			 $this->FG_EDIT_ALT = gettext("Edit this ").$this->FG_INSTANCE_NAME;		}else{			 $this->FG_EDIT_ALT	= $alttext_edit;		}		if (isset($alttext_delete)){			 $this->FG_DELETE_ALT = gettext("Delete this ").$this->FG_INSTANCE_NAME;		}else{			 $this->FG_DELETE_ALT	= $alttext_delete;		}	}	// ----------------------------------------------    // METHOD FOR THE EDITION    // ----------------------------------------------	/**     * Adds a "element" to the FG_TABLE_EDITION array.  Returns void.     * @public	 * @.0 $displayname - name of the column for the current field	 * @.1 $fieldname - name of the field to edit	 * @.2 $defaultvalue - value of the field	 * @.3 $fieldtype - type of edition (INPUT / SELECT / TEXTAREA / RADIOBUTTON/ CHECKBOX/ SUBFORM /...)		##	 * @.4 $fieldproperty - property of the field (ie: "size=6 maxlength=6")	 * @.5 $regexpr_nb the regexp number (check set_regular_expression function), used to this is this match with the value introduced	 * @.6 $error_message - set the error message	 * @.7 $type_selectfield - if the fieldtype = SELECT, set the type of field feed  (LIST or SQL)	 * @.8 $feed_selectfield - if the fieldtype = SELECT, [define a sql to feed it] OR [define a array to use]	 * @.9 $displayformat_selectfield - if the fieldtype = SELECT and fieldname of sql > 1 is useful to define the format to show the data (ie: "%1 : (%2)")	 * @.10 $config_radiobouttonfield - if the fieldtype = RADIOBUTTON : config format - valuename1 :value1, valuename2 :value2,...  (ie: "Yes :t, - No:f")	 * @.12 $check_emptyvalue - ("no" or "yes") if "no" we we check the regularexpression only if a value has been entered	 * @.13 $attach2table - yes	 * @.14 $attach2table_conf - "doc_tariff:call_tariff_id:call_tariff:webm_retention, id, country_id:id IN (select call_tariff_id from doc_tariff where document_id = %id) AND cttype='PHONE':document_id:%1 - (%3):2:country:label, id:%1:id='%1'"	 * @.END $comment - set a comment to display below the field     */	 /*	// THE VARIABLE $FG_TABLE_EDITION WOULD DEFINE THE COL THAT WE WANT SHOW IN YOUR EDITION TABLE	// 0. NAME OF THE COLUMN IN THE HTML PAGE,	// 1. NAME OF THE FIELD	// 2. VALUE OF THE FIELD	// 3. THE TYPE OF THE FIELD (INPUT/SELECT/TEXTAREA)	// 4. THE PROPERTY OF THIS FIELD	// 5. REGEXPRES TO CHECK THE VALUE	//    "^.{3}$": A STRING WITH EXACTLY 3 CHARACTERS.	//     ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$  : EMAIL ADRESSE	// 6. ERROR MESSAGE // Used IF SELECT for ask-add as option with value -1	// 7.  IF THE FIELD TYPE IS A SELECT,  DEFINE LIST OR SQL	// 8.  IF SQL,		THE TABLE NAME	// 9.  IF SQL,		THE FIELDS  : Three MAXIMUM IN ORDER (NAME, VALUE, ...other that we need for the display) ;)	// 10. IF SQL,		THE CLAUSE	// 11. IF LIST,		THE NAME OF THE LIST	// 12. IF LIST,		DISPLAY : %1 : (%2) ; IF SELECT , show the content of that field	// 13. CHECK_EMPTYVALUE - ("no" or "yes") if "no" we we check the regularexpression only if a value has been entered - if NO-NULL, if the value is	// 	 					  not entered the field will not be include in the update/addition query	// 14. COMMENT ( that is not included in FG_TABLE_EDITION or FG_TABLE_ADITION )	// 15. SQL CUSTOM QUERY : customer SQL   or   function to display the edit input	// 16. DISPLAYINPUT_DEFAULTSELECT : IF INPUT : FUNCTION TO DISPLAY THE VALUE OF THE FIELD ; IF SELECT IT WILL DISPLAY THE OPTION PER DEFAUTL, ie:	//									'<OPTION  value="-1" selected>NOT DEFINED</OPTION>'	// 17. COMMENT ABOVE : this will insert a comment line above the edition line, useful to separate section and to provide some detailed instruction	 */	function AddEditElement($displayname, $fieldname, $defaultvalue, $fieldtype, $fieldproperty, $regexpr_nb, $error_message, $type_selectfield,		$lie_tablename, $lie_tablefield, $lie_clause, $listname, $displayformat_selectfield, $check_emptyvalue , $comment, $custom_query = null,		$displayinput_defaultselect = null, $comment_above = null, $field_enabled = true){				if($field_enabled==true)		{					$cur = count($this->FG_TABLE_EDITION);			$this->FG_TABLE_EDITION[$cur] = array ( $displayname, $fieldname, $defaultvalue, $fieldtype, $fieldproperty, $regexpr_nb, $error_message,							$type_selectfield, $lie_tablename, $lie_tablefield, $lie_clause, $listname, $displayformat_selectfield, $check_emptyvalue,							$custom_query, $displayinput_defaultselect, $comment_above);					$this->FG_TABLE_COMMENT[$cur] = $comment;			$this->FG_TABLE_ADITION[$cur] = $this->FG_TABLE_EDITION[$cur];			$this->FG_NB_TABLE_ADITION = $this->FG_NB_TABLE_EDITION = count($this->FG_TABLE_EDITION);		}	}	/**     * Sets Search form fieldnames for the view module     * @public     	 * @ $displayname , $fieldname, $fieldvar	      */	function AddSearchElement_C1($displayname, $fieldname, $fieldvar ){		$cur = count($this->FG_FILTER_SEARCH_FORM_1C);		$this->FG_FILTER_SEARCH_FORM_1C[$cur] = array($displayname, $fieldname, $fieldvar);	}		function AddSearchElement_C2($displayname, $fieldname1 , $fielvar1 , $fieldname2 , $fielvar2, $sqlfield){		$cur = count($this->FG_FILTER_SEARCH_FORM_2C);		$this->FG_FILTER_SEARCH_FORM_2C[$cur] = array($displayname, $fieldname1 , $fielvar1 , $fieldname2 , $fielvar2, $sqlfield);	}	/**     * Sets Search form select rows for the view module     * @public	 * @ $displayname , SQL or array to fill select and the name of select box     */		function AddSearchElement_Select($displayname, $table = null, $fields = null, $clause = null,			$order = null ,$sens = null , $select_name, $sql_type = 1, $array_content = null){					$cur = count($this->FG_FILTER_SEARCH_FORM_SELECT);				if ($sql_type){			$sql = array($table, $fields, $clause, $order ,$sens);			$this->FG_FILTER_SEARCH_FORM_SELECT[$cur] = array($displayname, $sql, $select_name);		}else{			$this->FG_FILTER_SEARCH_FORM_SELECT[$cur] = array($displayname, 0, $select_name, $array_content);		}			}			/**     * Sets Query fieldnames for the Edit/ADD module     * @public     	 * @ $col_query	      */	 	function FieldEditElement ($fieldname) {     		if($this->FG_DISPLAY_SELECT == true)		{			if(strlen($this->FG_SELECT_FIELDNAME)>0)			{				$fieldname.= ", ".$this->FG_SELECT_FIELDNAME;			}		}		$this->FG_QUERY_EDITION = $fieldname;		$this->FG_QUERY_ADITION = $fieldname;	}			function set_regular_expression(){			// 0.  A STRING WITH EXACTLY 3 CHARACTERS.					$this -> FG_regular[]  = array(	"^.{3}", 						gettext("(at least 3 characters)"));								// 1.  EMAIL ADRESSE		$this -> FG_regular[]  = array(	"^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$", 						gettext("(must match email structure. Example : name@domain.com)"));								// 2 . IF AT LEAST FIVE SUCCESSIVE CHARACTERS APPEAR AT THE END OF THE STRING.		$this -> FG_regular[]  = array(	".{5}$", 						gettext("(at least 5 successive characters appear at the end of this string)"));		// 3. IF AT LEAST 4 CHARACTERS		$this -> FG_regular[]  = array(	".{4}", 						gettext("(at least 4 characters)"));		// 4		$this -> FG_regular[]  = array(	"^[0-9]+$"	, 						gettext("(number format)"));					// 5		$this -> FG_regular[]  = array(	"^([0-9]{4})-([0-9]{2})-([0-9]{2})$"	, 						"(YYYY-MM-DD)");					// 6		$this -> FG_regular[]  = array(	"^[0-9]{8,}$"	, 						gettext("(only number with more that 8 digits)"));					// 7		$this -> FG_regular[]  = array(	"^[0-9][ .0-9\/\-]{6,}[0-9]$"	, 						gettext("(at least 8 digits using . or - or the space key)"));								// 8		$this -> FG_regular[]  = array(	".{5}", 						gettext("network adress format"));		// 9		$this -> FG_regular[]  = array(	"^.{1}",						gettext("at least 1 character"));			// 10		$this -> FG_regular[]  = array(    "^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})$"   ,		                        "(YYYY-MM-DD HH:MM:SS)");		// 11		$this -> FG_regular[]  = array(    "^.{2}",					gettext("(AT LEAST 2 CARACTERS)"));		// 12		$this -> FG_regular[]  = array(    "^(-){0,1}[0-9]+(\.){0,1}[0-9]*$"       ,					gettext("(NUMBER FORMAT WITH/WITHOUT DECIMAL, use '.' for decimal)"));				// 13  - RATECARD		$this -> FG_regular[]  = array(    "^(defaultprefix|[0-9]+)$",					"(NUMBER FORMAT OR 'defaultprefix')");				// 14  - DNID PREFIX FOR RATECARD		$this -> FG_regular[]  = array(    "^(all|[0-9]+)$",		                        "(NUMBER FORMAT OR 'all')");				// 15 - RATECARD TIME		$this -> FG_regular[]  = array(    "^([0-9]{2}):([0-9]{2})$"   ,		                        "(HH:MM)");								// 16  TEXT > 15 caract		$this -> FG_regular[]  = array(	".{15}", 						gettext("You must write something."));				// 17  TEXT > 15 caract		$this -> FG_regular[]  = array(	".{8}", 						gettext("8 characters alphanumeric"));				// 18 - CALLERID - PhoneNumber		$this -> FG_regular[]  = array(    "^(\+|[0-9]{1})[0-9]+$"   ,		                        "Phone Number format");		// 19 - CAPTCHAIMAGE - Alpahnumeric		$this -> FG_regular[]  = array("^(".strtoupper($_SESSION["captcha_code"]).")|(".strtolower($_SESSION["captcha_code"]).")$",						gettext("(at least 6 Alphanumeric characters)"));		// check_select		// TO check if a select have a value different -1	}				//--------------------------------- TO ADD IN THE FUTURE	/*	// The variable  would define if you want have a link for the insert page in the view/edit page	$FG_LINK_ADD=true;	// The variable  Where the edition will target (link)	$FG_INSERT_LINK="P2E_entity_edit.php?form_action=ask-add&atmenu=$FG_CLASS_NAME";			// The variable  would define if you want use a search engine in this module	$FG_SEARCH_ENGINE=false;	*/						// ----------------------------------------------    // FUNCTION FOR THE FORM    // ----------------------------------------------		function do_field_duration($sql,$fld, $fldsql){  		$fldtype = $fld.'type';		if (isset($_POST[$fld]) && ($_POST[$fld]!='')){                if (strpos($sql,'WHERE') > 0){                        $sql = "$sql AND ";                }else{                        $sql = "$sql WHERE ";                }				$sql = "$sql $fldsql";				if (isset ($_POST[$fldtype])){                                        switch ($_POST[$fldtype]) {							case 1:	$sql = "$sql ='".$_POST[$fld]."'";  break;							case 2: $sql = "$sql <= '".$_POST[$fld]."'";  break;							case 3: $sql = "$sql < '".$_POST[$fld]."'";  break;														case 4: $sql = "$sql > '".$_POST[$fld]."'";  break;							case 5: $sql = "$sql >= '".$_POST[$fld]."'";  break;						}                }else{ $sql = "$sql = '".$_POST[$fld]."'"; }		}		return $sql;  }function do_field($sql,$fld, $simple=0){  		$fldtype = $fld.'type';        if (isset($_POST[$fld]) && ($_POST[$fld]!='')){				if (strpos($sql,'WHERE') > 0){                        $sql = "$sql AND ";                }else{                        $sql = "$sql WHERE ";                }				$sql = "$sql $fld";				if ($simple==0){					if (isset ($_POST[$fldtype])){      							switch ($_POST[$fldtype]) {								case 1:	$sql = "$sql='".$_POST[$fld]."'";  break;								case 2: $sql = "$sql LIKE '".$_POST[$fld]."%'";  break;								case 3: $sql = "$sql LIKE '%".$_POST[$fld]."%'";  break;								case 4: $sql = "$sql LIKE '%".$_POST[$fld]."'";							}					}else{ 						$sql = "$sql LIKE '%".$_POST[$fld]."%'"; 					}				}else{					$sql = "$sql ='".$_POST[$fld]."'";				}		}		return $sql;  }	/**     * Function to execture the appropriate action     * @public     	      */	function perform_action (&$form_action){		switch ($form_action) {			case "add":			   $this -> perform_add($form_action);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -