当前位置: 首页>>代码示例>>PHP>>正文


PHP pagination::nav_bar方法代码示例

本文整理汇总了PHP中pagination::nav_bar方法的典型用法代码示例。如果您正苦于以下问题:PHP pagination::nav_bar方法的具体用法?PHP pagination::nav_bar怎么用?PHP pagination::nav_bar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pagination的用法示例。


在下文中一共展示了pagination::nav_bar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildEditTable

 public static function buildEditTable($formID)
 {
     $form = self::get($formID);
     // Get all objects from this form
     $objects = objects::getAllObjectsForForm($formID);
     $objects = objects::sort($objects, $form['objectTitleField']);
     // If the data is too large, setup pagination
     if (sizeof($objects) > mfcs::config("metadataPageCount")) {
         $pagination = new pagination(sizeof($objects));
         $pagination->itemsPerPage = mfcs::config("metadataPageCount");
         $pagination->currentPage = isset(mfcs::$engine->cleanGet['MYSQL'][$pagination->urlVar]) ? mfcs::$engine->cleanGet['MYSQL'][$pagination->urlVar] : 1;
         $startPos = $pagination->itemsPerPage * ($pagination->currentPage - 1);
         $objects = array_slice($objects, $startPos, $pagination->itemsPerPage);
     }
     if (count($objects) > 0) {
         $headers = array();
         $headers[] = "Delete";
         foreach ($form['fields'] as $field) {
             $headers[] = $field['label'];
         }
         if (forms::isMetadataForm($formID) === TRUE) {
             $headers[] = "Search";
             $headers[] = "Move";
         }
         $tableRows = array();
         for ($I = 0; $I < count($objects); $I++) {
             $temp = array();
             $temp[] = sprintf('<input type="checkbox" name="delete[]" value="%s"', $objects[$I]['ID']);
             foreach ($form['fields'] as $field) {
                 $temp[] = sprintf('<input type="%s" style="%s" name="%s_%s" value="%s" />', $field['type'], $field['style'], $field['name'], $objects[$I]['ID'], isset($objects[$I]['data'][$field['name']]) ? htmlSanitize($objects[$I]['data'][$field['name']]) : "");
             }
             if (forms::isMetadataForm($formID) === TRUE) {
                 $temp[] = sprintf('<a href="%sdataView/list.php?listType=metadataObjects&amp;formID=%s&amp;objectID=%s">Find Objects</a>', localvars::get('siteRoot'), htmlSanitize($formID), $objects[$I]['ID']);
                 $temp[] = sprintf('<a href="%sdataEntry/move.php?objectID=%s">Move</a>', localvars::get('siteRoot'), $objects[$I]['ID']);
             }
             $tableRows[] = $temp;
         }
         $table = new tableObject("array");
         $table->summary = "Object Listing";
         $table->class = "tableObject table table-striped table-bordered";
         $table->headers($headers);
         $output = "";
         // Add in pagination bar
         if (isset($pagination)) {
             $output .= $pagination->nav_bar();
         }
         $output .= sprintf('<form action="%s?formID=%s" method="%s" name="updateForm" data-formid="%s">', $_SERVER['PHP_SELF'], htmlSanitize($formID), "post", mfcs::$engine->openDB->escape($formID));
         $output .= sessionInsertCSRF();
         $output .= $table->display($tableRows);
         $output .= '<input type="submit" name="updateEdit" value="Update" class="btn" />';
         $output .= "</form>";
         // Add in pagination bar
         if (isset($pagination)) {
             $output .= $pagination->nav_bar();
         }
         return $output;
     } else {
         return "No data entered for this Metadata Form.";
     }
 }
开发者ID:PseudoAj,项目名称:mfcs,代码行数:60,代码来源:forms.php

示例2: createTable

 private static function createTable($data, $headers = NULL, $pagination = TRUE, $formID = NULL)
 {
     $table = new tableObject("array");
     $table->summary = "Object Listing";
     $table->sortable = FALSE;
     $table->class = "table table-striped table-bordered";
     $table->id = "objectListingTable";
     $table->layout = TRUE;
     if (isnull($headers)) {
         $headers = array();
         $headers[] = "System IDNO";
         $headers[] = "Form IDNO";
         $headers[] = "Title";
         $headers[] = "View";
         $headers[] = "Edit";
         // $headers[] = "Revisions";
     }
     $table->headers($headers);
     $userPaginationCount = users::user('pagination', 25);
     if ($pagination && sizeof($data) > $userPaginationCount) {
         $engine = mfcs::$engine;
         $pagination = new pagination(sizeof($data));
         $pagination->itemsPerPage = $userPaginationCount;
         $pagination->currentPage = isset($engine->cleanGet['MYSQL'][$pagination->urlVar]) ? $engine->cleanGet['MYSQL'][$pagination->urlVar] : 1;
         $startPos = $userPaginationCount * ($pagination->currentPage - 1);
         $dataNodes = array_slice($data, $startPos, $userPaginationCount);
         $tableHTML = $table->display($dataNodes);
         $tableHTML .= $pagination->nav_bar();
         $tableHTML .= sprintf('<p><span class="paginationJumpLabel">Jump to Page:</span> %s</p>', $pagination->dropdown());
         $tableHTML .= sprintf('<p><span class="paginationJumpLabel">Records per page:</span> %s</p>', $pagination->recordsPerPageDropdown());
         $tableHTML .= sprintf('<p><form id="jumpToIDNOForm"><span class="paginationJumpLabel">Jump to IDNO:</span> <input type="text" name="jumpToIDNO" id="jumpToIDNO" data-formid="%s" value="" /></form></p>', isnull($formID) ? "" : htmlSanitize($formID));
         return $tableHTML;
     } else {
         return $table->display($data);
     }
 }
开发者ID:PseudoAj,项目名称:mfcs,代码行数:36,代码来源:list.php


注:本文中的pagination::nav_bar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。