当前位置: 首页>>代码示例>>PHP>>正文


PHP Hook::getNameById方法代码示例

本文整理汇总了PHP中Hook::getNameById方法的典型用法代码示例。如果您正苦于以下问题:PHP Hook::getNameById方法的具体用法?PHP Hook::getNameById怎么用?PHP Hook::getNameById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hook的用法示例。


在下文中一共展示了Hook::getNameById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveModule

 public static function saveModule()
 {
     $module = new VerticalMegaMenus();
     $shopId = Context::getContext()->shop->id;
     $languages = $module->getAllLanguage();
     $response = new stdClass();
     $itemId = intval($_POST['moduleId']);
     $db = DB::getInstance();
     $names = $_POST['module_titles'];
     $position = intval($_POST['position']);
     $position_name = Hook::getNameById($position);
     $layout = Tools::getValue('moduleLayout', 'default');
     $showCount = intval($_POST['showCount']);
     if ($itemId == 0) {
         $maxOrdering = $db->getValue("Select MAX(ordering) From " . _DB_PREFIX_ . "verticalmegamenus_modules Where `position` = " . $position);
         if ($maxOrdering > 0) {
             $maxOrdering++;
         } else {
             $maxOrdering = 1;
         }
         if ($db->execute("Insert Into " . _DB_PREFIX_ . "verticalmegamenus_modules (`id_shop`, `position`, `position_name`, `layout`, `ordering`, `status`, `show_count_item`) Values ('" . $shopId . "', '" . $position . "', '{$position_name}', '" . $layout . "', '" . $maxOrdering . "', '1', '" . $showCount . "')")) {
             $insertId = $db->Insert_ID();
             if ($languages) {
                 $insertDatas = array();
                 foreach ($languages as $index => $language) {
                     $insertDatas[] = array('module_id' => $insertId, 'id_lang' => $language->id, 'id_shop' => $shopId, 'name' => $db->escape($names[$index]));
                 }
                 if ($insertDatas) {
                     $db->insert('verticalmegamenus_module_lang', $insertDatas);
                 }
             }
             $response->status = '1';
             $response->msg = $module->ajaxTranslate('Add new Module Success!');
         } else {
             $response->status = '0';
             $response->msg = $module->ajaxTranslate('Add new Module not Success!');
         }
     } else {
         $item = $db->getRow("Select * From " . _DB_PREFIX_ . "verticalmegamenus_modules Where id = " . $itemId);
         $db->execute("Update " . _DB_PREFIX_ . "verticalmegamenus_modules Set `id_shop`='" . $shopId . "', `position` = '" . $position . "', `position_name`='{$position_name}', `layout`='" . $layout . "', `show_count_item` = '" . $showCount . "' Where id = " . $itemId);
         if ($languages) {
             $insertDatas = array();
             foreach ($languages as $index => $language) {
                 $check = DB::getInstance()->getValue("Select module_id From " . _DB_PREFIX_ . "verticalmegamenus_module_lang Where module_id = {$itemId} AND id_lang = " . $language->id . " AND id_shop = " . $shopId);
                 if ($check) {
                     $db->execute("Update " . _DB_PREFIX_ . "verticalmegamenus_module_lang Set `name` = '" . $db->escape($names[$index]) . "' Where `module_id` = " . $itemId . " AND `id_lang` = " . $language->id . " AND `id_shop` = " . $shopId);
                 } else {
                     $insertDatas[] = array('module_id' => $itemId, 'id_lang' => $language->id, 'id_shop' => $shopId, 'name' => $db->escape($names[$index]));
                 }
             }
             if ($insertDatas) {
                 $db->insert('verticalmegamenus_module_lang', $insertDatas);
             }
         }
         $response->status = '1';
         $response->msg = $module->ajaxTranslate('Update Module Success!');
     }
     $module->clearCache();
     die(Tools::jsonEncode($response));
 }
开发者ID:abdoumej,项目名称:libsamy,代码行数:60,代码来源:ajax.php

示例2: postProcess

 public function postProcess()
 {
     if (Tools::isSubmit('submit' . $this->className)) {
         if (!$this->manageLinkList()) {
             return false;
         }
         $hook_name = Hook::getNameById(Tools::getValue('id_hook'));
         if (!Hook::isModuleRegisteredOnHook($this->module, $hook_name, $this->context->shop->id)) {
             Hook::registerHook($this->module, $hook_name);
         }
         $this->module->_clearCache($this->module->templateFile);
         Tools::redirectAdmin($this->context->link->getAdminLink('Admin' . $this->name));
     } elseif (Tools::isSubmit('delete' . $this->className)) {
         if (!$this->deleteLinkList()) {
             return false;
         }
         $this->module->_clearCache($this->module->templateFile);
         Tools::redirectAdmin($this->context->link->getAdminLink('Admin' . $this->name));
     }
     return parent::postProcess();
 }
开发者ID:prestashop,项目名称:ps_linklist,代码行数:21,代码来源:AdminLinkWidgetController.php

示例3: hookactionModuleRegisterHookAfter

 public function hookactionModuleRegisterHookAfter($params)
 {
     $module = $params['object'];
     $current_theme = Theme::getThemeInfo($this->context->shop->id_theme);
     if (!$this->IsOvicThemes($current_theme['theme_name'])) {
         return;
     }
     if ($module->name != $this->name) {
         $hook_name = $params['hook_name'];
         if ($hook_name && Validate::isHookName($hook_name)) {
             $id_hook = Hook::getIdByName($hook_name);
             $hook_name = Hook::getNameById($id_hook);
             // get full hookname
             //order possition hook
             $id_hook_header = Hook::getIdByName('Header');
             if ($id_hook && $id_hook === $id_hook_header) {
                 $this->changeHeaderPosition();
             }
             if (in_array($hook_name, self::$OptionHookAssign)) {
                 $this->backupModuleHook($id_hook, 'hook_module', 'ovic_backup_hook_module', true);
             } elseif (in_array($hook_name, self::getHookexecuteList())) {
                 $this->backupModuleHook($id_hook, 'hook_module', 'ovic_backup_hook_module', false);
             } else {
                 return;
             }
             $id_shop = (int) $this->context->shop->id;
             $current_id_option = Configuration::get('OVIC_CURRENT_OPTION', null, null, $id_shop);
             $current_option = new Options($current_id_option);
             $moduleHook = array();
             $moduleHook[] = $module->name;
             $moduleHook[] = $hook_name;
             if ($current_option && Validate::isLoadedObject($current_option)) {
                 //insert module to current option
                 $HookedModulesArr = self::getModulesHook($current_option->theme, $current_option->alias, $hook_name);
                 $HookedModulesArr = Tools::jsonDecode($HookedModulesArr['modules'], true);
                 if (!is_array($HookedModulesArr)) {
                     $HookedModulesArr = array();
                 }
                 $key = array_search($moduleHook, $HookedModulesArr);
                 if ($key && !array_key_exists($key, $HookedModulesArr)) {
                     $HookedModulesArr[] = $moduleHook;
                     self::registerHookModule($current_option, $hook_name, Tools::jsonEncode($HookedModulesArr), $id_shop);
                 }
             }
             $pagelist = Meta::getMetas();
             $sidebarPages = array();
             $theme = new Theme((int) $this->context->shop->id_theme);
             if ($hook_name == 'displayLeftColumn' || $hook_name == 'displayRightColumn') {
                 foreach ($pagelist as $page) {
                     if ($hook_name == 'displayLeftColumn' && $theme->hasLeftColumn($page['page'])) {
                         $HookedModulesArr = self::getSideBarModulesByPage($page['page'], 'left', false);
                         if (!is_array($HookedModulesArr)) {
                             $HookedModulesArr = array();
                         }
                         $key = array_search($moduleHook, $HookedModulesArr);
                         if ($key && !array_key_exists($key, $HookedModulesArr)) {
                             $HookedModulesArr[] = $moduleHook;
                             self::registerSidebarModule($page['page'], 'left', Tools::jsonEncode($HookedModulesArr), $id_shop);
                         }
                     }
                     if ($hook_name == 'displayRightColumn' && $theme->hasRightColumn($page['page'])) {
                         $HookedModulesArr = self::getSideBarModulesByPage($page['page'], 'right', false);
                         if (!is_array($HookedModulesArr)) {
                             $HookedModulesArr = array();
                         }
                         $key = array_search($moduleHook, $HookedModulesArr);
                         if ($key && !array_key_exists($key, $HookedModulesArr)) {
                             $HookedModulesArr[] = $moduleHook;
                             self::registerSidebarModule($page['page'], 'right', Tools::jsonEncode($HookedModulesArr), $id_shop);
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:zangles,项目名称:lennyba,代码行数:76,代码来源:oviclayoutcontrol.php

示例4: unregisterHook

    /**
     * Unregister module from hook
     *
     * @param mixed $id_hook Hook id (can be a hook name since 1.5.0)
     * @param array $shop_list List of shop
     * @return boolean result
     */
    public function unregisterHook($hook_id, $shop_list = null)
    {
        // Get hook id if a name is given as argument
        if (!is_numeric($hook_id)) {
            $hook_name = (int) $hook_id;
            // Retrocompatibility
            $hook_id = Hook::getIdByName($hook_id);
            if (!$hook_id) {
                return false;
            }
        } else {
            $hook_name = Hook::getNameById((int) $hook_id);
        }
        Hook::exec('actionModuleUnRegisterHookBefore', array('object' => $this, 'hook_name' => $hook_name));
        // Unregister module on hook by id
        $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'hook_module`
			WHERE `id_module` = ' . (int) $this->id . ' AND `id_hook` = ' . (int) $hook_id . ($shop_list ? ' AND `id_shop` IN(' . implode(', ', $shop_list) . ')' : '');
        $result = Db::getInstance()->execute($sql);
        // Clean modules position
        $this->cleanPositions($hook_id, $shop_list);
        Hook::exec('actionModuleUnRegisterHookAfter', array('object' => $this, 'hook_name' => $hook_name));
        return $result;
    }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:30,代码来源:Module.php

示例5: ajaxProcessChangeModuleHook

 /**
  * Change hook execute off module
  */
 public function ajaxProcessChangeModuleHook()
 {
     $result = array();
     $id_hook = (int) Tools::getValue('id_hook');
     $hookname = Hook::getNameById($id_hook);
     $id_option = (int) Tools::getValue('id_option');
     $option = new Options($id_option);
     $id_hookexec = (int) Tools::getValue('id_hookexec');
     $hookexec_name = Hook::getNameById($id_hookexec);
     $old_hook = (int) Tools::getValue('old_hook');
     $id_module = (int) Tools::getValue('id_module');
     if ($option && Validate::isLoadedObject($option) && $id_module && Validate::isUnsignedId($id_module) && $hookname && Validate::isHookName($hookname) && $hookexec_name && Validate::isHookName($hookexec_name)) {
         $result['status'] = true;
         $moduleObject = Module::getInstanceById($id_module);
         $HookedModulesArr = OvicLayoutControl::getModulesHook($option->theme, $option->alias, $hookname);
         $HookedModulesArr = Tools::jsonDecode($HookedModulesArr['modules'], true);
         if (!is_array($HookedModulesArr)) {
             $result['status'] = false;
         }
         if ($result['status']) {
             $moduleHook = array();
             $moduleHook[] = $moduleObject->name;
             $moduleHook[] = Hook::getNameById($old_hook);
             $key = array_search($moduleHook, $HookedModulesArr);
             $result['test'] = $key;
             if (array_key_exists($key, $HookedModulesArr)) {
                 $moduleHook[1] = $hookexec_name;
                 $HookedModulesArr[$key] = $moduleHook;
                 $result['status'] = OvicLayoutControl::registerHookModule($option, $hookname, Tools::jsonEncode($HookedModulesArr), $this->context->shop->id);
                 $result['moduleinfo'] = $moduleObject->name . '-' . $hookexec_name;
             }
         }
     }
     die(Tools::jsonEncode($result));
 }
开发者ID:zangles,项目名称:lennyba,代码行数:38,代码来源:AdminLayoutBuilderController.php

示例6: ajaxProcessremoveModuleHook

 /**
  * remove a module from a hook
  */
 public function ajaxProcessremoveModuleHook()
 {
     $result = array();
     $hookname = Tools::getValue('hookname');
     $id_option = (int) Tools::getValue('id_option');
     $id_hookexec = (int) Tools::getValue('id_hookexec');
     $hookexec_name = Hook::getNameById($id_hookexec);
     $id_module = (int) Tools::getValue('id_module');
     if ($id_module && Validate::isUnsignedId($id_module) && $hookname && Validate::isHookName($hookname) && $hookexec_name && Validate::isHookName($hookexec_name)) {
         $moduleObject = Module::getInstanceById($id_module);
         $HookedModulesArr = OvicLayoutControl::getModulesHook($id_option, $hookname);
         $HookedModulesArr = Tools::jsonDecode($HookedModulesArr['modules'], true);
         $HookedModulesArr = array_values($HookedModulesArr);
         $moduleHook = array();
         $moduleHook[] = $moduleObject->name;
         $moduleHook[] = $hookexec_name;
         if ($HookedModulesArr && is_array($HookedModulesArr) && sizeof($HookedModulesArr)) {
             $key = array_search($moduleHook, $HookedModulesArr);
             unset($HookedModulesArr[$key]);
         }
         $HookedModulesArr = array_values($HookedModulesArr);
         $result['status'] = OvicLayoutControl::registerHookModule($id_option, $hookname, Tools::jsonEncode($HookedModulesArr), $this->context->shop->id);
         $result['msg'] = $this->l('Successful deletion');
         //$this->displayError
     }
     Tools::clearCache();
     die(Tools::jsonEncode($result));
 }
开发者ID:habypk,项目名称:zocart,代码行数:31,代码来源:AdminLayoutBuilderController.php

示例7: getPositionOptions

 public function getPositionOptions($selected = 0)
 {
     $positionOptions = '';
     $items = DB::getInstance()->executeS("Select id_hook From " . _DB_PREFIX_ . "hook_module Where id_module = " . $this->id);
     if ($items) {
         foreach ($items as $item) {
             if ($selected == $item['id_hook']) {
                 $positionOptions .= '<option selected="selected" value="' . $item['id_hook'] . '">' . Hook::getNameById($item['id_hook']) . '</option>';
             } else {
                 $positionOptions .= '<option value="' . $item['id_hook'] . '">' . Hook::getNameById($item['id_hook']) . '</option>';
             }
         }
     }
     return $positionOptions;
 }
开发者ID:abdoumej,项目名称:libsamy,代码行数:15,代码来源:groupcategory-d09415.php

示例8: ajaxProcessChangeModuleHook

 /**
  * Change hook execute off module
  */
 public function ajaxProcessChangeModuleHook()
 {
     $result = array();
     $pagemeta = Tools::getValue('pagemeta');
     $hookcolumn = Tools::getValue('hookcolumn');
     $id_hookexec = (int) Tools::getValue('id_hookexec');
     $hookexec_name = Hook::getNameById($id_hookexec);
     $old_hook = (int) Tools::getValue('old_hook');
     $id_module = (int) Tools::getValue('id_module');
     if ($id_module && Validate::isUnsignedId($id_module) && $hookexec_name && Validate::isHookName($hookexec_name)) {
         $result['status'] = true;
         $moduleObject = Module::getInstanceById($id_module);
         $HookedModulesArr = OvicLayoutControl::getSideBarModulesByPage($pagemeta, $hookcolumn, false);
         if (!is_array($HookedModulesArr)) {
             $result['status'] = false;
         }
         if ($result['status']) {
             $moduleHook = array();
             $moduleHook[] = $moduleObject->name;
             $moduleHook[] = Hook::getNameById($old_hook);
             $key = array_search($moduleHook, $HookedModulesArr);
             if (array_key_exists($key, $HookedModulesArr)) {
                 $moduleHook[1] = $hookexec_name;
                 $HookedModulesArr[$key] = $moduleHook;
                 $result['status'] = OvicLayoutControl::registerSidebarModule($pagemeta, $hookcolumn, Tools::jsonEncode($HookedModulesArr), $this->context->shop->id);
                 $result['moduleinfo'] = $moduleObject->name . '-' . $hookexec_name;
             }
         }
     }
     Tools::clearCache();
     die(Tools::jsonEncode($result));
 }
开发者ID:zangles,项目名称:lennyba,代码行数:35,代码来源:AdminLayoutSettingController.php

示例9: saveGroup

 static function saveGroup()
 {
     $db = DB::getInstance();
     $module = new OvicCustomTags();
     $module->clearCache();
     $shopId = Context::getContext()->shop->id;
     $languages = $module->getAllLanguages();
     $itemId = Tools::getValue('groupId');
     $names = Tools::getValue('names', array());
     $position = intval($_POST['position']);
     $position_name = Hook::getNameById($position);
     $arrParams = array('background' => Tools::getValue('background', '#82A3CC'), 'color' => Tools::getValue('color', '#ffffff'));
     $params = json_encode($arrParams);
     $response = new stdClass();
     if ($itemId == 0) {
         $maxOrdering = $db->getValue("Select MAX(ordering) From " . _DB_PREFIX_ . "ovic_custom_tags_groups Where `position` = " . $position);
         if ($maxOrdering > 0) {
             $maxOrdering++;
         } else {
             $maxOrdering = 1;
         }
         if ($db->execute("Insert Into " . _DB_PREFIX_ . "ovic_custom_tags_groups (`id_shop`, `position`, `position_name`, `status`, `params`, `ordering`) Values ('" . $shopId . "', '{$position}', '{$position_name}', '1', '{$params}', '{$maxOrdering}')")) {
             $insertId = $db->Insert_ID();
             if ($languages) {
                 $arrInsert = array();
                 foreach ($languages as $index => $language) {
                     $arrInsert[] = array('groupId' => $insertId, 'id_lang' => $language->id, 'id_shop' => $shopId, 'name' => $db->escape($names[$index]));
                 }
                 if ($arrInsert) {
                     $db->insert('ovic_custom_tags_group_lang', $arrInsert);
                 }
             }
             $response->status = 1;
             $response->msg = 'Add new Group Success!';
         } else {
             $response->status = 0;
             $response->msg = 'Error: Add new Group Failed!';
         }
     } else {
         $item = $db->getRow("Select * From " . _DB_PREFIX_ . "ovic_custom_tags_groups Where id = " . $itemId);
         if ($item) {
             $db->execute("Update " . _DB_PREFIX_ . "ovic_custom_tags_groups Set `params`='{$params}', `position` = '{$position}', `position_name`='{$position_name}' Where id = " . $itemId);
             $arrInsert = array();
             foreach ($languages as $index => $language) {
                 $check = $db->getValue("Select groupId From " . _DB_PREFIX_ . "ovic_custom_tags_group_lang Where groupId = " . $itemId . " AND id_lang = " . $language->id . " AND id_shop = " . $shopId);
                 if ($check) {
                     $db->execute("Update " . _DB_PREFIX_ . "ovic_custom_tags_group_lang Set `name`='" . $db->escape($names[$index]) . "' Where `groupId` = '" . $itemId . "' AND `id_lang` = '" . $language->id . "' AND `id_shop` = '" . $shopId . "'");
                 } else {
                     $arrInsert[] = array('groupId' => $itemId, 'id_lang' => $language->id, 'id_shop' => $shopId, 'name' => $db->escape($names[$index]));
                 }
             }
             if ($arrInsert) {
                 $db->insert('ovic_custom_tags_group_lang', $arrInsert);
             }
             $response->status = 1;
             $response->msg = 'Update Group success!';
         } else {
             $response->status = 1;
             $response->msg = 'Error: Not isset Group.';
         }
     }
     die(Tools::jsonEncode($response));
 }
开发者ID:abdoumej,项目名称:libsamy,代码行数:63,代码来源:backend.ajax.php

示例10: hookactionModuleRegisterHookAfter

 public function hookactionModuleRegisterHookAfter($params)
 {
     $module = $params['object'];
     if ($module->name != $this->name) {
         $hook_name = $params['hook_name'];
         if ($hook_name && Validate::isHookName($hook_name)) {
             $id_hook = Hook::getIdByName($hook_name);
             $hook_name = Hook::getNameById($id_hook);
             if (in_array($hook_name, self::$OptionHookAssign)) {
                 $this->backupModuleHook($id_hook, 'hook_module', 'ovic_backup_hook_module', true);
             } elseif (in_array($hook_name, self::getHookexecuteList())) {
                 $this->backupModuleHook($id_hook, 'hook_module', 'ovic_backup_hook_module', false);
             }
             $id_shop = $this->context->shop->id;
             $current_id_option = Configuration::get('OVIC_CURRENT_OPTION');
             $moduleHook = array();
             $moduleHook[] = $module->name;
             $moduleHook[] = $hook_name;
             if ($current_id_option && Validate::isUnsignedId($current_id_option)) {
                 //insert module to current option
                 $HookedModulesArr = self::getModulesHook($current_id_option, $hook_name);
                 $HookedModulesArr = Tools::jsonDecode($HookedModulesArr['modules'], true);
                 if (!is_array($HookedModulesArr)) {
                     $HookedModulesArr = array();
                 }
                 $key = array_search($moduleHook, $HookedModulesArr);
                 if (!array_key_exists($key, $HookedModulesArr)) {
                     $HookedModulesArr[] = $moduleHook;
                     self::registerHookModule($current_id_option, $hook_name, Tools::jsonEncode($HookedModulesArr), $this->context->shop->id);
                 }
             }
             $pagelist = Meta::getMetas();
             $sidebarPages = array();
             $theme = new Theme((int) $this->context->shop->id_theme);
             if ($hook_name == 'displayLeftColumn' || $hook_name == 'displayRightColumn') {
                 foreach ($pagelist as $page) {
                     if ($hook_name == 'displayLeftColumn' && $theme->hasLeftColumn($page['page'])) {
                         $HookedModulesArr = self::getSideBarModulesByPage($page['page'], 'left', false);
                         $HookedModulesArr[] = $moduleHook;
                         self::registerSidebarModule($page['page'], 'left', Tools::jsonEncode($HookedModulesArr), $this->context->shop->id);
                     }
                     if ($hook_name == 'displayRightColumn' && $theme->hasRightColumn($page['page'])) {
                         $HookedModulesArr = self::getSideBarModulesByPage($page['page'], 'right', false);
                         $HookedModulesArr[] = $moduleHook;
                         self::registerSidebarModule($page['page'], 'right', Tools::jsonEncode($HookedModulesArr), $this->context->shop->id);
                     }
                 }
             }
         }
     }
 }
开发者ID:habypk,项目名称:zocart,代码行数:51,代码来源:oviclayoutcontrol_bak_10.3.15.php

示例11: getAllModule

 public function getAllModule()
 {
     $langId = Context::getContext()->language->id;
     $shopId = Context::getContext()->shop->id;
     $items = DB::getInstance()->executeS("Select * From " . _DB_PREFIX_ . "flexiblebrand_modules Where id_shop = '" . $shopId . "' Order By position, ordering");
     $html = '';
     if ($items) {
         foreach ($items as $item) {
             $itemLang = $this->getModuleByLang($item['id'], $langId, $shopId);
             if ($item['status'] == "1") {
                 $status = '<a title="Enabled" class="list-action-enable action-enabled lik-module-status" item-id="' . $item['id'] . '" value="' . $item['status'] . '"><i class="icon-check"></i></a>';
             } else {
                 $status = '<a title="Disabled" class="list-action-enable action-disabled lik-module-status" item-id="' . $item['id'] . '" value="' . $item['status'] . '"><i class="icon-check"></i></a>';
             }
             $params = json_decode($item['params']);
             $html .= '<tr id="mod_' . $item['id'] . '">
 				    <td><a class="module-item" href="javascript:void(0)" item-id="' . $item['id'] . '">' . $itemLang['module_title'] . '</a></td>                        
                     <td class="center">' . $this->moduleLayout[$params->moduleLayout] . '</td>
                     <td class="center">' . Hook::getNameById($item['position']) . '</td>								
 				    <td class="pointer dragHandle center" ><div class="dragGroup"><div class="positions">' . $item['ordering'] . '</div></div></td>		
 				    <td class="center">' . $status . '</td>                        
                     <td class="center">
                         <a href="javascript:void(0)" item-id="' . $item['id'] . '" class="lik-module-edit"><i class="icon-edit"></i></a>&nbsp;
                         <a href="javascript:void(0)" item-id="' . $item['id'] . '" class="lik-module-delete"><i class="icon-trash" ></i></a>
                     </td>
                 </tr>';
         }
     }
     return $html;
 }
开发者ID:habypk,项目名称:zocart,代码行数:30,代码来源:flexiblebrands.php

示例12: saveBanner

 static function saveBanner()
 {
     $module = new OvicCustomBanner();
     $module->clearCache();
     $shopId = Context::getContext()->shop->id;
     $itemId = Tools::getValue('bannerId');
     $position = Tools::getValue('position');
     $position_name = Hook::getNameById($position);
     $langs = $module->getArrLangs();
     $titles = $_POST['titles'];
     $images = $_POST['images'];
     $links = $_POST['links'];
     $params = array('layout' => Tools::getValue('layout', 'default'), 'width' => Tools::getValue('width', 'none-column'), 'className' => Tools::getValue('className', ''));
     $response = new stdClass();
     $db = DB::getInstance();
     if ($itemId == 0) {
         $maxOrdering = $db->getValue("Select MAX(ordering) From " . _DB_PREFIX_ . "ovic_custom_banners Where `position` = " . $position);
         if ($maxOrdering > 0) {
             $maxOrdering++;
         } else {
             $maxOrdering = 1;
         }
         if ($db->execute("Insert Into " . _DB_PREFIX_ . "ovic_custom_banners (`id_shop`, `position`, `position_name`, `status`, `params`, `ordering`) Values ('" . $shopId . "', '{$position}', '{$position_name}', 1, '" . json_encode($params) . "', '{$maxOrdering}')")) {
             $insertId = $db->Insert_ID();
             if ($langs) {
                 $arrSql = array();
                 foreach ($langs as $index => $lang) {
                     if ($images[$index] && file_exists($module->pathTemp . $images[$index])) {
                         $path_info = pathinfo($images[$index]);
                         $ext = $path_info['extension'];
                         $bannerName = $insertId . '-' . $lang->id . '-' . $shopId . '-banner.' . $ext;
                         copy($module->pathTemp . $images[$index], $module->pathBanner . $bannerName);
                         unlink($module->pathTemp . $images[$index]);
                         $arrSql[] = array('bannerId' => $insertId, 'id_lang' => $lang->id, 'id_shop' => $shopId, 'banner_image' => $bannerName, 'banner_link' => $db->escape($links[$index]), 'banner_title' => $db->escape($titles[$index]));
                         //"Insert Into "._DB_PREFIX_."ovic_custom_banner_lang (`bannerId`, `id_lang`, `id_shop`, `banner_image`, `banner_link`, `banner_title`) Values ('$insertId', '".$lang->id."', '$shopId', '".$bannerName."', '".$links[$index]."', '".$titles[$index]."')";
                     }
                 }
                 if ($arrSql) {
                     $db->insert('ovic_custom_banner_lang', $arrSql);
                 }
             }
             $response->status = 1;
             $response->msg = 'Add new Group Success!';
         } else {
             $response->status = 0;
             $response->msg = 'Error: Add new Group Failed!';
         }
     } else {
         $item = $db->getRow("Select * From " . _DB_PREFIX_ . "ovic_custom_banners Where id = " . $itemId);
         if ($item) {
             $db->execute("Update " . _DB_PREFIX_ . "ovic_custom_banners Set `params`='" . json_encode($params) . "', `position` = '{$position}', `position_name` = '{$position_name}' Where id = " . $itemId);
             $arrSql = array();
             foreach ($langs as $index => $lang) {
                 $check = DB::getInstance()->getValue("Select bannerId From " . _DB_PREFIX_ . "ovic_custom_banner_lang Where bannerId = " . $itemId . " AND id_lang = " . $lang->id . " AND id_shop = " . $shopId);
                 if ($images[$index] && file_exists($module->pathTemp . $images[$index])) {
                     $path_info = pathinfo($images[$index]);
                     $ext = $path_info['extension'];
                     $bannerName = $itemId . '-' . $lang->id . '-' . $shopId . '-banner.' . $ext;
                     copy($module->pathTemp . $images[$index], $module->pathBanner . $bannerName);
                     unlink($module->pathTemp . $images[$index]);
                     if ($check) {
                         $db->execute("Update " . _DB_PREFIX_ . "ovic_custom_banner_lang Set `banner_image` = '" . $bannerName . "', `banner_link`='" . $db->escape($links[$index]) . "', `banner_title`='" . $db->escape($titles[$index]) . "' Where `bannerId` = '" . $itemId . "' AND `id_lang` = '" . $lang->id . "' AND `id_shop` = '" . $shopId . "'");
                     } else {
                         $arrSql[] = array('bannerId' => $itemId, 'id_lang' => $lang->id, 'id_shop' => $shopId, 'banner_image' => $bannerName, 'banner_link' => $db->escape($links[$index]), 'banner_title' => $db->escape($titles[$index]));
                         //"Insert Into "._DB_PREFIX_."ovic_custom_banner_lang (`bannerId`, `id_lang`, `id_shop`, `banner_image`, `banner_link`, `banner_title`) Values ('$insertId', '".$lang->id."', '$shopId', '".$bannerName."', '".$links[$index]."', '".$titles[$index]."')";
                     }
                 } else {
                     if ($check) {
                         $db->execute("Update " . _DB_PREFIX_ . "ovic_custom_banner_lang Set `banner_link`='" . $db->escape($links[$index]) . "', `banner_title`='" . $db->escape($titles[$index]) . "' Where `bannerId` = '" . $itemId . "' AND `id_lang` = '" . $lang->id . "' AND `id_shop` = '" . $shopId . "'");
                     } else {
                         $arrSql[] = array('bannerId' => $itemId, 'id_lang' => $lang->id, 'id_shop' => $shopId, 'banner_image' => $bannerName, 'banner_link' => $db->escape($links[$index]), 'banner_title' => $db->escape($titles[$index]));
                         //"Insert Into "._DB_PREFIX_."ovic_custom_banner_lang (`bannerId`, `id_lang`, `id_shop`, `banner_link`, `banner_title`) Values ('$insertId', '".$lang->id."', '$shopId', '".$links[$index]."', '".$titles[$index]."')";
                     }
                 }
             }
             if ($arrSql) {
                 $db->insert('ovic_custom_banner_lang', $arrSql);
             }
             $response->status = 1;
             $response->msg = 'Update Group success!';
         } else {
             $response->status = 1;
             $response->msg = 'Error: Not isset Group.';
         }
     }
     die(Tools::jsonEncode($response));
 }
开发者ID:abdoumej,项目名称:libsamy,代码行数:87,代码来源:backend.ajax.php

示例13: getAllGroups

 public function getAllGroups()
 {
     $langId = Context::getContext()->language->id;
     $shopId = Context::getContext()->shop->id;
     $items = DB::getInstance()->executeS("Select * From " . _DB_PREFIX_ . "ovic_custom_tags_groups Where `id_shop`='" . $shopId . "' Order By position, ordering");
     $content = '';
     if ($items) {
         foreach ($items as $item) {
             if ($item['status'] == "1") {
                 $status = '<a title="Enabled" class="list-action-enable action-enabled lik-group-status" item-id="' . $item['id'] . '" value="' . $item['status'] . '"><i class="icon-check"></i></a>';
             } else {
                 $status = '<a title="Disabled" class="list-action-enable action-disabled lik-group-status" item-id="' . $item['id'] . '" value="' . $item['status'] . '"><i class="icon-check"></i></a>';
             }
             $params = json_decode($item['params']);
             $value = '<div class="style-values"><span class="style-value" style="background: ' . $params->background . '">&nbsp;</span><label>Background</label>: <span>' . $params->background . '</span></div>';
             $value .= '<div class="style-values"><span class="style-value" style="background: ' . $params->color . '">&nbsp;</span><label>Color</label>: <span>' . $params->color . '</span></div>';
             $itemLang = $this->getGroupByLang($item['id'], $langId, $shopId);
             $content .= '<tr id="gr_' . $item['id'] . '">
 				    <td><a class="lik-group" href="javascript:void(0)" item-id="' . $item['id'] . '">' . $itemLang['name'] . '</a></td>    				    
                     <td class="center">' . Hook::getNameById($item['position']) . '</td>
                     <td>' . $value . '</td>								
 				    <td class="pointer dragHandle center" ><div class="dragGroup"><div class="positions">' . $item['ordering'] . '</div></div></td>		
 				    <td class="center">' . $status . '</td>                        
                     <td class="center">
                         <a href="javascript:void(0)" item-id="' . $item['id'] . '" class="lik-group-edit"><i class="icon-edit"></i></a>&nbsp;
                         <a href="javascript:void(0)" item-id="' . $item['id'] . '" class="lik-group-delete"><i class="icon-trash" ></i></a>
                     </td>
                 </tr>';
         }
     }
     return $content;
 }
开发者ID:habypk,项目名称:zocart,代码行数:32,代码来源:oviccustomtags.php

示例14: getAllBanner

 public function getAllBanner()
 {
     $langId = Context::getContext()->language->id;
     $shopId = Context::getContext()->shop->id;
     $items = DB::getInstance()->executeS("Select * From " . _DB_PREFIX_ . "ovic_custom_banners Where id_shop='" . $shopId . "' Order By position, ordering");
     $content = '';
     if ($items) {
         foreach ($items as $item) {
             if ($item['status'] == "1") {
                 $status = '<a title="Enabled" class="list-action-enable action-enabled lik-banner-status" item-id="' . $item['id'] . '" value="' . $item['status'] . '"><i class="icon-check"></i></a>';
             } else {
                 $status = '<a title="Disabled" class="list-action-enable action-disabled lik-banner-status" item-id="' . $item['id'] . '" value="' . $item['status'] . '"><i class="icon-check"></i></a>';
             }
             $params = json_decode($item['params']);
             $itemLang = $this->getBannerByLang($item['id'], $langId, $shopId);
             $content .= '<tr id="bn_' . $item['id'] . '"><td><img width="80" src="' . $this->getBannerSrc($itemLang['banner_image']) . '" alt="' . $itemLang['banner_title'] . '" /></td><td class="center">' . Hook::getNameById($item['position']) . '</td><td class="pointer dragHandle center" ><div class="dragGroup"><div class="positions">' . $item['ordering'] . '</div></div></td><td class="center">' . $status . '</td><td class="center"><a href="javascript:void(0)" item-id="' . $item['id'] . '" class="lik-banner-edit"><i class="icon-edit"></i></a>&nbsp;<a href="javascript:void(0)" item-id="' . $item['id'] . '" class="lik-banner-delete"><i class="icon-trash" ></i></a></td></tr>';
         }
     }
     return $content;
 }
开发者ID:abdoumej,项目名称:libsamy,代码行数:20,代码来源:oviccustombanner.php

示例15: saveGroup

 public static function saveGroup()
 {
     $module = new GroupCategory();
     $module->clearCache();
     $shopId = Context::getContext()->shop->id;
     $languages = $module->getAllLanguage();
     $db = DB::getInstance();
     $groupId = intval($_POST['groupId']);
     $names = Tools::getValue('names', array());
     $groupIcon = Tools::getValue('groupIcon', '');
     $banners = Tools::getValue('banners', array());
     $links = Tools::getValue('links', array());
     $style_id = intval($_POST['style_id']);
     $categoryId = intval($_POST['categoryId']);
     $type_default = $_POST['type_default'];
     $types = Tools::getValue('types', array());
     if ($types) {
         $types = json_encode($_POST['types']);
     } else {
         $types = '';
     }
     $manufacturerIds = Tools::getValue('manufacturerIds', array());
     $imageWidth = intval($_POST['imageWidth']);
     $imageHeight = intval($_POST['imageHeight']);
     $layout = 'default';
     $position = intval($_POST['position']);
     $position_name = Hook::getNameById($position);
     $itemData = new stdClass();
     $itemData->itemWidth = $module->imageHomeSize['width'];
     $itemData->itemHeight = $module->imageHomeSize['height'];
     $itemData->itemMinWidth = 200;
     $itemData->countItem = intval($_POST['countItem']);
     $manufacturer = new stdClass();
     $manufacturer->ids = array();
     $manIds = array();
     if ($manufacturerIds) {
         foreach ($manufacturerIds as $i => $value) {
             if ($value != '0') {
                 $manufacturer->ids[] = $value;
             }
         }
     }
     $manufacturer->imageWidth = $imageWidth;
     $manufacturer->imageHeight = $imageHeight;
     $manufactureConfig = json_encode($manufacturer);
     $itemConfig = json_encode($itemData);
     require_once dirname(__FILE__) . '/GroupCategoryThumb.php';
     $img = new GroupCategoryThumb();
     $response = new stdClass();
     if ($groupId == 0) {
         $maxOrdering = $db->getValue("Select MAX(ordering) From " . _DB_PREFIX_ . "groupcategory_groups Where `position` = " . $position);
         if ($maxOrdering > 0) {
             $maxOrdering++;
         } else {
             $maxOrdering = 1;
         }
         $sql = "Insert Into " . _DB_PREFIX_ . "groupcategory_groups (`position`, `position_name`, `id_shop`, `categoryId`, `style_id`, `manufactureConfig`, `itemConfig`, `types`, `ordering`, `status`, `type_default`, `layout`) Values ('" . $position . "', '{$position_name}', '{$shopId}', '" . $categoryId . "', '" . $style_id . "', '" . $manufactureConfig . "', '" . $itemConfig . "', '" . $types . "', '" . $maxOrdering . "', 1, '" . $type_default . "', '" . $layout . "')";
         if (DB::getInstance()->execute($sql)) {
             $insertId = DB::getInstance()->Insert_ID();
             if ($groupIcon && file_exists($module->pathTemp . $groupIcon)) {
                 $path_info = pathinfo($groupIcon);
                 $ext = $path_info['extension'];
                 $iconName = $insertId . '-' . $shopId . '-icon.' . $ext;
                 if (copy($module->pathTemp . $groupIcon, $module->pathBanner . $iconName)) {
                     unlink($module->pathTemp . $groupIcon);
                     DB::getInstance()->execute("Update " . _DB_PREFIX_ . "groupcategory_groups Set icon='" . $iconName . "' Where id = " . $insertId);
                 }
             }
             if ($languages) {
                 $insertDatas = array();
                 $defaultBanner = array();
                 foreach ($languages as $index => $language) {
                     if ($banners[$index] && file_exists($module->pathTemp . $banners[$index])) {
                         $path_info = pathinfo($banners[$index]);
                         $ext = $path_info['extension'];
                         $bannerName = $insertId . '-' . $language->id . '-' . $shopId . '-banner.' . $ext;
                         $sourceSize = getimagesize($module->pathTemp . $banners[$index]);
                         if ($sourceSize[0] > 281) {
                             @$img->pCreate($module->pathTemp . $banners[$index], 281, null, 100, true);
                             @$img->pSave($module->pathBanner . $bannerName);
                         } else {
                             copy($module->pathTemp . $banners[$index], $module->pathBanner . $bannerName);
                         }
                         unlink($module->pathTemp . $banners[$index]);
                         $size = getimagesize($module->pathBanner . $bannerName);
                         $params = new stdClass();
                         $params->width = $size[0];
                         $params->height = $size[1];
                         $params->w_per_h = round($size[0] / $size[1], 3);
                         if (!$defaultBanner) {
                             $defaultBanner['banner'] = $bannerName;
                             $defaultBanner['params'] = $params;
                         }
                         $insertDatas[] = array('group_id' => $insertId, 'id_lang' => $language->id, 'id_shop' => $shopId, 'name' => $db->escape($names[$index]), 'banner' => $bannerName, 'banner_link' => $db->escape($links[$index]), 'banner_size' => json_encode($params));
                     } else {
                         if ($defaultBanner) {
                             $path_info = pathinfo($defaultBanner['banner']);
                             $ext = $path_info['extension'];
                             $bannerName = $insertId . '-' . $language->id . '-' . $shopId . '-banner.' . $ext;
                             $insertDatas[] = array('group_id' => $insertId, 'id_lang' => $language->id, 'id_shop' => $shopId, 'name' => $db->escape($names[$index]), 'banner' => $bannerName, 'banner_link' => $db->escape($links[$index]), 'banner_size' => json_encode($defaultBanner['params']));
//.........这里部分代码省略.........
开发者ID:habypk,项目名称:zocart,代码行数:101,代码来源:ajax.php


注:本文中的Hook::getNameById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。