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

📄 sqlitetableproperties.class.php

📁 架設ROSE私服必備之物 ROSE數據庫
💻 PHP
📖 第 1 页 / 共 3 页
字号:
				$this->editFormLine($index);			}			echo '</table>';			echo '<input type="hidden" name="table" value="'.$this->table.'">'."\n".			     '<input type="hidden" name="action" value="save">'."\n";			if($GLOBALS['action'] == 'addChamp') echo '<input type="hidden" name="after" value="'.$_POST["after"].'">'."\n";			echo '<input class="button" type="submit" value="'.$GLOBALS['traduct']->get(51).'">';			echo '</form>';			echo '</center>';		} else $this->tablePropView();	}		/**	* Display one column form	*	* @access private	* @param integer $index Number of column	*/	function editFormLine($index){		if($GLOBALS['action'] != 'addChamp'){			if(isset($this->infoTable[$index]['name'])) 			$fieldName 		= $this->infoTable[$index]['name']; else $fieldName = '';			if(isset($this->infoTable[$index]['notnull'])) 		$notnull 		= $this->infoTable[$index]['notnull']; else $notnull = '';			if(isset($this->infoTable[$index]['dflt_value'])) 	$fieldDefault 	= $this->infoTable[$index]['dflt_value']; else $fieldDefault = '';			if(isset($this->infoTable[$index]['primary'])) 		$fieldPrimary 	= $this->infoTable[$index]['primary']; else $fieldPrimary = '';			if($pos=strpos($this->infoTable[$index]['type'], '(')){				preg_match('/\((.*)\)/', $this->infoTable[$index]['type'], $lenType);				$lenght = $lenType[1];					$type = substr($this->infoTable[$index]['type'], 0, $pos);			} else {				$lenght = '';				$type = $this->infoTable[$index]['type'];			}		} else {			$fieldName = $notnull = $fieldDefault = $fieldPrimary = '';			$type = '';			$lenght = '';		}	  		$out = '<tr>				<td align="center" class="Browse"><input type="text" class="text" name="fieldName['.$index.']" value="'.$fieldName.'"></td>				<td align="center" class="Browse">        <select name="fieldType['.$index.']">'."\n";		$tabType = array_keys($GLOBALS['SQLiteType']);		asort($tabType);		foreach($tabType as $dispType) $out .= '     		<option value="'.$dispType.'"'.((strtoupper($type)==$dispType)? ' selected="selected"' : '' ).'>'.$dispType.'</option>'."\n";		$out .= ' 	</select>'."\n".'</td>				<td align="center" class="Browse"><input type="text" class="text" size="8" name="fieldLength['.$index.']" value="'.$lenght.'"></td>				<td align="center" class="Browse"><select name="fieldNull['.$index.']">						<option value="NOT NULL"'.(($notnull)? ' selected="selected"' : '' ).'>not null</option>						<option value=""'.((!$notnull)? ' selected="selected"' : '' ).'>null</option>					</select></td>				<td align="center" class="Browse"><input type="text" class="text" name="fieldDefault['.$index.']" value="'.$fieldDefault.'"></td>				<td align="center" class="Browse"><input type="radio" value="$index" name="primary" '.(($fieldPrimary)? ' checked="checked"' : '' ).'></td>				</tr>';		echo $out;	}			/**	* Display TABLE properties	*	* @access public	*/	function tablePropView(){	  echo '<!-- SQLiteTableProperties.class.php : tablePropView() -->'."\n";		if( (($GLOBALS['index_action'] == 'save') && empty($_POST['addCols'])) || ($GLOBALS['index_action'] == 'delete') ) {			$gestIndex =& new TableIndex($this->table, $this->infoTable);			displayQuery('');			unset($GLOBALS['indexSeq'], $_GET['indexSeq'], $_POST['indexSeq']);			unset($GLOBALS['index_action'], $_GET['index_action'], $_POST['index_action']);			unset($gestIndex);					}		$out = '<br\>				<div align="center">				<table class="Main" cellpadding="0" cellspacing="0" width="80%">					<tr>						<td>				<form name="tabprop" action="main.php?dbsel='.$GLOBALS['dbsel'].'" method="POST" target="main">				<table class="Browse" cellpadding="0" cellspacing="0" width="100%">					<thead>					<tr>';		if(!$GLOBALS['workDb']->isReadOnly() && displayCondition('properties')) $out .= '			<td class="Browse">&nbsp;</td>';		$out .= '			<td align="center" class="Browse">'.$GLOBALS['traduct']->get(27).'</td>						<td align="center" class="Browse">'.$GLOBALS['traduct']->get(28).'</td>						<td align="center" class="Browse">'.$GLOBALS['traduct']->get(30).'</td>						<td align="center" class="Browse">'.$GLOBALS['traduct']->get(31).'</td>						<td align="center" class="Browse" colspan="5">'.$GLOBALS['traduct']->get(33).'</td>					</tr>					</thead>';		if(is_array($this->infoTable)){			foreach($this->infoTable as $tableElement){				if(isset($tableElement['cid'])) $out .= $this->linePropView($tableElement['cid']);			}		}		if(!$GLOBALS['workDb']->isReadOnly() && displayCondition('properties')) $out .= '	<tr><td colspan="10" class="BrowseSelect">&nbsp;&nbsp;&nbsp;'.displayPics("arrow_ltr.gif")."&nbsp;				<a href=\"#\" onClick=\"javascript:setCheckBox('tabprop','modify',true);\" class=\"Browse\">".$GLOBALS["traduct"]->get(34)."</a>&nbsp;/&nbsp;				<a href=\"#\" onClick=\"javascript:setCheckBox('tabprop', 'modify', false);\" class=\"Browse\">".$GLOBALS["traduct"]->get(35)."</a>&nbsp;-&nbsp;<i>".$GLOBALS["traduct"]->get(36)."</i>&nbsp;:&nbsp;				<a href=\"#\" onClick=\"javascript: document.tabprop.action.value='modify'; document.tabprop.submit();\" class=\"Browse\">".displayPics("edit.png", $GLOBALS["traduct"]->get(14))."</a>&nbsp;-&nbsp;				<a href=\"#\" onClick=\"javascript: if(confirm('".$GLOBALS["traduct"]->get(37)."')) { document.tabprop.action.value='delete'; document.tabprop.submit();}\" class=\"Browse\">".displayPics("deletecol.png", $GLOBALS["traduct"]->get(15))."</a></td></tr>";		$out .= '</table>';		$out .= '<input type="hidden" name="table" value="'.$GLOBALS['table'].'">'."\n";		$out .= '<input type="hidden" name="action" value="">'."\n";		$out .= '</form>';		echo $out;		echo '<hr width="80%">';		if(!$GLOBALS['workDb']->isReadOnly() && displayCondition('properties')) $this->formAddChamp();		echo '<div class="TableOptions">'."\n";		echo '<div class="Indexes">'."\n";		echo '<h5>'.$GLOBALS['traduct']->get(38).'</h5>';		$gestIndex =& new TableIndex($this->table, $this->infoTable);		echo '</div>'."\n";		echo '</div>'."\n";		echo '</td>				</tr>				</table>				</div>';			}			/**	* Display one column properties	*	* @access private	* @param integer $index Number of column	*/	function linePropView($index){		if($index % 2) $localBgColor = $GLOBALS['browseColor1'];		else $localBgColor = $GLOBALS['browseColor2'];		$textConfirm = $GLOBALS['traduct']->get(39).'\n'.$this->infoTable[$index]['name'].'?';		if(!$this->infoTable[$index]['notnull']) $defltValue = '<i>NULL</i>';		elseif($this->infoTable[$index]['dflt_value']=='') $defltValue = '&nbsp;';		else $defltValue = $this->infoTable[$index]['dflt_value'];		$out = '';		$out .= "\t<tr bgcolor='".$localBgColor."' onMouseOver=\"setRowColor(this, $index, 'over', '".$localBgColor."', '".$GLOBALS['browseColorOver']."', '".$GLOBALS['browseColorClick']."')\"									onMouseOut=\"setRowColor(this, $index, 'out', '".$localBgColor."', '".$GLOBALS['browseColorOver']."', '".$GLOBALS['browseColorClick']."')\">\n";		if(!$GLOBALS['workDb']->isReadOnly() && displayCondition("properties")) $out .= '<td align="center" class="Browse"><input type="checkbox" name="modify['.$index.']"></td>'."\n";		$out .= '<td align="left" class="Browse">'.$this->infoTable[$index]['name'].'</td>'."\n";		$out .= '<td align="left" class="Browse">'.strtoupper($this->infoTable[$index]['type']).'</td>'."\n";		$out .= '<td align="center" class="Browse">'.((!$this->infoTable[$index]['notnull'])? $GLOBALS['traduct']->get(40) : $GLOBALS['traduct']->get(41) ).'</td>'."\n";		$out .= '<td align="right" class="Browse">'.$defltValue.'</td>'."\n";				$out .= '<td align="center" class="Browse" width="7%">';		if(!$GLOBALS['workDb']->isReadOnly() && displayCondition("properties")) $out .= "<a href=\"#\" onClick=\"javascript:setTableAction('tabprop', ".$index.", 'modify');\" class=\"Browse\">".displayPics("edit.png", $GLOBALS['traduct']->get(14))."</a>";		else $out .= "<i>".displayPics("edit_off.png", $GLOBALS['traduct']->get(14))."</i>";		$out .= '</td>'."\n";				$out .= '<td align="center" class="Browse" width="7%">';		if(!$GLOBALS['workDb']->isReadOnly() && displayCondition("properties")) $out .= "<a href=\"#\" onClick=\"javascript:if(confirm('".$textConfirm."')) setTableAction('tabprop', ".$index.", 'delete');\" class=\"Browse\">".displayPics("deletecol.png", $GLOBALS['traduct']->get(15))."</a>";		else $out .= "<i>".displayPics("deletecol_off.png", $GLOBALS['traduct']->get(15))."</i>";		$out .= '</td>'."\n";				$out .= '<td align="center" class="Browse" width="7%">';		if(!$GLOBALS['workDb']->isReadOnly() && displayCondition("properties")) $out .= "<a href=\"#\" onClick=\"javascript:setTableAction('tabprop', ".$index.", 'unique');\" class=\"Browse\">".displayPics("unique.png", $GLOBALS['traduct']->get(197))."</a>";		else $out .= "<i>".displayPics("unique_off.png", $GLOBALS['traduct']->get(197))."</i>";		$out .= '</td>'."\n";		$out .= '<td align="center" class="Browse" width="7%">';		if(!$GLOBALS['workDb']->isReadOnly() && displayCondition("properties")) $out .= "<a href=\"#\" onClick=\"javascript:setTableAction('tabprop', ".$index.", 'index');\" class=\"Browse\">".displayPics("index.png", $GLOBALS['traduct']->get(198))."</a>";		else $out .= "<i>".displayPics("index_off.png", $GLOBALS['traduct']->get(198))."</i>";		$out .= '</td>'."\n";		$out .= '<td align="center" class="Browse" width="7%">';		if(($this->tablePrimary) && isset($this->infoTable[$index]['primary']) && ($this->infoTable[$index]['primary'])) {			if(!$GLOBALS['workDb']->isReadOnly() && displayCondition("properties")) $out .= "<a href=\"#\" onClick=\"javascript:setTableAction('tabprop', ".$index.", 'noprimary');\" class=\"Browse\">".displayPics("primaire.png", $GLOBALS['traduct']->get(42))."</a>";			else $out .= "<i>".displayPics("primaire_off.png", $GLOBALS['traduct']->get(42))."</i>";		} elseif(($this->tablePrimary) && (!isset($this->infoTable[$index]['primary']) || !($this->infoTable[$index]['primary']))) {			$out .= '&nbsp;';		} elseif(!$this->tablePrimary) {			if(!$GLOBALS['workDb']->isReadOnly() && displayCondition("properties")) $out .= "<a href=\"#\" onClick=\"javascript:setTableAction('tabprop', ".$index.", 'addprimary');\" class=\"Browse\">".displayPics("primaire.png", $GLOBALS['traduct']->get(42))."</a>";			else $out .= '<i>'.displayPics("primaire.png", $GLOBALS['traduct']->get(42)).'</i>';		}		$out .= '</td>';		$out .= '	</tr>';		return $out;	}		/**	* Retreive the column number with his name	*	* @access public	* @param string $name Column name	*/	function numCol($name){		if(is_array($this->infoTable))			while(list($cid, $champ)=each($this->infoTable))				if($champ["name"]==$name) 					return $cid;		return false;	}		/**	* Display add column Form	*	* @access public	*/	function formAddChamp(){		echo '<!-- SQLiteTableProperties.class.php : formAddChamp() -->'."\n";		echo '<form name="addChamp" action="main.php?dbsel='.$GLOBALS['dbsel'].'&amp;table='.$this->table.'" method="POST" target="main">'."\n";		echo '<span style="font-size: 12px;">'.$GLOBALS['traduct']->get(43).' 				<input type="text" name="nbChamps" value="1" size=2 class="small-input"> '.				$GLOBALS['traduct']->get(44).' '."\n";		echo '<select name="after" class="small-input">'."\n";		echo '<option value="END">'.$GLOBALS['traduct']->get(45).'</option>'."\n";		echo '<option value="START">'.$GLOBALS['traduct']->get(46).'</option>'."\n";		foreach($this->infoTable as $champ) echo '<option value="'.$champ['cid'].'">'.$GLOBALS['traduct']->get(47).' '.$champ['name'].'</option>'."\n";		echo '</select>				<input type="submit" value="'.$GLOBALS['traduct']->get(69).'" class="button small-input">'."\n";		echo '<input type="hidden" name="action" value="addChamp">'."\n";		echo '</span>				</form>'."\n";	}	/**	* Display Form for add or modify table record	*	* @access public	* @param string $req query where the record is	* @param integer $numId Number of the query record	* @param boolean $error if true, display POST value	*/	function formElement($req='', $numId='', $error=false){		if(empty($req) && empty($numId)) $title = $GLOBALS['traduct']->get(48);		else $title = $GLOBALS['traduct']->get(49);		if(!empty($req)) $tabData = $this->recupElement($req, $numId, $error);		else $tabData = array();	    echo '<!-- SQLiteTableProperties.class.php : formElement() -->'."\n";				echo '<center><h4>'.$title.'</h4>'."\n";		echo '<form name="editElement" action="main.php?dbsel='.$GLOBALS['dbsel'].'&amp;table='.$this->table.'" method="POST" target="main">'."\n";		echo '	<table class="Insert" cellpadding="2" cellspacing="0" width="80%">					<thead>					<tr>						<td align="center" class="Browse">'.$GLOBALS['traduct']->get(27).'</td>						<td align="center" class="Browse">'.$GLOBALS['traduct']->get(28).'</td>						<td align="center" class="Browse">'.$GLOBALS['traduct']->get(10).'</td>						<td align="center" class="Browse">'.$GLOBALS['traduct']->get(30).'</td>						<td align="center" class="Browse">'.$GLOBALS['traduct']->get(50).'</td>					</tr>					</thead>';		reset($this->infoTable);		while(list($cid, $tabInfo) = each($this->infoTable)){			$this->lineElement($tabInfo, $tabData);			}				echo '</table>';		echo '<input type="hidden" name="action" value="saveElement">'."\n";		if(isset($_REQUEST['currentPage'])) echo '<input type="hidden" name="currentPage" value="'.$_REQUEST['currentPage'].'">'."\n";		if($req) {			echo '<input type="hidden" name="numId" value="'.$numId.'">'."\n";			echo '<input type="hidden" name="req" value="'.urlencode($req).'">'."\n";		}		echo '<table width=80% align="center"><tr><td>';		$fontSize = "10px";		if($GLOBALS["action"]!= "insertElement") {			echo '<!--save type--><table><tr><td style="white-space: nowrap; font-size: '.$fontSize.';">'.$GLOBALS['traduct']->get(221).' : </td>					<td><input type="radio" name="save_type" value="as_new_row"></td>					<td style="font-size: '.$fontSize.';">: '.$GLOBALS['traduct']->get(219).'</td></tr>					<tr><td>&nbsp;</td>					<td><input type="radio" name="save_type" value="save" checked="checked"></td>					<td style="font-size: '.$fontSize.';">: '.$GLOBALS['traduct']->get(220).'</td></tr></table><br/><!--end save type-->'."\n";		} else {			echo '<div align="center" style="font-size: '.$fontSize.';">'.$GLOBALS['traduct']->get(219).'</div>';		}		echo '</td><td align="right">';		echo '<table><tr><td style="white-space: nowrap; font-size: '.$fontSize.';">'.$GLOBALS['traduct']->get(151).' : </td>				<td><input type="radio" name="after_save" value="'.((isset($_REQUEST['currentPage']) && !empty($_REQUEST['currentPage']))? $_REQUEST['currentPage'] : ((isset($_REQUEST['after_save']) && !empty($_REQUEST['after_save']))? $_REQUEST['after_save'] : 'properties' ) ).'"'.((!isset($_POST['after_save']) || !empty($_POST['after_save']))? ' checked="checked"' : '' ).'></td>				<td style="font-size: '.$fontSize.';">: '.$GLOBALS['traduct']->get(152).'</td></tr>				<tr><td>&nbsp;</td>				<td><input type="radio" name="after_save" value=""'.((isset($_REQUEST['after_save']) && ($_REQUEST['after_save']==''))? ' checked="checked"' : '' ).'></td>				<td style="font-size: '.$fontSize.';">: '.$GLOBALS['traduct']->get(153).'</td></tr></table><br/>'."\n";		echo '</td></tr></table>';				echo '<input class="button" type="submit" value="'.$GLOBALS['traduct']->get(51).'" onclick="document.tabprop.submit();">';		echo '</form>';		echo '</center>'."\n";		echo '<br/>'.str_repeat('&nbsp;', 10).'&raquo;&nbsp;<a href="main.php?dbsel='.$GLOBALS['dbsel'].'&amp;table='.$this->table.'&amp;action=insertFromFile" class="base" target="main">'.$GLOBALS['traduct']->get(52).'</a>';		return;	}		/**	* Display on column for inert modify record	*	* @access private	* @param array $infoTable table properties	* @param array $tabValue current value for modify record	*/	function lineElement($infoTable, $tabValue=''){		$simpleType = strtoupper(substr($infoTable['type'],0,4));		if(($simpleType == 'TEXT') || ($simpleType == 'BLOB')) $BigInput = true; else $BigInput = false;		if($BigInput && ADVANCED_EDITOR && (!isset($_COOKIE["SQLiteManager_HTMLon"]) || !$_COOKIE["SQLiteManager_HTMLon"])) $CheckreadOnly = ' DISABLED'; else $CheckreadOnly = '';		if(!isset($tabValue[$infoTable['name']])) $tabValue[$infoTable['name']] = '';		echo '	<tr>					<td align="left" class="Insert">'.$infoTable['name'].'</td>					<td align="center" class="Insert">'.StrToUpper($infoTable['type']).'</td>					<td align="center" class="Insert">'.SQLiteFunctionList($infoTable['name']).'</td>					<td align="center" class="Insert">';					if(!$infoTable['notnull'] || isset($infoTable['primary'])){			$CheckNull =  '<input type="checkbox" name="nullField['.$infoTable['name'].']" ';			if($tabValue[$infoTable['name']]=='') $CheckNull .= 'checked="checked"';			$CheckNull .= $CheckreadOnly;			$CheckNull .= ' onChange="if(this.checked) cleanNullField(\'editElement\', \''.$infoTable['name'].'\');">';		} else {

⌨️ 快捷键说明

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