本文整理匯總了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;
}