Module AdminComment (pour rajout de notes sur les produits, non visibles des clients)

This commit is contained in:
2020-02-26 16:08:25 +01:00
parent 8ba55c376d
commit d33d484b22
30 changed files with 4455 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" ?>
<config xmlns="http://thelia.net/schema/dic/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<loops>
<loop name="admin_comment" class="AdminComment\Loop\AdminCommentLoop" />
</loops>
<forms>
<form name="admin_comment_create_form" class="AdminComment\Form\AdminCommentCreateForm" />
<form name="admin_comment_update_form" class="AdminComment\Form\AdminCommentUpdateForm" />
</forms>
<commands>
<!--
<command class="AdminComment\Command\MySuperCommand" />
-->
</commands>
<services>
<service id="action.admin_comment" class="AdminComment\Action\AdminCommentAction" scope="request">
<tag name="kernel.event_subscriber"/>
</service>
</services>
<hooks>
<hook id="admincomment.hook" class="AdminComment\Hook\BackHook" scope="request">
<tag name="hook.event_listener" event="main.after-content" type="back" />
<tag name="hook.event_listener" event="main.footer-js" type="back" />
<tag name="hook.event_listener" event="category.edit-js" type="back" method="onEditJs" />
<tag name="hook.event_listener" event="product.edit-js" type="back" method="onEditJs" />
<tag name="hook.event_listener" event="folder.edit-js" type="back" method="onEditJs" />
<tag name="hook.event_listener" event="content.edit-js" type="back" method="onEditJs" />
<tag name="hook.event_listener" event="customer.edit-js" type="back" method="onEditJs" />
<tag name="hook.event_listener" event="order.edit-js" type="back" method="onEditJs" />
<tag name="hook.event_listener" event="coupon.update-js" type="back" method="onEditJs" />
<tag name="hook.event_listener" event="category.tab" type="back" method="onEditTab" />
<tag name="hook.event_listener" event="product.tab" type="back" method="onEditTab" />
<tag name="hook.event_listener" event="folder.tab" type="back" method="onEditTab" />
<tag name="hook.event_listener" event="content.tab" type="back" method="onEditTab" />
<tag name="hook.event_listener" event="order.tab" type="back" method="onEditTab" />
<tag name="hook.event_listener" event="orders.table-header" type="back" method="onListHeader" />
<tag name="hook.event_listener" event="orders.table-row" type="back" method="onListRow" />
</hook>
</hooks>
<!--
<exports>
</exports>
-->
<!--
<imports>
</imports>
-->
</config>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://thelia.net/schema/dic/module"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_1.xsd">
<fullnamespace>AdminComment\AdminComment</fullnamespace>
<descriptive locale="en_US">
<title>Admin Comments</title>
</descriptive>
<descriptive locale="fr_FR">
<title>Commentaires Admin</title>
</descriptive>
<languages>
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>1.1.1</version>
<author>
<name>Julien Chanséaume</name>
<email>julien@thelia.net</email>
</author>
<type>classic</type>
<thelia>2.1.0</thelia>
<stability>other</stability>
</module>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<!-- back -->
<route id="admincomment.admin.list" path="/admin/module/AdminComment/list/{key}/{id}" methods="get">
<default key="_controller">AdminComment:AdminComment:list</default>
<requirement key="key">.+</requirement>
<requirement key="id">\d+</requirement>
</route>
<route id="admincomment.admin.create" path="/admin/module/AdminComment/create" methods="post">
<default key="_controller">AdminComment:AdminComment:create</default>
</route>
<route id="admincomment.admin.save" path="/admin/module/AdminComment/save" methods="post">
<default key="_controller">AdminComment:AdminComment:save</default>
</route>
<route id="admincomment.admin.delete" path="/admin/module/AdminComment/delete" methods="post">
<default key="_controller">AdminComment:AdminComment:delete</default>
</route>
</routes>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="thelia"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../core/vendor/propel/propel/resources/xsd/database.xsd" >
<table name="admin_comment" namespace="AdminComment\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="admin_id" type="INTEGER" required="false" />
<column name="comment" type="LONGVARCHAR" />
<column name="element_key" required="true" size="255" type="VARCHAR" />
<column name="element_id" required="true" type="INTEGER" />
<foreign-key foreignTable="admin" name="fk_admin_comment_admin_id" onDelete="SET NULL" onUpdate="RESTRICT">
<reference foreign="id" local="admin_id" />
</foreign-key>
<behavior name="timestampable" />
</table>
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
</database>

View File

@@ -0,0 +1,2 @@
# Sqlfile -> Database map
thelia.sql=thelia

View File

@@ -0,0 +1,31 @@
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
-- admin_comment
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `admin_comment`;
CREATE TABLE `admin_comment`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`admin_id` INTEGER,
`comment` TEXT,
`element_key` VARCHAR(255) NOT NULL,
`element_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `FI_admin_comment_admin_id` (`admin_id`),
CONSTRAINT `fk_admin_comment_admin_id`
FOREIGN KEY (`admin_id`)
REFERENCES `admin` (`id`)
ON UPDATE RESTRICT
ON DELETE SET NULL
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;