noalyss Version-9
Static Public Member Functions
Html_Table Class Reference

contains HTML features More...

+ Collaboration diagram for Html_Table:

Static Public Member Functions

static sql2table ($cn, $a_col, $sql, $table_style='class="result"', $a_sql_var=null)
 
static test_me ()
 

Detailed Description

contains HTML features

Definition at line 30 of file html_table.class.php.

Member Function Documentation

◆ sql2table()

static Html_Table::sql2table (   $cn,
  $a_col,
  $sql,
  $table_style = 'class="result"',
  $a_sql_var = null 
)
static
 @brief Receives a SQL command and returns a string with the HTML code
 to display it as a table.
 Simple table without any feature (link in certain cell, sort,...)
 @param $cn database object
 @param $a_col header of the column it is an array of array
        indexes are link, name,image, style
 @param $sql query to execute
 @param $table_style style of the table
 @parm $a_sql_var array variable for the $sql DEFAULT NULL
static function test_me()
{
$order=" order by f_id desc ";
$url=HtmlInput::get_to_string(array("gDossier","test_select"));
if ( isset($_GET['sb']))
{
$order=" order by f_id";
$img="image/select1.gif";
}
else
{
$url=$url."&sb=as";
$img="image/select2.gif";
}
$sql="select f_id,name,quick_code from vw_client $order limit 10";
echo $sql;
array(
array('name'=>'N° de fiche',
'style'=>'text-align:right',
'link'=>$url,
'image'=>$img),
array('name'=>'Nom',
'style'=>'text-align:right'),
array('name'=>'QuickCode')
)
,
);
}
$url
$_GET['qcode']
static connect()
static sql2table($cn, $a_col, $sql, $table_style='class="result"', $a_sql_var=null)
static test_me()
static get_to_string($array, $start="?")
transform $_GET data to string
$img

Definition at line 79 of file html_table.class.php.

80 {
81 $r='';
82 $r=sprintf('<table %s>',$table_style);
83 $r.='<tr>';
84 for ( $i=0;$i <count($a_col);$i++)
85 {
86 $content=h($a_col[$i]['name']);
87 $style=(isset($a_col[$i]['style']))?$a_col[$i]['style']:"";
88 if ( isset($a_col[$i]['image']) && $a_col[$i]['image'] != '')
89 {
90 $content=sprintf('<img src="%s" border="0"></img>%s',$a_col[$i]['image'],$content);
91 }
92 if ( isset($a_col[$i]['link']) )
93 {
94 $content=sprintf('<a href="%s">%s</a>',
95 $a_col[$i]['link'],
96 $content);
97 $r.="<th $style>$content</th>";
98 }
99 else
100 $r.= "<th $style>". h($content)."</th>";
101 }
102 $r.='</tr>';
103 $ret=$cn->exec_sql($sql,$a_sql_var);
104 for ($i=0;$i<Database::num_row($ret);$i++)
105 {
106 $r.='<tr>';
108 for ($e=0;$e<count($row);$e++)
109 {
110 $style='';$content=h($row[$e]);
111
112 if ( isset($a_col[$e]['style']) )
113 $style=$a_col[$e]['style'];
114 if ( isset ($a_col[$e]['raw']))
115 $r.='<td $style>'.$row[$e].'</td>';
116 else
118 }
119 $r.='</tr>';
120 }
121 $r.='</table>';
122 return $r;
123 }
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
h( $row[ 'oa_description'])
static fetch_row($ret, $p_row)
wrapper for the function pg_fetch_row
static num_row($ret)
wrapper for the function pg_num_rows
$content
Definition: xml.php:17

References $a_col, $cn, $content, $e, $i, $r, $ret, $row, $sql, $style, DatabaseCore\fetch_row(), h, DatabaseCore\num_row(), and td().

Referenced by test_me().

+ Here is the call graph for this function:

◆ test_me()

static Html_Table::test_me ( )
static

Definition at line 124 of file html_table.class.php.

125 {
127 $order=" order by f_id desc ";
128 $url=HtmlInput::get_to_string(array("gDossier","test_select"));
129
130 if ( isset($_GET['sb']))
131 {
132 $order=" order by f_id";
133 $img="image/select1.gif";
134 }
135 else
136 {
137 $url=$url."&sb=as";
138 $img="image/select2.gif";
139 }
140 $sql="select f_id,name,quick_code from vw_client $order limit 10";
141 echo $sql;
142
143
145 array(
146 array('name'=>'N° de fiche',
147 'style'=>'text-align:right',
148 'link'=>$url,
149 'image'=>$img),
150 array('name'=>'Nom',
151 'style'=>'text-align:right'),
152 array('name'=>'QuickCode')
153 )
154 ,
155 $sql
156 );
157 }

References $_GET, $cn, $img, $order, $sql, $url, Dossier\connect(), HtmlInput\get_to_string(), and sql2table().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: