Aded feature_template and category_template position management

This commit is contained in:
franck
2013-09-21 11:46:09 +02:00
parent f6530f0bfc
commit e3644cd6cc
33 changed files with 728 additions and 124 deletions

View File

@@ -135,6 +135,47 @@ class Template extends BaseAction implements EventSubscriberInterface
} }
} }
/**
* Changes position, selecting absolute ou relative change.
*
* @param CategoryChangePositionEvent $event
*/
public function updateAttributePosition(UpdatePositionEvent $event)
{
$attributeTemplate = AttributeTemplateQuery::create()->findPk($event->getObjectId());
$this->updatePosition($attributeTemplate, $event);
}
/**
* Changes position, selecting absolute ou relative change.
*
* @param CategoryChangePositionEvent $event
*/
public function updateFeaturePosition(UpdatePositionEvent $event)
{
$featureTemplate = FeatureTemplateQuery::create()->findPk($event->getObjectId());
$this->updatePosition($featureTemplate, $event);
}
protected function updatePosition($object, UpdatePositionEvent $event)
{
if (null !== $object) {
$object->setDispatcher($this->getDispatcher());
$mode = $event->getMode();
if ($mode == UpdatePositionEvent::POSITION_ABSOLUTE)
$object->changeAbsolutePosition($event->getPosition());
else if ($mode == UpdatePositionEvent::POSITION_UP)
$object->movePositionUp();
else if ($mode == UpdatePositionEvent::POSITION_DOWN)
$object->movePositionDown();
}
}
public function deleteAttribute(TemplateDeleteAttributeEvent $event) { public function deleteAttribute(TemplateDeleteAttributeEvent $event) {
$attribute_template = AttributeTemplateQuery::create() $attribute_template = AttributeTemplateQuery::create()
@@ -185,6 +226,9 @@ class Template extends BaseAction implements EventSubscriberInterface
TheliaEvents::TEMPLATE_ADD_FEATURE => array("addFeature", 128), TheliaEvents::TEMPLATE_ADD_FEATURE => array("addFeature", 128),
TheliaEvents::TEMPLATE_DELETE_FEATURE => array("deleteFeature", 128), TheliaEvents::TEMPLATE_DELETE_FEATURE => array("deleteFeature", 128),
TheliaEvents::TEMPLATE_CHANGE_ATTRIBUTE_POSITION => array('updateAttributePosition', 128),
TheliaEvents::TEMPLATE_CHANGE_FEATURE_POSITION => array('updateFeaturePosition', 128),
); );
} }
} }

View File

@@ -353,6 +353,10 @@
<default key="_controller">Thelia\Controller\Admin\TemplateController::deleteFeatureAction</default> <default key="_controller">Thelia\Controller\Admin\TemplateController::deleteFeatureAction</default>
</route> </route>
<route id="admin.configuration.templates.attributes.update-feature-position" path="/admin/template/update-feature-position">
<default key="_controller">Thelia\Controller\Admin\TemplateController::updateFeaturePositionAction</default>
</route>
<route id="admin.configuration.templates.attributes.list" path="/admin/configuration/templates/attributes/list"> <route id="admin.configuration.templates.attributes.list" path="/admin/configuration/templates/attributes/list">
<default key="_controller">Thelia\Controller\Admin\TemplateController::getAjaxAttributesAction</default> <default key="_controller">Thelia\Controller\Admin\TemplateController::getAjaxAttributesAction</default>
</route> </route>
@@ -365,6 +369,10 @@
<default key="_controller">Thelia\Controller\Admin\TemplateController::deleteAttributeAction</default> <default key="_controller">Thelia\Controller\Admin\TemplateController::deleteAttributeAction</default>
</route> </route>
<route id="admin.configuration.templates.attributes.update-attribute-position" path="/admin/template/update-attribute-position">
<default key="_controller">Thelia\Controller\Admin\TemplateController::updateAttributePositionAction</default>
</route>
<!-- attribute and attributes value management --> <!-- attribute and attributes value management -->

View File

@@ -58,6 +58,7 @@ abstract class AbstractCrudController extends BaseAdminController
* @param string $objectName the lower case object name. Example. "message" * @param string $objectName the lower case object name. Example. "message"
* *
* @param string $defaultListOrder the default object list order, or null if list is not sortable. Example: manual * @param string $defaultListOrder the default object list order, or null if list is not sortable. Example: manual
* @param string $orderRequestParameterName Name of the request parameter that set the list order (null if list is not sortable)
* *
* @param string $viewPermissionIdentifier the 'view' permission identifier. Example: "admin.configuration.message.view" * @param string $viewPermissionIdentifier the 'view' permission identifier. Example: "admin.configuration.message.view"
* @param string $createPermissionIdentifier the 'create' permission identifier. Example: "admin.configuration.message.create" * @param string $createPermissionIdentifier the 'create' permission identifier. Example: "admin.configuration.message.create"

View File

@@ -39,6 +39,8 @@ use Thelia\Core\Event\TemplateDeleteAttributeEvent;
use Thelia\Core\Event\TemplateAddAttributeEvent; use Thelia\Core\Event\TemplateAddAttributeEvent;
use Thelia\Core\Event\TemplateAddFeatureEvent; use Thelia\Core\Event\TemplateAddFeatureEvent;
use Thelia\Core\Event\TemplateDeleteFeatureEvent; use Thelia\Core\Event\TemplateDeleteFeatureEvent;
use Thelia\Model\FeatureTemplateQuery;
use Thelia\Model\AttributeTemplateQuery;
/** /**
* Manages product templates * Manages product templates
@@ -255,6 +257,21 @@ class TemplateController extends AbstractCrudController
$this->redirectToEditionTemplate(); $this->redirectToEditionTemplate();
} }
public function updateAttributePositionAction() {
// Find attribute_template
$attributeTemplate = AttributeTemplateQuery::create()
->filterByTemplateId($this->getRequest()->get('template_id', null))
->filterByAttributeId($this->getRequest()->get('attribute_id', null))
->findOne()
;
return $this->updatePosition(
$attributeTemplate,
TheliaEvents::TEMPLATE_CHANGE_ATTRIBUTE_POSITION
);
}
public function addFeatureAction() { public function addFeatureAction() {
// Check current user authorization // Check current user authorization
@@ -299,4 +316,50 @@ class TemplateController extends AbstractCrudController
$this->redirectToEditionTemplate(); $this->redirectToEditionTemplate();
} }
public function updateFeaturePositionAction() {
// Find feature_template
$featureTemplate = FeatureTemplateQuery::create()
->filterByTemplateId($this->getRequest()->get('template_id', null))
->filterByFeatureId($this->getRequest()->get('feature_id', null))
->findOne()
;
return $this->updatePosition(
$featureTemplate,
TheliaEvents::TEMPLATE_CHANGE_FEATURE_POSITION
);
}
protected function updatePosition($object, $eventName) {
// Check current user authorization
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
if ($object != null) {
try {
$mode = $this->getRequest()->get('mode', null);
if ($mode == 'up')
$mode = UpdatePositionEvent::POSITION_UP;
else if ($mode == 'down')
$mode = UpdatePositionEvent::POSITION_DOWN;
else
$mode = UpdatePositionEvent::POSITION_ABSOLUTE;
$position = $this->getRequest()->get('position', null);
$event = new UpdatePositionEvent($object->getId(), $mode, $position);
$this->dispatch($eventName, $event);
}
catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
}
$this->redirectToEditionTemplate();
}
} }

View File

@@ -400,6 +400,7 @@ final class TheliaEvents
const AFTER_DELETECURRENCY = "action.after_deleteCurrency"; const AFTER_DELETECURRENCY = "action.after_deleteCurrency";
const CHANGE_DEFAULT_CURRENCY = 'action.changeDefaultCurrency'; const CHANGE_DEFAULT_CURRENCY = 'action.changeDefaultCurrency';
// -- Product templates management ----------------------------------------- // -- Product templates management -----------------------------------------
const TEMPLATE_CREATE = "action.createTemplate"; const TEMPLATE_CREATE = "action.createTemplate";
@@ -412,6 +413,9 @@ final class TheliaEvents
const TEMPLATE_ADD_FEATURE = "action.templateAddFeature"; const TEMPLATE_ADD_FEATURE = "action.templateAddFeature";
const TEMPLATE_DELETE_FEATURE = "action.templateDeleteFeature"; const TEMPLATE_DELETE_FEATURE = "action.templateDeleteFeature";
const TEMPLATE_CHANGE_FEATURE_POSITION = "action.templateChangeAttributePosition";
const TEMPLATE_CHANGE_ATTRIBUTE_POSITION = "action.templateChangeFeaturePosition";
const BEFORE_CREATETEMPLATE = "action.before_createTemplate"; const BEFORE_CREATETEMPLATE = "action.before_createTemplate";
const AFTER_CREATETEMPLATE = "action.after_createTemplate"; const AFTER_CREATETEMPLATE = "action.after_createTemplate";

View File

@@ -41,7 +41,8 @@ use Thelia\Type\BooleanOrBothType;
use Thelia\Model\ProductQuery; use Thelia\Model\ProductQuery;
use Thelia\Model\TemplateQuery; use Thelia\Model\TemplateQuery;
use Thelia\Model\AttributeTemplateQuery; use Thelia\Model\AttributeTemplateQuery;
use Thelia\Core\Translation\Translator;
use Thelia\Model\Map\AttributeTemplateTableMap;
/** /**
* *
* Attribute loop * Attribute loop
@@ -106,6 +107,9 @@ class Attribute extends BaseI18nLoop
$product = $this->getProduct(); $product = $this->getProduct();
$template = $this->getTemplate(); $template = $this->getTemplate();
$exclude_template = $this->getExcludeTemplate();
$use_attribute_pos = true;
if (null !== $product) { if (null !== $product) {
// Find the template assigned to the product. // Find the template assigned to the product.
@@ -114,29 +118,37 @@ class Attribute extends BaseI18nLoop
// Ignore if the product cannot be found. // Ignore if the product cannot be found.
if ($productObj !== null) if ($productObj !== null)
$template = $productObj->getTemplate(); $template = $productObj->getTemplate();
}
// If we have to filter by template, find all attributes assigned to this template, and filter by found IDs
if (null !== $template) {
$search->filterById(
AttributeTemplateQuery::create()->filterByTemplateId($template)->select('attribute_id')->find(),
Criteria::IN
);
} }
$exclude_template = $this->getExcludeTemplate(); if (null !== $template) {
// If we have to filter by template, find all attributes assigned to this template, and filter by found IDs // Join with feature_template table to get position
if (null !== $exclude_template) { $search
// Exclure tous les attribut qui sont attachés aux templates indiqués ->withColumn(AttributeTemplateTableMap::POSITION, 'position')
$search->filterById( ->filterByTemplate(TemplateQuery::create()->findById($template), Criteria::IN)
AttributeTemplateQuery::create()->filterByTemplateId($exclude_template)->select('attribute_id')->find(), ;
Criteria::NOT_IN
); $use_attribute_pos = false;
}
else if (null !== $exclude_template) {
// Join with attribute_template table to get position
$exclude_attributes = AttributeTemplateQuery::create()->filterByTemplateId($exclude_template)->select('attribute_id')->find();
$search
->joinAttributeTemplate(null, Criteria::LEFT_JOIN)
->withColumn(AttributeTemplateTableMap::POSITION, 'position')
->filterById($exclude_attributes, Criteria::NOT_IN)
;
$use_attribute_pos = false;
} }
$orders = $this->getOrder(); $orders = $this->getOrder();
if ($template == null && ($order == "manual" || $order == "manual_reverse"))
throw new \InvalidException(Translator::getInstance()->trans("Can't use manual or manual_reverse order without a 'template' or 'produst' parameter"));
foreach ($orders as $order) { foreach ($orders as $order) {
switch ($order) { switch ($order) {
case "id": case "id":
@@ -152,10 +164,16 @@ class Attribute extends BaseI18nLoop
$search->addDescendingOrderByColumn('i18n_TITLE'); $search->addDescendingOrderByColumn('i18n_TITLE');
break; break;
case "manual": case "manual":
$search->orderByPosition(Criteria::ASC); if ($use_attribute_pos)
$search->orderByPosition(Criteria::ASC);
else
$search->addAscendingOrderByColumn(AttributeTemplateTableMap::POSITION);
break; break;
case "manual_reverse": case "manual_reverse":
$search->orderByPosition(Criteria::DESC); if ($use_attribute_pos)
$search->orderByPosition(Criteria::DESC);
else
$search->addDescendingOrderByColumn(AttributeTemplateTableMap::POSITION);
break; break;
} }
} }
@@ -174,7 +192,8 @@ class Attribute extends BaseI18nLoop
->set("CHAPO", $attribute->getVirtualColumn('i18n_CHAPO')) ->set("CHAPO", $attribute->getVirtualColumn('i18n_CHAPO'))
->set("DESCRIPTION", $attribute->getVirtualColumn('i18n_DESCRIPTION')) ->set("DESCRIPTION", $attribute->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM", $attribute->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("POSTSCRIPTUM", $attribute->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("POSITION", $attribute->getPosition()); ->set("POSITION", $use_attribute_pos ? $attribute->getPosition() : $attribute->getVirtualColumn('position'))
;
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);
} }

View File

@@ -41,6 +41,8 @@ use Thelia\Type\TypeCollection;
use Thelia\Type; use Thelia\Type;
use Thelia\Type\BooleanOrBothType; use Thelia\Type\BooleanOrBothType;
use Thelia\Model\FeatureTemplateQuery; use Thelia\Model\FeatureTemplateQuery;
use Thelia\Model\TemplateQuery;
use Thelia\Model\Map\FeatureTemplateTableMap;
/** /**
* *
@@ -70,7 +72,7 @@ class Feature extends BaseI18nLoop
new Argument( new Argument(
'order', 'order',
new TypeCollection( new TypeCollection(
new Type\EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual_reverse')) new Type\EnumListType(array('id', 'id_reverse', 'alpha', 'alpha-reverse', 'manual', 'manual_reverse'))
), ),
'manual' 'manual'
), ),
@@ -108,6 +110,9 @@ class Feature extends BaseI18nLoop
$product = $this->getProduct(); $product = $this->getProduct();
$template = $this->getTemplate(); $template = $this->getTemplate();
$exclude_template = $this->getExcludeTemplate();
$use_feature_pos = true;
if (null !== $product) { if (null !== $product) {
// Find the template assigned to the product. // Find the template assigned to the product.
@@ -116,31 +121,35 @@ class Feature extends BaseI18nLoop
// Ignore if the product cannot be found. // Ignore if the product cannot be found.
if ($productObj !== null) if ($productObj !== null)
$template = $productObj->getTemplate(); $template = $productObj->getTemplate();
}
// If we have to filter by template, find all features assigned to this template, and filter by found IDs
if (null !== $template) {
$search->filterById(
FeatureTemplateQuery::create()->filterByTemplateId($template)->select('feature_id')->find(),
Criteria::IN
);
} }
$exclude_template = $this->getExcludeTemplate(); if (null !== $template) {
// Join with feature_template table to get position
$search
->withColumn(FeatureTemplateTableMap::POSITION, 'position')
->filterByTemplate(TemplateQuery::create()->findById($template), Criteria::IN)
;
$use_feature_pos = false;
}
// If we have to filter by template, find all features assigned to this template, and filter by found IDs
if (null !== $exclude_template) { if (null !== $exclude_template) {
// Exclure tous les attribut qui sont attachés aux templates indiqués $exclude_features = FeatureTemplateQuery::create()->filterByTemplateId($exclude_template)->select('feature_id')->find();
$search->filterById(
FeatureTemplateQuery::create()->filterByTemplateId($exclude_template)->select('feature_id')->find(), $search
Criteria::NOT_IN ->joinFeatureTemplate(null, Criteria::LEFT_JOIN)
); ->withColumn(FeatureTemplateTableMap::POSITION, 'position')
->filterById($exclude_features, Criteria::NOT_IN)
;
$use_feature_pos = false;
} }
$title = $this->getTitle(); $title = $this->getTitle();
if (null !== $title) { if (null !== $title) {
//find all feture that match exactly this title and find with all locales. //find all feature that match exactly this title and find with all locales.
$features = FeatureI18nQuery::create() $features = FeatureI18nQuery::create()
->filterByTitle($title, Criteria::LIKE) ->filterByTitle($title, Criteria::LIKE)
->select('id') ->select('id')
@@ -158,6 +167,12 @@ class Feature extends BaseI18nLoop
foreach ($orders as $order) { foreach ($orders as $order) {
switch ($order) { switch ($order) {
case "id":
$search->orderById(Criteria::ASC);
break;
case "id_reverse":
$search->orderById(Criteria::DESC);
break;
case "alpha": case "alpha":
$search->addAscendingOrderByColumn('i18n_TITLE'); $search->addAscendingOrderByColumn('i18n_TITLE');
break; break;
@@ -165,14 +180,22 @@ class Feature extends BaseI18nLoop
$search->addDescendingOrderByColumn('i18n_TITLE'); $search->addDescendingOrderByColumn('i18n_TITLE');
break; break;
case "manual": case "manual":
$search->orderByPosition(Criteria::ASC); if ($use_feature_pos)
$search->orderByPosition(Criteria::ASC);
else
$search->addAscendingOrderByColumn(FeatureTemplateTableMap::POSITION);
break; break;
case "manual_reverse": case "manual_reverse":
$search->orderByPosition(Criteria::DESC); if ($use_feature_pos)
$search->orderByPosition(Criteria::DESC);
else
$search->addDescendingOrderByColumn(FeatureTemplateTableMap::POSITION);
break; break;
} }
} }
/* perform search */ /* perform search */
$features = $this->search($search, $pagination); $features = $this->search($search, $pagination);
@@ -187,7 +210,8 @@ class Feature extends BaseI18nLoop
->set("CHAPO", $feature->getVirtualColumn('i18n_CHAPO')) ->set("CHAPO", $feature->getVirtualColumn('i18n_CHAPO'))
->set("DESCRIPTION", $feature->getVirtualColumn('i18n_DESCRIPTION')) ->set("DESCRIPTION", $feature->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM", $feature->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("POSTSCRIPTUM", $feature->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("POSITION", $feature->getPosition()); ->set("POSITION", $use_feature_pos ? $feature->getPosition() : $feature->getVirtualColumn('position'))
;
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);
} }

View File

@@ -48,8 +48,9 @@ class UrlGenerator extends AbstractSmartyPlugin
public function generateUrlFunction($params, &$smarty) public function generateUrlFunction($params, &$smarty)
{ {
// the path to process // the path to process
$path = $this->getParam($params, 'path', null); $path = $this->getParam($params, 'path', null);
$file = $this->getParam($params, 'file', null); $file = $this->getParam($params, 'file', null); // Do not invoke index.php in URL (get a static file in web space
$noamp = $this->getParam($params, 'noamp', null); // Do not change & in &amp;
if ($file !== null) { if ($file !== null) {
$path = $file; $path = $file;
@@ -66,12 +67,11 @@ class UrlGenerator extends AbstractSmartyPlugin
$url = URL::getInstance()->absoluteUrl( $url = URL::getInstance()->absoluteUrl(
$path, $path,
$this->getArgsFromParam($params, array('path', 'file', 'target')), $this->getArgsFromParam($params, array('noamp', 'path', 'file', 'target')),
$mode $mode
); );
// FIXME: potentially dangerous ? if ($noamp == null) $url = str_replace('&', '&amp;', $url);
$url = str_replace('&', '&amp;', $url);
if ($target != null) $url .= '#'.$target; if ($target != null) $url .= '#'.$target;

View File

@@ -3,8 +3,29 @@
namespace Thelia\Model; namespace Thelia\Model;
use Thelia\Model\Base\AttributeTemplate as BaseAttributeTemplate; use Thelia\Model\Base\AttributeTemplate as BaseAttributeTemplate;
use Propel\Runtime\Connection\ConnectionInterface;
class AttributeTemplate extends BaseAttributeTemplate class AttributeTemplate extends BaseAttributeTemplate
{ {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait;
/**
* Calculate next position relative to our template
*/
protected function addCriteriaToPositionQuery($query)
{
$query->filterByTemplateId($this->getTemplateId());
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->setPosition($this->getNextPosition());
return true;
}
} }

View File

@@ -76,6 +76,18 @@ abstract class AttributeTemplate implements ActiveRecordInterface
*/ */
protected $template_id; protected $template_id;
/**
* The value for the position field.
* @var int
*/
protected $position;
/**
* The value for the attribute_templatecol field.
* @var string
*/
protected $attribute_templatecol;
/** /**
* The value for the created_at field. * The value for the created_at field.
* @var string * @var string
@@ -393,6 +405,28 @@ abstract class AttributeTemplate implements ActiveRecordInterface
return $this->template_id; return $this->template_id;
} }
/**
* Get the [position] column value.
*
* @return int
*/
public function getPosition()
{
return $this->position;
}
/**
* Get the [attribute_templatecol] column value.
*
* @return string
*/
public function getAttributeTemplatecol()
{
return $this->attribute_templatecol;
}
/** /**
* Get the [optionally formatted] temporal [created_at] column value. * Get the [optionally formatted] temporal [created_at] column value.
* *
@@ -504,6 +538,48 @@ abstract class AttributeTemplate implements ActiveRecordInterface
return $this; return $this;
} // setTemplateId() } // setTemplateId()
/**
* Set the value of [position] column.
*
* @param int $v new value
* @return \Thelia\Model\AttributeTemplate The current object (for fluent API support)
*/
public function setPosition($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->position !== $v) {
$this->position = $v;
$this->modifiedColumns[] = AttributeTemplateTableMap::POSITION;
}
return $this;
} // setPosition()
/**
* Set the value of [attribute_templatecol] column.
*
* @param string $v new value
* @return \Thelia\Model\AttributeTemplate The current object (for fluent API support)
*/
public function setAttributeTemplatecol($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->attribute_templatecol !== $v) {
$this->attribute_templatecol = $v;
$this->modifiedColumns[] = AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL;
}
return $this;
} // setAttributeTemplatecol()
/** /**
* Sets the value of [created_at] column to a normalized version of the date/time value specified. * Sets the value of [created_at] column to a normalized version of the date/time value specified.
* *
@@ -592,13 +668,19 @@ abstract class AttributeTemplate implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AttributeTemplateTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AttributeTemplateTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)];
$this->template_id = (null !== $col) ? (int) $col : null; $this->template_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AttributeTemplateTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AttributeTemplateTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
$this->position = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AttributeTemplateTableMap::translateFieldName('AttributeTemplatecol', TableMap::TYPE_PHPNAME, $indexType)];
$this->attribute_templatecol = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : AttributeTemplateTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AttributeTemplateTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : AttributeTemplateTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
@@ -611,7 +693,7 @@ abstract class AttributeTemplate implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 5; // 5 = AttributeTemplateTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 7; // 7 = AttributeTemplateTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\AttributeTemplate object", 0, $e); throw new PropelException("Error populating \Thelia\Model\AttributeTemplate object", 0, $e);
@@ -867,6 +949,12 @@ abstract class AttributeTemplate implements ActiveRecordInterface
if ($this->isColumnModified(AttributeTemplateTableMap::TEMPLATE_ID)) { if ($this->isColumnModified(AttributeTemplateTableMap::TEMPLATE_ID)) {
$modifiedColumns[':p' . $index++] = 'TEMPLATE_ID'; $modifiedColumns[':p' . $index++] = 'TEMPLATE_ID';
} }
if ($this->isColumnModified(AttributeTemplateTableMap::POSITION)) {
$modifiedColumns[':p' . $index++] = 'POSITION';
}
if ($this->isColumnModified(AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL)) {
$modifiedColumns[':p' . $index++] = 'ATTRIBUTE_TEMPLATECOL';
}
if ($this->isColumnModified(AttributeTemplateTableMap::CREATED_AT)) { if ($this->isColumnModified(AttributeTemplateTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT'; $modifiedColumns[':p' . $index++] = 'CREATED_AT';
} }
@@ -893,6 +981,12 @@ abstract class AttributeTemplate implements ActiveRecordInterface
case 'TEMPLATE_ID': case 'TEMPLATE_ID':
$stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT);
break; break;
case 'POSITION':
$stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
break;
case 'ATTRIBUTE_TEMPLATECOL':
$stmt->bindValue($identifier, $this->attribute_templatecol, PDO::PARAM_STR);
break;
case 'CREATED_AT': case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break; break;
@@ -971,9 +1065,15 @@ abstract class AttributeTemplate implements ActiveRecordInterface
return $this->getTemplateId(); return $this->getTemplateId();
break; break;
case 3: case 3:
return $this->getCreatedAt(); return $this->getPosition();
break; break;
case 4: case 4:
return $this->getAttributeTemplatecol();
break;
case 5:
return $this->getCreatedAt();
break;
case 6:
return $this->getUpdatedAt(); return $this->getUpdatedAt();
break; break;
default: default:
@@ -1008,8 +1108,10 @@ abstract class AttributeTemplate implements ActiveRecordInterface
$keys[0] => $this->getId(), $keys[0] => $this->getId(),
$keys[1] => $this->getAttributeId(), $keys[1] => $this->getAttributeId(),
$keys[2] => $this->getTemplateId(), $keys[2] => $this->getTemplateId(),
$keys[3] => $this->getCreatedAt(), $keys[3] => $this->getPosition(),
$keys[4] => $this->getUpdatedAt(), $keys[4] => $this->getAttributeTemplatecol(),
$keys[5] => $this->getCreatedAt(),
$keys[6] => $this->getUpdatedAt(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn) foreach($virtualColumns as $key => $virtualColumn)
@@ -1068,9 +1170,15 @@ abstract class AttributeTemplate implements ActiveRecordInterface
$this->setTemplateId($value); $this->setTemplateId($value);
break; break;
case 3: case 3:
$this->setCreatedAt($value); $this->setPosition($value);
break; break;
case 4: case 4:
$this->setAttributeTemplatecol($value);
break;
case 5:
$this->setCreatedAt($value);
break;
case 6:
$this->setUpdatedAt($value); $this->setUpdatedAt($value);
break; break;
} // switch() } // switch()
@@ -1100,8 +1208,10 @@ abstract class AttributeTemplate implements ActiveRecordInterface
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setAttributeId($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setAttributeId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setTemplateId($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setTemplateId($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setPosition($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); if (array_key_exists($keys[4], $arr)) $this->setAttributeTemplatecol($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
} }
/** /**
@@ -1116,6 +1226,8 @@ abstract class AttributeTemplate implements ActiveRecordInterface
if ($this->isColumnModified(AttributeTemplateTableMap::ID)) $criteria->add(AttributeTemplateTableMap::ID, $this->id); if ($this->isColumnModified(AttributeTemplateTableMap::ID)) $criteria->add(AttributeTemplateTableMap::ID, $this->id);
if ($this->isColumnModified(AttributeTemplateTableMap::ATTRIBUTE_ID)) $criteria->add(AttributeTemplateTableMap::ATTRIBUTE_ID, $this->attribute_id); if ($this->isColumnModified(AttributeTemplateTableMap::ATTRIBUTE_ID)) $criteria->add(AttributeTemplateTableMap::ATTRIBUTE_ID, $this->attribute_id);
if ($this->isColumnModified(AttributeTemplateTableMap::TEMPLATE_ID)) $criteria->add(AttributeTemplateTableMap::TEMPLATE_ID, $this->template_id); if ($this->isColumnModified(AttributeTemplateTableMap::TEMPLATE_ID)) $criteria->add(AttributeTemplateTableMap::TEMPLATE_ID, $this->template_id);
if ($this->isColumnModified(AttributeTemplateTableMap::POSITION)) $criteria->add(AttributeTemplateTableMap::POSITION, $this->position);
if ($this->isColumnModified(AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL)) $criteria->add(AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL, $this->attribute_templatecol);
if ($this->isColumnModified(AttributeTemplateTableMap::CREATED_AT)) $criteria->add(AttributeTemplateTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(AttributeTemplateTableMap::CREATED_AT)) $criteria->add(AttributeTemplateTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(AttributeTemplateTableMap::UPDATED_AT)) $criteria->add(AttributeTemplateTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(AttributeTemplateTableMap::UPDATED_AT)) $criteria->add(AttributeTemplateTableMap::UPDATED_AT, $this->updated_at);
@@ -1183,6 +1295,8 @@ abstract class AttributeTemplate implements ActiveRecordInterface
{ {
$copyObj->setAttributeId($this->getAttributeId()); $copyObj->setAttributeId($this->getAttributeId());
$copyObj->setTemplateId($this->getTemplateId()); $copyObj->setTemplateId($this->getTemplateId());
$copyObj->setPosition($this->getPosition());
$copyObj->setAttributeTemplatecol($this->getAttributeTemplatecol());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) { if ($makeNew) {
@@ -1323,6 +1437,8 @@ abstract class AttributeTemplate implements ActiveRecordInterface
$this->id = null; $this->id = null;
$this->attribute_id = null; $this->attribute_id = null;
$this->template_id = null; $this->template_id = null;
$this->position = null;
$this->attribute_templatecol = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;

View File

@@ -24,12 +24,16 @@ use Thelia\Model\Map\AttributeTemplateTableMap;
* @method ChildAttributeTemplateQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildAttributeTemplateQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildAttributeTemplateQuery orderByAttributeId($order = Criteria::ASC) Order by the attribute_id column * @method ChildAttributeTemplateQuery orderByAttributeId($order = Criteria::ASC) Order by the attribute_id column
* @method ChildAttributeTemplateQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column * @method ChildAttributeTemplateQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
* @method ChildAttributeTemplateQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildAttributeTemplateQuery orderByAttributeTemplatecol($order = Criteria::ASC) Order by the attribute_templatecol column
* @method ChildAttributeTemplateQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildAttributeTemplateQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildAttributeTemplateQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildAttributeTemplateQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildAttributeTemplateQuery groupById() Group by the id column * @method ChildAttributeTemplateQuery groupById() Group by the id column
* @method ChildAttributeTemplateQuery groupByAttributeId() Group by the attribute_id column * @method ChildAttributeTemplateQuery groupByAttributeId() Group by the attribute_id column
* @method ChildAttributeTemplateQuery groupByTemplateId() Group by the template_id column * @method ChildAttributeTemplateQuery groupByTemplateId() Group by the template_id column
* @method ChildAttributeTemplateQuery groupByPosition() Group by the position column
* @method ChildAttributeTemplateQuery groupByAttributeTemplatecol() Group by the attribute_templatecol column
* @method ChildAttributeTemplateQuery groupByCreatedAt() Group by the created_at column * @method ChildAttributeTemplateQuery groupByCreatedAt() Group by the created_at column
* @method ChildAttributeTemplateQuery groupByUpdatedAt() Group by the updated_at column * @method ChildAttributeTemplateQuery groupByUpdatedAt() Group by the updated_at column
* *
@@ -51,12 +55,16 @@ use Thelia\Model\Map\AttributeTemplateTableMap;
* @method ChildAttributeTemplate findOneById(int $id) Return the first ChildAttributeTemplate filtered by the id column * @method ChildAttributeTemplate findOneById(int $id) Return the first ChildAttributeTemplate filtered by the id column
* @method ChildAttributeTemplate findOneByAttributeId(int $attribute_id) Return the first ChildAttributeTemplate filtered by the attribute_id column * @method ChildAttributeTemplate findOneByAttributeId(int $attribute_id) Return the first ChildAttributeTemplate filtered by the attribute_id column
* @method ChildAttributeTemplate findOneByTemplateId(int $template_id) Return the first ChildAttributeTemplate filtered by the template_id column * @method ChildAttributeTemplate findOneByTemplateId(int $template_id) Return the first ChildAttributeTemplate filtered by the template_id column
* @method ChildAttributeTemplate findOneByPosition(int $position) Return the first ChildAttributeTemplate filtered by the position column
* @method ChildAttributeTemplate findOneByAttributeTemplatecol(string $attribute_templatecol) Return the first ChildAttributeTemplate filtered by the attribute_templatecol column
* @method ChildAttributeTemplate findOneByCreatedAt(string $created_at) Return the first ChildAttributeTemplate filtered by the created_at column * @method ChildAttributeTemplate findOneByCreatedAt(string $created_at) Return the first ChildAttributeTemplate filtered by the created_at column
* @method ChildAttributeTemplate findOneByUpdatedAt(string $updated_at) Return the first ChildAttributeTemplate filtered by the updated_at column * @method ChildAttributeTemplate findOneByUpdatedAt(string $updated_at) Return the first ChildAttributeTemplate filtered by the updated_at column
* *
* @method array findById(int $id) Return ChildAttributeTemplate objects filtered by the id column * @method array findById(int $id) Return ChildAttributeTemplate objects filtered by the id column
* @method array findByAttributeId(int $attribute_id) Return ChildAttributeTemplate objects filtered by the attribute_id column * @method array findByAttributeId(int $attribute_id) Return ChildAttributeTemplate objects filtered by the attribute_id column
* @method array findByTemplateId(int $template_id) Return ChildAttributeTemplate objects filtered by the template_id column * @method array findByTemplateId(int $template_id) Return ChildAttributeTemplate objects filtered by the template_id column
* @method array findByPosition(int $position) Return ChildAttributeTemplate objects filtered by the position column
* @method array findByAttributeTemplatecol(string $attribute_templatecol) Return ChildAttributeTemplate objects filtered by the attribute_templatecol column
* @method array findByCreatedAt(string $created_at) Return ChildAttributeTemplate objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildAttributeTemplate objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildAttributeTemplate objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildAttributeTemplate objects filtered by the updated_at column
* *
@@ -147,7 +155,7 @@ abstract class AttributeTemplateQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, ATTRIBUTE_ID, TEMPLATE_ID, CREATED_AT, UPDATED_AT FROM attribute_template WHERE ID = :p0'; $sql = 'SELECT ID, ATTRIBUTE_ID, TEMPLATE_ID, POSITION, ATTRIBUTE_TEMPLATECOL, CREATED_AT, UPDATED_AT FROM attribute_template WHERE ID = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -363,6 +371,76 @@ abstract class AttributeTemplateQuery extends ModelCriteria
return $this->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $templateId, $comparison); return $this->addUsingAlias(AttributeTemplateTableMap::TEMPLATE_ID, $templateId, $comparison);
} }
/**
* Filter the query on the position column
*
* Example usage:
* <code>
* $query->filterByPosition(1234); // WHERE position = 1234
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
* </code>
*
* @param mixed $position The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function filterByPosition($position = null, $comparison = null)
{
if (is_array($position)) {
$useMinMax = false;
if (isset($position['min'])) {
$this->addUsingAlias(AttributeTemplateTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(AttributeTemplateTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(AttributeTemplateTableMap::POSITION, $position, $comparison);
}
/**
* Filter the query on the attribute_templatecol column
*
* Example usage:
* <code>
* $query->filterByAttributeTemplatecol('fooValue'); // WHERE attribute_templatecol = 'fooValue'
* $query->filterByAttributeTemplatecol('%fooValue%'); // WHERE attribute_templatecol LIKE '%fooValue%'
* </code>
*
* @param string $attributeTemplatecol The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildAttributeTemplateQuery The current query, for fluid interface
*/
public function filterByAttributeTemplatecol($attributeTemplatecol = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($attributeTemplatecol)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $attributeTemplatecol)) {
$attributeTemplatecol = str_replace('*', '%', $attributeTemplatecol);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL, $attributeTemplatecol, $comparison);
}
/** /**
* Filter the query on the created_at column * Filter the query on the created_at column
* *

View File

@@ -76,6 +76,12 @@ abstract class FeatureTemplate implements ActiveRecordInterface
*/ */
protected $template_id; protected $template_id;
/**
* The value for the position field.
* @var int
*/
protected $position;
/** /**
* The value for the created_at field. * The value for the created_at field.
* @var string * @var string
@@ -393,6 +399,17 @@ abstract class FeatureTemplate implements ActiveRecordInterface
return $this->template_id; return $this->template_id;
} }
/**
* Get the [position] column value.
*
* @return int
*/
public function getPosition()
{
return $this->position;
}
/** /**
* Get the [optionally formatted] temporal [created_at] column value. * Get the [optionally formatted] temporal [created_at] column value.
* *
@@ -504,6 +521,27 @@ abstract class FeatureTemplate implements ActiveRecordInterface
return $this; return $this;
} // setTemplateId() } // setTemplateId()
/**
* Set the value of [position] column.
*
* @param int $v new value
* @return \Thelia\Model\FeatureTemplate The current object (for fluent API support)
*/
public function setPosition($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->position !== $v) {
$this->position = $v;
$this->modifiedColumns[] = FeatureTemplateTableMap::POSITION;
}
return $this;
} // setPosition()
/** /**
* Sets the value of [created_at] column to a normalized version of the date/time value specified. * Sets the value of [created_at] column to a normalized version of the date/time value specified.
* *
@@ -592,13 +630,16 @@ abstract class FeatureTemplate implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : FeatureTemplateTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : FeatureTemplateTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)];
$this->template_id = (null !== $col) ? (int) $col : null; $this->template_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : FeatureTemplateTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : FeatureTemplateTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
$this->position = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : FeatureTemplateTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : FeatureTemplateTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : FeatureTemplateTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
@@ -611,7 +652,7 @@ abstract class FeatureTemplate implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 5; // 5 = FeatureTemplateTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 6; // 6 = FeatureTemplateTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\FeatureTemplate object", 0, $e); throw new PropelException("Error populating \Thelia\Model\FeatureTemplate object", 0, $e);
@@ -867,6 +908,9 @@ abstract class FeatureTemplate implements ActiveRecordInterface
if ($this->isColumnModified(FeatureTemplateTableMap::TEMPLATE_ID)) { if ($this->isColumnModified(FeatureTemplateTableMap::TEMPLATE_ID)) {
$modifiedColumns[':p' . $index++] = 'TEMPLATE_ID'; $modifiedColumns[':p' . $index++] = 'TEMPLATE_ID';
} }
if ($this->isColumnModified(FeatureTemplateTableMap::POSITION)) {
$modifiedColumns[':p' . $index++] = 'POSITION';
}
if ($this->isColumnModified(FeatureTemplateTableMap::CREATED_AT)) { if ($this->isColumnModified(FeatureTemplateTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT'; $modifiedColumns[':p' . $index++] = 'CREATED_AT';
} }
@@ -893,6 +937,9 @@ abstract class FeatureTemplate implements ActiveRecordInterface
case 'TEMPLATE_ID': case 'TEMPLATE_ID':
$stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT);
break; break;
case 'POSITION':
$stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
break;
case 'CREATED_AT': case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break; break;
@@ -971,9 +1018,12 @@ abstract class FeatureTemplate implements ActiveRecordInterface
return $this->getTemplateId(); return $this->getTemplateId();
break; break;
case 3: case 3:
return $this->getCreatedAt(); return $this->getPosition();
break; break;
case 4: case 4:
return $this->getCreatedAt();
break;
case 5:
return $this->getUpdatedAt(); return $this->getUpdatedAt();
break; break;
default: default:
@@ -1008,8 +1058,9 @@ abstract class FeatureTemplate implements ActiveRecordInterface
$keys[0] => $this->getId(), $keys[0] => $this->getId(),
$keys[1] => $this->getFeatureId(), $keys[1] => $this->getFeatureId(),
$keys[2] => $this->getTemplateId(), $keys[2] => $this->getTemplateId(),
$keys[3] => $this->getCreatedAt(), $keys[3] => $this->getPosition(),
$keys[4] => $this->getUpdatedAt(), $keys[4] => $this->getCreatedAt(),
$keys[5] => $this->getUpdatedAt(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn) foreach($virtualColumns as $key => $virtualColumn)
@@ -1068,9 +1119,12 @@ abstract class FeatureTemplate implements ActiveRecordInterface
$this->setTemplateId($value); $this->setTemplateId($value);
break; break;
case 3: case 3:
$this->setCreatedAt($value); $this->setPosition($value);
break; break;
case 4: case 4:
$this->setCreatedAt($value);
break;
case 5:
$this->setUpdatedAt($value); $this->setUpdatedAt($value);
break; break;
} // switch() } // switch()
@@ -1100,8 +1154,9 @@ abstract class FeatureTemplate implements ActiveRecordInterface
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setFeatureId($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setFeatureId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setTemplateId($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setTemplateId($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setPosition($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
} }
/** /**
@@ -1116,6 +1171,7 @@ abstract class FeatureTemplate implements ActiveRecordInterface
if ($this->isColumnModified(FeatureTemplateTableMap::ID)) $criteria->add(FeatureTemplateTableMap::ID, $this->id); if ($this->isColumnModified(FeatureTemplateTableMap::ID)) $criteria->add(FeatureTemplateTableMap::ID, $this->id);
if ($this->isColumnModified(FeatureTemplateTableMap::FEATURE_ID)) $criteria->add(FeatureTemplateTableMap::FEATURE_ID, $this->feature_id); if ($this->isColumnModified(FeatureTemplateTableMap::FEATURE_ID)) $criteria->add(FeatureTemplateTableMap::FEATURE_ID, $this->feature_id);
if ($this->isColumnModified(FeatureTemplateTableMap::TEMPLATE_ID)) $criteria->add(FeatureTemplateTableMap::TEMPLATE_ID, $this->template_id); if ($this->isColumnModified(FeatureTemplateTableMap::TEMPLATE_ID)) $criteria->add(FeatureTemplateTableMap::TEMPLATE_ID, $this->template_id);
if ($this->isColumnModified(FeatureTemplateTableMap::POSITION)) $criteria->add(FeatureTemplateTableMap::POSITION, $this->position);
if ($this->isColumnModified(FeatureTemplateTableMap::CREATED_AT)) $criteria->add(FeatureTemplateTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(FeatureTemplateTableMap::CREATED_AT)) $criteria->add(FeatureTemplateTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(FeatureTemplateTableMap::UPDATED_AT)) $criteria->add(FeatureTemplateTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(FeatureTemplateTableMap::UPDATED_AT)) $criteria->add(FeatureTemplateTableMap::UPDATED_AT, $this->updated_at);
@@ -1183,6 +1239,7 @@ abstract class FeatureTemplate implements ActiveRecordInterface
{ {
$copyObj->setFeatureId($this->getFeatureId()); $copyObj->setFeatureId($this->getFeatureId());
$copyObj->setTemplateId($this->getTemplateId()); $copyObj->setTemplateId($this->getTemplateId());
$copyObj->setPosition($this->getPosition());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) { if ($makeNew) {
@@ -1323,6 +1380,7 @@ abstract class FeatureTemplate implements ActiveRecordInterface
$this->id = null; $this->id = null;
$this->feature_id = null; $this->feature_id = null;
$this->template_id = null; $this->template_id = null;
$this->position = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;

View File

@@ -24,12 +24,14 @@ use Thelia\Model\Map\FeatureTemplateTableMap;
* @method ChildFeatureTemplateQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildFeatureTemplateQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildFeatureTemplateQuery orderByFeatureId($order = Criteria::ASC) Order by the feature_id column * @method ChildFeatureTemplateQuery orderByFeatureId($order = Criteria::ASC) Order by the feature_id column
* @method ChildFeatureTemplateQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column * @method ChildFeatureTemplateQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
* @method ChildFeatureTemplateQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildFeatureTemplateQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildFeatureTemplateQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildFeatureTemplateQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildFeatureTemplateQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildFeatureTemplateQuery groupById() Group by the id column * @method ChildFeatureTemplateQuery groupById() Group by the id column
* @method ChildFeatureTemplateQuery groupByFeatureId() Group by the feature_id column * @method ChildFeatureTemplateQuery groupByFeatureId() Group by the feature_id column
* @method ChildFeatureTemplateQuery groupByTemplateId() Group by the template_id column * @method ChildFeatureTemplateQuery groupByTemplateId() Group by the template_id column
* @method ChildFeatureTemplateQuery groupByPosition() Group by the position column
* @method ChildFeatureTemplateQuery groupByCreatedAt() Group by the created_at column * @method ChildFeatureTemplateQuery groupByCreatedAt() Group by the created_at column
* @method ChildFeatureTemplateQuery groupByUpdatedAt() Group by the updated_at column * @method ChildFeatureTemplateQuery groupByUpdatedAt() Group by the updated_at column
* *
@@ -51,12 +53,14 @@ use Thelia\Model\Map\FeatureTemplateTableMap;
* @method ChildFeatureTemplate findOneById(int $id) Return the first ChildFeatureTemplate filtered by the id column * @method ChildFeatureTemplate findOneById(int $id) Return the first ChildFeatureTemplate filtered by the id column
* @method ChildFeatureTemplate findOneByFeatureId(int $feature_id) Return the first ChildFeatureTemplate filtered by the feature_id column * @method ChildFeatureTemplate findOneByFeatureId(int $feature_id) Return the first ChildFeatureTemplate filtered by the feature_id column
* @method ChildFeatureTemplate findOneByTemplateId(int $template_id) Return the first ChildFeatureTemplate filtered by the template_id column * @method ChildFeatureTemplate findOneByTemplateId(int $template_id) Return the first ChildFeatureTemplate filtered by the template_id column
* @method ChildFeatureTemplate findOneByPosition(int $position) Return the first ChildFeatureTemplate filtered by the position column
* @method ChildFeatureTemplate findOneByCreatedAt(string $created_at) Return the first ChildFeatureTemplate filtered by the created_at column * @method ChildFeatureTemplate findOneByCreatedAt(string $created_at) Return the first ChildFeatureTemplate filtered by the created_at column
* @method ChildFeatureTemplate findOneByUpdatedAt(string $updated_at) Return the first ChildFeatureTemplate filtered by the updated_at column * @method ChildFeatureTemplate findOneByUpdatedAt(string $updated_at) Return the first ChildFeatureTemplate filtered by the updated_at column
* *
* @method array findById(int $id) Return ChildFeatureTemplate objects filtered by the id column * @method array findById(int $id) Return ChildFeatureTemplate objects filtered by the id column
* @method array findByFeatureId(int $feature_id) Return ChildFeatureTemplate objects filtered by the feature_id column * @method array findByFeatureId(int $feature_id) Return ChildFeatureTemplate objects filtered by the feature_id column
* @method array findByTemplateId(int $template_id) Return ChildFeatureTemplate objects filtered by the template_id column * @method array findByTemplateId(int $template_id) Return ChildFeatureTemplate objects filtered by the template_id column
* @method array findByPosition(int $position) Return ChildFeatureTemplate objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ChildFeatureTemplate objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildFeatureTemplate objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildFeatureTemplate objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildFeatureTemplate objects filtered by the updated_at column
* *
@@ -147,7 +151,7 @@ abstract class FeatureTemplateQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, FEATURE_ID, TEMPLATE_ID, CREATED_AT, UPDATED_AT FROM feature_template WHERE ID = :p0'; $sql = 'SELECT ID, FEATURE_ID, TEMPLATE_ID, POSITION, CREATED_AT, UPDATED_AT FROM feature_template WHERE ID = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -363,6 +367,47 @@ abstract class FeatureTemplateQuery extends ModelCriteria
return $this->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $templateId, $comparison); return $this->addUsingAlias(FeatureTemplateTableMap::TEMPLATE_ID, $templateId, $comparison);
} }
/**
* Filter the query on the position column
*
* Example usage:
* <code>
* $query->filterByPosition(1234); // WHERE position = 1234
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
* </code>
*
* @param mixed $position The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildFeatureTemplateQuery The current query, for fluid interface
*/
public function filterByPosition($position = null, $comparison = null)
{
if (is_array($position)) {
$useMinMax = false;
if (isset($position['min'])) {
$this->addUsingAlias(FeatureTemplateTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(FeatureTemplateTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(FeatureTemplateTableMap::POSITION, $position, $comparison);
}
/** /**
* Filter the query on the created_at column * Filter the query on the created_at column
* *

View File

@@ -3,8 +3,30 @@
namespace Thelia\Model; namespace Thelia\Model;
use Thelia\Model\Base\FeatureTemplate as BaseFeatureTemplate; use Thelia\Model\Base\FeatureTemplate as BaseFeatureTemplate;
use Propel\Runtime\Connection\ConnectionInterface;
class FeatureTemplate extends BaseFeatureTemplate class FeatureTemplate extends BaseFeatureTemplate
{ {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait;
/**
* Calculate next position relative to our template
*/
protected function addCriteriaToPositionQuery($query)
{
$query->filterByTemplateId($this->getTemplateId());
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
// Set the current position for the new object
$this->setPosition($this->getNextPosition());
return true;
}
} }

View File

@@ -57,7 +57,7 @@ class AttributeTemplateTableMap extends TableMap
/** /**
* The total number of columns * The total number of columns
*/ */
const NUM_COLUMNS = 5; const NUM_COLUMNS = 7;
/** /**
* The number of lazy-loaded columns * The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class AttributeTemplateTableMap extends TableMap
/** /**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/ */
const NUM_HYDRATE_COLUMNS = 5; const NUM_HYDRATE_COLUMNS = 7;
/** /**
* the column name for the ID field * the column name for the ID field
@@ -84,6 +84,16 @@ class AttributeTemplateTableMap extends TableMap
*/ */
const TEMPLATE_ID = 'attribute_template.TEMPLATE_ID'; const TEMPLATE_ID = 'attribute_template.TEMPLATE_ID';
/**
* the column name for the POSITION field
*/
const POSITION = 'attribute_template.POSITION';
/**
* the column name for the ATTRIBUTE_TEMPLATECOL field
*/
const ATTRIBUTE_TEMPLATECOL = 'attribute_template.ATTRIBUTE_TEMPLATECOL';
/** /**
* the column name for the CREATED_AT field * the column name for the CREATED_AT field
*/ */
@@ -106,12 +116,12 @@ class AttributeTemplateTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'AttributeId', 'TemplateId', 'CreatedAt', 'UpdatedAt', ), self::TYPE_PHPNAME => array('Id', 'AttributeId', 'TemplateId', 'Position', 'AttributeTemplatecol', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'attributeId', 'templateId', 'createdAt', 'updatedAt', ), self::TYPE_STUDLYPHPNAME => array('id', 'attributeId', 'templateId', 'position', 'attributeTemplatecol', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(AttributeTemplateTableMap::ID, AttributeTemplateTableMap::ATTRIBUTE_ID, AttributeTemplateTableMap::TEMPLATE_ID, AttributeTemplateTableMap::CREATED_AT, AttributeTemplateTableMap::UPDATED_AT, ), self::TYPE_COLNAME => array(AttributeTemplateTableMap::ID, AttributeTemplateTableMap::ATTRIBUTE_ID, AttributeTemplateTableMap::TEMPLATE_ID, AttributeTemplateTableMap::POSITION, AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL, AttributeTemplateTableMap::CREATED_AT, AttributeTemplateTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'ATTRIBUTE_ID', 'TEMPLATE_ID', 'CREATED_AT', 'UPDATED_AT', ), self::TYPE_RAW_COLNAME => array('ID', 'ATTRIBUTE_ID', 'TEMPLATE_ID', 'POSITION', 'ATTRIBUTE_TEMPLATECOL', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'attribute_id', 'template_id', 'created_at', 'updated_at', ), self::TYPE_FIELDNAME => array('id', 'attribute_id', 'template_id', 'position', 'attribute_templatecol', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
); );
/** /**
@@ -121,12 +131,12 @@ class AttributeTemplateTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'AttributeId' => 1, 'TemplateId' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), self::TYPE_PHPNAME => array('Id' => 0, 'AttributeId' => 1, 'TemplateId' => 2, 'Position' => 3, 'AttributeTemplatecol' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'attributeId' => 1, 'templateId' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'attributeId' => 1, 'templateId' => 2, 'position' => 3, 'attributeTemplatecol' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
self::TYPE_COLNAME => array(AttributeTemplateTableMap::ID => 0, AttributeTemplateTableMap::ATTRIBUTE_ID => 1, AttributeTemplateTableMap::TEMPLATE_ID => 2, AttributeTemplateTableMap::CREATED_AT => 3, AttributeTemplateTableMap::UPDATED_AT => 4, ), self::TYPE_COLNAME => array(AttributeTemplateTableMap::ID => 0, AttributeTemplateTableMap::ATTRIBUTE_ID => 1, AttributeTemplateTableMap::TEMPLATE_ID => 2, AttributeTemplateTableMap::POSITION => 3, AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL => 4, AttributeTemplateTableMap::CREATED_AT => 5, AttributeTemplateTableMap::UPDATED_AT => 6, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ATTRIBUTE_ID' => 1, 'TEMPLATE_ID' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'ATTRIBUTE_ID' => 1, 'TEMPLATE_ID' => 2, 'POSITION' => 3, 'ATTRIBUTE_TEMPLATECOL' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
self::TYPE_FIELDNAME => array('id' => 0, 'attribute_id' => 1, 'template_id' => 2, 'created_at' => 3, 'updated_at' => 4, ), self::TYPE_FIELDNAME => array('id' => 0, 'attribute_id' => 1, 'template_id' => 2, 'position' => 3, 'attribute_templatecol' => 4, 'created_at' => 5, 'updated_at' => 6, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
); );
/** /**
@@ -149,6 +159,8 @@ class AttributeTemplateTableMap extends TableMap
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('ATTRIBUTE_ID', 'AttributeId', 'INTEGER', 'attribute', 'ID', true, null, null); $this->addForeignKey('ATTRIBUTE_ID', 'AttributeId', 'INTEGER', 'attribute', 'ID', true, null, null);
$this->addForeignKey('TEMPLATE_ID', 'TemplateId', 'INTEGER', 'template', 'ID', true, null, null); $this->addForeignKey('TEMPLATE_ID', 'TemplateId', 'INTEGER', 'template', 'ID', true, null, null);
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
$this->addColumn('ATTRIBUTE_TEMPLATECOL', 'AttributeTemplatecol', 'VARCHAR', false, 45, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize() } // initialize()
@@ -316,12 +328,16 @@ class AttributeTemplateTableMap extends TableMap
$criteria->addSelectColumn(AttributeTemplateTableMap::ID); $criteria->addSelectColumn(AttributeTemplateTableMap::ID);
$criteria->addSelectColumn(AttributeTemplateTableMap::ATTRIBUTE_ID); $criteria->addSelectColumn(AttributeTemplateTableMap::ATTRIBUTE_ID);
$criteria->addSelectColumn(AttributeTemplateTableMap::TEMPLATE_ID); $criteria->addSelectColumn(AttributeTemplateTableMap::TEMPLATE_ID);
$criteria->addSelectColumn(AttributeTemplateTableMap::POSITION);
$criteria->addSelectColumn(AttributeTemplateTableMap::ATTRIBUTE_TEMPLATECOL);
$criteria->addSelectColumn(AttributeTemplateTableMap::CREATED_AT); $criteria->addSelectColumn(AttributeTemplateTableMap::CREATED_AT);
$criteria->addSelectColumn(AttributeTemplateTableMap::UPDATED_AT); $criteria->addSelectColumn(AttributeTemplateTableMap::UPDATED_AT);
} else { } else {
$criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.ATTRIBUTE_ID'); $criteria->addSelectColumn($alias . '.ATTRIBUTE_ID');
$criteria->addSelectColumn($alias . '.TEMPLATE_ID'); $criteria->addSelectColumn($alias . '.TEMPLATE_ID');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.ATTRIBUTE_TEMPLATECOL');
$criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT');
} }

View File

@@ -156,7 +156,7 @@ class FeatureTableMap extends TableMap
// columns // columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('VISIBLE', 'Visible', 'INTEGER', false, null, 0); $this->addColumn('VISIBLE', 'Visible', 'INTEGER', false, null, 0);
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null); $this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize() } // initialize()

View File

@@ -57,7 +57,7 @@ class FeatureTemplateTableMap extends TableMap
/** /**
* The total number of columns * The total number of columns
*/ */
const NUM_COLUMNS = 5; const NUM_COLUMNS = 6;
/** /**
* The number of lazy-loaded columns * The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class FeatureTemplateTableMap extends TableMap
/** /**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/ */
const NUM_HYDRATE_COLUMNS = 5; const NUM_HYDRATE_COLUMNS = 6;
/** /**
* the column name for the ID field * the column name for the ID field
@@ -84,6 +84,11 @@ class FeatureTemplateTableMap extends TableMap
*/ */
const TEMPLATE_ID = 'feature_template.TEMPLATE_ID'; const TEMPLATE_ID = 'feature_template.TEMPLATE_ID';
/**
* the column name for the POSITION field
*/
const POSITION = 'feature_template.POSITION';
/** /**
* the column name for the CREATED_AT field * the column name for the CREATED_AT field
*/ */
@@ -106,12 +111,12 @@ class FeatureTemplateTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'FeatureId', 'TemplateId', 'CreatedAt', 'UpdatedAt', ), self::TYPE_PHPNAME => array('Id', 'FeatureId', 'TemplateId', 'Position', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'featureId', 'templateId', 'createdAt', 'updatedAt', ), self::TYPE_STUDLYPHPNAME => array('id', 'featureId', 'templateId', 'position', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(FeatureTemplateTableMap::ID, FeatureTemplateTableMap::FEATURE_ID, FeatureTemplateTableMap::TEMPLATE_ID, FeatureTemplateTableMap::CREATED_AT, FeatureTemplateTableMap::UPDATED_AT, ), self::TYPE_COLNAME => array(FeatureTemplateTableMap::ID, FeatureTemplateTableMap::FEATURE_ID, FeatureTemplateTableMap::TEMPLATE_ID, FeatureTemplateTableMap::POSITION, FeatureTemplateTableMap::CREATED_AT, FeatureTemplateTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'FEATURE_ID', 'TEMPLATE_ID', 'CREATED_AT', 'UPDATED_AT', ), self::TYPE_RAW_COLNAME => array('ID', 'FEATURE_ID', 'TEMPLATE_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'feature_id', 'template_id', 'created_at', 'updated_at', ), self::TYPE_FIELDNAME => array('id', 'feature_id', 'template_id', 'position', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
); );
/** /**
@@ -121,12 +126,12 @@ class FeatureTemplateTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'FeatureId' => 1, 'TemplateId' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), self::TYPE_PHPNAME => array('Id' => 0, 'FeatureId' => 1, 'TemplateId' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'featureId' => 1, 'templateId' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'featureId' => 1, 'templateId' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
self::TYPE_COLNAME => array(FeatureTemplateTableMap::ID => 0, FeatureTemplateTableMap::FEATURE_ID => 1, FeatureTemplateTableMap::TEMPLATE_ID => 2, FeatureTemplateTableMap::CREATED_AT => 3, FeatureTemplateTableMap::UPDATED_AT => 4, ), self::TYPE_COLNAME => array(FeatureTemplateTableMap::ID => 0, FeatureTemplateTableMap::FEATURE_ID => 1, FeatureTemplateTableMap::TEMPLATE_ID => 2, FeatureTemplateTableMap::POSITION => 3, FeatureTemplateTableMap::CREATED_AT => 4, FeatureTemplateTableMap::UPDATED_AT => 5, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'FEATURE_ID' => 1, 'TEMPLATE_ID' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'FEATURE_ID' => 1, 'TEMPLATE_ID' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
self::TYPE_FIELDNAME => array('id' => 0, 'feature_id' => 1, 'template_id' => 2, 'created_at' => 3, 'updated_at' => 4, ), self::TYPE_FIELDNAME => array('id' => 0, 'feature_id' => 1, 'template_id' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
); );
/** /**
@@ -149,6 +154,7 @@ class FeatureTemplateTableMap extends TableMap
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('FEATURE_ID', 'FeatureId', 'INTEGER', 'feature', 'ID', true, null, null); $this->addForeignKey('FEATURE_ID', 'FeatureId', 'INTEGER', 'feature', 'ID', true, null, null);
$this->addForeignKey('TEMPLATE_ID', 'TemplateId', 'INTEGER', 'template', 'ID', true, null, null); $this->addForeignKey('TEMPLATE_ID', 'TemplateId', 'INTEGER', 'template', 'ID', true, null, null);
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize() } // initialize()
@@ -316,12 +322,14 @@ class FeatureTemplateTableMap extends TableMap
$criteria->addSelectColumn(FeatureTemplateTableMap::ID); $criteria->addSelectColumn(FeatureTemplateTableMap::ID);
$criteria->addSelectColumn(FeatureTemplateTableMap::FEATURE_ID); $criteria->addSelectColumn(FeatureTemplateTableMap::FEATURE_ID);
$criteria->addSelectColumn(FeatureTemplateTableMap::TEMPLATE_ID); $criteria->addSelectColumn(FeatureTemplateTableMap::TEMPLATE_ID);
$criteria->addSelectColumn(FeatureTemplateTableMap::POSITION);
$criteria->addSelectColumn(FeatureTemplateTableMap::CREATED_AT); $criteria->addSelectColumn(FeatureTemplateTableMap::CREATED_AT);
$criteria->addSelectColumn(FeatureTemplateTableMap::UPDATED_AT); $criteria->addSelectColumn(FeatureTemplateTableMap::UPDATED_AT);
} else { } else {
$criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.FEATURE_ID'); $criteria->addSelectColumn($alias . '.FEATURE_ID');
$criteria->addSelectColumn($alias . '.TEMPLATE_ID'); $criteria->addSelectColumn($alias . '.TEMPLATE_ID');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT');
} }

View File

@@ -89,6 +89,9 @@ class Product extends BaseProduct
public function updateDefaultCategory($defaultCategoryId) { public function updateDefaultCategory($defaultCategoryId) {
// Allow uncategorized products (NULL instead of 0, to bypass delete cascade constraint)
if ($defaultCategoryId <= 0) $defaultCategoryId = NULL;
// Update the default category // Update the default category
$productCategory = ProductCategoryQuery::create() $productCategory = ProductCategoryQuery::create()
->filterByProductId($this->getId()) ->filterByProductId($this->getId())

View File

@@ -179,6 +179,7 @@ trait PositionManagementTrait {
try { try {
foreach ($results as $result) { foreach ($results as $result) {
$result->setDispatcher($this->getDispatcher())->setPosition($result->getPosition() + $delta)->save($cnx); $result->setDispatcher($this->getDispatcher())->setPosition($result->getPosition() + $delta)->save($cnx);
} }

View File

@@ -186,7 +186,7 @@ CREATE TABLE `feature`
( (
`id` INTEGER NOT NULL AUTO_INCREMENT, `id` INTEGER NOT NULL AUTO_INCREMENT,
`visible` INTEGER DEFAULT 0, `visible` INTEGER DEFAULT 0,
`position` INTEGER NOT NULL, `position` INTEGER,
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
@@ -262,6 +262,7 @@ CREATE TABLE `feature_template`
`id` INTEGER NOT NULL AUTO_INCREMENT, `id` INTEGER NOT NULL AUTO_INCREMENT,
`feature_id` INTEGER NOT NULL, `feature_id` INTEGER NOT NULL,
`template_id` INTEGER NOT NULL, `template_id` INTEGER NOT NULL,
`position` INTEGER,
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
@@ -387,6 +388,8 @@ CREATE TABLE `attribute_template`
`id` INTEGER NOT NULL AUTO_INCREMENT, `id` INTEGER NOT NULL AUTO_INCREMENT,
`attribute_id` INTEGER NOT NULL, `attribute_id` INTEGER NOT NULL,
`template_id` INTEGER NOT NULL, `template_id` INTEGER NOT NULL,
`position` INTEGER,
`attribute_templatecol` VARCHAR(45),
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),

View File

@@ -145,11 +145,11 @@
</table> </table>
<table name="feature" namespace="Thelia\Model"> <table name="feature" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" /> <column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column defaultValue="0" name="visible" type="INTEGER" />
<column defaultValue="0" name="visible" type="INTEGER" /> <column defaultValue="0" name="visible" type="INTEGER" />
<column name="title" size="255" type="VARCHAR" /> <column name="title" size="255" type="VARCHAR" />
<column name="description" type="CLOB" /> <column name="description" type="CLOB" />
<column name="chapo" type="LONGVARCHAR" /> <column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" />
<column name="position" type="INTEGER" /> <column name="position" type="INTEGER" />
<behavior name="timestampable" /> <behavior name="timestampable" />
<behavior name="i18n"> <behavior name="i18n">
@@ -205,6 +205,7 @@
<table isCrossRef="true" name="feature_template" namespace="Thelia\Model"> <table isCrossRef="true" name="feature_template" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" /> <column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="feature_id" required="true" type="INTEGER" /> <column name="feature_id" required="true" type="INTEGER" />
<column name="template_id" required="true" type="INTEGER" />
<column name="position" type="INTEGER" /> <column name="position" type="INTEGER" />
<foreign-key foreignTable="feature" name="fk_feature_template_id" onDelete="CASCADE" onUpdate="RESTRICT"> <foreign-key foreignTable="feature" name="fk_feature_template_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="feature_id" /> <reference foreign="id" local="feature_id" />
@@ -221,11 +222,11 @@
<behavior name="timestampable" /> <behavior name="timestampable" />
</table> </table>
<table name="attribute" namespace="Thelia\Model"> <table name="attribute" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" /> <column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="title" size="255" type="VARCHAR" /> <column name="title" size="255" type="VARCHAR" />
<column name="description" type="CLOB" /> <column name="description" type="CLOB" />
<column name="chapo" type="LONGVARCHAR" /> <column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" />
<column name="position" type="INTEGER" /> <column name="position" type="INTEGER" />
<behavior name="timestampable" /> <behavior name="timestampable" />
<behavior name="i18n"> <behavior name="i18n">
@@ -298,6 +299,8 @@
<table isCrossRef="true" name="attribute_template" namespace="Thelia\Model"> <table isCrossRef="true" name="attribute_template" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" /> <column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="attribute_id" required="true" type="INTEGER" /> <column name="attribute_id" required="true" type="INTEGER" />
<column name="template_id" required="true" type="INTEGER" />
<column name="position" type="INTEGER" />
<column name="attribute_templatecol" size="45" type="VARCHAR" /> <column name="attribute_templatecol" size="45" type="VARCHAR" />
<foreign-key foreignTable="attribute" name="fk_attribute_template_id" onDelete="CASCADE" onUpdate="RESTRICT"> <foreign-key foreignTable="attribute" name="fk_attribute_template_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="attribute_id" /> <reference foreign="id" local="attribute_id" />

View File

@@ -33,6 +33,8 @@
<th>{intl l='Attribute title'}</th> <th>{intl l='Attribute title'}</th>
<th class="text-center">{intl l='Position'}</th>
{module_include location='template_attributes_table_header'} {module_include location='template_attributes_table_header'}
<th class="actions">{intl l="Actions"}</th> <th class="actions">{intl l="Actions"}</th>
@@ -44,8 +46,17 @@
<tr> <tr>
<td>{$ID}</td> <td>{$ID}</td>
<td> <td>{$TITLE}</td>
{$TITLE}
<td class="text-center">
{admin_position_block
permission="admin.templates.edit"
path={url path="admin/template/update-attribute-position" template_id=$template_id}
url_parameter="attribute_id"
in_place_edit_class="attributePositionChange"
position=$POSITION
id=$ID
}
</td> </td>
{module_include location='template_attributes_table_row'} {module_include location='template_attributes_table_row'}
@@ -64,7 +75,7 @@
{elseloop rel="assigned_attributes"} {elseloop rel="assigned_attributes"}
<tr> <tr>
<td colspan="3"> <td colspan="4">
<div class="alert alert-info"> <div class="alert alert-info">
{intl l="This template contains no attributes"} {intl l="This template contains no attributes"}
</div> </div>
@@ -93,11 +104,33 @@
} }
<script> <script>
$(function() { $(function() {
// Set proper attribute ID in delete attribute from // Set proper attribute ID in delete attribute from
$('a.delete-attribute').click(function(ev) { $('a.delete-attribute').click(function(ev) {
$('#attribute_delete_id').val($(this).data('id')); $('#attribute_delete_id').val($(this).data('id'));
}); });
{* Inline editing of object position using bootstrap-editable *}
$('.attributePositionChange').editable({
type : 'text',
title : '{intl l="Enter new category position"}',
mode : 'popup',
inputclass : 'input-mini',
placement : 'left',
success : function(response, newValue) {
// The URL template
var url = "{url noamp='1' path="admin/template/update-attribute-position" template_id=$template_id attribute_id='__ID__' position='__POS__'}";
// Perform subtitutions
url = url.replace('__ID__', $(this).data('id')).replace('__POS__', newValue);
// Reload the page
location.href = url;
}
});
}); });
</script> </script>

View File

@@ -33,6 +33,8 @@
<th>{intl l='Feature title'}</th> <th>{intl l='Feature title'}</th>
<th class="text-center">{intl l='Position'}</th>
{module_include location='template_features_table_header'} {module_include location='template_features_table_header'}
<th class="actions">{intl l="Actions"}</th> <th class="actions">{intl l="Actions"}</th>
@@ -48,6 +50,17 @@
{$TITLE} {$TITLE}
</td> </td>
<td class="text-center">
{admin_position_block
permission="admin.templates.edit"
path={url path="/admin/template/update-feature-position" template_id=$template_id}
url_parameter="feature_id"
in_place_edit_class="featurePositionChange"
position=$POSITION
id=$ID
}
</td>
{module_include location='template_features_table_row'} {module_include location='template_features_table_row'}
<td class="actions"> <td class="actions">
@@ -64,7 +77,7 @@
{elseloop rel="assigned_features"} {elseloop rel="assigned_features"}
<tr> <tr>
<td colspan="3"> <td colspan="4">
<div class="alert alert-info"> <div class="alert alert-info">
{intl l="This template contains no features"} {intl l="This template contains no features"}
</div> </div>
@@ -100,5 +113,26 @@
$('a.delete-feature').click(function(ev) { $('a.delete-feature').click(function(ev) {
$('#feature_delete_id').val($(this).data('id')); $('#feature_delete_id').val($(this).data('id'));
}); });
{* Inline editing of object position using bootstrap-editable *}
$('.featurePositionChange').editable({
type : 'text',
title : '{intl l="Enter new category position"}',
mode : 'popup',
inputclass : 'input-mini',
placement : 'left',
success : function(response, newValue) {
// The URL template
var url = "{url noamp='1' path='/admin/template/update-feature-position' template_id=$template_id feature_id='__ID__' position='__POS__'}";
// Perform subtitutions
url = url.replace('__ID__', $(this).data('id')).replace('__POS__', newValue);
// Reload the page
location.href = url;
}
});
}); });
</script> </script>

View File

@@ -303,7 +303,7 @@
placement : 'left', placement : 'left',
success : function(response, newValue) { success : function(response, newValue) {
// The URL template // The URL template
var url = "{url path='/admin/configuration/attributes-av/update-position' attributeav_id='__ID__' position='__POS__' attribute_id=$attribute_id}"; var url = "{url noamp='1' path='/admin/configuration/attributes-av/update-position' attributeav_id='__ID__' position='__POS__' attribute_id=$attribute_id}";
// Perform subtitutions // Perform subtitutions
url = url.replace('__ID__', $(this).data('id')).replace('__POS__', newValue); url = url.replace('__ID__', $(this).data('id')).replace('__POS__', newValue);

View File

@@ -312,7 +312,7 @@
placement : 'left', placement : 'left',
success : function(response, newValue) { success : function(response, newValue) {
// The URL template // The URL template
var url = "{url path='/admin/configuration/attributes/update-position' attribute_id='__ID__' position='__POS__'}"; var url = "{url noamp='1' path='/admin/configuration/attributes/update-position' attribute_id='__ID__' position='__POS__'}";
// Perform subtitutions // Perform subtitutions
url = url.replace('__ID__', $(this).data('id')) url = url.replace('__ID__', $(this).data('id'))

View File

@@ -604,7 +604,7 @@
placement : 'left', placement : 'left',
success : function(response, newValue) { success : function(response, newValue) {
// The URL template // The URL template
var url = "{url path='/admin/categories/update-position' category_id='__ID__' position='__POS__'}"; var url = "{url noamp='1' path='/admin/categories/update-position' category_id='__ID__' position='__POS__'}";
// Perform subtitutions // Perform subtitutions
url = url.replace('__ID__', $(this).data('id')) url = url.replace('__ID__', $(this).data('id'))
@@ -623,7 +623,7 @@
placement : 'left', placement : 'left',
success : function(response, newValue) { success : function(response, newValue) {
// The URL template // The URL template
var url = "{url path='/admin/products/update-position' product_id='__ID__' position='__POS__'}"; var url = "{url noamp='1' path='/admin/products/update-position' product_id='__ID__' position='__POS__'}";
// Perform subtitutions // Perform subtitutions
url = url.replace('__ID__', $(this).data('id')) url = url.replace('__ID__', $(this).data('id'))

View File

@@ -331,7 +331,7 @@
placement : 'left', placement : 'left',
success : function(response, newValue) { success : function(response, newValue) {
// The URL template // The URL template
var url = "{url path='/admin/configuration/currencies/update-position' currency_id='__ID__' position='__POS__'}"; var url = "{url noamp='1' path='/admin/configuration/currencies/update-position' currency_id='__ID__' position='__POS__'}";
// Perform subtitutions // Perform subtitutions
url = url.replace('__ID__', $(this).data('id')) url = url.replace('__ID__', $(this).data('id'))

View File

@@ -303,7 +303,7 @@
placement : 'left', placement : 'left',
success : function(response, newValue) { success : function(response, newValue) {
// The URL template // The URL template
var url = "{url path='/admin/configuration/features-av/update-position' featureav_id='__ID__' position='__POS__' feature_id=$feature_id}"; var url = "{url noamp='1' path='/admin/configuration/features-av/update-position' featureav_id='__ID__' position='__POS__' feature_id=$feature_id}";
// Perform subtitutions // Perform subtitutions
url = url.replace('__ID__', $(this).data('id')).replace('__POS__', newValue); url = url.replace('__ID__', $(this).data('id')).replace('__POS__', newValue);

View File

@@ -312,7 +312,7 @@
placement : 'left', placement : 'left',
success : function(response, newValue) { success : function(response, newValue) {
// The URL template // The URL template
var url = "{url path='/admin/configuration/features/update-position' feature_id='__ID__' position='__POS__'}"; var url = "{url noamp='1' path='/admin/configuration/features/update-position' feature_id='__ID__' position='__POS__'}";
// Perform subtitutions // Perform subtitutions
url = url.replace('__ID__', $(this).data('id')) url = url.replace('__ID__', $(this).data('id'))

View File

@@ -7,8 +7,8 @@
{block name="main-content"} {block name="main-content"}
<div class="folders"> <div class="folders">
<div id="wrapper" class="container"> <div id="wrapper" class="container">
{* include file="includes/folder-breadcrumb.html" *} {* include file="includes/folder-breadcrumb.html" *}
{module_include location='folders_top'} {module_include location='folders_top'}
@@ -213,7 +213,7 @@
label="{intl l='ID'}" label="{intl l='ID'}"
} }
<th>&nbsp;</th> <th>&nbsp;</th>
<th class="object-title"> <th class="object-title">
{admin_sortable_header {admin_sortable_header
@@ -416,7 +416,7 @@
{form_field form=$form field='default_folder'} {form_field form=$form field='default_folder'}
<input type="hidden" name="{$name}" value="{$folder_id}" /> <input type="hidden" name="{$name}" value="{$folder_id}" />
{/form_field} {/form_field}
{form_field form=$form field='title'} {form_field form=$form field='title'}
<div class="form-group {if $error}has-error{/if}"> <div class="form-group {if $error}has-error{/if}">
@@ -580,7 +580,7 @@
placement : 'left', placement : 'left',
success : function(response, newValue) { success : function(response, newValue) {
// The URL template // The URL template
var url = "{url path='/admin/folders/update-position' folder_id='__ID__' position='__POS__'}"; var url = "{url noamp='1' path='/admin/folders/update-position' folder_id='__ID__' position='__POS__'}";
// Perform subtitutions // Perform subtitutions
url = url.replace('__ID__', $(this).data('id')) url = url.replace('__ID__', $(this).data('id'))
@@ -599,7 +599,7 @@
placement : 'left', placement : 'left',
success : function(response, newValue) { success : function(response, newValue) {
// The URL template // The URL template
var url = "{url path='/admin/contents/update-position' content_id='__ID__' position='__POS__'}"; var url = "{url noamp='1' path='/admin/contents/update-position' content_id='__ID__' position='__POS__'}";
// Perform subtitutions // Perform subtitutions
url = url.replace('__ID__', $(this).data('id')) url = url.replace('__ID__', $(this).data('id'))

View File

@@ -221,7 +221,7 @@ $(function() {
placement : 'left', placement : 'left',
success : function(response, newValue) { success : function(response, newValue) {
// The URL template // The URL template
var url = "{url path='admin/product/update-accessory-position/' accessory_id='__ID__' product_id=$product_id position='__POS__'}"; var url = "{url noamp='1' path='admin/product/update-accessory-position/' accessory_id='__ID__' product_id=$product_id position='__POS__'}";
// Perform subtitutions // Perform subtitutions
url = url.replace('__ID__', $(this).data('id')).replace('__POS__', newValue); url = url.replace('__ID__', $(this).data('id')).replace('__POS__', newValue);

View File

@@ -106,10 +106,14 @@
{block name="javascript-initialization"} {block name="javascript-initialization"}
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
<script src="{$asset_url}"></script>
{/javascripts}
<script> <script>
$(function() { $(function() {
$('#feature_list_management').load("{url path='/admin/configuration/templates/features/list' template_id=$template_id}"); $('#feature_list_management').load("{url noamp='1' path='/admin/configuration/templates/features/list' template_id=$template_id}");
$('#attribute_list_management').load("{url path='/admin/configuration/templates/attributes/list' template_id=$template_id}"); $('#attribute_list_management').load("{url noamp='1' path='/admin/configuration/templates/attributes/list' template_id=$template_id}");
}); });
</script> </script>
{/block} {/block}

View File

@@ -25,7 +25,7 @@
{if ! empty($general_error) } {if ! empty($general_error) }
<div class="alert alert-danger">{$general_error}</div> <div class="alert alert-danger">{$general_error}</div>
{/if} {/if}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-condensed table-left-aligned"> <table class="table table-striped table-condensed table-left-aligned">
<caption> <caption>
@@ -194,10 +194,6 @@
{block name="javascript-initialization"} {block name="javascript-initialization"}
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
<script src="{$asset_url}"></script>
{/javascripts}
<script> <script>
$(function() { $(function() {