當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。