本文整理汇总了PHP中Tab::getNbTabs方法的典型用法代码示例。如果您正苦于以下问题:PHP Tab::getNbTabs方法的具体用法?PHP Tab::getNbTabs怎么用?PHP Tab::getNbTabs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tab
的用法示例。
在下文中一共展示了Tab::getNbTabs方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
public function postProcess()
{
if ($id_tab = intval(Tools::getValue('id_tab')) and $direction = Tools::getValue('move') and Validate::isLoadedObject($tab = new Tab($id_tab))) {
global $currentIndex;
if ($tab->move($direction)) {
Tools::redirectAdmin($currentIndex . '&token=' . $this->token);
}
} else {
if (!Tools::getValue('position')) {
$_POST['position'] = Tab::getNbTabs(Tools::getValue('id_parent'));
}
parent::postProcess();
}
}
示例2: postProcess
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_) {
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if ($id_tab = (int) Tools::getValue('id_tab') and $direction = Tools::getValue('move') and Validate::isLoadedObject($tab = new Tab($id_tab))) {
global $currentIndex;
if ($tab->move($direction)) {
Tools::redirectAdmin($currentIndex . '&token=' . $this->token);
}
} else {
if (!Tools::getValue('position')) {
$_POST['position'] = Tab::getNbTabs(Tools::getValue('id_parent'));
}
parent::postProcess();
}
}
示例3: addAdminTab
public function addAdminTab()
{
$id_parent = Tab::getIdFromClassName('AdminParentOrders');
$adminTab = new Tab();
$languages = Language::getLanguages(true);
$adminTab->name = array();
foreach ($languages as $lang) {
$adminTab->name[$lang['id_lang']] = 'fr' == $lang['iso_code'] ? 'Carte des commandes' : 'Order map';
}
$adminTab->class_name = 'AdminMappa';
$adminTab->module = $this->name;
$adminTab->id_parent = $id_parent;
$adminTab->active = true;
$adminTab->position = Tab::getNbTabs($id_parent);
if (!$adminTab->save()) {
return false;
}
Configuration::updateValue('ADMIN_TAB_MODULE_MAPPA', $adminTab->id);
return true;
}
示例4: move
public function move($direction)
{
$nb_tabs = Tab::getNbTabs($this->id_parent);
if ($direction != 'l' && $direction != 'r') {
return false;
}
if ($nb_tabs <= 1) {
return false;
}
if ($direction == 'l' && $this->position <= 1) {
return false;
}
if ($direction == 'r' && $this->position >= $nb_tabs) {
return false;
}
$new_position = $direction == 'l' ? $this->position - 1 : $this->position + 1;
Db::getInstance()->execute('
UPDATE `' . _DB_PREFIX_ . 'tab` t
SET position = ' . (int) $this->position . '
WHERE id_parent = ' . (int) $this->id_parent . '
AND position = ' . (int) $new_position);
$this->position = $new_position;
return $this->update();
}
示例5: postProcess
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_) {
$this->errors[] = Tools::displayError('This functionality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if (($id_tab = (int) Tools::getValue('id_tab')) && ($direction = Tools::getValue('move')) && Validate::isLoadedObject($tab = new Tab($id_tab))) {
if ($tab->move($direction)) {
Tools::redirectAdmin(self::$currentIndex . '&token=' . $this->token);
}
} elseif (Tools::getValue('position') && !Tools::isSubmit('submitAdd' . $this->table)) {
if ($this->tabAccess['edit'] !== '1') {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
} elseif (!Validate::isLoadedObject($object = new Tab((int) Tools::getValue($this->identifier)))) {
$this->errors[] = Tools::displayError('An error occurred while updating the status for an object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
}
if (!$object->updatePosition((int) Tools::getValue('way'), (int) Tools::getValue('position'))) {
$this->errors[] = Tools::displayError('Failed to update the position.');
} else {
Tools::redirectAdmin(self::$currentIndex . '&conf=5&token=' . Tools::getAdminTokenLite('AdminTabs'));
}
} elseif (Tools::isSubmit('submitAdd' . $this->table) && Tools::getValue('id_tab') === Tools::getValue('id_parent')) {
$this->errors[] = Tools::displayError('You can\'t put this menu inside itself. ');
} elseif (Tools::isSubmit('submitAdd' . $this->table) && ($id_parent = (int) Tools::getValue('id_parent'))) {
$this->redirect_after = self::$currentIndex . '&id_' . $this->table . '=' . $id_parent . '&details' . $this->table . '&conf=4&token=' . $this->token;
} elseif (isset($_GET['details' . $this->table]) && is_array($this->bulk_actions)) {
$submit_bulk_actions = array_merge(array('enableSelection' => array('text' => $this->l('Enable selection'), 'icon' => 'icon-power-off text-success'), 'disableSelection' => array('text' => $this->l('Disable selection'), 'icon' => 'icon-power-off text-danger')), $this->bulk_actions);
foreach ($submit_bulk_actions as $bulk_action => $params) {
if (Tools::isSubmit('submitBulk' . $bulk_action . $this->table) || Tools::isSubmit('submitBulk' . $bulk_action)) {
if ($this->tabAccess['edit'] === '1') {
$this->action = 'bulk' . $bulk_action;
$this->boxes = Tools::getValue($this->list_id . 'Box');
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
break;
} elseif (Tools::isSubmit('submitBulk')) {
if ($this->tabAccess['edit'] === '1') {
$this->action = 'bulk' . Tools::getValue('select_submitBulk');
$this->boxes = Tools::getValue($this->list_id . 'Box');
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
break;
}
}
} else {
// Temporary add the position depend of the selection of the parent category
if (!Tools::isSubmit('id_tab')) {
// @todo Review
$_POST['position'] = Tab::getNbTabs(Tools::getValue('id_parent'));
}
}
if (!count($this->errors)) {
parent::postProcess();
}
}
示例6: postProcess
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_) {
$this->errors[] = Tools::displayError('This functionality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if (($id_tab = (int) Tools::getValue('id_tab')) && ($direction = Tools::getValue('move')) && Validate::isLoadedObject($tab = new Tab($id_tab))) {
if ($tab->move($direction)) {
Tools::redirectAdmin(self::$currentIndex . '&token=' . $this->token);
}
} elseif (Tools::getValue('position') && !Tools::isSubmit('submitAdd' . $this->table)) {
if ($this->tabAccess['edit'] !== '1') {
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
} elseif (!Validate::isLoadedObject($object = new Tab((int) Tools::getValue($this->identifier)))) {
$this->errors[] = Tools::displayError('An error occurred while updating status for object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
}
if (!$object->updatePosition((int) Tools::getValue('way'), (int) Tools::getValue('position'))) {
$this->errors[] = Tools::displayError('Failed to update the position.');
} else {
Tools::redirectAdmin(self::$currentIndex . '&conf=5&token=' . Tools::getAdminTokenLite('AdminTabs'));
}
} elseif (Tools::isSubmit('submitAddtab') && Tools::getValue('id_tab') === Tools::getValue('id_parent')) {
$this->errors[] = Tools::displayError('You can\'t put this menu in itself');
} else {
// Temporary add the position depend of the selection of the parent category
if (!Tools::isSubmit('id_tab')) {
// @todo Review
$_POST['position'] = Tab::getNbTabs(Tools::getValue('id_parent'));
}
}
if (!count($this->errors)) {
parent::postProcess();
}
}