本文整理汇总了PHP中Tab::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Tab::save方法的具体用法?PHP Tab::save怎么用?PHP Tab::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tab
的用法示例。
在下文中一共展示了Tab::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adminInstall
private function adminInstall()
{
// 1.5+ only
if (preg_match("/^1.(3|4).*/", _PS_VERSION_)) {
return;
}
// Parent tab requires 2 levels menu in Prestashop 1.5
$parent = new Tab();
$parent->class_name = preg_match("/^1.5.*/", _PS_VERSION_) ? 'AdminFacebookShopMain' : 'AdminFacebookShop';
$parent->id_parent = 0;
// Home tab
$parent->module = $this->name;
$languages = Language::getLanguages(false);
foreach ($languages as $lang) {
$parent->name[$lang['id_lang']] = $this->l('Facebook Store');
}
$parent->save();
/* Prestashop 1.6 does not require a second level tab */
if (preg_match("/^1.5.*/", _PS_VERSION_)) {
// Child Tab
$tab = new Tab();
$tab->class_name = 'AdminFacebookShop';
$tab->id_parent = $parent->id;
$tab->module = $this->name;
foreach ($languages as $lang) {
$tab->name[$lang['id_lang']] = $this->l('Manage');
}
$tab->save();
}
}
示例2: install
/**
* Installation du module
*/
public function install()
{
if (!parent::install() || !$this->registerHook('actionCustomerAccountAdd')) {
return false;
}
//Création d'une tab prestashop
$tab = new Tab();
$tab->class_name = 'Rules';
$tab->module = $this->name;
$tab->id_parent = Tab::getIdFromClassName('AdminParentCustomer');
$languages = Language::getLanguages();
foreach ($languages as $lang) {
$tab->name[$lang['id_lang']] = 'Customer Auto Groups';
}
try {
$tab->save();
} catch (Exception $e) {
echo $e->getMessage();
return false;
}
if (!$this->_installSql()) {
return false;
}
return true;
}
示例3: install
public function install()
{
/* Before creating a new tab "AdminSelfUpgrade" we need to remove any existing "AdminUpgrade" tab (present in v1.4.4.0 and v1.4.4.1) */
if ($id_tab = Tab::getIdFromClassName('AdminUpgrade')) {
$tab = new Tab((int) $id_tab);
if (!$tab->delete()) {
$this->_errors[] = sprintf($this->l('Unable to delete outdated AdminUpgrade tab %d'), (int) $id_tab);
}
}
/* If the "AdminSelfUpgrade" tab does not exist yet, create it */
if (!($id_tab = Tab::getIdFromClassName('AdminSelfUpgrade'))) {
$tab = new Tab();
$tab->class_name = 'AdminSelfUpgrade';
$tab->module = 'autoupgrade';
$tab->id_parent = (int) Tab::getIdFromClassName('AdminTools');
foreach (Language::getLanguages(false) as $lang) {
$tab->name[(int) $lang['id_lang']] = '1-Click Upgrade';
}
if (!$tab->save()) {
return $this->_abortInstall($this->l('Unable to create the "AdminSelfUpgrade" tab'));
}
if (!@copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'logo.gif', _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 't' . DIRECTORY_SEPARATOR . 'AdminSelfUpgrade.gif')) {
return $this->_abortInstall(sprintf($this->l('Unable to copy logo.gif in %s'), _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 't' . DIRECTORY_SEPARATOR));
}
} else {
$tab = new Tab((int) $id_tab);
}
/* Update the "AdminSelfUpgrade" tab id in database or exit */
if (Validate::isLoadedObject($tab)) {
Configuration::updateValue('PS_AUTOUPDATE_MODULE_IDTAB', (int) $tab->id);
} else {
return $this->_abortInstall($this->l('Unable to load the "AdminSelfUpgrade" tab'));
}
/* Check that the 1-click upgrade working directory is existing or create it */
$autoupgrade_dir = _PS_ADMIN_DIR_ . DIRECTORY_SEPARATOR . 'autoupgrade';
if (!file_exists($autoupgrade_dir) && !@mkdir($autoupgrade_dir, 0755)) {
return $this->_abortInstall(sprintf($this->l('Unable to create the directory "%s"'), $autoupgrade_dir));
}
/* Make sure that the 1-click upgrade working directory is writeable */
if (!is_writable($autoupgrade_dir)) {
return $this->_abortInstall(sprintf($this->l('Unable to write in the directory "%s"'), $autoupgrade_dir));
}
/* If a previous version of ajax-upgradetab.php exists, delete it */
if (file_exists($autoupgrade_dir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php')) {
@unlink($autoupgrade_dir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php');
}
/* Then, try to copy the newest version from the module's directory */
if (!@copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php', $autoupgrade_dir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php')) {
return $this->_abortInstall(sprintf($this->l('Unable to copy ajax-upgradetab.php in %s'), $autoupgrade_dir));
}
/* Make sure that the XML config directory exists */
if (!file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml') && !@mkdir(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml', 0755)) {
return $this->_abortInstall(sprintf($this->l('Unable to create the directory "%s"'), _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml'));
}
/* Create a dummy index.php file in the XML config directory to avoid directory listing */
if (!file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'index.php') && (file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'index.php') && !@copy(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'index.php', _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'index.php'))) {
return $this->_abortInstall(sprintf($this->l('Unable to create the directory "%s"'), _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml'));
}
return parent::install();
}
示例4: addTab
protected function addTab()
{
$tab = new Tab();
$tab->class_name = 'AdminSampleDataInstall';
$tab->id_parent = 0;
$tab->module = $this->name;
$tab->position = 100;
$languages = Language::getLanguages(false);
foreach ($languages as $lang) {
$tab->name[$lang['id_lang']] = 'Sample Data Install';
}
if (!$tab->save()) {
return false;
}
$tab_id = $tab->id;
require_once dirname(__FILE__) . '/install/install_tab.php';
foreach ($tabvalue as $tab) {
$newtab = new Tab();
$newtab->class_name = $tab['class_name'];
$newtab->id_parent = $tab_id;
$newtab->module = $tab['module'];
foreach ($languages as $l) {
$newtab->name[$l['id_lang']] = $this->l($tab['name']);
}
if (!$newtab->save()) {
return false;
}
}
return true;
}
示例5: install
public function install()
{
if (!parent::install() || !Configuration::updateValue('eicmslinks_admin_path', 0)) {
return false;
}
//Copie des dossier de l'editeur tinyMce
$this->copyDir(dirname(__FILE__) . '/tiny_mce/', dirname(__FILE__) . '/../../js/tiny_mce/plugins/');
//Copie de l'override du formulaire cms de l'admin (Normalement devrait fonctionner via prestashop)
$this->copyDir(dirname(__FILE__) . '/override/controllers/admin/templates/', dirname(__FILE__) . '/../../override/controllers/admin/templates/');
//Création d'une tab prestashop ( nécessaire pour le controller back office )
$tab = new Tab();
$tab->class_name = 'wysiwyg';
//On va la ranger dans "Préférences comme les pages cms y sont insérée
$id_parent = Tab::getIdFromClassName('AdminParentPreferences');
$tab->id_parent = $id_parent;
$tab->module = $this->name;
$languages = Language::getLanguages();
foreach ($languages as $lang) {
$tab->name[$lang['id_lang']] = 'EiCmsLinks';
}
try {
$tab->save();
} catch (Exception $e) {
echo $e->getMessage();
return false;
}
//Spécifique 1.5 ( on renomme le fichier de surcharge avec le bon nom car ils ne sont pas compatibles entre les versions )
if (_PS_VERSION_ < '1.6') {
rename(dirname(__FILE__) . '/../../override/controllers/admin/templates/cms/helpers/form/form.tpl', dirname(__FILE__) . '/../../override/controllers/admin/templates/cms/helpers/form/form16.tpl');
rename(dirname(__FILE__) . '/../../override/controllers/admin/templates/cms/helpers/form/form15.tpl', dirname(__FILE__) . '/../../override/controllers/admin/templates/cms/helpers/form/form.tpl');
}
return true;
}
示例6: install
public function install()
{
if (!parent::install() || !$this->registerHook('displayHeader') || !$this->registerHook('displayBackOfficeHeader') || !$this->installDB()) {
return false;
}
if (!$this->backupAllModulesHook('hook_module', 'ovic_backup_hook_module')) {
return false;
}
$result = true;
foreach (self::$OptionHookAssign as $hookname) {
if (!$this->registerHook($hookname)) {
$result &= false;
break;
}
}
if (!$result || !$this->registerHook('actionModuleRegisterHookAfter') || !$this->installSampleData()) {
return false;
}
//$defaultfont = htmlentities("<link href='http://fonts.googleapis.com/css?family=Cuprum' rel='stylesheet' type='text/css'>");
// if (is_string($defaultfont) === true)
// $defaultfont = urldecode(preg_replace('/((\%5C0+)|(\%00+))/i', '', urlencode($defaultfont)));
// $defaultfont = !is_string($defaultfont)? $defaultfont : stripslashes($defaultfont);
// Configuration::updateValue('OVIC_FONT_LINK', $defaultfont);
// Configuration::updateValue('OVIC_MAIN_COLOR','#fe983d');
// Configuration::updateValue('OVIC_BTN_COLOR','#333');
// Configuration::updateValue('OVIC_BTN_HOVER_COLOR','#000');
// Configuration::updateValue('OVIC_BTN_TEXT_COLOR','#fff');
// Configuration::updateValue('OVIC_BTN_TEXT_HOVER_COLOR','#fff');
$langs = Language::getLanguages();
$tab = new Tab();
$tab->class_name = "AdminThemeConfig";
foreach ($langs as $l) {
$tab->name[$l['id_lang']] = $this->l('Ovic Theme config');
}
$tab->module = '';
$tab->id_parent = 0;
//Root tab
$tab->save();
$tab_id = $tab->id;
$newtab = new Tab();
$newtab->class_name = "AdminLayoutSetting";
foreach ($langs as $l) {
$newtab->name[$l['id_lang']] = $this->l('Layout Control');
}
$newtab->module = $this->name;
$newtab->id_parent = $tab_id;
$newtab->add();
$newtab = new Tab();
$newtab->class_name = "AdminLayoutBuilder";
foreach ($langs as $l) {
$newtab->name[$l['id_lang']] = $this->l('Layout Builder');
}
$newtab->module = $this->name;
$newtab->id_parent = $tab_id;
$newtab->add();
return true;
}
示例7: actionAdd
public function actionAdd()
{
if (empty($_POST)) {
$viewData = array();
$this->render('edit', $viewData);
exit;
}
$res = array('statusCode' => 200, 'message' => '添加成功!');
try {
$m = new Tab();
$m->name = $_REQUEST['name'];
//谱子名称
$m->class = $_REQUEST['class'];
//歌曲名称
$m->scover = $_REQUEST['scover'];
//专辑id
$m->mcover = $_REQUEST['mcover'];
$m->bcover = $_REQUEST['bcover'];
$m->content = $_REQUEST['content'];
$m->poptab = $_REQUEST['poptab'];
$m->solotab = $_REQUEST['solotab'];
$m->views = $_REQUEST['views'];
//自建分类
$m->downs = $_REQUEST['downs'];
$m->replys = $_REQUEST['replys'];
$m->date = $_REQUEST['date'];
$m->editor = $_REQUEST['editor'];
$m->intro = $_REQUEST['intro'];
$m->link1 = $_REQUEST['link1'];
$m->link2 = $_REQUEST['link2'];
$m->link3 = $_REQUEST['link3'];
$m->link4 = $_REQUEST['link4'];
$m->veditor = $_REQUEST['veditor'];
$m->peditor = $_REQUEST['peditor'];
$m->team = $_REQUEST['team'];
$m->taobaolink = $_REQUEST['taobaolink'];
$m->bbslink = $_REQUEST['bbslink'];
$m->qita = $_REQUEST['qita'];
$m->market_price = $_REQUEST['market_price'];
$m->cost_price = $_REQUEST['cost_price'];
$m->sell_price = $_REQUEST['sell_price'];
$m->quantity = $_REQUEST['quantity'];
$m->virtual_price = $_REQUEST['virtual_price'];
$flag = $m->save();
if (!$flag) {
throw new exception('添加失败');
}
} catch (Exception $e) {
$res['statusCode'] = 300;
$res['message'] = '失败【' . $e->getMessage() . '】';
}
$res['navTabId'] = 'zineList';
$res['callbackType'] = 'closeCurrent';
$res['forwardUrl'] = '/manage/zine/index';
$this->ajaxDwzReturn($res);
}
示例8: install
public function install()
{
if (!parent::install() || !$this->installDB()) {
return false;
}
if (!$this->registerHook('displayHeader') || !$this->registerHook('displayBackOfficeHeader') || !$this->registerHook('displayProductListReviews')) {
return false;
}
if (!$this->backupAllModulesHook('hook_module', 'ovic_backup_hook_module')) {
return false;
}
$result = true;
foreach (self::$OptionHookAssign as $hookname) {
if (!$this->registerHook($hookname)) {
$result &= false;
break;
}
}
if (!$result || !$this->registerHook('actionModuleRegisterHookAfter')) {
return false;
}
if (!$this->installSampleData()) {
return false;
}
$langs = Language::getLanguages();
$tab = new Tab();
$tab->class_name = "AdminThemeConfig";
foreach ($langs as $l) {
$tab->name[$l['id_lang']] = $this->l('Ovic Theme config');
}
$tab->module = '';
$tab->id_parent = 0;
//Root tab
$tab->save();
$tab_id = $tab->id;
$newtab = new Tab();
$newtab->class_name = "AdminLayoutSetting";
foreach ($langs as $l) {
$newtab->name[$l['id_lang']] = $this->l('Layout Control');
}
$newtab->module = $this->name;
$newtab->id_parent = $tab_id;
$newtab->add();
$newtab = new Tab();
$newtab->class_name = "AdminLayoutBuilder";
foreach ($langs as $l) {
$newtab->name[$l['id_lang']] = $this->l('Layout Builder');
}
$newtab->module = $this->name;
$newtab->id_parent = $tab_id;
$newtab->add();
//Theme::getThemeInfo($this->context->shop->id_theme)
return true;
}
示例9: installModuleTab
/**
* Istallation fcn of admin tables (ps_tab, ps_tab_advice, ps_tab_lang, ps_access)
* @param unknown $tabClass
* @param unknown $tabName
* @param unknown $idTabParent
* @return boolean
*/
private function installModuleTab($tabClass, $tabName, $idTabParent)
{
$tab = new Tab();
$tab->name = $tabName;
$tab->class_name = $tabClass;
$tab->module = $this->name;
$tab->id_parent = $idTabParent;
if (!$tab->save()) {
return false;
}
return true;
}
示例10: installController
private function installController($controllerName, $name)
{
$tab_admin_order_id = Tab::getIdFromClassName('AdminTools');
$tab = new Tab();
$tab->class_name = $controllerName;
$tab->id_parent = $tab_admin_order_id;
$tab->module = $this->name;
$languages = Language::getLanguages(false);
foreach ($languages as $lang) {
$tab->name[$lang['id_lang']] = $name;
}
$tab->save();
}
示例11: installModuleTab
private function installModuleTab($tab_class, $tab_name, $id_tab_name)
{
copy(_PS_MODULE_DIR_ . $this->name . '/img/logo.png', _PS_IMG_DIR_ . 't/' . $tab_class . '.gif');
copy(_PS_MODULE_DIR_ . $this->name . '/img/webform.png', _PS_IMG_DIR_ . 't/Getresponse_webform.gif');
$tab = new Tab();
$tab->name = $tab_name;
$tab->class_name = $tab_class;
$tab->id_parent = $id_tab_name;
if (!$tab->save()) {
return false;
}
return true;
}
示例12: installModuleTab
private function installModuleTab($tabClass, $tabName, $idTabParent)
{
@copy(_PS_MODULE_DIR_ . $this->name . '/logo.gif', _PS_IMG_DIR_ . 't/' . $tabClass . '.gif');
$tab = new Tab();
$tab->name = $tabName;
$tab->class_name = $tabClass;
$tab->module = $this->name;
$tab->id_parent = $idTabParent;
if (!$tab->save()) {
return false;
}
return true;
}
示例13: createAdminTabs
private function createAdminTabs()
{
$langs = Language::getLanguages();
$id_lang = (int) Configuration::get('PS_LANG_DEFAULT');
/* * ** create tab publications *** */
$tab0 = new Tab();
$tab0->class_name = "AdminVideos";
$tab0->module = "myvideo";
$tab0->id_parent = 0;
foreach ($langs as $l) {
$tab0->name[$l['id_lang']] = $this->l('Videos');
}
$tab0->save();
$blog_tab_id = $tab0->id;
$tab1 = new Tab();
$tab1->class_name = "AdminVideoCategory";
$tab1->module = "myvideo";
$tab1->id_parent = $blog_tab_id;
foreach ($langs as $l) {
$tab1->name[$l['id_lang']] = $this->l('Video Categories');
}
$tab1->save();
/* * ** create tab categories *** */
$tab2 = new Tab();
$tab2->class_name = "AdminVideo";
$tab2->module = "myvideo";
$tab2->id_parent = $blog_tab_id;
foreach ($langs as $l) {
$tab2->name[$l['id_lang']] = $this->l('Video');
}
$tab2->save();
/* * * RIGHTS MANAGEMENT ** */
Db::getInstance()->Execute('DELETE FROM ' . _DB_PREFIX_ . 'access
WHERE `id_tab` = ' . (int) $tab0->id . '
OR `id_tab` = ' . (int) $tab1->id . '
OR `id_tab` = ' . (int) $tab2->id);
Db::getInstance()->Execute('DELETE FROM ' . _DB_PREFIX_ . 'module_access WHERE `id_module` = ' . (int) $this->id);
$profiles = Profile::getProfiles($id_lang);
if (count($profiles)) {
foreach ($profiles as $p) {
Db::getInstance()->Execute('INSERT IGNORE INTO `' . _DB_PREFIX_ . 'access`(`id_profile`,`id_tab`,`view`,`add`,`edit`,`delete`)
VALUES (' . $p['id_profile'] . ', ' . (int) $tab0->id . ',1,1,1,1)');
Db::getInstance()->Execute('INSERT IGNORE INTO `' . _DB_PREFIX_ . 'access`(`id_profile`,`id_tab`,`view`,`add`,`edit`,`delete`)
VALUES (' . $p['id_profile'] . ', ' . (int) $tab1->id . ',1,1,1,1)');
Db::getInstance()->Execute('INSERT IGNORE INTO `' . _DB_PREFIX_ . 'access`(`id_profile`,`id_tab`,`view`,`add`,`edit`,`delete`)
VALUES (' . $p['id_profile'] . ', ' . (int) $tab2->id . ',1,1,1,1)');
Db::getInstance()->execute('INSERT INTO ' . _DB_PREFIX_ . 'module_access(`id_profile`, `id_module`, `configure`, `view`)
VALUES (' . $p['id_profile'] . ',' . (int) $this->id . ',1,1)');
}
}
}
示例14: installModuleTab
private function installModuleTab($class, $name)
{
$sql = '
SELECT `id_tab` FROM `' . _DB_PREFIX_ . 'tab` WHERE `class_name` = "AdminCatalog"';
$tabParent = (int) Db::getInstance()->getValue($sql);
if (!is_array($name)) {
$name = self::getMultilangField($name);
}
$tab = new Tab();
$tab->name = $name;
$tab->class_name = $class;
$tab->module = $this->name;
$tab->id_parent = $tabParent;
return $tab->save();
}
示例15: upgrade_module_2_1_4
function upgrade_module_2_1_4($object)
{
$id_tab = (int) Tab::getIdFromClassName('AdminSmartBlogAjax');
if ($id_tab) {
$tab = new Tab($id_tab);
$tab->active = 1;
$tab->class_name = 'AdminSmartBlogAjax';
$tab->name = array();
foreach (Language::getLanguages(true) as $lang) {
$tab->name[$lang['id_lang']] = 'SmartBlogAjax';
}
$tab->id_parent = -1;
$tab->module = $object->name;
$tab->save();
}
return true;
}