function header_row() { echo "<tr>\n"; column_header("Work For", "requester_name"); if ("{$GLOBALS['org_code']}" == "") { column_header("Org.", "abbreviation"); } column_header("WR #", "request_timesheet.request_id"); column_header("Done On", "work_on"); column_header("Duration", "work_quantity"); column_header("Rate", "work_rate"); column_header("Review?", "review_needed"); if ("{$GLOBALS['uncharged']}" == "") { column_header("Charged on", "work_charged"); } column_header("Description", "work_description"); column_header("Request", "brief"); echo "</tr>"; }
function header_row() { global $format, $columns, $available_columns; // We want to use nice column names, but sometimes we have to // sort by something else (e.g. case insensitive) $nice_names = array("request_for" => "lfull", "request_by" => "lby_fullname", "brief" => "lbrief", "status" => "status_desc", "type" => "request_type_desc", "tags" => "request_tags", "last_change" => "request.last_activity"); echo "<tr>\n"; reset($columns); while (list($k, $v) = each($columns)) { if ($v == "0" || $v == "off") { continue; } $real_name = $v; if (isset($nice_names[$v])) { $real_name = $nice_names[$v]; } column_header($available_columns[$real_name], $real_name); } echo "</tr>"; }
function header_row() { echo "<tr>\n"; column_header("Work For", "requester_name"); if (isset($GLOBALS[org_code]) && $GLOBALS[org_code] > 0) { column_header("Org.", "abbreviation"); } column_header("WR #", "request_timesheet.request_id"); column_header("Done On", "work_on"); column_header("Duration", "work_quantity"); column_header("Rate", "request_timesheet.work_rate"); column_header("Done By", "worker_name"); if ("{$GLOBALS['uncharged']}" == "") { column_header("Charged on", "work_charged"); } column_header("Description", "work_description"); column_header("Request", "brief"); column_header("Review?", "review_needed"); column_header("OK to charge", ""); column_header("Invoice", "charged_details"); column_header("Amount", "charged_amount"); column_header("Charged On", "work_charged"); echo "</tr>"; }
function get_table($table){ $header=$table['row_first']; $matrix=$table['matrix']; $matrix_appearance=$table['matrix_appearance']; $matrix_links=$table['matrix_links']; $matrix_html=$table['matrix_html']; $sort=$table['sort']; $sort_direction=$table['sort_direction']; $matrix_properties=@$table['matrix_properties']; $row_height=@$table['rows']['height']; if(count($table['matrix'])>0){ //Открывает таблицу $html="<table cellspacing='0' cellpadding='1' border='1' class='data'>"; //Открываем строку $html.="<tr>"; //Строим заголовок таблицы foreach($header as $column_name=>$column_user_name){ $width=@$table['columns'][$column_name]['width']; if(@$table['columns'][$column_name]['input_type']!='hidden'){ $html.="<th style='width:$width;'>".column_header($column_name, $column_user_name, $sort, $sort_direction)."</th>"; }else{ $html.=""; } } //Закрываем строку $html.="</tr>"; //Остальные строки (не головные) foreach($matrix as $row=>$columns) { //'open row' $html.="<tr>"; //look over columns for current row foreach($columns as $column=>$value){ $input_width=@$table['columns'][$column]['input_width']; if(@$_GET['regime']=="read" || $table['type']=='readonly'){ if(@$table['columns'][$column]['input_type']!='hidden'){ $html.="<td style='{$matrix_appearance[$row][$column]};height:$row_height;padding-left:8px;'>"; if(isset($matrix_links[$row][$column])) $html.="<a href='{$matrix_links[$row][$column]}' class='no_underlined'>"; if(@$table['columns'][$column]['type']=="date"){ if(date("d.m.Y", strtotime($value))=="31.12.1969"){ $html.=""; }else{ $html.=date("d.m.Y", strtotime($value)); } }else{ $html.=$value; } if(isset($matrix_links[$row][$column])) $html.="</a>"; $html.="</td>"; }else{ $html.=""; } }else{ if(@$table['columns'][$column]['input_type']!='hidden'){ $html.="<td style='{$matrix_appearance[$row][$column]['td']['style']};height:$row_height;padding-left:5px;'>"; }else{ $html.=""; } //Для полей типа "Дата" if(@$table['columns'][$column]['type']=="date"){ if(date("d.m.Y", strtotime($value))=="31.12.1969"){ $date_html=""; }else{ $date_html=date("d.m.Y", strtotime($value)); } if(isset($matrix_links[$row][$column])){ $html.="<a href='{$matrix_links[$row][$column]['href']}' style='{$matrix_appearance[$row][$column]['style']}' class='no_underlined' onclick='{$matrix_appearance[$row][$column]['onclick']}'>".$date_html."</a>"; }else{ $html.="<input name='Form[$row][$column]' value='".$date_html."' class='datepickerTimeField' style='{$matrix_appearance[$row][$column]['input']['style']};margin:0;padding:0;border:0px;width:$input_width;'>"; } //Для полей типа "Hidden" }elseif(@$table['columns'][$column]['input_type']=='hidden'){ $html.="<input type='hidden' name='Form[$row][$column]' value='$value' style=''>"; //Для полей типа "Текст" }else{ if(isset($matrix_links[$row][$column])){ $html.="<a href='{$matrix_links[$row][$column]['href']}' style='{$matrix_appearance[$row][$column]['style']}' class='no_underlined' onclick='{$matrix_appearance[$row][$column]['onclick']}'>".$value."</a>"; }elseif(isset($matrix_html[$row][$column])){ $html.=$value; }else{ $html.="<input type='text' name='Form[$row][$column]' value='$value' style='{$matrix_appearance[$row][$column]['input']['style']};margin:0;padding:0;border:5px;width:$input_width;'>"; //Специально закомментирован. Варик был для автосохранения после изменения любого поля onChange=\"document.getElementById('Form').submit(); Плох тем, что страница откручивается назад каждый раз. } } if(@$table['columns'][$column]['input_type']!='hidden'){ $html.="</td>"; }else{ $html.=""; } } } //Закрываем строку $html.="</tr>"; } //Закрываем таблицу $html.="</table>"; }else{ $html.="<div class='clr'>В таблице отсутствуют записи.</div>"; } //Кнопка "Сохранить" if($table['save_button'] && get_user_group($_SESSION['user'])=="writer"){ if(@$_GET['regime']=='read'){ $html.=""; }else{ $html.="<br/><input type='submit' value='Сохранить'>"; } } //Возвращаем HTML return $html; }
<th><?php echo column_header(group_label(), 'den'); ?> </th> <?php if ($use_subgroups) { echo '<th>' . subgroup_label() . '</th>'; } ?> <th><?php echo column_header('Car Number', 'car'); ?> </th> <th>Photo</th> <th><?php echo column_header('Last Name', 'name'); ?> </th> <th>First Name</th> <th>Car Name</th> <th>Passed?</th> <?php if ($xbs) { echo '<th>' . $xbs_award_name . '</th>'; } ?> </tr> </thead> <tbody> <?php