+ * $query->filterByFullNamespace('fooValue'); // WHERE full_namespace = 'fooValue'
+ * $query->filterByFullNamespace('%fooValue%'); // WHERE full_namespace LIKE '%fooValue%'
+ *
+ *
+ * @param string $fullNamespace 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 ChildModuleQuery The current query, for fluid interface
+ */
+ public function filterByFullNamespace($fullNamespace = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($fullNamespace)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $fullNamespace)) {
+ $fullNamespace = str_replace('*', '%', $fullNamespace);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ModuleTableMap::FULL_NAMESPACE, $fullNamespace, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
diff --git a/core/lib/Thelia/Model/Map/ModuleTableMap.php b/core/lib/Thelia/Model/Map/ModuleTableMap.php
index cccaa890a..dae9fda4a 100644
--- a/core/lib/Thelia/Model/Map/ModuleTableMap.php
+++ b/core/lib/Thelia/Model/Map/ModuleTableMap.php
@@ -57,7 +57,7 @@ class ModuleTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 7;
+ const NUM_COLUMNS = 8;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class ModuleTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 7;
+ const NUM_HYDRATE_COLUMNS = 8;
/**
* the column name for the ID field
@@ -94,6 +94,11 @@ class ModuleTableMap extends TableMap
*/
const POSITION = 'module.POSITION';
+ /**
+ * the column name for the FULL_NAMESPACE field
+ */
+ const FULL_NAMESPACE = 'module.FULL_NAMESPACE';
+
/**
* the column name for the CREATED_AT field
*/
@@ -125,12 +130,12 @@ class ModuleTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Activate', 'Position', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'activate', 'position', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(ModuleTableMap::ID, ModuleTableMap::CODE, ModuleTableMap::TYPE, ModuleTableMap::ACTIVATE, ModuleTableMap::POSITION, ModuleTableMap::CREATED_AT, ModuleTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'ACTIVATE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'code', 'type', 'activate', 'position', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
+ self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Activate', 'Position', 'FullNamespace', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'activate', 'position', 'fullNamespace', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(ModuleTableMap::ID, ModuleTableMap::CODE, ModuleTableMap::TYPE, ModuleTableMap::ACTIVATE, ModuleTableMap::POSITION, ModuleTableMap::FULL_NAMESPACE, ModuleTableMap::CREATED_AT, ModuleTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'ACTIVATE', 'POSITION', 'FULL_NAMESPACE', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'code', 'type', 'activate', 'position', 'full_namespace', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
);
/**
@@ -140,12 +145,12 @@ class ModuleTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Activate' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
- self::TYPE_COLNAME => array(ModuleTableMap::ID => 0, ModuleTableMap::CODE => 1, ModuleTableMap::TYPE => 2, ModuleTableMap::ACTIVATE => 3, ModuleTableMap::POSITION => 4, ModuleTableMap::CREATED_AT => 5, ModuleTableMap::UPDATED_AT => 6, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'ACTIVATE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Activate' => 3, 'Position' => 4, 'FullNamespace' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'fullNamespace' => 5, 'createdAt' => 6, 'updatedAt' => 7, ),
+ self::TYPE_COLNAME => array(ModuleTableMap::ID => 0, ModuleTableMap::CODE => 1, ModuleTableMap::TYPE => 2, ModuleTableMap::ACTIVATE => 3, ModuleTableMap::POSITION => 4, ModuleTableMap::FULL_NAMESPACE => 5, ModuleTableMap::CREATED_AT => 6, ModuleTableMap::UPDATED_AT => 7, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'ACTIVATE' => 3, 'POSITION' => 4, 'FULL_NAMESPACE' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'full_namespace' => 5, 'created_at' => 6, 'updated_at' => 7, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
);
/**
@@ -169,6 +174,7 @@ class ModuleTableMap extends TableMap
$this->addColumn('TYPE', 'Type', 'TINYINT', true, null, null);
$this->addColumn('ACTIVATE', 'Activate', 'TINYINT', false, null, null);
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
+ $this->addColumn('FULL_NAMESPACE', 'FullNamespace', 'VARCHAR', false, 255, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -349,6 +355,7 @@ class ModuleTableMap extends TableMap
$criteria->addSelectColumn(ModuleTableMap::TYPE);
$criteria->addSelectColumn(ModuleTableMap::ACTIVATE);
$criteria->addSelectColumn(ModuleTableMap::POSITION);
+ $criteria->addSelectColumn(ModuleTableMap::FULL_NAMESPACE);
$criteria->addSelectColumn(ModuleTableMap::CREATED_AT);
$criteria->addSelectColumn(ModuleTableMap::UPDATED_AT);
} else {
@@ -357,6 +364,7 @@ class ModuleTableMap extends TableMap
$criteria->addSelectColumn($alias . '.TYPE');
$criteria->addSelectColumn($alias . '.ACTIVATE');
$criteria->addSelectColumn($alias . '.POSITION');
+ $criteria->addSelectColumn($alias . '.FULL_NAMESPACE');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php b/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php
index 5e22f08e9..5e5dae010 100755
--- a/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php
+++ b/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php
@@ -113,7 +113,7 @@ class ModelCriteriaTools
$localeSearch = LangQuery::create()->findOneById($requestedLangId);
if ($localeSearch === null) {
- throw new \InvalidArgumentException(sprintf('Incorrect lang argument given in attribute loop: lang ID %d not found', $requestedLangId));
+ throw new \InvalidArgumentException(sprintf('Incorrect lang argument given : lang ID %d not found', $requestedLangId));
}
$locale = $localeSearch->getLocale();
diff --git a/core/lib/Thelia/Model/Tools/PositionManagementTrait.php b/core/lib/Thelia/Model/Tools/PositionManagementTrait.php
index 9e0b1f35c..eb71564eb 100644
--- a/core/lib/Thelia/Model/Tools/PositionManagementTrait.php
+++ b/core/lib/Thelia/Model/Tools/PositionManagementTrait.php
@@ -55,7 +55,7 @@ trait PositionManagementTrait {
->orderByPosition(Criteria::DESC)
->limit(1);
- if ($parent !== null) $last->filterByParent($parent);
+ if ($parent !== null) $query->filterByParent($parent);
$last = $query->findOne()
;
diff --git a/core/lib/Thelia/Module/BaseModule.php b/core/lib/Thelia/Module/BaseModule.php
index 07cc1d116..145da3c02 100755
--- a/core/lib/Thelia/Module/BaseModule.php
+++ b/core/lib/Thelia/Module/BaseModule.php
@@ -24,7 +24,9 @@
namespace Thelia\Module;
-abstract class BaseModule
+use Symfony\Component\DependencyInjection\ContainerAware;
+
+abstract class BaseModule extends ContainerAware
{
public function __construct()
@@ -37,6 +39,19 @@ abstract class BaseModule
}
+ public function hasContainer()
+ {
+ return null === $this->container;
+ }
+
+ public function getContainer()
+ {
+ if($this->hasContainer() === false) {
+ throw new \RuntimeException("Sorry, container his not available in this context");
+ }
+ return $this->container;
+ }
+
abstract public function install();
abstract public function destroy();
diff --git a/core/lib/Thelia/Module/BaseModuleInterface.php b/core/lib/Thelia/Module/BaseModuleInterface.php
new file mode 100644
index 000000000..2db450830
--- /dev/null
+++ b/core/lib/Thelia/Module/BaseModuleInterface.php
@@ -0,0 +1,37 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Module;
+
+
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\HttpFoundation\Request;
+
+interface BaseModuleInterface {
+
+ public function setRequest(Request $request);
+ public function getRequest();
+
+ public function setDispatcher(EventDispatcherInterface $dispatcher);
+ public function getDispatcher();
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Module/DeliveryModuleInterface.php b/core/lib/Thelia/Module/DeliveryModuleInterface.php
new file mode 100644
index 000000000..b8ffcfc01
--- /dev/null
+++ b/core/lib/Thelia/Module/DeliveryModuleInterface.php
@@ -0,0 +1,36 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Module;
+
+
+interface DeliveryModuleInterface extends BaseModuleInterface {
+
+ /**
+ *
+ * calculate and return delivery price
+ *
+ * @return mixed
+ */
+ public function calculate($country = null);
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Tools/DateTimeFormat.php b/core/lib/Thelia/Tools/DateTimeFormat.php
new file mode 100755
index 000000000..bd6161389
--- /dev/null
+++ b/core/lib/Thelia/Tools/DateTimeFormat.php
@@ -0,0 +1,66 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Tools;
+
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+class DateTimeFormat
+{
+ protected $request;
+
+ public function __construct(Request $request)
+ {
+ $this->request = $request;
+ }
+
+ public static function getInstance(Request $request)
+ {
+ return new DateTimeFormat($request);
+ }
+
+ public function getFormat($output = null)
+ {
+ $lang = $this->request->getSession()->getLang();
+
+ $format = null;
+
+ if($lang) {
+ switch ($output) {
+ case "date" :
+ $format = $lang->getDateFormat();
+ break;
+ case "time" :
+ $format = $lang->getTimeFormat();
+ break;
+ default:
+ case "datetime" :
+ $format = $lang->getDateTimeFormat();
+ break;
+ }
+ }
+
+ return $format;
+ }
+}
\ No newline at end of file
diff --git a/install/insert.sql b/install/insert.sql
index a2e5868e4..344381a37 100755
--- a/install/insert.sql
+++ b/install/insert.sql
@@ -17,7 +17,9 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml', 0, 0, NOW(), NOW()),
('page_not_found_view', '404.html', 0, 0, NOW(), NOW());
-INSERT INTO `module` (`code`, `type`, `activate`, `position`, `created_at`, `updated_at`) VALUES ('test', '1', '1', '1', NOW(), NOW());
+
+INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES
+(1, 'DebugBar', 1, 1, 1, 'DebugBar\\DebugBar', NOW(), NOW());
INSERT INTO `customer_title`(`id`, `by_default`, `position`, `created_at`, `updated_at`) VALUES
(1, 1, 1, NOW(), NOW()),
diff --git a/install/thelia.sql b/install/thelia.sql
index 879f323b9..2fb3723ca 100755
--- a/install/thelia.sql
+++ b/install/thelia.sql
@@ -803,6 +803,7 @@ CREATE TABLE `module`
`type` TINYINT NOT NULL,
`activate` TINYINT,
`position` INTEGER,
+ `full_namespace` VARCHAR(255),
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
diff --git a/local/config/schema.xml b/local/config/schema.xml
index d4fb9213f..b2d1c8886 100755
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -605,6 +605,7 @@
| + {admin_sortable_header + current_order=$category_order + order='id' + reverse_order='id_reverse' + path={url path='/admin/catalog' id_category=$current_category_id} + label="{intl l='ID'}" + } + | +@@ -47,8 +55,8 @@ current_order=$category_order order='alpha' reverse_order='alpha_reverse' - path={url path='/admin/catalog/category' id="{$current_category_id}"} - label={intl l='Category title'} + path={url path='/admin/catalog' id_category=$current_category_id} + label="{intl l='Category title'}" } | @@ -59,8 +67,8 @@ current_order=$category_order order='visible' reverse_order='visible_reverse' - path={url path='/admin/catalog/category' id="{$current_category_id}"} - label={intl l='Online'} + path={url path='/admin/catalog' id_category=$current_category_id} + label="{intl l='Online'}" } @@ -69,8 +77,8 @@ current_order=$category_order order='manual' reverse_order='manual_reverse' - path={url path='/admin/catalog/category' id="{$current_category_id}"} - label={intl l='Position'} + path={url path='/admin/catalog' id_category=$current_category_id} + label="{intl l='Position'}" } @@ -81,22 +89,24 @@||||
|---|---|---|---|---|---|
| {$ID} | +
- i={$ID} {loop type="image" name="cat_image" source="category" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"}
- |
- - {$ID} p={$POSITION} {$TITLE} + + {$TITLE} | {module_include location='category_list_row'}
- {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.category.edit"}
+ {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.categories.edit"}
| {admin_position_block - permission="admin.category.edit" - path={url path='admin/catalog/category' category_id="{$ID}"} + permission="admin.categories.edit" + path={url path='admin/category/update-position' category_id=$ID} url_parameter="category_id" in_place_edit_class="categoryPositionChange" - position="$POSITION" - id="$ID" + position=$POSITION + id=$ID } |
-
+
- {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.category.edit"}
-
+ {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.categories.edit"}
+
{/loop}
- {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.category.delete"}
+ {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.categories.delete"}
{/loop}
@@ -143,7 +153,7 @@
|