WIP : admin profiles

This commit is contained in:
Etienne Roudeix
2013-10-21 11:44:33 +02:00
parent c63c509f2f
commit f564db2a8b
40 changed files with 16660 additions and 316 deletions

View File

@@ -24,31 +24,108 @@
namespace Thelia\Core\Event\Profile;
use Thelia\Core\Event\ActionEvent;
use Thelia\Model\Group;
use Thelia\Model\Profile;
class ProfileEvent extends ActionEvent
{
protected $group = null;
protected $profile = null;
protected $id = null;
protected $locale = null;
protected $code = null;
protected $title = null;
protected $chapo = null;
protected $description = null;
protected $postscriptum = null;
public function __construct(Group $group = null)
public function __construct(Profile $profile = null)
{
$this->group = $group;
$this->profile = $profile;
}
public function hasGroup()
public function hasProfile()
{
return ! is_null($this->group);
return ! is_null($this->profile);
}
public function getGroup()
public function getProfile()
{
return $this->group;
return $this->profile;
}
public function setGroup(Group $group)
public function setProfile(Profile $profile)
{
$this->group = $group;
$this->profile = $profile;
return $this;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setCode($code)
{
$this->code = $code;
}
public function getCode()
{
return $this->code;
}
public function setChapo($chapo)
{
$this->chapo = $chapo;
}
public function getChapo()
{
return $this->chapo;
}
public function setDescription($description)
{
$this->description = $description;
}
public function getDescription()
{
return $this->description;
}
public function setLocale($locale)
{
$this->locale = $locale;
}
public function getLocale()
{
return $this->locale;
}
public function setPostscriptum($postscriptum)
{
$this->postscriptum = $postscriptum;
}
public function getPostscriptum()
{
return $this->postscriptum;
}
public function setTitle($title)
{
$this->title = $title;
}
public function getTitle()
{
return $this->title;
}
}

View File

@@ -0,0 +1,105 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Template\Loop;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Template\Element\BaseI18nLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Model\ProfileQuery;
use Thelia\Model\ProductQuery;
use Thelia\Type\TypeCollection;
use Thelia\Type;
use Thelia\Type\BooleanOrBothType;
/**
*
* Profile loop
*
*
* Class Profile
* @package Thelia\Core\Template\Loop
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
class Profile extends BaseI18nLoop
{
public $timestampable = true;
/**
* @return ArgumentCollection
*/
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('id')
);
}
/**
* @param $pagination
*
* @return \Thelia\Core\Template\Element\LoopResult
*/
public function exec(&$pagination)
{
$search = ProfileQuery::create();
/* manage translations */
$locale = $this->configureI18nProcessing($search);
$id = $this->getId();
if (null !== $id) {
$search->filterById($id, Criteria::IN);
}
$search->orderById(Criteria::ASC);
/* perform search */
$features = $this->search($search, $pagination);
$loopResult = new LoopResult($features);
foreach ($features as $feature) {
$loopResultRow = new LoopResultRow($loopResult, $feature, $this->versionable, $this->timestampable, $this->countable);
$loopResultRow->set("ID", $feature->getId())
->set("IS_TRANSLATED",$feature->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE",$locale)
->set("CODE",$feature->getCode())
->set("TITLE",$feature->getVirtualColumn('i18n_TITLE'))
->set("CHAPO", $feature->getVirtualColumn('i18n_CHAPO'))
->set("DESCRIPTION", $feature->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM", $feature->getVirtualColumn('i18n_POSTSCRIPTUM'))
;
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
}