Premiers écrans sur module PointRetrait
This commit is contained in:
78
local/modules/PointRetrait/Loop/ScheduleLoop.php
Normal file
78
local/modules/PointRetrait/Loop/ScheduleLoop.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace PointRetrait\Loop;
|
||||
|
||||
use PointRetrait\Model\PdrScheduleQuery;
|
||||
use PointRetrait\PointRetrait;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
|
||||
|
||||
/**
|
||||
* Class ScheduleLoop
|
||||
* @package PointRetrait\Loop
|
||||
*/
|
||||
class ScheduleLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
public $countable = false;
|
||||
public $timestampable = false;
|
||||
public $versionable = false;
|
||||
|
||||
|
||||
/**
|
||||
* @param LoopResult $loopResult
|
||||
*
|
||||
* @return LoopResult
|
||||
*/
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
foreach ($loopResult->getResultDataCollection() as $pdr_schedule) {
|
||||
|
||||
$loopResultRow = new LoopResultRow($pdr_schedule);
|
||||
$loopResultRow
|
||||
->set("ID", $pdr_schedule->getId())
|
||||
->set("PLACE_ID", $pdr_schedule->getIdArea())
|
||||
->set("DAY", $pdr_schedule->getDay())
|
||||
->set("DAY_LABEL", PointRetrait::getDayLabel($pdr_schedule->getDay()))
|
||||
->set("BEGIN", $pdr_schedule->getBeginTime())
|
||||
->set("END", $pdr_schedule->getEndTime())
|
||||
;
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
return $loopResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntListTypeArgument('id'),
|
||||
Argument::createIntListTypeArgument('place_id')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
$places = PdrScheduleQuery::create();
|
||||
if (null != $id = $this->getId()) {
|
||||
$places->filterById($id);
|
||||
}
|
||||
if (null != $id = $this->getPlaceId()) {
|
||||
$places->filterByIdPlace($id);
|
||||
}
|
||||
|
||||
return $places->orderByDay()->orderByBeginTime();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user