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


PHP PaginatedList::first方法代码示例

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


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

示例1: DataObjectsToBeUpdated

 public function DataObjectsToBeUpdated()
 {
     if (!self::$objects) {
         $table = $this->SecureTableToBeUpdated();
         $field = $this->SecureFieldToBeUpdated();
         $where = '';
         if (isset($this->requestParams["where"]) && $this->requestParams["where"]) {
             $where = urldecode($this->requestParams["where"]);
         }
         $sort = '';
         if (isset($this->requestParams["sort"]) && $this->requestParams["sort"]) {
             $sort = urldecode($this->requestParams["sort"]);
         }
         $titleField = 'Title';
         if (isset($this->requestParams["titlefield"]) && $this->requestParams["titlefield"]) {
             $titleField = urldecode($this->requestParams["titlefield"]);
         }
         $start = 0;
         if (isset($this->requestParams["start"])) {
             $start = intval($this->requestParams["start"]);
         }
         if (isset($_GET["debug"])) {
             print_r("SELECT * FROM {$table} {$where} SORT BY {$sort} LIMIT {$start}, " . Config::inst()->get("DataObjectOneFieldUpdateController", "page_size"));
         }
         $dataList = $table::get()->where($where)->sort($sort);
         $objects = new PaginatedList($dataList, $this->request);
         $objects->setPageLength(Config::inst()->get("DataObjectOneFieldUpdateController", "page_size"));
         $arrayList = new ArrayList();
         if ($objects->count()) {
             $testObject = $objects->first();
             if (!$testObject->canEdit()) {
                 Security::permissionFailure($this, _t('Security.PERMFAILURE', ' This page is secured and you need administrator rights to access it. Enter your credentials below and we will send you right along.'));
                 return;
             }
             foreach ($objects as $obj) {
                 $obj->FormField = $obj->dbObject($field)->scaffoldFormField();
                 $obj->FormField->setName($obj->ClassName . "/" . $obj->ID);
                 //3.0TODO Check that I work vvv.
                 $obj->FormField->addExtraClass("updateField");
                 $obj->FieldToBeUpdatedValue = $obj->{$field};
                 $obj->FormField->setValue($obj->{$field});
                 $arrayList->push(new ArrayData(array("FormField" => $obj->FormField, "MyTitle" => $obj->{$titleField}())));
             }
         }
         self::$objects = $arrayList;
         self::$objects_without_field = $objects;
     }
     return self::$objects;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-dataobjectsorter,代码行数:49,代码来源:DataObjectOneFieldUpdateController.php


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