diff --git a/main/admin/questions.php b/main/admin/questions.php index 642757121f..60d054a746 100644 --- a/main/admin/questions.php +++ b/main/admin/questions.php @@ -217,7 +217,6 @@ switch ($action) { break; } - $tpl = new Template(get_lang('Questions')); $tpl->assign('form', $formContent); $tpl->assign('pagination', $pagination); diff --git a/plugin/embedregistry/EmbedRegistryPlugin.php b/plugin/embedregistry/EmbedRegistryPlugin.php index d1abaa333e..67c0deea0c 100644 --- a/plugin/embedregistry/EmbedRegistryPlugin.php +++ b/plugin/embedregistry/EmbedRegistryPlugin.php @@ -7,7 +7,7 @@ use Chamilo\PluginBundle\Entity\EmbedRegistry\Embed; use Symfony\Component\Filesystem\Filesystem; /** - * Class EmbedRegistryPlugin + * Class EmbedRegistryPlugin. */ class EmbedRegistryPlugin extends Plugin { @@ -85,25 +85,6 @@ class EmbedRegistryPlugin extends Plugin $this->createPluginTables(); } - private function createPluginTables() - { - $connection = Database::getManager()->getConnection(); - - if ($connection->getSchemaManager()->tablesExist(self::TBL_EMBED)) { - return; - } - - $queries = [ - 'CREATE TABLE plugin_embed_registry_embed (id INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, session_id INT DEFAULT NULL, title LONGTEXT NOT NULL, display_start_date DATETIME NOT NULL, display_end_date DATETIME NOT NULL, html_code LONGTEXT NOT NULL, INDEX IDX_5236D25991D79BD3 (c_id), INDEX IDX_5236D259613FECDF (session_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB', - 'ALTER TABLE plugin_embed_registry_embed ADD CONSTRAINT FK_5236D25991D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)', - 'ALTER TABLE plugin_embed_registry_embed ADD CONSTRAINT FK_5236D259613FECDF FOREIGN KEY (session_id) REFERENCES session (id)', - ]; - - foreach ($queries as $query) { - Database::query($query); - } - } - public function uninstall() { $entityPath = $this->getEntityPath(); @@ -116,14 +97,6 @@ class EmbedRegistryPlugin extends Plugin Database::query('DROP TABLE IF EXISTS '.self::TBL_EMBED); } - /** - * @return string - */ - private function getEntityPath() - { - return api_get_path(SYS_PATH).'src/Chamilo/PluginBundle/Entity/'.$this->getCamelCaseName(); - } - /** * @return EmbedRegistryPlugin */ @@ -144,13 +117,6 @@ class EmbedRegistryPlugin extends Plugin return $this; } - private function deleteCourseToolLinks() - { - Database::getManager() - ->createQuery('DELETE FROM ChamiloCourseBundle:CTool t WHERE t.category = :category AND t.link LIKE :link') - ->execute(['category' => 'plugin', 'link' => 'embedregistry/start.php%']); - } - /** * @param int $courseId */ @@ -239,9 +205,9 @@ class EmbedRegistryPlugin extends Plugin /** * @param Embed $embed * - * @return int - * * @throws \Doctrine\ORM\Query\QueryException + * + * @return int */ public function getMembersCount(Embed $embed) { @@ -285,4 +251,38 @@ class EmbedRegistryPlugin extends Plugin ]; Database::insert($tableAccess, $params); } + + private function createPluginTables() + { + $connection = Database::getManager()->getConnection(); + + if ($connection->getSchemaManager()->tablesExist(self::TBL_EMBED)) { + return; + } + + $queries = [ + 'CREATE TABLE plugin_embed_registry_embed (id INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, session_id INT DEFAULT NULL, title LONGTEXT NOT NULL, display_start_date DATETIME NOT NULL, display_end_date DATETIME NOT NULL, html_code LONGTEXT NOT NULL, INDEX IDX_5236D25991D79BD3 (c_id), INDEX IDX_5236D259613FECDF (session_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB', + 'ALTER TABLE plugin_embed_registry_embed ADD CONSTRAINT FK_5236D25991D79BD3 FOREIGN KEY (c_id) REFERENCES course (id)', + 'ALTER TABLE plugin_embed_registry_embed ADD CONSTRAINT FK_5236D259613FECDF FOREIGN KEY (session_id) REFERENCES session (id)', + ]; + + foreach ($queries as $query) { + Database::query($query); + } + } + + /** + * @return string + */ + private function getEntityPath() + { + return api_get_path(SYS_PATH).'src/Chamilo/PluginBundle/Entity/'.$this->getCamelCaseName(); + } + + private function deleteCourseToolLinks() + { + Database::getManager() + ->createQuery('DELETE FROM ChamiloCourseBundle:CTool t WHERE t.category = :category AND t.link LIKE :link') + ->execute(['category' => 'plugin', 'link' => 'embedregistry/start.php%']); + } } diff --git a/plugin/embedregistry/Entity/Embed.php b/plugin/embedregistry/Entity/Embed.php index 2601b2dfba..86dcd7efb1 100644 --- a/plugin/embedregistry/Entity/Embed.php +++ b/plugin/embedregistry/Entity/Embed.php @@ -18,7 +18,7 @@ use Doctrine\ORM\Mapping as ORM; class Embed { /** - * @var integer + * @var int * * @ORM\Column(name="id", type="integer") * @ORM\Id