This commit is contained in:
franck
2013-09-05 10:00:39 +02:00
15 changed files with 1120 additions and 689 deletions

View File

@@ -49,7 +49,7 @@ class DefaultController extends BaseFrontController
if(ConfigQuery::isRewritingEnable()) {
/* Does the query GET parameters match a rewritten URL ? */
$rewrittenUrl = URL::getInstance()->retrieveCurrent();
$rewrittenUrl = URL::getInstance()->retrieveCurrent($request);
if($rewrittenUrl->rewrittenUrl !== null) {
/* 301 redirection to rewritten URL */
$this->redirect($rewrittenUrl->rewrittenUrl, 301);
@@ -63,9 +63,13 @@ class DefaultController extends BaseFrontController
$view = $request->request->get('view');
}
}
if(!is_null($view)) {
if(null !== $view) {
$request->attributes->set('_view', $view);
}
if (null === $view && null === $request->attributes->get("_view")) {
$request->attributes->set("_view", "index");
}
}
}

View File

@@ -85,10 +85,40 @@ abstract class Lang implements ActiveRecordInterface
protected $url;
/**
* The value for the position field.
* @var int
* The value for the date_format field.
* @var string
*/
protected $position;
protected $date_format;
/**
* The value for the time_format field.
* @var string
*/
protected $time_format;
/**
* The value for the datetime_format field.
* @var string
*/
protected $datetime_format;
/**
* The value for the decimal_separator field.
* @var string
*/
protected $decimal_separator;
/**
* The value for the thousands_separator field.
* @var string
*/
protected $thousands_separator;
/**
* The value for the decimals field.
* @var string
*/
protected $decimals;
/**
* The value for the by_default field.
@@ -96,6 +126,12 @@ abstract class Lang implements ActiveRecordInterface
*/
protected $by_default;
/**
* The value for the position field.
* @var int
*/
protected $position;
/**
* The value for the created_at field.
* @var string
@@ -426,14 +462,69 @@ abstract class Lang implements ActiveRecordInterface
}
/**
* Get the [position] column value.
* Get the [date_format] column value.
*
* @return int
* @return string
*/
public function getPosition()
public function getDateFormat()
{
return $this->position;
return $this->date_format;
}
/**
* Get the [time_format] column value.
*
* @return string
*/
public function getTimeFormat()
{
return $this->time_format;
}
/**
* Get the [datetime_format] column value.
*
* @return string
*/
public function getDatetimeFormat()
{
return $this->datetime_format;
}
/**
* Get the [decimal_separator] column value.
*
* @return string
*/
public function getDecimalSeparator()
{
return $this->decimal_separator;
}
/**
* Get the [thousands_separator] column value.
*
* @return string
*/
public function getThousandsSeparator()
{
return $this->thousands_separator;
}
/**
* Get the [decimals] column value.
*
* @return string
*/
public function getDecimals()
{
return $this->decimals;
}
/**
@@ -447,6 +538,17 @@ abstract class Lang implements ActiveRecordInterface
return $this->by_default;
}
/**
* Get the [position] column value.
*
* @return int
*/
public function getPosition()
{
return $this->position;
}
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -593,25 +695,130 @@ abstract class Lang implements ActiveRecordInterface
} // setUrl()
/**
* Set the value of [position] column.
* Set the value of [date_format] column.
*
* @param int $v new value
* @param string $v new value
* @return \Thelia\Model\Lang The current object (for fluent API support)
*/
public function setPosition($v)
public function setDateFormat($v)
{
if ($v !== null) {
$v = (int) $v;
$v = (string) $v;
}
if ($this->position !== $v) {
$this->position = $v;
$this->modifiedColumns[] = LangTableMap::POSITION;
if ($this->date_format !== $v) {
$this->date_format = $v;
$this->modifiedColumns[] = LangTableMap::DATE_FORMAT;
}
return $this;
} // setPosition()
} // setDateFormat()
/**
* Set the value of [time_format] column.
*
* @param string $v new value
* @return \Thelia\Model\Lang The current object (for fluent API support)
*/
public function setTimeFormat($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->time_format !== $v) {
$this->time_format = $v;
$this->modifiedColumns[] = LangTableMap::TIME_FORMAT;
}
return $this;
} // setTimeFormat()
/**
* Set the value of [datetime_format] column.
*
* @param string $v new value
* @return \Thelia\Model\Lang The current object (for fluent API support)
*/
public function setDatetimeFormat($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->datetime_format !== $v) {
$this->datetime_format = $v;
$this->modifiedColumns[] = LangTableMap::DATETIME_FORMAT;
}
return $this;
} // setDatetimeFormat()
/**
* Set the value of [decimal_separator] column.
*
* @param string $v new value
* @return \Thelia\Model\Lang The current object (for fluent API support)
*/
public function setDecimalSeparator($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->decimal_separator !== $v) {
$this->decimal_separator = $v;
$this->modifiedColumns[] = LangTableMap::DECIMAL_SEPARATOR;
}
return $this;
} // setDecimalSeparator()
/**
* Set the value of [thousands_separator] column.
*
* @param string $v new value
* @return \Thelia\Model\Lang The current object (for fluent API support)
*/
public function setThousandsSeparator($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->thousands_separator !== $v) {
$this->thousands_separator = $v;
$this->modifiedColumns[] = LangTableMap::THOUSANDS_SEPARATOR;
}
return $this;
} // setThousandsSeparator()
/**
* Set the value of [decimals] column.
*
* @param string $v new value
* @return \Thelia\Model\Lang The current object (for fluent API support)
*/
public function setDecimals($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->decimals !== $v) {
$this->decimals = $v;
$this->modifiedColumns[] = LangTableMap::DECIMALS;
}
return $this;
} // setDecimals()
/**
* Set the value of [by_default] column.
@@ -634,6 +841,27 @@ abstract class Lang implements ActiveRecordInterface
return $this;
} // setByDefault()
/**
* Set the value of [position] column.
*
* @param int $v new value
* @return \Thelia\Model\Lang 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[] = LangTableMap::POSITION;
}
return $this;
} // setPosition()
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -728,19 +956,37 @@ abstract class Lang implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : LangTableMap::translateFieldName('Url', TableMap::TYPE_PHPNAME, $indexType)];
$this->url = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : LangTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
$this->position = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : LangTableMap::translateFieldName('DateFormat', TableMap::TYPE_PHPNAME, $indexType)];
$this->date_format = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : LangTableMap::translateFieldName('ByDefault', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : LangTableMap::translateFieldName('TimeFormat', TableMap::TYPE_PHPNAME, $indexType)];
$this->time_format = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : LangTableMap::translateFieldName('DatetimeFormat', TableMap::TYPE_PHPNAME, $indexType)];
$this->datetime_format = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : LangTableMap::translateFieldName('DecimalSeparator', TableMap::TYPE_PHPNAME, $indexType)];
$this->decimal_separator = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : LangTableMap::translateFieldName('ThousandsSeparator', TableMap::TYPE_PHPNAME, $indexType)];
$this->thousands_separator = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : LangTableMap::translateFieldName('Decimals', TableMap::TYPE_PHPNAME, $indexType)];
$this->decimals = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : LangTableMap::translateFieldName('ByDefault', TableMap::TYPE_PHPNAME, $indexType)];
$this->by_default = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : LangTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : LangTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
$this->position = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : LangTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : LangTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : LangTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -753,7 +999,7 @@ abstract class Lang implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 9; // 9 = LangTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 15; // 15 = LangTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Lang object", 0, $e);
@@ -988,12 +1234,30 @@ abstract class Lang implements ActiveRecordInterface
if ($this->isColumnModified(LangTableMap::URL)) {
$modifiedColumns[':p' . $index++] = 'URL';
}
if ($this->isColumnModified(LangTableMap::POSITION)) {
$modifiedColumns[':p' . $index++] = 'POSITION';
if ($this->isColumnModified(LangTableMap::DATE_FORMAT)) {
$modifiedColumns[':p' . $index++] = 'DATE_FORMAT';
}
if ($this->isColumnModified(LangTableMap::TIME_FORMAT)) {
$modifiedColumns[':p' . $index++] = 'TIME_FORMAT';
}
if ($this->isColumnModified(LangTableMap::DATETIME_FORMAT)) {
$modifiedColumns[':p' . $index++] = 'DATETIME_FORMAT';
}
if ($this->isColumnModified(LangTableMap::DECIMAL_SEPARATOR)) {
$modifiedColumns[':p' . $index++] = 'DECIMAL_SEPARATOR';
}
if ($this->isColumnModified(LangTableMap::THOUSANDS_SEPARATOR)) {
$modifiedColumns[':p' . $index++] = 'THOUSANDS_SEPARATOR';
}
if ($this->isColumnModified(LangTableMap::DECIMALS)) {
$modifiedColumns[':p' . $index++] = 'DECIMALS';
}
if ($this->isColumnModified(LangTableMap::BY_DEFAULT)) {
$modifiedColumns[':p' . $index++] = 'BY_DEFAULT';
}
if ($this->isColumnModified(LangTableMap::POSITION)) {
$modifiedColumns[':p' . $index++] = 'POSITION';
}
if ($this->isColumnModified(LangTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -1026,12 +1290,30 @@ abstract class Lang implements ActiveRecordInterface
case 'URL':
$stmt->bindValue($identifier, $this->url, PDO::PARAM_STR);
break;
case 'POSITION':
$stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
case 'DATE_FORMAT':
$stmt->bindValue($identifier, $this->date_format, PDO::PARAM_STR);
break;
case 'TIME_FORMAT':
$stmt->bindValue($identifier, $this->time_format, PDO::PARAM_STR);
break;
case 'DATETIME_FORMAT':
$stmt->bindValue($identifier, $this->datetime_format, PDO::PARAM_STR);
break;
case 'DECIMAL_SEPARATOR':
$stmt->bindValue($identifier, $this->decimal_separator, PDO::PARAM_STR);
break;
case 'THOUSANDS_SEPARATOR':
$stmt->bindValue($identifier, $this->thousands_separator, PDO::PARAM_STR);
break;
case 'DECIMALS':
$stmt->bindValue($identifier, $this->decimals, PDO::PARAM_STR);
break;
case 'BY_DEFAULT':
$stmt->bindValue($identifier, $this->by_default, PDO::PARAM_INT);
break;
case 'POSITION':
$stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -1116,15 +1398,33 @@ abstract class Lang implements ActiveRecordInterface
return $this->getUrl();
break;
case 5:
return $this->getPosition();
return $this->getDateFormat();
break;
case 6:
return $this->getByDefault();
return $this->getTimeFormat();
break;
case 7:
return $this->getCreatedAt();
return $this->getDatetimeFormat();
break;
case 8:
return $this->getDecimalSeparator();
break;
case 9:
return $this->getThousandsSeparator();
break;
case 10:
return $this->getDecimals();
break;
case 11:
return $this->getByDefault();
break;
case 12:
return $this->getPosition();
break;
case 13:
return $this->getCreatedAt();
break;
case 14:
return $this->getUpdatedAt();
break;
default:
@@ -1160,10 +1460,16 @@ abstract class Lang implements ActiveRecordInterface
$keys[2] => $this->getCode(),
$keys[3] => $this->getLocale(),
$keys[4] => $this->getUrl(),
$keys[5] => $this->getPosition(),
$keys[6] => $this->getByDefault(),
$keys[7] => $this->getCreatedAt(),
$keys[8] => $this->getUpdatedAt(),
$keys[5] => $this->getDateFormat(),
$keys[6] => $this->getTimeFormat(),
$keys[7] => $this->getDatetimeFormat(),
$keys[8] => $this->getDecimalSeparator(),
$keys[9] => $this->getThousandsSeparator(),
$keys[10] => $this->getDecimals(),
$keys[11] => $this->getByDefault(),
$keys[12] => $this->getPosition(),
$keys[13] => $this->getCreatedAt(),
$keys[14] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1220,15 +1526,33 @@ abstract class Lang implements ActiveRecordInterface
$this->setUrl($value);
break;
case 5:
$this->setPosition($value);
$this->setDateFormat($value);
break;
case 6:
$this->setByDefault($value);
$this->setTimeFormat($value);
break;
case 7:
$this->setCreatedAt($value);
$this->setDatetimeFormat($value);
break;
case 8:
$this->setDecimalSeparator($value);
break;
case 9:
$this->setThousandsSeparator($value);
break;
case 10:
$this->setDecimals($value);
break;
case 11:
$this->setByDefault($value);
break;
case 12:
$this->setPosition($value);
break;
case 13:
$this->setCreatedAt($value);
break;
case 14:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1260,10 +1584,16 @@ abstract class Lang implements ActiveRecordInterface
if (array_key_exists($keys[2], $arr)) $this->setCode($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setLocale($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUrl($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setPosition($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setByDefault($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]);
if (array_key_exists($keys[5], $arr)) $this->setDateFormat($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setTimeFormat($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setDatetimeFormat($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setDecimalSeparator($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setThousandsSeparator($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setDecimals($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setByDefault($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setPosition($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]);
if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]);
}
/**
@@ -1280,8 +1610,14 @@ abstract class Lang implements ActiveRecordInterface
if ($this->isColumnModified(LangTableMap::CODE)) $criteria->add(LangTableMap::CODE, $this->code);
if ($this->isColumnModified(LangTableMap::LOCALE)) $criteria->add(LangTableMap::LOCALE, $this->locale);
if ($this->isColumnModified(LangTableMap::URL)) $criteria->add(LangTableMap::URL, $this->url);
if ($this->isColumnModified(LangTableMap::POSITION)) $criteria->add(LangTableMap::POSITION, $this->position);
if ($this->isColumnModified(LangTableMap::DATE_FORMAT)) $criteria->add(LangTableMap::DATE_FORMAT, $this->date_format);
if ($this->isColumnModified(LangTableMap::TIME_FORMAT)) $criteria->add(LangTableMap::TIME_FORMAT, $this->time_format);
if ($this->isColumnModified(LangTableMap::DATETIME_FORMAT)) $criteria->add(LangTableMap::DATETIME_FORMAT, $this->datetime_format);
if ($this->isColumnModified(LangTableMap::DECIMAL_SEPARATOR)) $criteria->add(LangTableMap::DECIMAL_SEPARATOR, $this->decimal_separator);
if ($this->isColumnModified(LangTableMap::THOUSANDS_SEPARATOR)) $criteria->add(LangTableMap::THOUSANDS_SEPARATOR, $this->thousands_separator);
if ($this->isColumnModified(LangTableMap::DECIMALS)) $criteria->add(LangTableMap::DECIMALS, $this->decimals);
if ($this->isColumnModified(LangTableMap::BY_DEFAULT)) $criteria->add(LangTableMap::BY_DEFAULT, $this->by_default);
if ($this->isColumnModified(LangTableMap::POSITION)) $criteria->add(LangTableMap::POSITION, $this->position);
if ($this->isColumnModified(LangTableMap::CREATED_AT)) $criteria->add(LangTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(LangTableMap::UPDATED_AT)) $criteria->add(LangTableMap::UPDATED_AT, $this->updated_at);
@@ -1351,8 +1687,14 @@ abstract class Lang implements ActiveRecordInterface
$copyObj->setCode($this->getCode());
$copyObj->setLocale($this->getLocale());
$copyObj->setUrl($this->getUrl());
$copyObj->setPosition($this->getPosition());
$copyObj->setDateFormat($this->getDateFormat());
$copyObj->setTimeFormat($this->getTimeFormat());
$copyObj->setDatetimeFormat($this->getDatetimeFormat());
$copyObj->setDecimalSeparator($this->getDecimalSeparator());
$copyObj->setThousandsSeparator($this->getThousandsSeparator());
$copyObj->setDecimals($this->getDecimals());
$copyObj->setByDefault($this->getByDefault());
$copyObj->setPosition($this->getPosition());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) {
@@ -1393,8 +1735,14 @@ abstract class Lang implements ActiveRecordInterface
$this->code = null;
$this->locale = null;
$this->url = null;
$this->position = null;
$this->date_format = null;
$this->time_format = null;
$this->datetime_format = null;
$this->decimal_separator = null;
$this->thousands_separator = null;
$this->decimals = null;
$this->by_default = null;
$this->position = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;

View File

@@ -23,8 +23,14 @@ use Thelia\Model\Map\LangTableMap;
* @method ChildLangQuery orderByCode($order = Criteria::ASC) Order by the code column
* @method ChildLangQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildLangQuery orderByUrl($order = Criteria::ASC) Order by the url column
* @method ChildLangQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildLangQuery orderByDateFormat($order = Criteria::ASC) Order by the date_format column
* @method ChildLangQuery orderByTimeFormat($order = Criteria::ASC) Order by the time_format column
* @method ChildLangQuery orderByDatetimeFormat($order = Criteria::ASC) Order by the datetime_format column
* @method ChildLangQuery orderByDecimalSeparator($order = Criteria::ASC) Order by the decimal_separator column
* @method ChildLangQuery orderByThousandsSeparator($order = Criteria::ASC) Order by the thousands_separator column
* @method ChildLangQuery orderByDecimals($order = Criteria::ASC) Order by the decimals column
* @method ChildLangQuery orderByByDefault($order = Criteria::ASC) Order by the by_default column
* @method ChildLangQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildLangQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildLangQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
@@ -33,8 +39,14 @@ use Thelia\Model\Map\LangTableMap;
* @method ChildLangQuery groupByCode() Group by the code column
* @method ChildLangQuery groupByLocale() Group by the locale column
* @method ChildLangQuery groupByUrl() Group by the url column
* @method ChildLangQuery groupByPosition() Group by the position column
* @method ChildLangQuery groupByDateFormat() Group by the date_format column
* @method ChildLangQuery groupByTimeFormat() Group by the time_format column
* @method ChildLangQuery groupByDatetimeFormat() Group by the datetime_format column
* @method ChildLangQuery groupByDecimalSeparator() Group by the decimal_separator column
* @method ChildLangQuery groupByThousandsSeparator() Group by the thousands_separator column
* @method ChildLangQuery groupByDecimals() Group by the decimals column
* @method ChildLangQuery groupByByDefault() Group by the by_default column
* @method ChildLangQuery groupByPosition() Group by the position column
* @method ChildLangQuery groupByCreatedAt() Group by the created_at column
* @method ChildLangQuery groupByUpdatedAt() Group by the updated_at column
*
@@ -50,8 +62,14 @@ use Thelia\Model\Map\LangTableMap;
* @method ChildLang findOneByCode(string $code) Return the first ChildLang filtered by the code column
* @method ChildLang findOneByLocale(string $locale) Return the first ChildLang filtered by the locale column
* @method ChildLang findOneByUrl(string $url) Return the first ChildLang filtered by the url column
* @method ChildLang findOneByPosition(int $position) Return the first ChildLang filtered by the position column
* @method ChildLang findOneByDateFormat(string $date_format) Return the first ChildLang filtered by the date_format column
* @method ChildLang findOneByTimeFormat(string $time_format) Return the first ChildLang filtered by the time_format column
* @method ChildLang findOneByDatetimeFormat(string $datetime_format) Return the first ChildLang filtered by the datetime_format column
* @method ChildLang findOneByDecimalSeparator(string $decimal_separator) Return the first ChildLang filtered by the decimal_separator column
* @method ChildLang findOneByThousandsSeparator(string $thousands_separator) Return the first ChildLang filtered by the thousands_separator column
* @method ChildLang findOneByDecimals(string $decimals) Return the first ChildLang filtered by the decimals column
* @method ChildLang findOneByByDefault(int $by_default) Return the first ChildLang filtered by the by_default column
* @method ChildLang findOneByPosition(int $position) Return the first ChildLang filtered by the position column
* @method ChildLang findOneByCreatedAt(string $created_at) Return the first ChildLang filtered by the created_at column
* @method ChildLang findOneByUpdatedAt(string $updated_at) Return the first ChildLang filtered by the updated_at column
*
@@ -60,8 +78,14 @@ use Thelia\Model\Map\LangTableMap;
* @method array findByCode(string $code) Return ChildLang objects filtered by the code column
* @method array findByLocale(string $locale) Return ChildLang objects filtered by the locale column
* @method array findByUrl(string $url) Return ChildLang objects filtered by the url column
* @method array findByPosition(int $position) Return ChildLang objects filtered by the position column
* @method array findByDateFormat(string $date_format) Return ChildLang objects filtered by the date_format column
* @method array findByTimeFormat(string $time_format) Return ChildLang objects filtered by the time_format column
* @method array findByDatetimeFormat(string $datetime_format) Return ChildLang objects filtered by the datetime_format column
* @method array findByDecimalSeparator(string $decimal_separator) Return ChildLang objects filtered by the decimal_separator column
* @method array findByThousandsSeparator(string $thousands_separator) Return ChildLang objects filtered by the thousands_separator column
* @method array findByDecimals(string $decimals) Return ChildLang objects filtered by the decimals column
* @method array findByByDefault(int $by_default) Return ChildLang objects filtered by the by_default column
* @method array findByPosition(int $position) Return ChildLang objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ChildLang objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildLang objects filtered by the updated_at column
*
@@ -152,7 +176,7 @@ abstract class LangQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, TITLE, CODE, LOCALE, URL, POSITION, BY_DEFAULT, CREATED_AT, UPDATED_AT FROM lang WHERE ID = :p0';
$sql = 'SELECT ID, TITLE, CODE, LOCALE, URL, DATE_FORMAT, TIME_FORMAT, DATETIME_FORMAT, DECIMAL_SEPARATOR, THOUSANDS_SEPARATOR, DECIMALS, BY_DEFAULT, POSITION, CREATED_AT, UPDATED_AT FROM lang WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -399,44 +423,177 @@ abstract class LangQuery extends ModelCriteria
}
/**
* Filter the query on the position column
* Filter the query on the date_format 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
* $query->filterByDateFormat('fooValue'); // WHERE date_format = 'fooValue'
* $query->filterByDateFormat('%fooValue%'); // WHERE date_format LIKE '%fooValue%'
* </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 $dateFormat 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 ChildLangQuery The current query, for fluid interface
*/
public function filterByPosition($position = null, $comparison = null)
public function filterByDateFormat($dateFormat = null, $comparison = null)
{
if (is_array($position)) {
$useMinMax = false;
if (isset($position['min'])) {
$this->addUsingAlias(LangTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(LangTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
if (null === $comparison) {
if (is_array($dateFormat)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dateFormat)) {
$dateFormat = str_replace('*', '%', $dateFormat);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(LangTableMap::POSITION, $position, $comparison);
return $this->addUsingAlias(LangTableMap::DATE_FORMAT, $dateFormat, $comparison);
}
/**
* Filter the query on the time_format column
*
* Example usage:
* <code>
* $query->filterByTimeFormat('fooValue'); // WHERE time_format = 'fooValue'
* $query->filterByTimeFormat('%fooValue%'); // WHERE time_format LIKE '%fooValue%'
* </code>
*
* @param string $timeFormat 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 ChildLangQuery The current query, for fluid interface
*/
public function filterByTimeFormat($timeFormat = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($timeFormat)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $timeFormat)) {
$timeFormat = str_replace('*', '%', $timeFormat);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(LangTableMap::TIME_FORMAT, $timeFormat, $comparison);
}
/**
* Filter the query on the datetime_format column
*
* Example usage:
* <code>
* $query->filterByDatetimeFormat('fooValue'); // WHERE datetime_format = 'fooValue'
* $query->filterByDatetimeFormat('%fooValue%'); // WHERE datetime_format LIKE '%fooValue%'
* </code>
*
* @param string $datetimeFormat 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 ChildLangQuery The current query, for fluid interface
*/
public function filterByDatetimeFormat($datetimeFormat = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($datetimeFormat)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $datetimeFormat)) {
$datetimeFormat = str_replace('*', '%', $datetimeFormat);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(LangTableMap::DATETIME_FORMAT, $datetimeFormat, $comparison);
}
/**
* Filter the query on the decimal_separator column
*
* Example usage:
* <code>
* $query->filterByDecimalSeparator('fooValue'); // WHERE decimal_separator = 'fooValue'
* $query->filterByDecimalSeparator('%fooValue%'); // WHERE decimal_separator LIKE '%fooValue%'
* </code>
*
* @param string $decimalSeparator 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 ChildLangQuery The current query, for fluid interface
*/
public function filterByDecimalSeparator($decimalSeparator = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($decimalSeparator)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $decimalSeparator)) {
$decimalSeparator = str_replace('*', '%', $decimalSeparator);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(LangTableMap::DECIMAL_SEPARATOR, $decimalSeparator, $comparison);
}
/**
* Filter the query on the thousands_separator column
*
* Example usage:
* <code>
* $query->filterByThousandsSeparator('fooValue'); // WHERE thousands_separator = 'fooValue'
* $query->filterByThousandsSeparator('%fooValue%'); // WHERE thousands_separator LIKE '%fooValue%'
* </code>
*
* @param string $thousandsSeparator 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 ChildLangQuery The current query, for fluid interface
*/
public function filterByThousandsSeparator($thousandsSeparator = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($thousandsSeparator)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $thousandsSeparator)) {
$thousandsSeparator = str_replace('*', '%', $thousandsSeparator);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(LangTableMap::THOUSANDS_SEPARATOR, $thousandsSeparator, $comparison);
}
/**
* Filter the query on the decimals column
*
* Example usage:
* <code>
* $query->filterByDecimals('fooValue'); // WHERE decimals = 'fooValue'
* $query->filterByDecimals('%fooValue%'); // WHERE decimals LIKE '%fooValue%'
* </code>
*
* @param string $decimals 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 ChildLangQuery The current query, for fluid interface
*/
public function filterByDecimals($decimals = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($decimals)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $decimals)) {
$decimals = str_replace('*', '%', $decimals);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(LangTableMap::DECIMALS, $decimals, $comparison);
}
/**
@@ -480,6 +637,47 @@ abstract class LangQuery extends ModelCriteria
return $this->addUsingAlias(LangTableMap::BY_DEFAULT, $byDefault, $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 ChildLangQuery 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(LangTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($position['max'])) {
$this->addUsingAlias(LangTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(LangTableMap::POSITION, $position, $comparison);
}
/**
* Filter the query on the created_at column
*

View File

@@ -9,48 +9,15 @@ class Lang extends BaseLang {
/**
* Return the default language object, using a local variable to cache it.
*
* @throws RuntimeException
* @throws \RuntimeException
*/
private static $default_lang = null;
public static function getDefaultLanguage() {
if (self::$default_lang == null) {
$default_lang = LangQuery::create()->findOneByByDefault(true);
if ($default_lang == null) throw new RuntimeException("No default language is defined. Please define one.");
}
$default_lang = LangQuery::create()->findOneByByDefault(1);
if ($default_lang == null) throw new \RuntimeException("No default language is defined. Please define one.");
return $default_lang;
}
public function getDateFormat()
{
return "d/m/Y";
}
public function getTimeFormat()
{
return "H:i:s";
}
public function getDateTimeFormat()
{
return "d/m/Y H:i:s";
}
public function getDecimalSeparator()
{
return ".";
}
public function getThousandsSeparator()
{
return " ";
}
public function getDecimals()
{
return 2;
}
}

View File

@@ -57,7 +57,7 @@ class LangTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 9;
const NUM_COLUMNS = 15;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class LangTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 9;
const NUM_HYDRATE_COLUMNS = 15;
/**
* the column name for the ID field
@@ -95,15 +95,45 @@ class LangTableMap extends TableMap
const URL = 'lang.URL';
/**
* the column name for the POSITION field
* the column name for the DATE_FORMAT field
*/
const POSITION = 'lang.POSITION';
const DATE_FORMAT = 'lang.DATE_FORMAT';
/**
* the column name for the TIME_FORMAT field
*/
const TIME_FORMAT = 'lang.TIME_FORMAT';
/**
* the column name for the DATETIME_FORMAT field
*/
const DATETIME_FORMAT = 'lang.DATETIME_FORMAT';
/**
* the column name for the DECIMAL_SEPARATOR field
*/
const DECIMAL_SEPARATOR = 'lang.DECIMAL_SEPARATOR';
/**
* the column name for the THOUSANDS_SEPARATOR field
*/
const THOUSANDS_SEPARATOR = 'lang.THOUSANDS_SEPARATOR';
/**
* the column name for the DECIMALS field
*/
const DECIMALS = 'lang.DECIMALS';
/**
* the column name for the BY_DEFAULT field
*/
const BY_DEFAULT = 'lang.BY_DEFAULT';
/**
* the column name for the POSITION field
*/
const POSITION = 'lang.POSITION';
/**
* the column name for the CREATED_AT field
*/
@@ -126,12 +156,12 @@ class LangTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Title', 'Code', 'Locale', 'Url', 'Position', 'ByDefault', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'title', 'code', 'locale', 'url', 'position', 'byDefault', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(LangTableMap::ID, LangTableMap::TITLE, LangTableMap::CODE, LangTableMap::LOCALE, LangTableMap::URL, LangTableMap::POSITION, LangTableMap::BY_DEFAULT, LangTableMap::CREATED_AT, LangTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CODE', 'LOCALE', 'URL', 'POSITION', 'BY_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'title', 'code', 'locale', 'url', 'position', 'by_default', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
self::TYPE_PHPNAME => array('Id', 'Title', 'Code', 'Locale', 'Url', 'DateFormat', 'TimeFormat', 'DatetimeFormat', 'DecimalSeparator', 'ThousandsSeparator', 'Decimals', 'ByDefault', 'Position', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'title', 'code', 'locale', 'url', 'dateFormat', 'timeFormat', 'datetimeFormat', 'decimalSeparator', 'thousandsSeparator', 'decimals', 'byDefault', 'position', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(LangTableMap::ID, LangTableMap::TITLE, LangTableMap::CODE, LangTableMap::LOCALE, LangTableMap::URL, LangTableMap::DATE_FORMAT, LangTableMap::TIME_FORMAT, LangTableMap::DATETIME_FORMAT, LangTableMap::DECIMAL_SEPARATOR, LangTableMap::THOUSANDS_SEPARATOR, LangTableMap::DECIMALS, LangTableMap::BY_DEFAULT, LangTableMap::POSITION, LangTableMap::CREATED_AT, LangTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CODE', 'LOCALE', 'URL', 'DATE_FORMAT', 'TIME_FORMAT', 'DATETIME_FORMAT', 'DECIMAL_SEPARATOR', 'THOUSANDS_SEPARATOR', 'DECIMALS', 'BY_DEFAULT', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'title', 'code', 'locale', 'url', 'date_format', 'time_format', 'datetime_format', 'decimal_separator', 'thousands_separator', 'decimals', 'by_default', 'position', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
);
/**
@@ -141,12 +171,12 @@ class LangTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'Code' => 2, 'Locale' => 3, 'Url' => 4, 'Position' => 5, 'ByDefault' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'locale' => 3, 'url' => 4, 'position' => 5, 'byDefault' => 6, 'createdAt' => 7, 'updatedAt' => 8, ),
self::TYPE_COLNAME => array(LangTableMap::ID => 0, LangTableMap::TITLE => 1, LangTableMap::CODE => 2, LangTableMap::LOCALE => 3, LangTableMap::URL => 4, LangTableMap::POSITION => 5, LangTableMap::BY_DEFAULT => 6, LangTableMap::CREATED_AT => 7, LangTableMap::UPDATED_AT => 8, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CODE' => 2, 'LOCALE' => 3, 'URL' => 4, 'POSITION' => 5, 'BY_DEFAULT' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ),
self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'locale' => 3, 'url' => 4, 'position' => 5, 'by_default' => 6, 'created_at' => 7, 'updated_at' => 8, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'Code' => 2, 'Locale' => 3, 'Url' => 4, 'DateFormat' => 5, 'TimeFormat' => 6, 'DatetimeFormat' => 7, 'DecimalSeparator' => 8, 'ThousandsSeparator' => 9, 'Decimals' => 10, 'ByDefault' => 11, 'Position' => 12, 'CreatedAt' => 13, 'UpdatedAt' => 14, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'locale' => 3, 'url' => 4, 'dateFormat' => 5, 'timeFormat' => 6, 'datetimeFormat' => 7, 'decimalSeparator' => 8, 'thousandsSeparator' => 9, 'decimals' => 10, 'byDefault' => 11, 'position' => 12, 'createdAt' => 13, 'updatedAt' => 14, ),
self::TYPE_COLNAME => array(LangTableMap::ID => 0, LangTableMap::TITLE => 1, LangTableMap::CODE => 2, LangTableMap::LOCALE => 3, LangTableMap::URL => 4, LangTableMap::DATE_FORMAT => 5, LangTableMap::TIME_FORMAT => 6, LangTableMap::DATETIME_FORMAT => 7, LangTableMap::DECIMAL_SEPARATOR => 8, LangTableMap::THOUSANDS_SEPARATOR => 9, LangTableMap::DECIMALS => 10, LangTableMap::BY_DEFAULT => 11, LangTableMap::POSITION => 12, LangTableMap::CREATED_AT => 13, LangTableMap::UPDATED_AT => 14, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CODE' => 2, 'LOCALE' => 3, 'URL' => 4, 'DATE_FORMAT' => 5, 'TIME_FORMAT' => 6, 'DATETIME_FORMAT' => 7, 'DECIMAL_SEPARATOR' => 8, 'THOUSANDS_SEPARATOR' => 9, 'DECIMALS' => 10, 'BY_DEFAULT' => 11, 'POSITION' => 12, 'CREATED_AT' => 13, 'UPDATED_AT' => 14, ),
self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'locale' => 3, 'url' => 4, 'date_format' => 5, 'time_format' => 6, 'datetime_format' => 7, 'decimal_separator' => 8, 'thousands_separator' => 9, 'decimals' => 10, 'by_default' => 11, 'position' => 12, 'created_at' => 13, 'updated_at' => 14, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
);
/**
@@ -170,8 +200,14 @@ class LangTableMap extends TableMap
$this->addColumn('CODE', 'Code', 'VARCHAR', false, 10, null);
$this->addColumn('LOCALE', 'Locale', 'VARCHAR', false, 45, null);
$this->addColumn('URL', 'Url', 'VARCHAR', false, 255, null);
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
$this->addColumn('DATE_FORMAT', 'DateFormat', 'VARCHAR', false, 45, null);
$this->addColumn('TIME_FORMAT', 'TimeFormat', 'VARCHAR', false, 45, null);
$this->addColumn('DATETIME_FORMAT', 'DatetimeFormat', 'VARCHAR', false, 45, null);
$this->addColumn('DECIMAL_SEPARATOR', 'DecimalSeparator', 'VARCHAR', false, 45, null);
$this->addColumn('THOUSANDS_SEPARATOR', 'ThousandsSeparator', 'VARCHAR', false, 45, null);
$this->addColumn('DECIMALS', 'Decimals', 'VARCHAR', false, 45, null);
$this->addColumn('BY_DEFAULT', 'ByDefault', 'TINYINT', false, null, null);
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -339,8 +375,14 @@ class LangTableMap extends TableMap
$criteria->addSelectColumn(LangTableMap::CODE);
$criteria->addSelectColumn(LangTableMap::LOCALE);
$criteria->addSelectColumn(LangTableMap::URL);
$criteria->addSelectColumn(LangTableMap::POSITION);
$criteria->addSelectColumn(LangTableMap::DATE_FORMAT);
$criteria->addSelectColumn(LangTableMap::TIME_FORMAT);
$criteria->addSelectColumn(LangTableMap::DATETIME_FORMAT);
$criteria->addSelectColumn(LangTableMap::DECIMAL_SEPARATOR);
$criteria->addSelectColumn(LangTableMap::THOUSANDS_SEPARATOR);
$criteria->addSelectColumn(LangTableMap::DECIMALS);
$criteria->addSelectColumn(LangTableMap::BY_DEFAULT);
$criteria->addSelectColumn(LangTableMap::POSITION);
$criteria->addSelectColumn(LangTableMap::CREATED_AT);
$criteria->addSelectColumn(LangTableMap::UPDATED_AT);
} else {
@@ -349,8 +391,14 @@ class LangTableMap extends TableMap
$criteria->addSelectColumn($alias . '.CODE');
$criteria->addSelectColumn($alias . '.LOCALE');
$criteria->addSelectColumn($alias . '.URL');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.DATE_FORMAT');
$criteria->addSelectColumn($alias . '.TIME_FORMAT');
$criteria->addSelectColumn($alias . '.DATETIME_FORMAT');
$criteria->addSelectColumn($alias . '.DECIMAL_SEPARATOR');
$criteria->addSelectColumn($alias . '.THOUSANDS_SEPARATOR');
$criteria->addSelectColumn($alias . '.DECIMALS');
$criteria->addSelectColumn($alias . '.BY_DEFAULT');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}

View File

@@ -43,7 +43,7 @@ class DefaultControllerTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($request->attributes->get('_view'), "index");
}
public function testNoActionWithQuery()
public function testNoActionWithGetParam()
{
$defaultController = new DefaultController();
$request = new Request(array(
@@ -55,15 +55,59 @@ class DefaultControllerTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($request->attributes->get('_view'), 'foo');
}
public function testNoActionWithRequest()
public function testNoActionWithPostParam()
{
$defaultController = new DefaultController();
$request = new Request(array(), array(
"view" => "foo"
));
$request = new Request(
array(),
array("view" => "foo")
);
$defaultController->noAction($request);
$this->assertEquals($request->attributes->get('_view'), 'foo');
}
public function testNoActionWithAttribute()
{
$defaultController = new DefaultController();
$request = new Request(
array(),
array(),
array("_view" => "foo")
);
$defaultController->noAction($request);
$this->assertEquals($request->attributes->get('_view'), 'foo');
}
public function testNoActionWithAttributeAndQuery()
{
$defaultController = new DefaultController();
$request = new Request(
array("view" => "bar"),
array(),
array("_view" => "foo")
);
$defaultController->noAction($request);
$this->assertEquals($request->attributes->get('_view'), 'bar');
}
public function testNoActionWithAttributeAndRequest()
{
$defaultController = new DefaultController();
$request = new Request(
array(),
array("view" => "bar"),
array("_view" => "foo")
);
$defaultController->noAction($request);
$this->assertEquals($request->attributes->get('_view'), 'bar');
}
}

View File

@@ -79,7 +79,8 @@ class URL
*/
public function getBaseUrl()
{
$lang = $this->container->get('request')->getSession()->getLang();
$request = $this->container->get('request');
$lang = $request->getSession()->getLang();
// Check if we have a specific URL for each lang.
$one_domain_foreach_lang = ConfigQuery::read("one_domain_foreach_lang", false);
@@ -92,7 +93,7 @@ class URL
}
else {
// Get the base URL
$base_url = ConfigQuery::read('base_url', null);
$base_url = ConfigQuery::read('base_url', $request->getSchemeAndHttpHost());
$err_msg_part = sprintf('base_url for lang %s', $lang->getCode());
}

View File

@@ -1,8 +1,8 @@
INSERT INTO `lang`(`id`,`title`,`code`,`locale`,`url`,`by_default`,`created_at`,`updated_at`)VALUES
(1, 'Français', 'fr', 'fr_FR', '','1', NOW(), NOW()),
(2, 'English', 'en', 'en_EN', '', '0', NOW(), NOW()),
(3, 'Espanol', 'es', 'es_ES', '', '0', NOW(), NOW()),
(4, 'Italiano', 'it', 'it_IT', '','0', NOW(), NOW());
INSERT INTO `lang`(`id`,`title`,`code`,`locale`,`url`,`date_format`,`time_format`,`datetime_format`,`decimal_separator`,`thousands_separator`,`decimals`,`by_default`,`created_at`,`updated_at`)VALUES
(1, 'Français', 'fr', 'fr_FR', '', 'd/m/Y', 'H:i:s', 'd/m/y H:i:s', ',', ' ', '2', '1', NOW(), NOW()),
(2, 'English', 'en', 'en_EN', '', 'm-d-Y', 'h:i:s', 'm-d-Y h:i:s', '.', ' ', '2', '0', NOW(), NOW()),
(3, 'castellano', 'es', 'es_ES', '', 'm-d-Y', 'h:i:s', 'm-d-Y h:i:s', ',', '.', '2', '0', NOW(), NOW()),
(4, 'Italiano', 'it', 'it_IT', '', 'd/m/Y', 'H:i:s', 'd/m/y H:i:s', ',', ' ', '2', '0', NOW(), NOW());
INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updated_at`) VALUES
('session_config.default', '1', 1, 1, NOW(), NOW()),

View File

@@ -522,8 +522,14 @@ CREATE TABLE `lang`
`code` VARCHAR(10),
`locale` VARCHAR(45),
`url` VARCHAR(255),
`position` INTEGER,
`date_format` VARCHAR(45),
`time_format` VARCHAR(45),
`datetime_format` VARCHAR(45),
`decimal_separator` VARCHAR(45),
`thousands_separator` VARCHAR(45),
`decimals` VARCHAR(45),
`by_default` TINYINT,
`position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)

View File

@@ -389,8 +389,14 @@
<column name="code" size="10" type="VARCHAR" />
<column name="locale" size="45" type="VARCHAR" />
<column name="url" size="255" type="VARCHAR" />
<column name="position" type="INTEGER" />
<column name="date_format" size="45" type="VARCHAR" />
<column name="time_format" size="45" type="VARCHAR" />
<column name="datetime_format" size="45" type="VARCHAR" />
<column name="decimal_separator" size="45" type="VARCHAR" />
<column name="thousands_separator" size="45" type="VARCHAR" />
<column name="decimals" size="45" type="VARCHAR" />
<column name="by_default" type="TINYINT" />
<column name="position" type="INTEGER" />
<behavior name="timestampable" />
</table>
<table name="folder" namespace="Thelia\Model">

View File

@@ -1,8 +1,7 @@
/*! X-editable - v1.4.6
/*! X-editable - v1.4.7
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
* http://github.com/vitalets/x-editable
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
.editableform {
margin-bottom: 0; /* overwrites bootstrap margin */
}
@@ -18,45 +17,45 @@
vertical-align: top;
margin-left: 7px;
/* inline-block emulation for IE7*/
zoom: 1;
zoom: 1;
*display: inline;
}
.editable-buttons.editable-buttons-bottom {
display: block;
display: block;
margin-top: 7px;
margin-left: 0;
}
.editable-input {
vertical-align: top;
vertical-align: top;
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
width: auto; /* bootstrap-responsive has width: 100% that breakes layout */
white-space: normal; /* reset white-space decalred in parent*/
/* display-inline emulation for IE7*/
zoom: 1;
*display: inline;
zoom: 1;
*display: inline;
}
.editable-buttons .editable-cancel {
margin-left: 7px;
margin-left: 7px;
}
/*for jquery-ui buttons need set height to look more pretty*/
.editable-buttons button.ui-button-icon-only {
height: 24px;
height: 24px;
width: 30px;
}
.editableform-loading {
background: url('../img/loading.gif') center center no-repeat;
background: url('../img/loading.gif') center center no-repeat;
height: 25px;
width: auto;
min-width: 25px;
width: auto;
min-width: 25px;
}
.editable-inline .editableform-loading {
background-position: left 5px;
background-position: left 5px;
}
.editable-error-block {
@@ -68,17 +67,17 @@
/*add padding for jquery ui*/
.editable-error-block.ui-state-error {
padding: 3px;
}
padding: 3px;
}
.editable-error {
color: red;
color: red;
}
/* ---- For specific types ---- */
.editableform .editable-date {
padding: 0;
padding: 0;
margin: 0;
float: left;
}
@@ -86,25 +85,25 @@
/* move datepicker icon to center of add-on button. See https://github.com/vitalets/x-editable/issues/183 */
.editable-inline .add-on .icon-th {
margin-top: 3px;
margin-left: 1px;
margin-left: 1px;
}
/* checklist vertical alignment */
.editable-checklist label input[type="checkbox"],
.editable-checklist label input[type="checkbox"],
.editable-checklist label span {
vertical-align: middle;
margin: 0;
}
.editable-checklist label {
white-space: nowrap;
white-space: nowrap;
}
/* set exact width of textarea to fit buttons toolbar */
.editable-wysihtml5 {
width: 566px;
height: 250px;
width: 566px;
height: 250px;
}
/* clear button shown as link in date inputs */
@@ -119,16 +118,16 @@
.editable-clear-x {
background: url('../img/clear.png') center center no-repeat;
display: block;
width: 13px;
width: 13px;
height: 13px;
position: absolute;
opacity: 0.6;
z-index: 100;
top: 50%;
right: 6px;
margin-top: -6px;
}
.editable-clear-x:hover {
@@ -140,49 +139,49 @@
}
.editable-container.editable-popup {
max-width: none !important; /* without this rule poshytip/tooltip does not stretch */
}
}
.editable-container.popover {
width: auto; /* without this rule popover does not stretch */
}
.editable-container.editable-inline {
display: inline-block;
display: inline-block;
vertical-align: middle;
width: auto;
/* inline-block emulation for IE7*/
zoom: 1;
*display: inline;
zoom: 1;
*display: inline;
}
.editable-container.ui-widget {
font-size: inherit; /* jqueryui widget font 1.1em too big, overwrite it */
z-index: 9990; /* should be less than select2 dropdown z-index to close dropdown first when click */
}
.editable-click,
a.editable-click,
.editable-click,
a.editable-click,
a.editable-click:hover {
text-decoration: none;
border-bottom: dotted 1px #0088cc;
border-bottom: dashed 1px #0088cc;
}
.editable-click.editable-disabled,
a.editable-click.editable-disabled,
.editable-click.editable-disabled,
a.editable-click.editable-disabled,
a.editable-click.editable-disabled:hover {
color: #585858;
color: #585858;
cursor: default;
border-bottom: none;
}
.editable-empty, .editable-empty:hover, .editable-empty:focus{
font-style: italic;
color: #DD1144;
font-style: italic;
color: #DD1144;
/* border-bottom: none; */
text-decoration: none;
}
.editable-unsaved {
font-weight: bold;
font-weight: bold;
}
.editable-unsaved:after {
@@ -194,12 +193,12 @@ a.editable-click.editable-disabled:hover {
-moz-transition: background-color 1400ms ease-out;
-o-transition: background-color 1400ms ease-out;
-ms-transition: background-color 1400ms ease-out;
transition: background-color 1400ms ease-out;
transition: background-color 1400ms ease-out;
}
/*see https://github.com/vitalets/x-editable/issues/139 */
.form-horizontal .editable
{
{
padding-top: 5px;
display:inline-block;
}

View File

@@ -1,8 +1,7 @@
/*! X-editable - v1.4.6
/*! X-editable - v1.4.7
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
* http://github.com/vitalets/x-editable
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
/**
Form with single input element, two buttons and two states: normal/loading.
Applied as jQuery method to DIV tag (not to form tag!). This is because form can be in loading state when spinner shown.
@@ -33,6 +32,9 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
//set initial value
//todo: may be add check: typeof str === 'string' ?
this.value = this.input.str2value(this.options.value);
//prerender: get input.$input
this.input.prerender();
},
initTemplate: function() {
this.$form = $($.fn.editableform.template);
@@ -80,9 +82,8 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
this.initInput();
//append input to form
this.input.prerender();
this.$form.find('div.editable-input').append(this.input.$tpl);
//append form to container
this.$div.append(this.$form);
@@ -620,6 +621,9 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
//error class attached to editable-error-block
$.fn.editableform.errorBlockClass = 'editable-error';
//engine
$.fn.editableform.engine = 'jqeury';
}(window.jQuery));
/**
@@ -898,6 +902,8 @@ Applied as jQuery method.
containerDataName: null, //object name in element's .data()
innerCss: null, //tbd in child class
containerClass: 'editable-container editable-popup', //css class applied to container element
defaults: {}, //container itself defaults
init: function(element, options) {
this.$element = $(element);
//since 1.4.1 container do not use data-* directly as they already merged into options.
@@ -975,10 +981,9 @@ Applied as jQuery method.
throw new Error(this.containerName + ' not found. Have you included corresponding js file?');
}
var cDef = $.fn[this.containerName].defaults;
//keys defined in container defaults go to container, others go to form
for(var k in this.options) {
if(k in cDef) {
if(k in this.defaults) {
this.containerOptions[k] = this.options[k];
} else {
this.formOptions[k] = this.options[k];
@@ -2249,7 +2254,7 @@ Makes editable any HTML element on the page. Applied as jQuery method.
@since 1.4.5
@default #FFFF80
**/
highlight: '#FFFF80'
highlight: '#FFFF80'
};
}(window.jQuery));
@@ -2415,7 +2420,7 @@ To create your own input you can inherit from this class.
},
// -------- helper functions --------
setClass: function() {
setClass: function() {
if(this.options.inputclass) {
this.$input.addClass(this.options.inputclass);
}
@@ -2447,9 +2452,9 @@ To create your own input you can inherit from this class.
@property inputclass
@type string
@default input-medium
@default null
**/
inputclass: 'input-medium',
inputclass: null,
//scope for external methods (e.g. source defined as function)
//for internal use only
scope: null,
@@ -3817,7 +3822,7 @@ $(function(){
@type string
@default ', '
**/
viewseparator: ', '
viewseparator: ', '
});
$.fn.editabletypes.select2 = Constructor;
@@ -4343,7 +4348,14 @@ $(function(){
$.extend(Constructor.prototype, {
render: function () {
this.$input.combodate(this.options.combodate);
if($.fn.editableform.engine === 'bs3') {
this.$input.siblings().find('select').addClass('form-control');
}
if(this.options.inputclass) {
this.$input.siblings().find('select').addClass(this.options.inputclass);
}
//"clear" link
/*
if(this.options.clear) {
@@ -4468,29 +4480,71 @@ $(function(){
}(window.jQuery));
/*
Editableform based on Twitter Bootstrap
Editableform based on Twitter Bootstrap 3
*/
(function ($) {
"use strict";
//store parent methods
var pInitInput = $.fn.editableform.Constructor.prototype.initInput;
$.extend($.fn.editableform.Constructor.prototype, {
initTemplate: function() {
initTemplate: function() {
this.$form = $($.fn.editableform.template);
this.$form.find('.control-group').addClass('form-group');
this.$form.find('.editable-error-block').addClass('help-block');
}
},
initInput: function() {
pInitInput.apply(this);
//for bs3 set default class `input-sm` to standard inputs
var emptyInputClass = this.input.options.inputclass === null || this.input.options.inputclass === false;
var defaultClass = 'input-sm';
//bs3 add `form-control` class to standard inputs
var stdtypes = 'text,select,textarea,password,email,url,tel,number,range,time'.split(',');
if(~$.inArray(this.input.type, stdtypes)) {
this.input.$input.addClass('form-control');
if(emptyInputClass) {
this.input.options.inputclass = defaultClass;
this.input.$input.addClass(defaultClass);
}
}
//apply bs3 size class also to buttons (to fit size of control)
var $btn = this.$form.find('.editable-buttons');
var classes = emptyInputClass ? [defaultClass] : this.input.options.inputclass.split(' ');
for(var i=0; i<classes.length; i++) {
// `btn-sm` is default now
/*
if(classes[i].toLowerCase() === 'input-sm') {
$btn.find('button').addClass('btn-sm');
}
*/
if(classes[i].toLowerCase() === 'input-lg') {
$btn.find('button').removeClass('btn-sm').addClass('btn-lg');
}
}
}
});
//buttons
$.fn.editableform.buttons = '<button type="submit" class="btn btn-primary editable-submit"><i class="icon-ok icon-white"></i></button>'+
'<button type="button" class="btn editable-cancel"><i class="icon-remove"></i></button>';
$.fn.editableform.buttons =
'<button type="submit" class="btn btn-primary btn-sm editable-submit">'+
'<i class="glyphicon glyphicon-ok"></i>'+
'</button>'+
'<button type="button" class="btn btn-default btn-sm editable-cancel">'+
'<i class="glyphicon glyphicon-remove"></i>'+
'</button>';
//error classes
$.fn.editableform.errorGroupClass = 'error';
$.fn.editableform.errorBlockClass = null;
$.fn.editableform.errorGroupClass = 'has-error';
$.fn.editableform.errorBlockClass = null;
//engine
$.fn.editableform.engine = 'bs3';
}(window.jQuery));
/**
* Editable Popover
* Editable Popover3 (for Bootstrap 3)
* ---------------------
* requires bootstrap-popover.js
*/
@@ -4500,15 +4554,16 @@ Editableform based on Twitter Bootstrap
//extend methods
$.extend($.fn.editableContainer.Popup.prototype, {
containerName: 'popover',
//for compatibility with bootstrap <= 2.2.1 (content inserted into <p> instead of directly .popover-content)
innerCss: $.fn.popover && $($.fn.popover.defaults.template).find('p').length ? '.popover-content p' : '.popover-content',
containerDataName: 'bs.popover',
innerCss: '.popover-content',
defaults: $.fn.popover.Constructor.DEFAULTS,
initContainer: function(){
$.extend(this.containerOptions, {
trigger: 'manual',
selector: false,
content: ' ',
template: $.fn.popover.defaults.template
template: this.defaults.template
});
//as template property is used in inputs, hide it from popover
@@ -4548,10 +4603,11 @@ Editableform based on Twitter Bootstrap
/**
* move popover to new position. This function mainly copied from bootstrap-popover.
*/
/*jshint laxcomma: true*/
/*jshint laxcomma: true, eqeqeq: false*/
setPosition: function () {
(function() {
(function() {
/*
var $tip = this.tip()
, inside
, pos
@@ -4661,9 +4717,27 @@ Editableform based on Twitter Bootstrap
.offset(tp)
.addClass(placement)
.addClass('in');
*/
var $tip = this.tip();
var placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement;
var pos = this.getPosition();
var actualWidth = $tip[0].offsetWidth;
var actualHeight = $tip[0].offsetHeight;
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight);
this.applyPlacement(calculatedOffset, placement);
}).call(this.container());
/*jshint laxcomma: false*/
/*jshint laxcomma: false, eqeqeq: true*/
}
});
@@ -6555,273 +6629,4 @@ Automatically shown in inline mode.
$.fn.editabletypes.datetimefield = DateTimeField;
}(window.jQuery));
/**
Typeahead input (bootstrap only). Based on Twitter Bootstrap [typeahead](http://twitter.github.com/bootstrap/javascript.html#typeahead).
Depending on `source` format typeahead operates in two modes:
* **strings**:
When `source` defined as array of strings, e.g. `['text1', 'text2', 'text3' ...]`.
User can submit one of these strings or any text entered in input (even if it is not matching source).
* **objects**:
When `source` defined as array of objects, e.g. `[{value: 1, text: "text1"}, {value: 2, text: "text2"}, ...]`.
User can submit only values that are in source (otherwise `null` is submitted). This is more like *dropdown* behavior.
@class typeahead
@extends list
@since 1.4.1
@final
@example
<a href="#" id="country" data-type="typeahead" data-pk="1" data-url="/post" data-original-title="Input country"></a>
<script>
$(function(){
$('#country').editable({
value: 'ru',
source: [
{value: 'gb', text: 'Great Britain'},
{value: 'us', text: 'United States'},
{value: 'ru', text: 'Russia'}
]
});
});
</script>
**/
(function ($) {
"use strict";
var Constructor = function (options) {
this.init('typeahead', options, Constructor.defaults);
//overriding objects in config (as by default jQuery extend() is not recursive)
this.options.typeahead = $.extend({}, Constructor.defaults.typeahead, {
//set default methods for typeahead to work with objects
matcher: this.matcher,
sorter: this.sorter,
highlighter: this.highlighter,
updater: this.updater
}, options.typeahead);
};
$.fn.editableutils.inherit(Constructor, $.fn.editabletypes.list);
$.extend(Constructor.prototype, {
renderList: function() {
this.$input = this.$tpl.is('input') ? this.$tpl : this.$tpl.find('input[type="text"]');
//set source of typeahead
this.options.typeahead.source = this.sourceData;
//apply typeahead
this.$input.typeahead(this.options.typeahead);
//patch some methods in typeahead
var ta = this.$input.data('typeahead');
ta.render = $.proxy(this.typeaheadRender, ta);
ta.select = $.proxy(this.typeaheadSelect, ta);
ta.move = $.proxy(this.typeaheadMove, ta);
this.renderClear();
this.setClass();
this.setAttr('placeholder');
},
value2htmlFinal: function(value, element) {
if(this.getIsObjects()) {
var items = $.fn.editableutils.itemsByValue(value, this.sourceData);
$(element).text(items.length ? items[0].text : '');
} else {
$(element).text(value);
}
},
html2value: function (html) {
return html ? html : null;
},
value2input: function(value) {
if(this.getIsObjects()) {
var items = $.fn.editableutils.itemsByValue(value, this.sourceData);
this.$input.data('value', value).val(items.length ? items[0].text : '');
} else {
this.$input.val(value);
}
},
input2value: function() {
if(this.getIsObjects()) {
var value = this.$input.data('value'),
items = $.fn.editableutils.itemsByValue(value, this.sourceData);
if(items.length && items[0].text.toLowerCase() === this.$input.val().toLowerCase()) {
return value;
} else {
return null; //entered string not found in source
}
} else {
return this.$input.val();
}
},
/*
if in sourceData values <> texts, typeahead in "objects" mode:
user must pick some value from list, otherwise `null` returned.
if all values == texts put typeahead in "strings" mode:
anything what entered is submited.
*/
getIsObjects: function() {
if(this.isObjects === undefined) {
this.isObjects = false;
for(var i=0; i<this.sourceData.length; i++) {
if(this.sourceData[i].value !== this.sourceData[i].text) {
this.isObjects = true;
break;
}
}
}
return this.isObjects;
},
/*
Methods borrowed from text input
*/
activate: $.fn.editabletypes.text.prototype.activate,
renderClear: $.fn.editabletypes.text.prototype.renderClear,
postrender: $.fn.editabletypes.text.prototype.postrender,
toggleClear: $.fn.editabletypes.text.prototype.toggleClear,
clear: function() {
$.fn.editabletypes.text.prototype.clear.call(this);
this.$input.data('value', '');
},
/*
Typeahead option methods used as defaults
*/
/*jshint eqeqeq:false, curly: false, laxcomma: true, asi: true*/
matcher: function (item) {
return $.fn.typeahead.Constructor.prototype.matcher.call(this, item.text);
},
sorter: function (items) {
var beginswith = []
, caseSensitive = []
, caseInsensitive = []
, item
, text;
while (item = items.shift()) {
text = item.text;
if (!text.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item);
else if (~text.indexOf(this.query)) caseSensitive.push(item);
else caseInsensitive.push(item);
}
return beginswith.concat(caseSensitive, caseInsensitive);
},
highlighter: function (item) {
return $.fn.typeahead.Constructor.prototype.highlighter.call(this, item.text);
},
updater: function (item) {
this.$element.data('value', item.value);
return item.text;
},
/*
Overwrite typeahead's render method to store objects.
There are a lot of disscussion in bootstrap repo on this point and still no result.
See https://github.com/twitter/bootstrap/issues/5967
This function just store item via jQuery data() method instead of attr('data-value')
*/
typeaheadRender: function (items) {
var that = this;
items = $(items).map(function (i, item) {
// i = $(that.options.item).attr('data-value', item)
i = $(that.options.item).data('item', item);
i.find('a').html(that.highlighter(item));
return i[0];
});
//add option to disable autoselect of first line
//see https://github.com/twitter/bootstrap/pull/4164
if (this.options.autoSelect) {
items.first().addClass('active');
}
this.$menu.html(items);
return this;
},
//add option to disable autoselect of first line
//see https://github.com/twitter/bootstrap/pull/4164
typeaheadSelect: function () {
var val = this.$menu.find('.active').data('item')
if(this.options.autoSelect || val){
this.$element
.val(this.updater(val))
.change()
}
return this.hide()
},
/*
if autoSelect = false and nothing matched we need extra press onEnter that is not convinient.
This patch fixes it.
*/
typeaheadMove: function (e) {
if (!this.shown) return
switch(e.keyCode) {
case 9: // tab
case 13: // enter
case 27: // escape
if (!this.$menu.find('.active').length) return
e.preventDefault()
break
case 38: // up arrow
e.preventDefault()
this.prev()
break
case 40: // down arrow
e.preventDefault()
this.next()
break
}
e.stopPropagation()
}
/*jshint eqeqeq: true, curly: true, laxcomma: false, asi: false*/
});
Constructor.defaults = $.extend({}, $.fn.editabletypes.list.defaults, {
/**
@property tpl
@default <input type="text">
**/
tpl:'<input type="text">',
/**
Configuration of typeahead. [Full list of options](http://twitter.github.com/bootstrap/javascript.html#typeahead).
@property typeahead
@type object
@default null
**/
typeahead: null,
/**
Whether to show `clear` button
@property clear
@type boolean
@default true
**/
clear: true
});
$.fn.editabletypes.typeahead = Constructor;
}(window.jQuery));

File diff suppressed because one or more lines are too long

View File

@@ -189,149 +189,157 @@
{* Adding a new currency *}
<div class="modal hide fade" id="add_currency_dialog" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal fade" id="add_currency_dialog" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>{intl l="Create a new currency"}</h3>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>{intl l="Create a new currency"}</h3>
</div>
{form name="thelia.admin.currency.creation"}
<form method="POST" action="{url path='/admin/configuration/currencies/create'}" {form_enctype form=$form}>
{form_hidden_fields form=$form}
{form_field form=$form field='success_url'}
{* on success, redirect to the edition page, _ID_ is replaced with the created currency ID, see controller *}
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/currencies/update' currency_id='_ID_'}" />
{/form_field}
{* We do not allow users to create secured currencies from here *}
<div class="modal-body">
{if $form_error}<div class="alert alert-block alert-error" id="add_currency_dialog_error">{$form_error_message}</div>{/if}
<div class="form-group">
<label class="control-label">
{intl l='Name *'}
</label>
<div class="controls">
{loop type="lang" name="default-lang" default_only="1"}
{* Switch edition to the current locale *}
<input type="hidden" name="edit_language_id" value="{$ID}" />
{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$LOCALE}" />
{/form_field}
<div class="input-group">
{form_field form=$form field='name'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency name'}" placeholder="{intl l='Name'}">
</span>
{/form_field}
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
</div>
<div class="help-block">{intl l="Enter here the currency name in the default language ($TITLE)"}</div>
{/loop}
</div>
</div>
<div class="form-group">
<label class="control-label">
{intl l='ISO 4217 code *'}
</label>
<div class="controls">
{form_field form=$form field='code'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='ISO 4217 code'}" placeholder="{intl l='Code'}">
</span>
<div class="help-block">
<a href="http://fr.wikipedia.org/wiki/ISO_4217" target="_blank">{intl l='More information about ISO 4217'}</a>
</div>
{/form_field}
</div>
</div>
<div class="form-group">
<label class="control-label">
{intl l='Symbol *'}
</label>
<div class="controls">
{form_field form=$form field='symbol'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency symbol'}" placeholder="{intl l='Symbol'}">
</span>
{/form_field}
</div>
</div>
<div class="form-group">
<label class="control-label">
{intl l='Rate *'}
</label>
<div class="controls">
{form_field form=$form field='rate'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency rate'}" placeholder="{intl l='Rate'}">
</span>
<div class="help-block">{intl l="The rate from Euro (Price in Euro * rate = Price in this currency)"}</div>
{/form_field}
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-default btn-primary">{intl l="Create this currency"}</button>
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">{intl l="Cancel"}</button>
</div>
</form>
{/form}
</div>
{form name="thelia.admin.currency.creation"}
<form method="POST" action="{url path='/admin/configuration/currencies/create'}" {form_enctype form=$form}>
{form_hidden_fields form=$form}
{form_field form=$form field='success_url'}
{* on success, redirect to the edition page, _ID_ is replaced with the created currency ID, see controller *}
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/currencies/update' currency_id='_ID_'}" />
{/form_field}
{* We do not allow users to create secured currencies from here *}
<div class="modal-body">
{if $form_error}<div class="alert alert-block alert-error" id="add_currency_dialog_error">{$form_error_message}</div>{/if}
<div class="control-group">
<label class="control-label">
{intl l='Name *'}
</label>
<div class="controls">
{loop type="lang" name="default-lang" default_only="1"}
{* Switch edition to the current locale *}
<input type="hidden" name="edit_language_id" value="{$ID}" />
{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$LOCALE}" />
{/form_field}
<div class="input-group">
{form_field form=$form field='name'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value}" title="{intl l='Currency name'}" placeholder="{intl l='Name'}">
</span>
{/form_field}
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
</div>
<div class="help-block">{intl l="Enter here the currency name in the default language ($TITLE)"}</div>
{/loop}
</div>
</div>
<div class="control-group">
<label class="control-label">
{intl l='ISO 4217 code *'}
</label>
<div class="controls">
{form_field form=$form field='code'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value}" title="{intl l='ISO 4217 code'}" placeholder="{intl l='Code'}">
</span>
<div class="help-block">
<a href="http://fr.wikipedia.org/wiki/ISO_4217" target="_blank">{intl l='More information about ISO 4217'}</a>
</div>
{/form_field}
</div>
</div>
<div class="control-group">
<label class="control-label">
{intl l='Symbol *'}
</label>
<div class="controls">
{form_field form=$form field='symbol'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value}" title="{intl l='Currency symbol'}" placeholder="{intl l='Symbol'}">
</span>
{/form_field}
</div>
</div>
<div class="control-group">
<label class="control-label">
{intl l='Rate *'}
</label>
<div class="controls">
{form_field form=$form field='rate'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value}" title="{intl l='Currency rate'}" placeholder="{intl l='Rate'}">
</span>
<div class="help-block">{intl l="The rate from Euro (Price in Euro * rate = Price in this currency)"}</div>
{/form_field}
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-default btn-primary">{intl l="Create this currency"}</button>
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">{intl l="Cancel"}</button>
</div>
</form>
{/form}
</div>
</div>
{* Delete confirmation dialog *}
<div class="modal hide fade" id="delete_currency_dialog" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal fade" id="delete_currency_dialog" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>{intl l="Delete a currency"}</h3>
</div>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>{intl l="Delete a currency"}</h3>
<div class="modal-body">
<p>{intl l="Do you really want to delete this currency ?"}</p>
</div>
<form method="post" action="{url path='/admin/configuration/currencies/delete'}">
<input type="hidden" name="currency_id" id="currency_delete_id" value="" />
<div class="modal-footer">
<button type="submit" class="btn btn-default btn-primary">{intl l="Yes"}</button>
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">{intl l="No"}</button>
</div>
</form>
</div>
<div class="modal-body">
<p>{intl l="Do you really want to delete this currency ?"}</p>
</div>
<form method="post" action="{url path='/admin/configuration/currencies/delete'}">
<input type="hidden" name="currency_id" id="currency_delete_id" value="" />
<div class="modal-footer">
<button type="submit" class="btn btn-default btn-primary">{intl l="Yes"}</button>
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">{intl l="No"}</button>
</div>
</form>
</div>
</div>
{/block}
{block name="after-javascript-include"}
{javascripts file='assets/bootstrap-editable/js/bootstrap-editable.js'}
<script src="{$asset_url}"></script>
{/javascripts}
{/block}
{block name="javascript-initialization"}
{javascripts file='assets/bootstrap-editable/js/bootstrap-editable.js'}
<script src="{$asset_url}"></script>
{/javascripts}
<script>
$(function() {

View File

@@ -27,100 +27,95 @@
</div>
<div class="form-container">
<div class="form-horizontal col-md-12">
<div class="col-md-12">
{form name="thelia.admin.currency.modification"}
<form method="POST" action="{url path='/admin/configuration/currencies/save'}" {form_enctype form=$form}>
<fieldset>
{* Be sure to get the currency ID, even if the form could not be validated *}
<input type="hidden" name="currency_id" value="{$currency_id}" />
{* Be sure to get the currency ID, even if the form could not be validated *}
<input type="hidden" name="currency_id" value="{$currency_id}" />
{include file="includes/inner-form-toolbar.html"}
{include file="includes/inner-form-toolbar.html"}
{form_hidden_fields form=$form}
{form_hidden_fields form=$form}
{form_field form=$form field='success_url'}
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/currencies'}" />
{/form_field}
{form_field form=$form field='success_url'}
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/currencies'}" />
{/form_field}
{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
{/form_field}
{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
{/form_field}
{if $form_error}<div class="alert alert-block alert-error">{$form_error_message}</div>{/if}
{if $form_error}<div class="alert alert-block alert-error">{$form_error_message}</div>{/if}
<div class="col-md-6">
<div class="row">
<div class="col-md-6">
<div class="control-group">
<label class="control-label">
{intl l='Name *'}
</label>
<div class="form-group">
<label class="control-label">
{intl l='Name *'}
</label>
<div class="controls">
{form_field form=$form field='name'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Currency name'}" placeholder="{intl l='Currency name'}" class="input-medium">
</span>
{/form_field}
</div>
</div>
<div class="controls">
{form_field form=$form field='name'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Currency name'}" placeholder="{intl l='Currency name'}" class="form-control input-medium">
</span>
{/form_field}
</div>
</div>
<div class="control-group">
<label class="control-label">
{intl l='ISO 4217 Code *'}
<span class="label-help-block"><a title="{intl l='More information about ISO 4217'}" href="http://fr.wikipedia.org/wiki/ISO_4217" target="_blank">List of ISO 4217 code</a></span>
</label>
<div class="form-group">
<label class="control-label">
{intl l='ISO 4217 Code *'}
<span class="label-help-block"><a title="{intl l='More information about ISO 4217'}" href="http://fr.wikipedia.org/wiki/ISO_4217" target="_blank">List of ISO 4217 code</a></span>
</label>
<div class="controls">
{form_field form=$form field='code'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Currency ISO 4217 Code'}" placeholder="{intl l='Code'}" class="input-mini">
</span>
{/form_field}
</div>
</div>
</div>
<div class="col-md-6">
<div class="control-group">
<label class="control-label">
{intl l='Symbol *'}
<span class="label-help-block">The symbol, sur as $, £, &euro;...</span>
</label>
<div class="controls">
{form_field form=$form field='symbol'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Currency symbol'}" placeholder="{intl l='Symbol'}" class="input-mini">
</span>
{/form_field}
</div>
</div>
<div class="control-group">
<label class="control-label">
{intl l='Rate from &euro; *'}
<span class="label-help-block">The rate from Euro</span>
</label>
<div class="controls">
{form_field form=$form field='rate'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Rate from Euro'}" placeholder="{intl l='Rate'}" class="input-mini">
</span>
{/form_field}
<span class="help-block">Price in Euro x rate = Price in this currency</span>
</div>
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<p>{intl l='Currency created on %date_create. Last modification: %date_change' date_create="{format_date date=$CREATE_DATE}" date_change="{format_date date=$UPDATE_DATE}"}</p>
{form_field form=$form field='code'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Currency ISO 4217 Code'}" placeholder="{intl l='Code'}" class="form-control input-mini">
</span>
{/form_field}
</div>
</div>
</div>
</fieldset>
<div class="col-md-6">
<div class="form-group">
<label class="control-label">
{intl l='Symbol *'}
<span class="label-help-block">The symbol, sur as $, £, &euro;...</span>
</label>
<div class="controls">
{form_field form=$form field='symbol'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Currency symbol'}" placeholder="{intl l='Symbol'}" class="form-control input-mini">
</span>
{/form_field}
</div>
</div>
<div class="form-group">
<label class="control-label">
{intl l='Rate from &euro; *'}
<span class="label-help-block">The rate from Euro</span>
</label>
<div class="controls">
{form_field form=$form field='rate'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Rate from Euro'}" placeholder="{intl l='Rate'}" class="form-control input-mini">
</span>
{/form_field}
<span class="help-block">Price in Euro x rate = Price in this currency</span>
</div>
</div>
</div>
</form>
{/form}
</div>