View | Details | Raw Unified | Return to bug 10763
Collapse All | Expand All

(-)a/C4/Creators/Lib.pm (-25 / +22 lines)
Lines 479-515 sub get_table_names { Link Here
479
=head2 C4::Creators::Lib::html_table()
479
=head2 C4::Creators::Lib::html_table()
480
480
481
This function returns an arrayref of an array of hashes contianing the supplied data formatted suitably to
481
This function returns an arrayref of an array of hashes contianing the supplied data formatted suitably to
482
be passed off as a T::P template parameter and used to build an html table.
482
be passed off as a template parameter and used to build an html table.
483
483
484
   my $table = html_table(header_fields, array_of_row_data);
484
   my $table = html_table(header_fields, array_of_row_data);
485
   $template->param(
485
   $template->param(
486
       TABLE => $table,
486
       table_loop => $table,
487
   );
487
   );
488
488
489
    html example:
489
    html example:
490
490
491
       <table>
491
        <table>
492
            <!-- TMPL_LOOP NAME="TABLE" -->
492
            [% FOREACH table_loo IN table_loop %]
493
            <!-- TMPL_IF NAME="header_fields" -->
493
                [% IF ( table_loo.header_fields ) %]
494
            <tr>
494
                    <tr>
495
            <!-- TMPL_LOOP NAME="header_fields" -->
495
                        [% FOREACH header_field IN table_loo.header_fields %]
496
                <th><!-- TMPL_VAR NAME="field_label" --></th>
496
                            <th>[% header_field.field_label %]</th>
497
            <!-- /TMPL_LOOP -->
497
                        [% END %]
498
            </tr>
498
                    </tr>
499
            <!-- TMPL_ELSE -->
499
                [% ELSE %]
500
            <tr>
500
                    <tr>
501
            <!-- TMPL_LOOP NAME="text_fields" -->
501
                        [% FOREACH text_field IN table_loo.text_fields %]
502
            <!-- TMPL_IF NAME="select_field" -->
502
                            [% IF ( text_field.select_field ) %]
503
                <td align="center"><input type="checkbox" name="action" value="<!-- TMPL_VAR NAME="field_value" -->" /></td>
503
                                <td><input type="checkbox" name="action" value="[% text_field.field_value %]"></td>
504
            <!-- TMPL_ELSIF NAME="field_value" -->
504
                            [% ELSE %]
505
                <td><!-- TMPL_VAR NAME="field_value" --></td>
505
                                <td>[% text_field.field_value %]</td>
506
            <!-- TMPL_ELSE -->
506
                            [% END %]
507
                <td>&nbsp;</td>
507
                        [% END %]
508
            <!-- /TMPL_IF -->
508
                    </tr>
509
            <!-- /TMPL_LOOP -->
509
                [% END %]
510
            </tr>
510
            [% END %]
511
            <!-- /TMPL_IF -->
512
            <!-- /TMPL_LOOP -->
513
        </table>
511
        </table>
514
512
515
=cut
513
=cut
516
- 

Return to bug 10763