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

📄 xajaxgrid.inc.php

📁 voip开源项目
💻 PHP
📖 第 1 页 / 共 2 页
字号:

	}


	/**
	* Add the line with the search form and the button to add a new record
	*
	* @param string 	$table		Table name of data base
	* @param array 	$fieldsFromSearch 	Its contains the values from "SELECT" search form.
	* @param array		$fieldsFromSearchShowAs	 Its contains the labels show in the "SELECT" search form.
	* @param boolen	$withNewButton	If = 0, then not print the "New Record" button.
	* @return none
	*
	*/

	function addRowSearch($table,$fieldsFromSearch,$fieldsFromSearchShowAs, $withNewButton = 1){
		global $local_grid;		$ind = 0;
		$this->search = '
			<table width="99%" border="0">
			<tr>
				<td align="left" width="10%">';
				if($withNewButton){
					$this->search .= '<button id="submitButton" onClick="xajax_add();return false;">'.$local_grid->Translate("add_record").'</button>';
				}
		$this->search .= '
				</td>
				<td> '.$local_grid->Translate("table").': '.
					$table.
				'</td>
				<td align="right" width="30%" nowrap>
				'.$local_grid->Translate(search).' : &nbsp;<input type="text" size="30" id="searchContent" name="searchContent">
				&nbsp;&nbsp;'.$local_grid->Translate("by").' &nbsp;
					<select id="searchField" name="searchField">
						<option value="'.null.'">'.$local_grid->Translate("select_field").'</option>';
					foreach ($fieldsFromSearchShowAs as $value) {
						$this->search .= '<option value="'.$fieldsFromSearch[$ind].'">'.$value.'</option>';
						$ind++;
					}
		$this->search .= '
					</select>
				&nbsp;&nbsp;<button id="submitButton" onClick="xajax_showGrid(0,'.$this->numRowsToShow.',document.getElementById(\'searchField\').value,document.getElementById(\'searchContent\').value,document.getElementById(\'searchField\').value);return false;">'.$local_grid->Translate("continue").'</button>
				</td>

			</tr>
		</table>';
	}
	/*
	* customer addRowSearth
	*/
    //澧炲姞鎼滅储閫夐」
	function addRowSearchMore($table,$fieldsFromSearch,$fieldsFromSearchShowAs,$filter,$content,$start,$limit, $withNewButton = 1){
		global $local_grid;
		$ind = 0;
		$ind_selected = 0;
		$this->search = '
		    <form action="javascript:void(null);" name="searchForm" id="searchForm" onSubmit="xajax_searchFormSubmit(xajax.getFormValues(\'searchForm\'),0,5);">
			<input type="hidden" name="numRows" id="numRows" value="'.$start.'"/>
			<input type="hidden" name="limit" id="limit" value="'.$limit.'"/>
			<table width="99%" border="0" style="line-height:30px;">

			<tr>
				<td align="left" width="10%">';
				if($withNewButton){
					$this->search .= '<button id="submitButton" onClick="xajax_add();return false;">'.$local_grid->Translate("add_record").'</button>';
				}
		$this->search .= '
				</td>
				<td> '.$local_grid->Translate("table").': ';
		$this->search .= $table ;
		$this->search .= '</td>
				<td align="right" width="50%">
					<div style="width:100%;height:auto;line-height:25px;" name="addSearth" id="addSearth">';
		if($filter != null){
			for($j=0;$j<count($filter);$j++){
				if(trim($content[$j]) != '' && trim($filter[$j]) != ''){
					$this->search .= ''.$local_grid->Translate(search).' : &nbsp;<input type="text" size="30"  name="searchContent[]" id="searchContent[]" value="'.$content[$j].'"/>
							&nbsp;&nbsp;'.$local_grid->Translate("by").' &nbsp;
								<select name="searchField[]" id="searchField[]">
									<option value="'.null.'">'.$local_grid->Translate("select_field").'</option>';
								foreach ($fieldsFromSearchShowAs as $value_arr) {
									if($ind_selected > count($fieldsFromSearch)-1)
									{
										$ind_selected = 0;
									}
									$this->search .= '<option value="'.$fieldsFromSearch[$ind_selected].'" ';
									if($fieldsFromSearch[$ind_selected] == $filter[$j]){
										$this->search .= ' selected ';
									}
									$this->search .=  '>'.$value_arr.'</option>';
									$ind_selected++;
								}
					$this->search .= '</select><br />';
				}
			}
		}
		$this->search .= ''.$local_grid->Translate('search').' : &nbsp;<input type="text" size="30"  name="searchContent[]" id="searchContent[]"/>
				&nbsp;&nbsp;'.$local_grid->Translate("by").' &nbsp;
					<select name="searchField[]" id="searchField[]">
						<option value="'.null.'">'.$local_grid->Translate("select_field").'</option>';
					foreach ($fieldsFromSearchShowAs as $value) {
						$this->search .= '<option value="'.$fieldsFromSearch[$ind].'" ';
						$this->search .=  '>'.$value.'</option>';
						$ind++;
					}
		$this->search .= '</select><br />';
		$this->search .= '</div>
					</td>
					<td>
				&nbsp;&nbsp;
				<INPUT TYPE="hidden" value="" name="numRowsToShow" id="numRowsToShow"/>
				<INPUT TYPE="hidden" value="'.$this->limit.'" name="limit" id="limit"/>
				&nbsp;&nbsp;
				<input type="submit" id="submitButton" name="submitButton" value="'.$local_grid->Translate("continue").'"/>
				</td>';
		if($this->exportFlag != ''){
			$this->search .='<td>
								<input type="checkbox" value="1" name="exportFlag" id="exportFlag"/>
						'.$local_grid->Translate("export").'
					         </td>';
		}
		$this->search .='</tr>

		</table></form>';
	}

	/**
	* Add the footer of the table (Grid), that its contains the record information such as number of records, previos, next and final,  totals records, etc. Each one with its link when it is posible.
	*
	*/

	function setFooter(){		
		global $local_grid;
		$next_rows = $this->start + $this->limit;
		$previos_rows = $this->start - $this->limit;
		if($next_rows>$this->numRows) $next_rows = $this->numRows;
		if($previos_rows<0)$previos_rows = 0;
		if($this->numRows < 1) $this->start = -1;
		$this->footer = '</table>';
		$this->footer .= '
		<table class="adminlist">
			<tr>
				<th colspan="'.$this->n_cols.'">
					<span class="pagenav">';
					if($this->start>0){
						$this->footer .= '<a href="?" onClick="
						document.getElementById(\'numRows\').value = 0;
						document.getElementById(\'limit\').value='.$this->limit.';
						xajax_searchFormSubmit(xajax.getFormValues(\'searchForm\'),0,'.$this->limit.');return false;">'.$local_grid->Translate("first").'</a>';
					}else{
						$this->footer .= $local_grid->Translate("first");
					}
					$this->footer .= '</span>
					<span class="pagenav">';

					if($this->start >0){
					$this->footer .= '<a href="?" onClick="
						document.getElementById(\'numRows\').value = '.$previos_rows.';
						document.getElementById(\'limit\').value='.$this->limit.';
						xajax_searchFormSubmit(xajax.getFormValues(\'searchForm\'),'.$previos_rows.','.$this->limit.');
						return false;">'.$local_grid->Translate("previous").'</a>';
					}else{
						$this->footer .= $local_grid->Translate("previous");
					}
					$this->footer .= '
					</span>
					<span class="pagenav">';

					$this->footer .= ' [ ' . ($this->start+1) . ' / ' . $next_rows .$local_grid->Translate("total"). $this->numRows .' ] ';

					$this->footer .= '
					</span>
					<span class="pagenav">';

					if($next_rows < $this->numRows){
						$this->footer .= '<a href="?" onClick="
						document.getElementById(\'numRows\').value = '.$next_rows.';
						document.getElementById(\'limit\').value='.$this->limit.';
						xajax_searchFormSubmit(xajax.getFormValues(\'searchForm\'),'.$next_rows.','.$this->limit.');return false;">'.$local_grid->Translate("next").'</a>';
					}else{
						$this->footer .= $local_grid->Translate("next");
					}

					$this->footer .= ' </span>
					<span class="pagenav">';

					if($next_rows < $this->numRows){
						$this->footer .= '<a href="?" onClick="
						document.getElementById(\'numRows\').value = '.($this->numRows - $this->limit).';
						document.getElementById(\'limit\').value='.$this->limit.';
						xajax_searchFormSubmit(xajax.getFormValues(\'searchForm\'),'.($this->numRows - $this->limit).','.$this->limit.');return false;">'.$local_grid->Translate("last").'</a>';
					}else{

						$this->footer .= $local_grid->Translate("last").'</span>';
					}
				$this->footer .= '
				</th>
			</tr>
		</table>';
		$this->footer .= $this->search = '
			<table width="99%" border="0">
			<tr>
				<td width="25%" align="left">&nbsp;</td>
				<td width="50%" align="center"><div id="msgZone">&nbsp;</div></td>
				<td width="25%" align="right">
					<button id="submitButton" onClick="xajax_showGrid(0,'.MAXROWSXPAGE.');return false;">'.$local_grid->Translate("show_all").'</button>
				</td>
			</tr>
		</table>';

	}

	/**
	* It combines the variables $this->search . $this->top . $this->header . $this->rows . $this->footer to create the table with the data.
	*
	*/

	function render(){
		$table = $this->search . $this->top . $this->header . $this->rows . $this->footer;

		return $table;
	}

}

/**
 * Class Table for general intentions
 *
 * @package XajaxGrid
 */
class Table {

	/**
	* Headers of table
	* @param string 	$tableTitle		Title of table
	* @return string
	*/
	function Top($tableTitle = "tableTitle", $formId = "formDiv"){
		$table = '
			<table width="100%" border="1" align="center" class="adminlist" >
			<tr class="drsMoveHandle">
				<th align="right" valign="center" >
					<img src="skin/default/images/close.png" onClick=\'javascript: document.getElementById("'.$formId.'").style.visibility="hidden";document.getElementById("'.$formId.'").innerHTML = "";return false;\' title="Close Window" style="cursor: pointer; height: 16px;">
				</th>
			</tr>
			<tr ><td><fieldset><legend>'.$tableTitle.'</legend>';

		return $table;
	}

	/**
	* Footer of table
	* @return string
	*/
	function Footer(){
		$table = '
			</fieldset>
			</td></tr>
			</table><br>';
		return $table;
	}
}

/**
 * Class Table for general intentions
 *
 * @package XajaxGrid
 */
class TableA {

	/**
	* Headers of table
	* @param string 	$tableTitle		Title of table
	* @return string
	*/
	function Top($tableTitle = "tableTitle"){
		$table = '
			<table border="0" width="98%">
			<tr ><td>';

		return $table;
	}

	/**
	* Footer of table
	* @return string
	*/
	function Footer(){
		$table = '
			</td></tr>
			</table><br>';
		return $table;
	}
}

?>

⌨️ 快捷键说明

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