Esempio n. 1
0
} else {
    echo "<li class='disabled'><a href='#'>&laquo;</a></li>";
}
// pages link
for ($i = 1; $i <= $pagination->total_pages(); $i++) {
    if ($i == $pagination->current_page) {
        echo '<li class="active"><a href="#">' . $i . '</a></li>';
    } else {
        $arr = array("currentPage" => $i);
        echo '<li><a href="' . appendToCurrentUri($arr) . '">' . $i . '</a></li>';
    }
}
//next link
if ($pagination->has_next_page()) {
    $arr = array("currentPage" => $pagination->next_page());
    echo '<li><a href="' . appendToCurrentUri($arr) . '">&raquo;</a></li>';
} else {
    echo "<li class='disabled'><a href='#'>&raquo;</a></li>";
}
?>
        </ul>
    </div>
    <?php 
// results per page selector
echo "<div class='col-sm-3 pagination-info'>";
echo "<form id='paginationForm' method='post'><p><label for='res_per_page'>Max. Results per Page: <input id='res_per_page' name='res_per_page' value='" . $pagination->per_page . "'></label></p></form>";
echo "</div>";
// show feedback about how many results are there and .....
$resultStart = $pagination->offset() + 1;
$resultEnd = $pagination->offset() + $pagination->per_page;
if ($resultEnd > $pagination->total_count) {
Esempio n. 2
0
 public function getHtmlTable($sql, $config = array())
 {
     // find the mySQL data
     $resource = $this->query($sql);
     // number of columns
     $output['numFields'] = $numfields = mysqli_num_fields($resource);
     // table start
     $output['markup'] = "<table class='table table-primary table-striped table-hover'><thead><tr>";
     // headings in header row
     for ($i = 0; $i < $numfields; $i += 1) {
         $output['fields'][] = $field = mysqli_fetch_field_direct($resource, $i);
         $output['markup'] .= "<th>" . uc_words($field->name) . "</th>";
     }
     // empty header cell for edit & delete button
     if (isset($config['page_id'])) {
         $output['markup'] .= "<th></th>";
     }
     // end of thead
     $output['markup'] .= "</tr></thead><tbody>";
     // flag to indicate if data was found
     $dataFound = false;
     // start of tbody, table rows
     while ($row = mysqli_fetch_assoc($resource)) {
         $dataFound = true;
         $output['markup'] .= "<tr>";
         for ($i = 0; $i < $numfields; $i += 1) {
             $field = mysqli_fetch_field_direct($resource, $i);
             $output['markup'] .= "<td><span " . $this->getHtmlAttributes($field, $row) . ">" . $row[$field->name] . "</span></td>";
         }
         if (isset($config['page_id'])) {
             // delete button
             $href = appendToCurrentUri(array('record_id' => $row['id'], 'delete' => 'true'));
             $delete_link = "<a href='" . $href . "' class='danger_link' data-recId='" . encrypt($field->table . "-" . $row['id']) . "'>" . icon("remove") . "</a>";
             // open link
             $href = "recordDetail.php?classname=" . tbl2cls($field->table) . "&recordId=" . $row['id'];
             $openLink = "<a href='" . $href . "' target='blank'>" . icon("folder-open") . "</a>";
             $output['markup'] .= "<td>{$openLink}&nbsp;&nbsp;&nbsp;&nbsp;{$delete_link}</td>";
         }
         $output['markup'] .= "</tr>";
     }
     // Show error if no data was found
     if (!$dataFound) {
         $colspan = isset($config['page_id']) ? $numfields + 1 : $numfields;
         $output['markup'] .= "<tr><td class='warning' colspan='" . $colspan . "'>No Data Found.</td></td></tr>";
     }
     // end of table
     $output['markup'] .= "</tbody></table>";
     return $output;
 }
Esempio n. 3
0
        }
        echo "<td class='hidden-print'>{$openLink}&nbsp;&nbsp;&nbsp;&nbsp;{$delete_link}{$addNewLink}</td>";
        echo "</tr>";
        $count++;
        // special treatment for Fee Vouchers
        if ($record instanceof Fee_voucher) {
            $details = $record->details();
            if ($details) {
                echo "<tr><td colspan='16'>";
                echo "<table width='70%' class='child-table'>";
                echo "<thead>";
                echo "<tr><th>Fee Category</th><th>Amount</th><th>Comments</th><th></th></tr>";
                echo "</thead>";
                foreach ($details as $key => $feeDetail) {
                    // delete link
                    $href = appendToCurrentUri(array('delete' => 'true', 'record_to_del' => $feeDetail->id->val, 'del_class' => 'Fee_voucher_datail'));
                    $delete_link = "<a href='" . $href . "' class='danger_link' data-recId='" . encrypt($feeDetail->id->table . "-" . $feeDetail->id->val) . "'>" . icon("remove") . "</a>";
                    echo "\n                    <tr>\n                        <td>{$feeDetail->fee_category_id->getEditableValue()}</td>\n                        <td>{$feeDetail->amount->getEditableValue()}</td>\n                        <td>{$feeDetail->comments->getEditableValue()}</td>\n                        <td class='hidden-print'>{$delete_link}</td>\n                    </tr>";
                }
                echo "</table>";
                echo "</td></tr>";
            }
        }
        // special treatment for Fee Vouchers end
        if ($classname == "Fee_voucher") {
            echo $tableEnd;
        }
        // we have a different display for vouchers
    }
}
if ($classname != "Fee_voucher") {