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

📄 datatable.class.inc

📁 国外很不错的一个开源OA系统Group-Office
💻 INC
📖 第 1 页 / 共 2 页
字号:
	{		return 'document.forms[\''.$this->form_name.'\'].elements[\''.$this->attributes['id'].'[task]\']';	}	function get_html()	{		if($this->remind_selected)		{			$this->hidden_selected = array_map('smart_stripslashes',$this->selected);		}		$table = '<input type="hidden" name="'.$this->attributes['id'].'[sort_ascending]" value="'.$this->sort_ascending.'" />'.$this->lb;		$table .= '<input type="hidden" name="'.$this->attributes['id'].'[sort_index]"  value="'.$this->sort_index.'" />'.$this->lb;		$table .= '<input type="hidden" name="'.$this->attributes['id'].'[offset]"  value="'.$this->offset.'" />'.$this->lb;		$table .= '<input type="hidden" name="'.$this->attributes['id'].'[start]"  value="'.$this->start.'" />'.$this->lb;		$table .= '<input type="hidden" name="'.$this->attributes['id'].'[task]"  value="" />'.$this->lb;		if(!isset($this->attributes['class']))		{			$this->set_attribute('class','go_table');		}		$table .= '<table';		foreach($this->attributes as $name=>$value)		{			$table .= ' '.$name.'="'.$value.'"';		}		$table .= '>'.$this->lb;		$table .= $this->get_headings();		$table .= $this->get_rows();		if(isset($this->footer))		{			$table .= $this->footer->get_html();		}		$table .= $this->get_pagination();		$table .= '</table>'.$this->lb;		$table .= $this->get_hidden_rows();		return $this->outerHTML.$table;	}	function get_headings()	{		global $GO_THEME, $GO_CONFIG;		$select_all_checkbox = new input('checkbox', 'dummy');		$select_all_checkbox->set_attribute('class','');		$select_all_checkbox->set_attribute('style','margin:0px;padding:0px;');		$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;');		$available_columns=array();		$headings = '';		foreach($this->headings as $key=>$heading)		{			$available_columns[]=$key.':'.base64_encode($heading->config_name);			if(!$this->allow_configuration)			{				$this->enabled_columns[]=$key;			}		}		$enabled_columns=$this->enabled_columns;		$this->enabled_columns=array();		foreach($enabled_columns as $column_index)		{			if(isset($this->headings[$column_index]))			{				$this->enabled_columns[]=$column_index;				$heading = $this->headings[$column_index];				if(empty($heading->sort_name) && $this->autosort)				{					$heading->sort_name = $column_index;				}				$headings .= '<th';				foreach($heading->attributes as $name=>$value)				{					$headings .= ' '.$name.'="'.$value.'"';				}				$headings .= '>';				if(empty($heading->name) && !isset($checkbox_added) && $this->multiselect)				{					$checkbox_added=true;					$headings .= $select_all_checkbox->get_html();				}else {					if(!isset($checkbox_added) && $this->multiselect)					{						$headings .= '<table cellpadding="0" cellspacing="0"><tr><td>'.$select_all_checkbox->get_html().'</td><td>';					}					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;					}					if(!isset($checkbox_added) && $this->multiselect)					{						$checkbox_added = true;						$headings .= '</td></tr></table>';					}				}				$headings .= '</th>'.$this->lb;			}		}		if(!empty($headings))		{			$headings = '<tr>'.$this->lb.$headings;			if($this->allow_configuration)			{				$headings .= '<th style="width:20px;"><a href="javascript:popup(\''.$GO_CONFIG->control_url.'table_config.php?table_id='.urlencode($this->attributes['id']).'&available_columns='.implode(';',$available_columns).'\',\'400\',\'400\');">'.				'<img src="'.$GO_THEME->images['configuration'].'" style="border:0px;height:16px;width:16px;" />'.				'</a></th>'.$this->lb;			}			$headings .= '</tr>'.$this->lb;			return $headings;		}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;	}}

⌨️ 快捷键说明

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