本文整理汇总了PHP中EntityManager::getPager方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityManager::getPager方法的具体用法?PHP EntityManager::getPager怎么用?PHP EntityManager::getPager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityManager
的用法示例。
在下文中一共展示了EntityManager::getPager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeShow
//.........这里部分代码省略.........
$this->pageD = $pd;
} else {
$resD = BaseSfReviewManager::NUM_REVIEWS;
$this->pageD = 2;
}
$id = $this->partido->getId();
$this->positives = SfReviewManager::getReviewsByEntityAndValue($request, Partido::NUM_ENTITY, $id, 1, $resU);
$this->negatives = SfReviewManager::getReviewsByEntityAndValue($request, Partido::NUM_ENTITY, $id, -1, $resD);
$positiveCount = $this->positives->getNbResults();
$negativeCount = $this->negatives->getNbResults();
$this->getUser()->setAttribute('pageU', '');
$this->getUser()->setAttribute('pageD', '');
$this->totalCount = $positiveCount + $negativeCount;
if ($this->totalCount > 0) {
$this->positivePerc = intval($positiveCount * 100 / $this->totalCount);
$this->negativePerc = 100 - $this->positivePerc;
} else {
$this->positivePerc = 0;
$this->negativePerc = 0;
}
// Enlaces
$c = new Criteria();
$rCriterion = $c->getNewCriterion(EnlacePeer::CULTURE, null, Criteria::ISNULL);
$rCriterion->addOr($c->getNewCriterion(EnlacePeer::CULTURE, $this->getUser()->getCulture()));
$rCriterion->addOr($c->getNewCriterion(EnlacePeer::CULTURE, ''));
$c->add($rCriterion);
$c->add(EnlacePeer::PARTIDO_ID, $id);
$c->addAscendingOrderByColumn(EnlacePeer::ORDEN);
$this->activeEnlaces = EnlacePeer::doSelect($c);
$this->twitterUser = FALSE;
foreach ($this->activeEnlaces as $enlace) {
if (preg_match("/twitter\\.com\\/#!\\/(.*)\$/is", $enlace->getUrl(), $matches)) {
$this->twitterUser = $matches[1];
break;
}
if (preg_match("/twitter\\.com\\/(.*)\$/is", $enlace->getUrl(), $matches)) {
$this->twitterUser = $matches[1];
break;
}
}
// Politicos mas votados
$c = new Criteria();
$c->addJoin(array(PoliticoPeer::ID, PoliticoI18nPeer::CULTURE), array(PoliticoI18nPeer::ID, "'{$culture}'"), Criteria::LEFT_JOIN);
$c->add(PoliticoPeer::VANITY, null, Criteria::ISNOTNULL);
$c->add(PoliticoPeer::PARTIDO_ID, $this->partido->getId());
$c->addDescendingOrderByColumn(PoliticoPeer::SUMU);
$c->addAscendingOrderByColumn(PoliticoPeer::SUMD);
$this->politicos = new sfPropelPager('Politico', 6);
$this->politicos->setCriteria($c);
$this->politicos->init();
// Lista de instituciones
$c = new Criteria();
$c->addJoin(InstitucionPeer::ID, PoliticoInstitucionPeer::INSTITUCION_ID);
$c->addJoin(PoliticoInstitucionPeer::POLITICO_ID, PoliticoPeer::ID);
$c->addJoin(PoliticoPeer::PARTIDO_ID, PartidoPeer::ID);
$c->add(PoliticoPeer::PARTIDO_ID, $this->partido->getId());
$c->add(InstitucionPeer::IS_MAIN, true);
$c->setDistinct();
$c->addAscendingOrderByColumn(InstitucionPeer::ORDEN);
$this->instituciones = InstitucionPeer::doSelect($c);
// Lista de listas
$this->listasGenerales = false;
$this->listasAutonomicas = false;
$this->listasMunicipales = false;
foreach ($this->partido->getListas() as $lista) {
//$lista->getCircunscripcion()->getGeo()
foreach ($lista->getConvocatoria()->getEleccion()->getEleccionInstitucions() as $insti) {
$geo = $insti->getInstitucion()->getGeo();
if ($geo->getId() == 1) {
$this->listasGenerales = true;
} elseif ($geo->getGeoRelatedByGeoId()->getId() == 1) {
$this->listasAutonomicas = true;
} elseif ($geo->getGeoRelatedByGeoId()->getGeoRelatedByGeoId()->getId() == 1) {
} elseif ($geo->getGeoRelatedByGeoId()->getGeoRelatedByGeoId()->getGeoRelatedByGeoId()->getId() == 1) {
$this->listasMunicipales = true;
}
}
}
$this->pageTitle = $this->partido->getNombre() . " (" . $this->partido->getAbreviatura() . ")";
$this->title = $this->pageTitle . ' - Voota';
$this->response->addMeta('Title', $this->title);
$descripcion = $this->partido->getAbreviatura() . ": " . sfContext::getInstance()->getI18N()->__('presentación, opiniones de usuarios a favor y en contra, políticos mejor valorados y enlaces. ', array()) . SfVoUtil::cutToLength($this->partido->getPresentacion(), 140, '...', true);
$this->response->addMeta('Descripcion', $descripcion);
// Listas de electorales
$convocatoriaActiva = sfConfig::get('sf_convocatoria_activa');
$this->convocatoria = ConvocatoriaPeer::retrieveByPk($convocatoriaActiva);
$c = new Criteria();
$c->add(ListaPeer::PARTIDO_ID, $this->partido->getId());
$c->add(ListaPeer::CONVOCATORIA_ID, $convocatoriaActiva);
$c->addJoin(ListaPeer::CIRCUNSCRIPCION_ID, CircunscripcionPeer::ID);
$c->addJoin(CircunscripcionPeer::GEO_ID, GeoPeer::ID);
$c->addAscendingOrderByColumn(GeoPeer::NOMBRE);
$this->listas = ListaPeer::doSelect($c);
/* paginador */
$this->partidosPager = EntityManager::getPager($this->partido);
/* / paginador */
// Feed
$request->setAttribute('rssTitle', $this->title . " Feed RSS");
$request->setAttribute('rssFeed', 'partido/feed?id=' . $this->partido->getVanity());
}
示例2: executeShow
public function executeShow(sfWebRequest $request)
{
$vanity = $request->getParameter('id');
$s = $request->getParameter('s', 0);
$culture = $this->getUser()->getCulture();
$c = new Criteria();
$c->add(PropuestaPeer::VANITY, $vanity);
$this->propuesta = PropuestaPeer::doSelectOne($c);
$this->forward404Unless($this->propuesta);
if ($this->propuesta->getCulture() != $culture) {
$this->redirect("@homepage");
}
if ($this->propuesta->getVanity() != $vanity) {
$this->redirect('propuesta/show?id=' . $this->propuesta->getVanity(), 301);
}
// Estabamos vootando antes del login ?
$sfr_status = $this->getUser()->getAttribute('sfr_status', false, 'sf_review');
if ($sfr_status) {
$aSfrStatus = array();
foreach ($sfr_status as $key => $value) {
$aSfrStatus[$key] = $value;
}
$this->sfr_status = $aSfrStatus;
$request->setAttribute('sfr_status', $aSfrStatus);
$this->getUser()->setAttribute('sfr_status', false, 'sf_review');
} else {
$this->getUser()->setAttribute('sfr_status', false, 'sf_review');
$this->sfr_status = false;
}
$exclude = array();
$this->positives = SfReviewManager::getReviewsByEntityAndValue($request, Propuesta::NUM_ENTITY, $this->propuesta->getId(), 1);
$this->negatives = SfReviewManager::getReviewsByEntityAndValue($request, Propuesta::NUM_ENTITY, $this->propuesta->getId(), -1);
$positiveCount = $this->positives->getNbResults();
$negativeCount = $this->negatives->getNbResults();
$this->totalCount = $positiveCount + $negativeCount;
if ($this->totalCount > 0) {
$this->positivePerc = intval($positiveCount * 100 / $this->totalCount);
$this->negativePerc = 100 - $this->positivePerc;
} else {
$this->positivePerc = 0;
$this->negativePerc = 0;
}
$this->title = sfContext::getInstance()->getI18N()->__('%1%, opiniones a favor y en contra en Voota', array('%1%' => $this->propuesta->getTitulo()));
$description = sfContext::getInstance()->getI18N()->__('Página de %1%', array('%1%' => $this->propuesta->getTitulo()));
$description .= sfContext::getInstance()->getI18N()->__('%1% votos a favor y %2% votos en contra.', array('%1%' => $positiveCount, '%2%' => $negativeCount));
$this->response->addMeta('Description', $description);
$this->response->setTitle($this->title);
// Enlaces
$this->activeEnlaces = $this->getEnlaces($this->propuesta);
$this->twitterUser = FALSE;
foreach ($this->activeEnlaces as $enlace) {
if (preg_match("/twitter\\.com\\/#!\\/(.*)\$/is", $enlace->getUrl(), $matches)) {
$this->twitterUser = $matches[1];
break;
}
if (preg_match("/twitter\\.com\\/(.*)\$/is", $enlace->getUrl(), $matches)) {
$this->twitterUser = $matches[1];
break;
}
}
/* paginador */
$this->propuestasPager = EntityManager::getPager($this->propuesta);
/* / paginador */
$c = new Criteria();
$c->add(PropuestaPeer::IS_ACTIVE, true);
$c->add(PropuestaPeer::CULTURE, $culture);
$this->propuestasCount = PropuestaPeer::doCount($c);
// Feed
$request->setAttribute('rssTitle', $this->title . " Feed RSS");
$request->setAttribute('rssFeed', 'propuesta/feed?id=' . $this->propuesta->getVanity());
}
示例3: executeShow
//.........这里部分代码省略.........
$pu = $this->getUser()->getAttribute('pageU');
$pd = $this->getUser()->getAttribute('pageD');
$c = $this->getUser()->getAttribute('review_c');
if ($c != '' && $pu != '') {
$resU = BaseSfReviewManager::NUM_REVIEWS * ($pu - 1);
$this->pageU = $pu;
} else {
$resU = BaseSfReviewManager::NUM_REVIEWS;
$this->pageU = 2;
}
if ($c != '' && $pd != '') {
$resD = BaseSfReviewManager::NUM_REVIEWS * ($pd - 1);
$this->pageD = $pd;
} else {
$resD = BaseSfReviewManager::NUM_REVIEWS;
$this->pageD = 2;
}
$exclude = array();
$this->positives = SfReviewManager::getReviewsByEntityAndValue($request, 1, $id, 1, $resU);
$this->negatives = SfReviewManager::getReviewsByEntityAndValue($request, 1, $id, -1, $resD);
$positiveCount = $this->positives->getNbResults();
$negativeCount = $this->negatives->getNbResults();
$this->getUser()->setAttribute('pageU', '');
$this->getUser()->setAttribute('pageD', '');
$this->totalCount = $positiveCount + $negativeCount;
if ($this->totalCount > 0) {
$this->positivePerc = intval($positiveCount * 100 / $this->totalCount);
$this->negativePerc = 100 - $this->positivePerc;
} else {
$this->positivePerc = 0;
$this->negativePerc = 0;
}
$this->title = sfContext::getInstance()->getI18N()->__('%1%, opiniones a favor y en contra en Voota', array('%1%' => $this->politico->getNombre() . ' ' . $this->politico->getApellidos()));
$description = sfContext::getInstance()->getI18N()->__('Página de %1%', array('%1%' => $this->politico->getNombre() . ' ' . $this->politico->getApellidos()));
if (count($this->politico->getPoliticoInstitucions()) > 0) {
$description .= " (";
//instituciones
foreach ($this->politico->getPoliticoInstitucions() as $idx => $politicoInstitucion) {
if ($idx > 0) {
$description .= ', ';
}
$description .= $politicoInstitucion->getInstitucion()->getNombre();
}
$description .= ")";
}
$description .= ", " . $this->politico->getPartido() . ", ";
//partido
$description .= sfContext::getInstance()->getI18N()->__('%1% votos a favor y %2% votos en contra.', array('%1%' => $positiveCount, '%2%' => $negativeCount));
$this->response->addMeta('Description', $description);
$this->response->setTitle($this->title);
// Enlaces
$c = new Criteria();
$rCriterion = $c->getNewCriterion(EnlacePeer::CULTURE, null, Criteria::ISNULL);
$rCriterion->addOr($c->getNewCriterion(EnlacePeer::CULTURE, $this->getUser()->getCulture()));
$rCriterion->addOr($c->getNewCriterion(EnlacePeer::CULTURE, ''));
$c->add($rCriterion);
if ($politico->getsfGuardUser()) {
$c->add(EnlacePeer::SF_GUARD_USER_ID, $politico->getsfGuardUser()->getId());
} else {
$c->add(EnlacePeer::POLITICO_ID, $id);
}
$c->add(EnlacePeer::URL, '', Criteria::NOT_EQUAL);
$c->addAscendingOrderByColumn(EnlacePeer::ORDEN);
$this->activeEnlaces = EnlacePeer::doSelect($c);
if ($politico->getsfGuardUser() && count($this->activeEnlaces) == 0) {
$c = new Criteria();
$rCriterion = $c->getNewCriterion(EnlacePeer::CULTURE, null, Criteria::ISNULL);
$rCriterion->addOr($c->getNewCriterion(EnlacePeer::CULTURE, $this->getUser()->getCulture()));
$rCriterion->addOr($c->getNewCriterion(EnlacePeer::CULTURE, ''));
$c->add($rCriterion);
$c->add(EnlacePeer::POLITICO_ID, $id);
$c->add(EnlacePeer::URL, '', Criteria::NOT_EQUAL);
$c->addAscendingOrderByColumn(EnlacePeer::ORDEN);
$this->activeEnlaces = EnlacePeer::doSelect($c);
}
$this->twitterUser = FALSE;
foreach ($this->activeEnlaces as $enlace) {
if (preg_match("/twitter\\.com\\/#!\\/(.*)\$/is", $enlace->getUrl(), $matches)) {
$this->twitterUser = $matches[1];
break;
}
if (preg_match("/twitter\\.com\\/(.*)\$/is", $enlace->getUrl(), $matches)) {
$this->twitterUser = $matches[1];
break;
}
}
/* paginador */
$this->politicosPager = EntityManager::getPager($this->politico);
/* / paginador */
// Feed
$request->setAttribute('rssTitle', $this->title . " Feed RSS");
$request->setAttribute('rssFeed', 'politico/feed?id=' . $this->politico->getVanity());
$this->listas = false;
$c = new Criteria();
$c->add(PoliticoListaPeer::POLITICO_ID, $this->politico->getId());
$c->addJoin(PoliticoListaPeer::LISTA_ID, ListaPeer::ID);
$c->addJoin(ConvocatoriaPeer::ID, ListaPeer::CONVOCATORIA_ID);
$c->add(ConvocatoriaPeer::FECHA, time(), Criteria::GREATER_THAN);
$this->listas = PoliticoListaPeer::doSelect($c);
}