samedi 5 mars 2016

How to show checked checkbox values in codigniter for print?

My question is how to show only checked elements in table to print. The print div is workink fine, but all rows printed. I like print the selected rows. Eg. I check multiple select rows, shoving the print_div.

Here the code:

<table class="table table-bordered footable">
                  <thead>
                    <tr>
                        <th class="control" >Select</th>
                        <th class="control" >ID</th>
                        <th><?php echo lang('Address');?></th>
                        <!-- Dynamic generated -->
                        <?php foreach($this->option_m->get_visible($content_language_id) as $row):?>

                        <th data-hide="phone"><?php echo $row->option?></th>
                        <?php endforeach;?>

                        <!-- End dynamic generated -->
                        <th class="control noPrint" data-hide="phone"><?php echo lang_check('Preview');?></th>
                        <th class="control noPrint"><?php echo lang('Edit');?></th>
                        <?php if(check_acl('party/delete')):?><th class="control noPrint"><?php echo lang('Delete');?></th><?php endif;?>
                    </tr>
                  </thead>
                  <tbody>
                    <?php if(count($partys)): foreach($partys as $party):?>
                                <tr>
                                    <td><label><input type="checkbox" value="<?php echo $party->id?>" /></label></td>
                                    <td><?php echo $party->id?></td>
                                    <td>
                                    <?php echo anchor('admin/party/edit/'.$party->id, $party->address)?>
                                    <?php if($party->is_activated == 0):?>
                                    &nbsp;&nbsp;&nbsp;&nbsp;<span class="label label-danger"><?php echo lang_check('Not Activated')?></span>
                                    <?php endif;?>
                                    <?php if(isset($settings['listing_expiry_days']) && $settings['listing_expiry_days'] > 0 && strtotime($party->date_modified) <= time()-$settings['listing_expiry_days']*86400): ?>
                                    &nbsp;&nbsp;&nbsp;&nbsp;<span class="label label-warning"><?php echo lang_check('Expired'); ?></span>
                                    <?php endif; ?>
                                    <?php if(!empty($party->activation_paid_date)):?>
                                    &nbsp;&nbsp;&nbsp;&nbsp;<span class="label label-success"><?php echo lang_check('Paid'); ?></span>
                                    <?php endif; ?>
                                    </td>
                                    <!-- Dynamic generated -->
                                    <?php foreach($this->option_m->get_visible($content_language_id) as $row):?>
                                    <td>
                                    <?php
                                        echo $this->party_m->get_field_from_listing($party, $row->option_id);
                                    ?>
                                    </td>
                                    <?php endforeach;?>
                                    <!-- End dynamic generated -->
                                    <td class="noPrint"><a class="btn btn-info" target="_blank" href="<?php echo site_url((config_item('listing_uri')===false?'club':config_item('listing_uri')).'/'.$party->id);?>"><i class="icon-search"></i></a></td>
                                    <td class="noPrint"><?php echo btn_edit('admin/party/edit/'.$party->id)?></td>
                                    <?php if(check_acl('party/delete')):?><td class="noPrint"><?php echo btn_delete('admin/party/delete/'.$party->id)?></td><?php endif;?>
                                </tr>
                    <?php endforeach;?>
                    <?php else:?>
                                <tr>
                                    <td colspan="20"><?php echo lang('We could not find any');?></td>
                                </tr>
                    <?php endif;?>           
                  </tbody>
                </table>

                <div style="text-align: center;"><?php echo $pagination; ?></div>


            </div>
            </div>


           <!-- Print Div-->

            <div id="div_print" style="visibility:hidden;background-color:#fff;">
            <center><img src="<?php echo base_url('assets/logo.png');?>" alt="Logo" /></center>

           <div class="widget wred">
            <div class="widget-head">
              <div class="pull-left">Party Address List</div>
              <div class="widget-icons pull-right">
                <i class="icon-chevron-up"></i> 
              </div>
              <div class="clearfix"></div>
            </div>          
                <table class="table table-bordered footable">
                  <thead>
                    <tr>

                        <th>#</th>
                        <th><?php echo lang('Address');?></th>
                        <!-- Dynamic generated -->
                        <?php foreach($this->option_m->get_visible($content_language_id) as $row):?>

                        <th><?php echo $row->option?></th>
                        <?php endforeach;?>


                    </tr>
                  </thead>
                  <tbody>
                    <?php if(count($partys)): foreach($partys as $party):?>


                                <tr>
                                    <td><?php echo $party->id?></td>
                                    <td>
                                    <?php echo $party->address?>
                                    <?php if($party->is_activated == 0):?>
                                    &nbsp;&nbsp;&nbsp;&nbsp;<span class="label label-danger"><?php echo lang_check('Not Activated')?></span>
                                    <?php endif;?>
                                    <?php if(isset($settings['listing_expiry_days']) && $settings['listing_expiry_days'] > 0 && strtotime($party->date_modified) <= time()-$settings['listing_expiry_days']*86400): ?>
                                    &nbsp;&nbsp;&nbsp;&nbsp;<span class="label label-warning"><?php echo lang_check('Expired'); ?></span>
                                    <?php endif; ?>
                                    <?php if(!empty($party->activation_paid_date)):?>
                                    &nbsp;&nbsp;&nbsp;&nbsp;<span class="label label-success"><?php echo lang_check('Paid'); ?></span>
                                    <?php endif; ?>
                                    </td>
                                    <!-- Dynamic generated -->
                                    <?php foreach($this->option_m->get_visible($content_language_id) as $row):?>
                                    <td>
                                    <?php
                                        echo $this->party_m->get_field_from_listing($party, $row->option_id);
                                    ?>
                                    </td>
                                    <?php endforeach;?>
                                    <!-- End dynamic generated -->

                                </tr>
                    <?php endforeach;?>
                    <?php else:?>
                                <tr>
                                    <td colspan="20">No printable element!</td>
                                </tr>
                    <?php endif;?>           
                  </tbody>
                </table>
                </div>

                <!-- Print Div Finish--> 

Please help me! Thanks.




Aucun commentaire:

Enregistrer un commentaire