本文整理汇总了PHP中EntityManager::getPropuestas方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityManager::getPropuestas方法的具体用法?PHP EntityManager::getPropuestas怎么用?PHP EntityManager::getPropuestas使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityManager
的用法示例。
在下文中一共展示了EntityManager::getPropuestas方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeRanking
public function executeRanking(sfWebRequest $request)
{
$p = $request->getParameter("p");
$culture = $this->getUser()->getCulture("es");
$page = $request->getParameter("page", 1);
$this->order = $request->getParameter("o", "pd");
$filter = array('type' => 'propuesta', 'partido' => false, 'institucion' => false, 'culture' => $culture, 'page' => $page, 'order' => $this->order);
$this->getUser()->setAttribute("filter_" . Propuesta::NUM_ENTITY, $filter);
$this->propuestasPager = EntityManager::getPropuestas($culture, $page, $this->order, EntityManager::PAGE_SIZE, &$totalUp, &$totalDown);
$this->totalUp = $totalUp;
$this->totalDown = $totalDown;
$rule = sfContext::getInstance()->getRouting()->getCurrentRouteName();
$params = "";
foreach ($request->getParameterHolder()->getAll() as $name => $value) {
if ($name != 'module' && $name != 'action' && $name != 'o' && $name != 'page') {
if ($params === "") {
$params .= "?";
} else {
$params .= "&";
}
$params .= "{$name}={$value}";
}
}
$this->route = "propuesta/ranking{$params}";
$this->pageTitle = sfContext::getInstance()->getI18N()->__('Ranking de propuestas', array());
if ($this->order != 'pd') {
switch ($this->order) {
case 'pa':
$orderTxt = sfContext::getInstance()->getI18N()->__('votos positivos inverso');
break;
case 'nd':
$orderTxt = sfContext::getInstance()->getI18N()->__('votos negativos');
break;
case 'na':
$orderTxt = sfContext::getInstance()->getI18N()->__('votos negativos inverso');
break;
case 'fd':
$orderTxt = sfContext::getInstance()->getI18N()->__('más recientes');
break;
case 'fa':
$orderTxt = sfContext::getInstance()->getI18N()->__('más antiguas');
break;
}
$this->pageTitle .= ", {$orderTxt}";
}
if ($page && $page != 1) {
$this->pageTitle .= " " . sfContext::getInstance()->getI18N()->__('(Pág. %1%)', array('%1%' => $page));
}
$this->title = $this->pageTitle . ' - Voota';
$description = sfContext::getInstance()->getI18N()->__('Ranking de propuestas', array());
if ($this->order != 'pd') {
$description .= ", {$orderTxt}";
}
if ($page && $page != 1) {
$description .= " " . sfContext::getInstance()->getI18N()->__('(Pág. %1%)', array('%1%' => $page));
}
$this->response->addMeta('Description', $description);
$this->response->setTitle($this->title);
}
示例2: execute
protected function execute($arguments = array(), $options = array())
{
$sfContext = sfContext::createInstance($this->configuration);
$controller = $sfContext->getController();
$this->cultures = array('ca' => 'cat', 'es' => 'es');
$culture = $options['culture'];
// initialize the database connection
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
//foreach($this->cultures as $culture => $ext){
$sfContext->getUser()->setCulture($culture);
// **************** HOME **********************
$this->writeToSitemap("voota-{$culture}", $controller->genUrl("@homepage", true), $culture);
// **************** Ultimas opiniones **********************
$this->writeToSitemap("voota-{$culture}", $controller->genUrl("@ultimas_opiniones_{$culture}", true), $culture);
$this->writeToSitemap("voota-{$culture}", $controller->genUrl("@ultimas_opiniones_politicos_{$culture}", true), $culture);
$this->writeToSitemap("voota-{$culture}", $controller->genUrl("@ultimas_opiniones_partidos_{$culture}", true), $culture);
$this->writeToSitemap("voota-{$culture}", $controller->genUrl("@ultimas_opiniones_propuestas_{$culture}", true), $culture);
$this->writeToSitemap("voota-{$culture}", $controller->genUrl("@ultimas_opiniones_otras_{$culture}", true), $culture);
$this->writeToSitemap("voota-{$culture}", $controller->genUrl("@ultimas_opiniones_feed_{$culture}", true), $culture);
$this->writeToSitemap("voota-{$culture}", $controller->genUrl("@ultimas_opiniones_politicos_feed_{$culture}", true), $culture);
$this->writeToSitemap("voota-{$culture}", $controller->genUrl("@ultimas_opiniones_partidos_feed_{$culture}", true), $culture);
$this->writeToSitemap("voota-{$culture}", $controller->genUrl("@ultimas_opiniones_propuestas_feed_{$culture}", true), $culture);
$this->writeToSitemap("voota-{$culture}", $controller->genUrl("@ultimas_opiniones_otras_feed_{$culture}", true), $culture);
// **************** varias **********************
$this->writeToSitemap("voota-{$culture}", $controller->genUrl("@about", true), $culture);
$this->writeToSitemap("voota-{$culture}", $controller->genUrl("@rules", true), $culture);
$this->writeToSitemap("voota-{$culture}", $controller->genUrl("@search", true), $culture);
$this->writeToSitemap("voota-{$culture}", $controller->genUrl("@contact", true), $culture);
// **************** Fichas POLITICOS **********************
$c = new Criteria();
//$c->setLimit(5);
$politicos = PoliticoPeer::doSelect($c);
foreach ($politicos as $politico) {
$this->writeToSitemap("politico-{$culture}", $controller->genUrl("politico/show?id=" . $politico->getVanity(), true), $culture);
}
// **************** Fichas PARTIDOS **********************
$c = new Criteria();
$c->add(PartidoPeer::IS_ACTIVE, true);
$partidos = PartidoPeer::doSelect($c);
foreach ($partidos as $partido) {
$this->writeToSitemap("partido-{$culture}", $controller->genUrl("partido/show?id=" . $partido->getAbreviatura(), true), $culture);
}
// **************** Fichas PROPUESTAS **********************
$c = new Criteria();
$c->add(PropuestaPeer::IS_ACTIVE, true);
$c->add(PropuestaPeer::CULTURE, $culture);
$propuestas = PropuestaPeer::doSelect($c);
foreach ($propuestas as $propuesta) {
$this->writeToSitemap("propuesta-{$culture}", $controller->genUrl("propuesta/show?id=" . $propuesta->getVanity(), true), $culture);
}
// **************** Fichas USUARIOS **********************
$c = new Criteria();
$c->add(SfGuardUserPeer::IS_ACTIVE, true);
$usuarios = SfGuardUserPeer::doSelect($c);
foreach ($usuarios as $usuario) {
$this->writeToSitemap("usuario-{$culture}", $controller->genUrl("perfil/show?username=" . $usuario->getProfile()->getVanity(), true), $culture);
}
// **************** feeds POLITICOS **********************
$c = new Criteria();
//$c->setLimit(5);
$politicos = PoliticoPeer::doSelect($c);
foreach ($politicos as $politico) {
$this->writeToSitemap("politico-feed-{$culture}", $controller->genUrl("politico/show?id=" . $politico->getVanity(), true), $culture);
}
// **************** feeds PARTIDOS **********************
$c = new Criteria();
$c->add(PartidoPeer::IS_ACTIVE, true);
$partidos = PartidoPeer::doSelect($c);
foreach ($partidos as $partido) {
$this->writeToSitemap("partido-feed-{$culture}", $controller->genUrl("partido/feed?id=" . $partido->getAbreviatura(), true), $culture);
}
// **************** feeds PROPUESTAS **********************
$c = new Criteria();
$c->add(PropuestaPeer::IS_ACTIVE, true);
$c->add(PropuestaPeer::CULTURE, $culture);
$propuestas = PropuestaPeer::doSelect($c);
foreach ($propuestas as $propuesta) {
$this->writeToSitemap("propuesta-feed-{$culture}", $controller->genUrl("propuesta/feed?id=" . $propuesta->getVanity(), true), $culture);
}
// **************** feeds USUARIOS **********************
$c = new Criteria();
$c->add(SfGuardUserPeer::IS_ACTIVE, true);
$usuarios = SfGuardUserPeer::doSelect($c);
foreach ($usuarios as $usuario) {
$this->writeToSitemap("usuario-feed-{$culture}", $controller->genUrl("perfil/feed?username=" . $usuario->getProfile()->getVanity(), true), $culture);
}
// **************** ranking PROPUESTAS **********************
$this->writeToSitemap("propuesta-ranking-{$culture}", $controller->genUrl("propuesta/ranking", true), $culture);
$pager = EntityManager::getPropuestas($culture);
$idx = 1;
while ($idx < $pager->getLastPage()) {
$idx++;
$this->writeToSitemap("propuesta-ranking-{$culture}", $controller->genUrl("propuesta/ranking?page={$idx}", true), $culture);
}
// **************** ranking POLITICOS **********************
$this->writeToSitemap("politico-ranking-{$culture}", $controller->genUrl("politico/ranking", true), $culture);
$pager = EntityManager::getPoliticos(false, false, $culture);
$idx = 1;
while ($idx < $pager->getLastPage()) {
//.........这里部分代码省略.........
示例3: entities_proposal
private function entities_proposal($data)
{
$sort = $this->getRequestParameter("sort", 'positive');
$page = $this->getRequestParameter("page", '1');
$limit = $this->getRequestParameter("limit", self::PAGE_SIZE);
if ($sort != 'positive' && $sort != 'negative') {
throw new BadRequestException('Invalid sort value.');
}
$pager = EntityManager::getPropuestas($this->getUser()->getCulture("es"), $page, $sort == 'positive' ? "pd" : "nd", $limit);
$entities = array();
foreach ($pager->getResults() as $proposal) {
$entities[] = new Entity($proposal);
}
return $entities;
}