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

📄 table.class.inc

📁 groupoffice
💻 INC
📖 第 1 页 / 共 2 页
字号:
		}		$table .= $this->get_pagination();				$table .= '</table>'.$this->lb;		$table .= $this->get_hidden_rows();					return $this->outerHTML.$table;				}		function get_headings()	{		global $GO_THEME;		$select_all_checkbox = new input('checkbox', 'dummy');		$select_all_checkbox->set_attribute('class','');		$select_all_checkbox->set_attribute('onclick',"javascript:table_select_all('".$this->form_name."','".$this->attributes['id']."',this.checked)");							if ($this->sort_ascending)		{			$image = new image('arrow_up');		}else		{			$image = new image('arrow_down');		}		$image->set_attribute('style','border:0px;margin-left:5;');			$headings = '';		foreach($this->headings as $key=>$heading)		{			if(empty($heading->sort_name) && $this->autosort)			{				$heading->sort_name = $key;			}						$headings .= '<th';			foreach($heading->attributes as $name=>$value)			{				$headings .= ' '.$name.'="'.$value.'"';			}			$headings .= '>';						if(!isset($checkbox_added))			{				$checkbox_added = true;				$headings .= $select_all_checkbox->get_html();			}						if($heading->sort_name !== '')			{				$headings .= '<a href="javascript:table_sort(\''.$this->form_name.'\',\''.$this->attributes['id'].'\',\''.$heading->sort_name.'\',';				if(($this->sort_ascending))				{					$headings .= '0';				}else				{					$headings .= '1';				}							$headings .= ');">'.$heading->name;								if($heading->sort_name == $this->sort_index)				{					$headings .= $image->get_html();				}								$headings .= '</a>';			}else			{				$headings .= $heading->name;			}			$headings .= '</th>'.$this->lb;		}		if(!empty($headings))		{			return '<tr>'.$this->lb.$headings.'</tr>'.$this->lb;		}else		{			return '';		}	}		function update_row_selection(&$row)	{		if($this->remind_selected && !empty($row->value))		{			$key = array_search(smart_addslashes($row->value), $this->hidden_selected);			if (is_int($key))			{				unset($this->hidden_selected[$key]);						$row->set_selected();			}		}		}			function get_rows()	{				$rows = '';			if($this->autosort)		{			if($this->sort_ascending)			{				asort($this->sort_table);			}else			{				arsort($this->sort_table);			}			foreach($this->sort_table as $key=>$value)			{				$this->update_row_selection($this->rows[$key]);								$rows .= $this->rows[$key]->get_html();			}		}else		{			/*			Removed foreach statement because this caused a lot of memory usage			Too bad the state of the object is lost when get_html() is called now*/			//foreach($this->rows as $row) 			while($row = array_shift($this->rows))			{				$this->update_row_selection($row);				$rows .= $row->get_html();			}		}		return $rows;	}		function get_hidden_rows()	{		$hidden_selected_rows = '';		foreach($this->hidden_selected as $hidden_selected_value)		{			$input = new input('hidden', $this->attributes['id'].'[selected][]', $hidden_selected_value);			$hidden_selected_rows .= $input->get_html();		}		return $hidden_selected_rows;	}		function get_pagination()	{		global $cmdShowAll, $cmdPrevious, $cmdNext;		$links = '';		if ($this->offset != 0)		{			if ($this->total_rows > $this->offset)			{				$links = '<table class="navLinks"><tr><td>';				$next_start = $this->start+$this->offset;				$previous_start = $this->start-$this->offset;								if ($this->start != 0)				{					$links .= '<a href="javascript:table_change_page(\''.$this->form_name.'\',\''.$this->attributes['id'].'\',0, '.$this->offset.');">&lt&lt</a>&nbsp;';					$links .= '<a href="javascript:table_change_page(\''.$this->form_name.'\',\''.$this->attributes['id'].'\','.$previous_start.', '.$this->offset.');">'.$cmdPrevious.'</a>&nbsp;';				}else				{					$links .= '<font color="#cccccc">&lt&lt '.$cmdPrevious.'</font>&nbsp;';				}				$start_link = ($this->start-(($this->max_links/2)*$this->offset));				$end_link = ($this->start+(($this->max_links/2)*$this->offset));				if ($start_link < 0)				{					$end_link = $end_link - $start_link;					$start_link=0;				}				if ($end_link > $this->total_rows)				{					$end_link = $this->total_rows;				}				if ($start_link > 0)				{					$links .= '...&nbsp;';				}				for ($i=$start_link;$i<$end_link;$i+=$this->offset)				{					$page = ($i/$this->offset)+1;					if ($i==$this->start)					{						$links .= '<b><i>'.$page.'</i></b>&nbsp;';					}else					{						$links .= '<a href="javascript:table_change_page(\''.$this->form_name.'\',\''.$this->attributes['id'].'\','.$i.','.$this->offset.');">'.$page.'</a>&nbsp;';					}				}				if ($end_link < $this->total_rows)				{					$links .= '...&nbsp;';				}				$last_page = floor($this->total_rows/$this->offset)*$this->offset;				if ($this->total_rows > $next_start)				{					$links .= '<a href="javascript:table_change_page(\''.$this->form_name.'\',\''.$this->attributes['id'].'\','.$next_start.', '.$this->offset.');">'.$cmdNext.'</a>&nbsp;';					$links .= '<a href="javascript:table_change_page(\''.$this->form_name.'\',\''.$this->attributes['id'].'\','.$last_page.', '.$this->offset.');">&gt&gt</a>';				}else				{					$links .= '<font color="#cccccc">'.$cmdNext.' &gt&gt</font>';				}				$links .= '</td><td align="right"><a class="normal" href="javascript:table_change_page(\''.$this->form_name.'\',\''.$this->attributes['id'].'\',0,0);">'.$cmdShowAll.'</a></td></tr></table>';				$links =   '<tr><td colspan="99" height="20">'.$links.'</td></tr>';					}		}		return $links;	}}class table_row extends html_element{	var $id;	var $cells = array();	var $table;	var $selected = false;		/*	* Constructor.	*	* @param id id tag of the tr element. Must be unique	* @param value Often the same as id but sometimes you want to have duplicate values.	*	*	 @return void	*/		function table_row($id='', $value= '')	{		if($value == '')		{			$value = $id;		}				$this->value = $value;			$this->tagname = 'tr';				$this->set_linebreak("\n");				if($id != '')		{			$this->set_attribute('id', $id);		}	}		function set_selected()	{		$this->selected = true;	}			function add_cell($cell)	{		$this->cells[] = $cell;	}		function unshift_cell($cell)	{		array_unshift($this->cells, $cell);	}	function get_html()	{		$row = '';		if(!empty($this->attributes['id']) && isset($this->table))		{			$checkbox = new checkbox('dtcb_'.$this->attributes['id'], $this->table->attributes['id'].'[selected][]', $this->value);			$checkbox->set_attribute('onclick', 'javascript:table_update_class(this, \''.addslashes($this->attributes['id']).'\')');			if($this->selected)			{				$checkbox->set_attribute('checked','checked');				$this->set_attribute('class', 'SelectedRow');			}						$checkbox->set_attribute('style', 'display:none;');			$row .=$checkbox->get_html().$this->lb;		}				$row .= '<tr';				if(!empty($this->attributes['id']) && 				!isset($this->attributes['onclick']) && isset($this->table)		)		{			$this->set_attribute('onclick', 'javascript:table_select(event, \''.				$this->table->form_name.'\',\''.				$this->table->attributes['id'].'\',\''.				addslashes($this->attributes['id']).'\','.				($this->table->multiselect ? 'true' : 'false').','.				$_SESSION['GO_SESSION']['use_checkbox_select'].');');		}						foreach($this->attributes as $name=>$value)		{			$row .= ' '.$name.'="'.$value.'"';		}		$row .= '>'.$this->lb;				/*		Removed foreach statement because this caused a lot of memory usage		Too bad the state of the object is lost when get_html() is called now*/		//foreach($this->cells as $cell)		while($cell = array_shift($this->cells))		{			$row .= $cell->get_html();		}				$row .= '</tr>'.$this->lb;				return $row;	}}class table_cell extends html_element{	var $sort_name = '';	var $innerHTML = '';		function table_cell($sort_name='', $innerHTML='')	{		$this->tagname = 'td';				$this->set_linebreak("\n");				$this->sort_name = $sort_name;		$this->innerHTML = empty($innerHTML) ? $sort_name : $innerHTML;	}	function get_html()	{			$html = '<td';						foreach($this->attributes as $name=>$value)			{				$html .= ' '.$name.'="'.$value.'"';			}			$html .= '>'.$this->lb.$this->innerHTML.'</td>'.$this->lb;						return $html;	}}class table_heading extends html_element{	var $sort_name = '';	var $name = '';		function table_heading($name='', $sort_name='')	{		$this->tagname = 'th';				$this->set_linebreak("\n");				$this->sort_name = $sort_name;		$this->name = $this->innerHTML = $name;	}}?>

⌨️ 快捷键说明

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