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


PHP DataObjectSet::setPaginationGetVar方法代码示例

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


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

示例1: parseResults

 protected function parseResults(RestfulService_Response $results)
 {
     $data = new DataObjectSet();
     // Parse out items in the request element so we can create pager and other items.
     $request = $results->xpath('/shrs/rq');
     $request = $request[0];
     $rqTitle = $request->xpath('t');
     $rqDate = $request->xpath('dt');
     $rqStart = $request->xpath('si');
     $rqCount = $request->xpath('rpd');
     $rqTotal = $request->xpath('tr');
     $rqTotalViewable = $request->xpath('tv');
     $rqTotalViewable = intval($rqTotalViewable[0]);
     $this->searchTitle = strval($rqTitle[0]);
     $records = $results->xpath('/shrs/rs/r');
     $zebra = 0;
     foreach ($records as $rec) {
         // create an empty dataobject to hold the job data
         $job = array();
         // get each data node from the xml
         $title = $rec->xpath('jt');
         $company = $rec->xpath('cn');
         $source = $rec->xpath('src');
         $type = $rec->xpath('ty');
         $location = $rec->xpath('loc');
         $seen = $rec->xpath('ls');
         $posted = $rec->xpath('dp');
         $excerpt = $rec->xpath('e');
         // create new fields for each piece of data in the dataobject
         $job['ID'] = new Text(NULL);
         $job['ID']->setValue(md5(strval($title[0])));
         $job['Title'] = new Text(NULL);
         $job['Title']->setValue(strval($title[0]));
         $job['Company'] = new Text(NULL);
         $job['Company']->setValue(strval($company[0]));
         $job['Source'] = new Text(NULL);
         // Need to grab the url attribute from the source element.
         $srcAttribs = $source[0]->attributes();
         $job['Source']->setValue(strval($srcAttribs['url']));
         $job['Location'] = new Text(NULL);
         $job['Location']->setValue(strval($location[0]));
         $job['LastSeen'] = new SS_DateTime();
         $job['LastSeen']->setValue(strval($seen[0]));
         $job['DatePosted'] = new SS_DateTime();
         $job['DatePosted']->setValue(strval($posted[0]));
         $job['Excerpt'] = new HTMLText();
         $job['Excerpt']->setValue('<p>' . strval($excerpt[0]) . '</p>');
         $job['Zebra'] = !$zebra ? 'odd' : 'even';
         $zebra = !$zebra ? 1 : 0;
         $data->push(new ArrayData($job));
         unset($job, $title, $company, $source, $type, $location, $seen, $posted, $excerpt);
     }
     $data->setPageLimits($this->page, $this->window, $rqTotalViewable);
     $data->setPaginationGetVar($this->pageVar);
     return $data;
 }
开发者ID:r0nn1ef,项目名称:SilverStripe-Jobamatic-Module,代码行数:56,代码来源:SimplyHiredService.php


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