本文整理汇总了PHP中sfPropelPager::paging方法的典型用法代码示例。如果您正苦于以下问题:PHP sfPropelPager::paging方法的具体用法?PHP sfPropelPager::paging怎么用?PHP sfPropelPager::paging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfPropelPager
的用法示例。
在下文中一共展示了sfPropelPager::paging方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMainListPanel
public static function getMainListPanel($documentId, $moduleName, $page = 1)
{
$moduleName = strtolower($moduleName);
try {
if ($moduleName == "tag") {
$moduleName = "admin";
}
$mainList = XMLParser::getXMLdataValues(sfConfig::get('sf_root_dir') . "/apps/panel/modules/" . $moduleName . "/config/mainList.xml");
$displayedObjects = array();
foreach ($mainList as $obj) {
if ($obj['tag'] == 'OBJECT' && $obj['type'] == 'complete') {
$displayedObjects[] = $obj['value'];
}
}
$children = array();
$res = array('children', 'paging');
$c = new Criteria();
if (!$documentId) {
$document = Rootfolder::getRootfolderByModule($moduleName);
if ($document) {
$documentId = $document->getId();
}
}
if ($documentId) {
$pager = new sfPropelPager("Relation", 20);
$c->add(RelationPeer::ID1, $documentId);
$c->add(RelationPeer::DOCUMENT_MODEL2, $displayedObjects, Criteria::IN);
if ($moduleName == 'houses' || $moduleName == 'jobs') {
$c->addDescendingOrderByColumn(RelationPeer::ID2);
} else {
$c->addAscendingOrderByColumn(RelationPeer::SORT_ORDER);
}
$pager->setCriteria($c);
$pager->setPage($page);
$pager->init();
foreach ($pager->getResults() as $relation) {
$id = $relation->getId2();
$res['children'][] = Document::getDocumentInstance($id);
}
}
$res['paging'] = $pager->paging(true);
return $res;
} catch (Exception $e) {
throw $e;
}
}
示例2: getMainList
public static function getMainList(&$documentId, $moduleName, $page = 1)
{
$moduleName = strtolower($moduleName);
try {
if ($moduleName == "settings") {
$settingsArr = array();
if (is_readable(sfConfig::get('sf_root_dir') . "/config/settings.xml")) {
$objects = XMLParser::getXMLdataValues(sfConfig::get('sf_root_dir') . "/config/settings.xml");
}
foreach ($objects as $obj) {
if ($obj['tag'] == 'ELEMENT' && $obj['type'] == 'open') {
$objName = $obj['attributes']['LABEL'];
$objDescription = $obj['attributes']['DESCRIPTION'];
}
if ($obj['tag'] == 'ITEM' && $obj['type'] == 'complete') {
//$val = $obj['attributes']['VALUE'];
$settingName = $objName;
//$settingName = strtolower($objName);
$settingsArr[$settingName] = $objDescription;
}
}
$pager = new sfPropelPager("Relation", 20);
$pager->setResults($settingsArr);
$pager->setPage($page);
$pager->init();
foreach ($pager->getResults() as $name => $label) {
$res['children'][$name] = $label;
}
$res['paging'] = $pager->paging(true);
return $res;
}
if ($moduleName == "labels") {
$localesArr = array();
if (is_readable(sfConfig::get('sf_root_dir') . "/config/locales.xml")) {
$objects = XMLParser::getXMLdataValues(sfConfig::get('sf_root_dir') . "/config/locales.xml");
foreach ($objects as $obj) {
if ($obj['tag'] == 'LOCALE' && $obj['type'] == 'open') {
$objName = $obj['attributes']['LABEL'];
if ($obj['attributes']['DESCRIPTION']) {
$objDescription = $obj['attributes']['DESCRIPTION'];
} else {
$objDescription = '[' . $obj['attributes']['LABEL'] . ']';
}
}
if ($obj['tag'] == 'ITEM' && $obj['type'] == 'complete') {
//$val = $obj['attributes']['VALUE'];
$localeName = $objName;
//$localeName = strtolower($objName);
$localesArr[$localeName] = $objDescription;
}
}
}
$pager = new sfPropelPager("Relation", 20);
$pager->setResults($localesArr);
$pager->setPage($page);
$pager->init();
foreach ($pager->getResults() as $name => $label) {
$res['children'][$name] = $label;
}
$res['paging'] = $pager->paging(true);
return $res;
}
$mainList = XMLParser::getXMLdataValues(sfConfig::get('sf_root_dir') . "/apps/panel/modules/" . $moduleName . "/config/mainList.xml");
$displayedObjects = array();
$rootId = null;
foreach ($mainList as $obj) {
if ($obj['tag'] == 'OBJECT' && $obj['type'] == 'complete') {
$displayedObjects[] = $obj['value'];
}
// check overwrite RootID
if ($obj['tag'] == 'OBJECTS' && $obj['type'] == 'open') {
if (array_key_exists("attributes", $obj) && array_key_exists("PARENT", $obj['attributes'])) {
$rootName = $obj['attributes']['PARENT'];
$rootDocument = Rootfolder::getRootfolderByModule($rootName);
if ($rootDocument) {
$rootId = $rootDocument->getId();
}
}
if (array_key_exists("attributes", $obj) && array_key_exists("TAG", $obj['attributes'])) {
$tag = $obj['attributes']['TAG'];
$rootDocument = Document::getDocumentByExclusiveTag($tag);
if ($rootDocument) {
$rootId = $rootDocument->getId();
}
}
}
}
$children = array();
$res = array('children' => array(), 'paging' => '');
$c = new Criteria();
if (!$documentId) {
if ($rootId) {
$documentId = $rootId;
} else {
$document = Rootfolder::getRootfolderByModule($moduleName);
if ($document) {
$documentId = $document->getId();
}
}
}
//.........这里部分代码省略.........