コード例 #1
0
 public function renderForm()
 {
     $mod = new posstaticblocks();
     $listModules = $mod->getListModuleInstalled();
     $listHookPosition = array(array('hook_position' => 'top'), array('hook_position' => 'rightColumn'), array('hook_position' => 'leftColumn'), array('hook_position' => 'displayHeader'), array('hook_position' => 'footer'), array('hook_position' => 'home'), array('hook_position' => 'blockPosition1'), array('hook_position' => 'blockPosition2'), array('hook_position' => 'blockPosition3'), array('hook_position' => 'bannerSequence'));
     $this->fields_form = array('tinymce' => true, 'legend' => array('title' => $this->l('Slideshow'), 'image' => '../img/admin/cog.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Title:'), 'name' => 'title', 'size' => 40, 'lang' => true), array('type' => 'text', 'label' => $this->l('Identify:'), 'name' => 'identify', 'size' => 40, 'require' => false), array('type' => 'radio', 'label' => $this->l('Show/hide title'), 'desc' => $this->l('Show/hide title?'), 'name' => 'active', 'required' => true, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'select', 'label' => $this->l('Hook Position:'), 'name' => 'hook_position', 'required' => true, 'options' => array('query' => $listHookPosition, 'id' => 'hook_position', 'name' => 'hook_position'), 'desc' => $this->l('Choose the type of the Hooks')), array('type' => 'radio', 'label' => $this->l('Show/hide Hook'), 'desc' => $this->l('Show/hide Hook?'), 'name' => 'showhook', 'required' => true, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'description', 'autoload_rte' => TRUE, 'lang' => true, 'required' => TRUE, 'rows' => 5, 'cols' => 40, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Order:'), 'name' => 'posorder', 'size' => 40, 'require' => false), array('type' => 'radio', 'label' => $this->l('Insert Module?'), 'desc' => $this->l('Insert module?'), 'name' => 'insert_module', 'required' => true, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on_module', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off_module', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'select', 'label' => $this->l('Modules:'), 'name' => 'name_module', 'required' => true, 'options' => array('query' => $listModules, 'id' => 'name', 'name' => 'name'), 'desc' => $this->l('Choose the type of the Module')), array('type' => 'select', 'label' => $this->l('Hook-Modules:'), 'name' => 'hook_module', 'required' => true, 'options' => array('query' => $listHookPosition, 'id' => 'hook_position', 'name' => 'hook_position'), 'desc' => $this->l('Choose the type of the Hooks'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'btn btn-default pull-right'));
     if (Shop::isFeatureActive()) {
         $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
     }
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     return parent::renderForm();
 }
コード例 #2
0
<?php

require_once dirname(__FILE__) . '../../../config/config.inc.php';
require_once dirname(__FILE__) . '../../../init.php';
include dirname(__FILE__) . '/posstaticblocks.php';
$pos = new posstaticblocks();
$name_module = $_POST['module_id'];
$module = Module::getInstanceByName($name_module);
$id_module = $module->id;
$hooks = $pos->getHooksByModuleId($id_module);
$hookArrays = array();
foreach ($hooks as $key => $hook) {
    $hookArrays[$key] = array('id_hook' => $hook['name'], 'name' => $hook['name']);
}
$json = json_encode($hookArrays);
die(json_encode($json));
コード例 #3
0
 public function getListModuleInstalled()
 {
     $mod = new posstaticblocks();
     $modules = $mod->getModulesInstalled(0);
     $arrayModule = array();
     foreach ($modules as $key => $module) {
         if ($module['active'] == 1) {
             $arrayModule[0] = array('id_module' => 0, 'name' => 'Chose Module');
             $arrayModule[$key] = $module;
         }
     }
     if ($arrayModule) {
         return $arrayModule;
     }
     return array();
 }