PHP Classes

File: view/melis-cms/front-plugins/render-plugins-menu.phtml

Recommend this page to a friend!
  Classes of Fabrice Fesch   Melis CMS   view/melis-cms/front-plugins/render-plugins-menu.phtml   Download  
File: view/melis-cms/front-plugins/render-plugins-menu.phtml
Role: Example script
Content type: text/plain
Description: Example script
Class: Melis CMS
Content management system that provides its tools
Author: By
Last change:
Date: 1 year ago
Size: 31,535 bytes
 

Contents

Class file image Download
<?php function displayMenuPlugin($moduleName, $pluginName, $pluginConf, $siteModule) { $conf = $pluginConf['melis']; if (!empty($conf['thumbnail'])) $thumbnail = $conf['thumbnail']; else $thumbnail = '/MelisFront/plugins/images/default.jpg'; if (!empty($conf['name'])) { $name = $conf['name']; } else { $name = $pluginName; } ?> <?php if(isset($conf['subcategory']['id'])) { $pluginid = $conf['subcategory']['id']; /** * check if plugin is came from the mini template * to remove the thumbnail */ if (strpos($pluginid, 'miniTemplatePlugins') !== false) { ?> <div class="melis-cms-plugin-snippets plugins-override-padding" data-module-name="<?= $moduleName; ?>" data-plugin-name="<?= $pluginName; ?>" data-plugin-site-module="<?= $siteModule ?>" title="<?php if (!empty($conf['description'])){ echo $conf['description']; } ?>"> <span class="melis-cms-plugin-title plugins-name-override-margin"><?= $name; ?></span> </div> <?php } else { ?> <div class="melis-cms-plugin-snippets" data-module-name="<?= $moduleName; ?>" data-plugin-name="<?= $pluginName; ?>" data-plugin-site-module="<?= $siteModule ?>" title="<?php if (!empty($conf['description'])){ echo $conf['description']; } ?>"> <img src="<?= $thumbnail; ?>" alt=""> <span class="melis-cms-plugin-title"><?= $name; ?></span> </div> <?php } }else{ ?> <div class="melis-cms-plugin-snippets" data-module-name="<?= $moduleName; ?>" data-plugin-name="<?= $pluginName; ?>" data-plugin-site-module="<?= $siteModule ?>" title="<?php if (!empty($conf['description'])){ echo $conf['description']; } ?>"> <img src="<?= $thumbnail; ?>" alt=""> <span class="melis-cms-plugin-title"><?= $name; ?></span> </div> <?php } ?> <?php } ?> <?php $ctrNewPlugins = 0; $sectionHasNewPlugins = $this->sectionNewPlugins ?? []; $moduleHasNewPlugins = $this->modulesHasNewPlugins ?? []; $subsectionHasNewPlugins = $this->subsectionHasNewPlugins ?? []; ?> <div class="melis-cms-dnd-box"> <div class="melis-cms-dnd-fix-menu"> <div class="melis-cms-dnd-title"><?= $this->boTranslate('tr_meliscms_Plugins') ?></div> <div class="melis-cms-plugin-filter-box"> <?php foreach ($this->newPluginList as $section => $plugin) : ?> <?php /** * count first the children of the current section * before displaying the parent tab */ $sectionChildrenCtr = count($plugin); ?> <?php if ($sectionChildrenCtr > 0) : ?> <div class="melis-cms-ps-box"> <span class="melis-cms-filter-btn" style="position:relative;"> <div class="melis-section-icons"> <!-- get melis module section icons --> <?= $this->getMelisSectionIcons($section) ?> </div> <?php $sectionName = $section; if ($section == 'CustomProjects') { $sectionName = "Custom / Projects"; } ?> <?= $sectionName ?> <?php if (in_array($section,$sectionHasNewPlugins)) : ?> <div class="melis-plugins-icon-new-parent"> <span class="melis-plugins-icon-new new-plugin-indicator">NEW!</span> </div> <?php endif ?> <i class="fa fa-angle-down angle-down-menu"></i> </span> <div class="melis-cms-plugin-snippets-box"> <?php foreach ($plugin as $moduleName => $templatingPlugins) : ?> <?php $firstLevelMaxWidth = ""; $moduleText = $this->boTranslate('tr_PluginSection_' . $moduleName); // regular rendering of menu ?> <?php if ($sectionChildrenCtr > 1) : ?> <div class="melis-cms-category-box"> <span class="melis-cms-category-btn"> <?php if (in_array($moduleName,$moduleHasNewPlugins)) : ?> <div class="melis-plugins-icon-new-child"> <span class="melis-plugins-icon-new new-plugin-indicator">NEW!</span> </div> <?php $firstLevelMaxWidth = "module-name" ?> <?php endif ?> <span class="<?= $firstLevelMaxWidth ?>"><?= $moduleText ?></span> <i class="fa fa-angle-down angle-down-menu"></i> </span> <div class="melis-cms-category-plugins-box"> <?php if (! empty($templatingPlugins)) { $hasSubsection = false; foreach ($templatingPlugins as $pluginName => $pluginConfig) { ?> <?php /* * modules that has subsection */ if ($pluginName == 'hasSubsection') { $hasSubsection = true; } if ($hasSubsection) { if ($pluginName != 'hasSubsection') { $subsectionTitle = $this->boTranslate($pluginConfig['title'] ?? null);?> <span class="melis-cms-filter-btn-sub-category"><?= $subsectionTitle; ?> <?php if(in_array($pluginConfig['title'],$subsectionHasNewPlugins)) {?> <div class="melis-plugins-icon-new-sub-child"> <span class="melis-plugins-icon-new new-plugin-indicator">NEW!</span> </div> <?php }?> <i class="fa fa-angle-down"></i> </span> <div class="melis-cms-category-plugins-box-sub"> <?php if (! empty($pluginConfig) && is_array($pluginConfig)) { foreach ($pluginConfig as $plugin => $config) { if (!empty($config['isCategory'])) { ?> <?php $children = $config; unset($children['text']); unset($children['isCategory']); ?> <?php if (! empty($children)) : ?> <span class="melis-cms-filter-btn-mini-tpl-category"><?= htmlentities($config['text']) ?> <?php if(in_array($pluginConfig['title'],$subsectionHasNewPlugins)) {?> <div class="melis-plugins-icon-new-sub-child"> <span class="melis-plugins-icon-new new-plugin-indicator">NEW!</span> </div> <?php }?> <i class="fa fa-angle-down"></i> </span> <div class="melis-cms-category-plugins-box-sub"> <?php foreach ($config as $key => $val) : ?> <?php if (!in_array($key, ['text', 'isCategory'])) : ?> <?php $conf = $val['melis'] ?? null; $thumbnail = $conf['thumbnail'] ?? "/MelisFront/plugins/images/default.jpg"; $name = $conf['name'] ?? $pluginName; $name = str_replace('\\', null, $name); $subcategory = $conf['subcategory']; $subcategoryId = $subcategory['id'] ?? null; $isNew = $val['isNew'] ?? false; $newClass = ''; if ($isNew) { $newClass = 'has-new-plugins'; } ?> <?php if ($plugin != 'title') : ?> <div class="melis-cms-plugin-snippets <?= $newClass ?>" data-module-name="<?= $moduleName; ?>" data-plugin-name="<?= $key; ?>" data-plugin-site-module="<?= $this->siteModule ?>" title="<?php if (!empty($conf['description'])) { echo $this->boTranslate(str_replace('\\', null, $conf['description'])); } ?>"> <img src="<?= $thumbnail; ?>" width="195"> <?php if ($isNew) : ?> <div class="melis-plugins-icon-new-sub-child "> <span class="melis-plugins-icon-new new-plugin-indicator">NEW!</span> </div> <?php endif; ?> <span class="melis-cms-plugin-title"><?= $this->boTranslate($name); ?></span> </div> <?php endif ?> <?php endif ?> <?php endforeach ?> </div> <?php endif ?> <?php } else { $conf = $config['melis'] ?? null; $thumbnail = $conf['thumbnail'] ?? "/MelisFront/plugins/images/default.jpg"; $name = $conf['name'] ?? $pluginName; $name = str_replace('\\', null, $name); $subcategory = $conf['subcategory'] ?? null; $subcategoryId = $subcategory['id'] ?? null; $isNew = $config['isNew'] ?? false; $newClass = ''; if ($isNew) { $newClass = 'has-new-plugins'; } if ($plugin != 'title') { ?> <div class="melis-cms-plugin-snippets <?= $newClass ?>" data-module-name="<?= $moduleName; ?>" data-plugin-name="<?= $plugin; ?>" data-plugin-site-module="<?= $this->siteModule ?>" title="<?php if (!empty($conf['description'])) { echo $this->boTranslate(str_replace('\\', null, $conf['description'])); } ?>"> <img src="<?= $thumbnail; ?>" width="195"> <?php if($isNew) {?> <div class="melis-plugins-icon-new-sub-child "> <span class="melis-plugins-icon-new new-plugin-indicator">NEW!</span> </div> <?php }?> <span class="melis-cms-plugin-title"><?= $this->boTranslate($name); ?></span> </div> <?php } } } } ?> </div> <?php }?> <?php } else { /* * this is for module that has no subsections */ $conf = $pluginConfig['melis']; $thumbnail = $conf['thumbnail'] ?? "/MelisFront/plugins/images/default.jpg"; $name = $conf['name'] ?? $pluginName; $name = str_replace('\\', null, $name); $moduleTextDisplay = $conf['moduleName']; $titleTextClass = ''; $isNew = $pluginConfig['isNew'] ?? false; $newClass = ''; if ($isNew) { $newClass = 'has-new-plugins'; } ?> <div class="melis-cms-plugin-snippets <?= $newClass ?>" data-module-name="<?= $moduleName; ?>" data-plugin-name="<?= $pluginName; ?>" data-plugin-site-module="<?= $this->siteModule ?>" title="<?php if (!empty($conf['description'])){ echo $this->boTranslate(str_replace('\\', null, $conf['description'])); } ?>"> <?php if ($moduleName!= "MelisMiniTemplate") { ?> <img src="<?= $thumbnail; ?>" alt=""> <?php }?> <?php if($isNew) {?> <div class="melis-plugins-icon-new-sub-child "> <span class="melis-plugins-icon-new new-plugin-indicator">NEW!</span> </div> <?php }?> <span class="melis-cms-plugin-title"><?= $this->boTranslate($name); ?></span> </div> <?php } ?> <?php } } ?> </div> </div> <?php else: ?> <?php // one special rule // if there's only one subsection then dont // rewrite the module name and just list plugins if (! empty($templatingPlugins)) : ?> <?php $hasSubsection = false; ?> <?php foreach ($templatingPlugins as $pluginName => $pluginConfig) : ?> <?php if ($pluginName == 'hasSubsection') { $hasSubsection = true; } if ($hasSubsection) : ?> <?php if ($pluginName != 'hasSubsection') : ?> <?php $subsectionTitle = $this->boTranslate($pluginConfig['title'] ?? null); ?> <span class="melis-cms-filter-btn-sub-category"> <?= $subsectionTitle; ?> <?php if (in_array($pluginConfig['title'], $subsectionHasNewPlugins)) : ?> <div class="melis-plugins-icon-new-sub-child"> <span class="melis-plugins-icon-new new-plugin-indicator">NEW!</span> </div> <?php endif ?> <i class="fa fa-angle-down"></i></span> <div class="melis-cms-category-plugins-box-sub"> <?php if (! empty($pluginConfig) && is_array($pluginConfig)) : ?> <?php foreach ($pluginConfig as $plugin => $config) : ?> <?php $conf = $config['melis'] ?? null; $thumbnail = $conf['thumbnail'] ?? "/MelisFront/plugins/images/default.jpg"; $name = $conf['name'] ?? $pluginName; $name = str_replace('\\',null,$name); $subcategory = $conf['subcategory'] ?? null; $subcategoryId = $subcategory['id'] ?? null; $isNew = $config['isNew'] ?? false; $newClass = ''; if ($isNew) { $newClass = 'has-new-plugins'; } ?> <?php if ($plugin != 'title') : ?> <div class="melis-cms-plugin-snippets <?= $newClass ?>" data-module-name="<?= $moduleName; ?>" data-plugin-name="<?= $plugin; ?>" data-plugin-site-module="<?= $this->siteModule ?>" title="<?php if (!empty($conf['description'])) { echo $this->boTranslate(str_replace('\\',null,$conf['description'])); } ?>"> <?php if ($moduleName!= "MelisMiniTemplate") : ?> <img src="<?= $thumbnail; ?>" alt=""> <?php endif ?> <?php if($isNew) : ?> <div class="melis-plugins-icon-new-sub-child "> <span class="melis-plugins-icon-new new-plugin-indicator">NEW!</span> </div> <?php endif ?> <span class="melis-cms-plugin-title"><?= $this->boTranslate($name); ?></span> </div> <?php endif ?> <?php endforeach ?> <?php endif ?> </div> <?php endif ?> <?php else : // this is for plugins doesnt have subsection(s) $conf = $pluginConfig['melis']; $thumbnail = $conf['thumbnail'] ?? "/MelisFront/plugins/images/default.jpg"; $name = $conf['name'] ?? $pluginName; $name = str_replace('\\',null,$name); $moduleTextDisplay = $conf['moduleName']; $isNew = $pluginConfig['isNew'] ?? false; $newClass = ''; if ($isNew) { $newClass = 'has-new-plugins'; } ?> <div class="melis-cms-plugin-snippets <?= $newClass ?>" data-module-name="<?= $moduleName; ?>" data-plugin-name="<?= $pluginName; ?>" data-plugin-site-module="<?= $this->siteModule ?>" title="<?php if (!empty($conf['description'])){ echo $this->boTranslate(str_replace('\\',null,$conf['description'])); } ?>" > <?php if ($moduleName!= "MelisMiniTemplate") : ?> <img src="<?= $thumbnail; ?>" alt=""> <?php endif ?> <?php if($isNew) : ?> <div class="melis-plugins-icon-new-sub-child "> <span class="melis-plugins-icon-new new-plugin-indicator">NEW!</span> </div> <?php endif ?> <span class="melis-cms-plugin-title"><?= $this->boTranslate($name) ?></span> </div> <?php endif ?> <?php endforeach ?> <?php endif ?> <?php endif ?> <?php endforeach ?> </div> </div> <?php endif ?> <?php endforeach ?> </div> </div> <div id="melisPluginBtn"> <?php if (!empty($sectionHasNewPlugins) ) : ?> <?php // latesplugin installed $latestPlugin = $this->latestPlugin; $latestPluginDatetime = $latestPlugin['latest_plugin_datetime']; $dateTimeElapse = date('Y-m-d h:i:s',strtotime("+" . $this->newPluginNotification . " days",strtotime($latestPluginDatetime))); $dateToday = date('Y-m-d h:i:s'); ?> <?php if ($dateToday < $dateTimeElapse) : ?> <span class="melis-templating-new-plugin"> <span class="new-plugin-indicator">NEW!</span> </span> <?php endif ?> <?php endif ?> <i class="fa fa-plug"></i> </div> </div> <!-- ======================= tinymce temp CSS ============================= --> <link rel="stylesheet" href="/MelisCms/css/jquery-ui.css"> <link rel="stylesheet" href="/MelisCms/css/plugin-mini-menu.css"> <link rel="stylesheet" href="/MelisCms/css/dragndrop.css"> <link href="/assets/css/schemes.css" media="screen" rel="stylesheet" type="text/css"> <script type="text/javascript" src="/MelisCms/js/dragndrop/jquery-ui.js"></script> <script type="text/javascript" src="/MelisCms/js/dragndrop/jquery.ui.touch-punch.min.js"></script> <script type="text/javascript" src="/MelisCms/js/plugins/plugin.sortable.js"></script> <script type="text/javascript" src="/MelisCms/js/dragndrop/dragndrop.js"></script>