예제 #1
0
파일: Cheque.php 프로젝트: badelas/thelia
 public function destroy(ConnectionInterface $con = null, $deleteModuleData = false)
 {
     // Delete our message
     if (null !== ($message = MessageQuery::create()->findOneByName('order_confirmation_cheque'))) {
         $message->delete($con);
     }
     parent::destroy($con, $deleteModuleData);
 }
예제 #2
0
 public function destroy(ConnectionInterface $con = null, $deleteModuleData = false)
 {
     parent::destroy($con, $deleteModuleData);
     if (!is_null($con) && $deleteModuleData === true) {
         $database = new Database($con);
         $database->insertSql(null, array(__DIR__ . '/Config/delete.sql'));
     }
 }
예제 #3
0
 public function destroy(ConnectionInterface $con = null, $deleteModuleData = false)
 {
     if ($deleteModuleData) {
         $fs = new Filesystem();
         $diaporamaImagesFolder = Diaporamas::getDiaporamaImagesFolder();
         $fs->exists($diaporamaImagesFolder) and $fs->remove($diaporamaImagesFolder);
     }
     return parent::destroy($con, $deleteModuleData);
 }
예제 #4
0
 /**
  * helper function allowing you to generate the HTML script tag
  *
  * @param string $fileName   the path to the js file
  * @param array  $attributes the attributes of the tag
  * @param array  $filters an array of assets processing filters (cofeescript, compress, etc.)
  *
  * @return string the script tag
  */
 public function addJS($fileName, $attributes = array(), $filters = [])
 {
     $tag = "";
     $url = $this->assetsResolver->resolveAssetURL($this->module->getCode(), $fileName, "js", $this->parser, $filters);
     if ("" !== $url) {
         $tags = array();
         $tags[] = '<script type="text/javascript" ';
         $tags[] = ' src="' . $url . '" ';
         foreach ($attributes as $name => $val) {
             if (is_string($name) && !in_array($name, ["src", "type"])) {
                 $tags[] = $name . '="' . $val . '" ';
             }
         }
         $tags[] = "></script>";
         $tag = implode($tags);
     }
     return $tag;
 }
예제 #5
0
 /**
  * Resolve the file path.
  *
  * A system of fallback enables file overriding. It will look for the template :
  *      - in the current template in directory /modules/{module code}/
  *      - in the module in the current template if it exists
  *      - in the module in the default template
  *
  * @param  $fileName    the filename
  *
  * @return mixed the path to directory containing the file if exists
  */
 protected function resolveSourcePath($fileName)
 {
     $fileDir = null;
     $found = false;
     // retrieve the template
     $smartyParser = $this->parser;
     // First look into the current template in the right scope : frontOffice, backOffice, ...
     // template should be overrided in : {template_path}/modules/{module_code}/{template_name}
     /** @var \Thelia\Core\Template\Smarty\SmartyParser $templateDefinition */
     $templateDefinition = $smartyParser->getTemplateDefinition(false);
     $templateDirectories = $smartyParser->getTemplateDirectories($templateDefinition->getType());
     if (isset($templateDirectories[$templateDefinition->getName()]["0"])) {
         $fileDir = $templateDirectories[$templateDefinition->getName()]["0"] . DS . TemplateDefinition::HOOK_OVERRIDE_SUBDIR . DS . $this->module->getCode();
         if (file_exists($fileDir . DS . $fileName)) {
             $found = true;
         }
     }
     // If the smarty template doesn't exist, we try to see if there is an
     // implementation for the template used in the module directory
     if (!$found) {
         if (isset($templateDirectories[$templateDefinition->getName()][$this->module->getCode()])) {
             $fileDir = $templateDirectories[$templateDefinition->getName()][$this->module->getCode()];
             if (file_exists($fileDir . DS . $fileName)) {
                 $found = true;
             }
         }
     }
     // Not here, we finally try to fallback on the default theme in the module
     if (!$found && $templateDefinition->getName() !== TemplateDefinition::HOOK_DEFAULT_THEME) {
         if ($templateDirectories[TemplateDefinition::HOOK_DEFAULT_THEME] && isset($templateDirectories[TemplateDefinition::HOOK_DEFAULT_THEME][$this->module->getCode()])) {
             $fileDir = $templateDirectories[TemplateDefinition::HOOK_DEFAULT_THEME][$this->module->getCode()];
             if (file_exists($fileDir . DS . $fileName)) {
                 $found = true;
             }
         }
     }
     return $fileDir;
 }
예제 #6
0
 /**
  * Set module configuration variable, creating it if required
  *
  * @param  string $variableName the variable name
  * @param  string $variableValue the variable value
  * @param  null $valueLocale the locale, or null if not required
  * @param  bool $createIfNotExists if true, the variable will be created if not already defined
  * @throws \LogicException if variable does not exists and $createIfNotExists is false
  * @return $this;
  */
 public static function setConfigValue($variableName, $variableValue, $valueLocale = null, $createIfNotExists = true)
 {
     parent::setConfigValue($variableName, $variableValue, "en_US", $createIfNotExists);
 }