本文整理汇总了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;
}