本文整理汇总了PHP中Tab::getNewLastPosition方法的典型用法代码示例。如果您正苦于以下问题:PHP Tab::getNewLastPosition方法的具体用法?PHP Tab::getNewLastPosition怎么用?PHP Tab::getNewLastPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tab
的用法示例。
在下文中一共展示了Tab::getNewLastPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addAdminTab
/**
* Add admin tabs in the menu
* @param Array $tabs
* Array[
* Array[
* id_parent => 0 || void
* className => Controller to link to
* module => modulename to easily delete when uninstalling
* name => name to display
* position => position
* ]
* ]
*/
public static function addAdminTab($data)
{
// Get ID Parent
$id_parent = isset($data['id_parent']) ? (int) $data['id_parent'] : (int) Tab::getIdFromClassName($data['classNameParent']);
// Tab
$tab = Tab::getInstanceFromClassName($data['className']);
$tab->id_parent = (int) $id_parent;
$tab->class_name = $data['className'];
$tab->module = $data['module'];
$tab->position = Tab::getNewLastPosition((int) $id_parent);
$tab->active = 1;
$languages = Language::getLanguages(false);
foreach ($languages as $lang) {
$tab->name[(int) $lang['id_lang']] = $data['name'];
}
if (!$tab->save()) {
return false;
}
return $tab->id;
}
示例2: update
/**
* Overrides update to set position to last when changing parent tab
*
* @see ObjectModel::update
* @param bool $null_values
* @return bool
*/
public function update($null_values = false)
{
$current_tab = new Tab($this->id);
if ($current_tab->id_parent != $this->id_parent) {
$this->position = Tab::getNewLastPosition($this->id_parent);
}
self::$_cache_tabs = array();
return parent::update($null_values);
}
示例3: install
public function install()
{
CertissimLogger::insertLog(__METHOD__ . " : " . __LINE__, "Génération du fichier log");
/** database tables creation * */
$sqlfile = dirname(__FILE__) . '/install.sql';
if (!file_exists($sqlfile) || !($sql = file_get_contents($sqlfile))) {
return false;
}
$sql = str_replace('PREFIX_', _DB_PREFIX_, $sql);
$queries = preg_split("/;\\s*[\r\n]+/", $sql);
foreach ($queries as $query) {
if (!Db::getInstance()->Execute(trim($query))) {
CertissimLogger::insertLog(__METHOD__ . " : " . __LINE__, "Install impossible, génération base échouée : " . Db::getInstance()->getMsgError());
return false;
}
}
//Certissim order stats insertion
foreach ($this->_certissim_states as $id => $label) {
$sql = "INSERT INTO `" . _DB_PREFIX_ . self::CERTISSIM_STATE_TABLE_NAME . "` (`id_certissim_state`,`label`) VALUES ('" . (int) $id . "','" . (string) $label . "')";
$insert = Db::getInstance()->execute($sql);
if (!$insert) {
CertissimLogger::insertLog(__METHOD__ . " : " . __LINE__, "Insertion state {$id}.{$label} échouée : " . Db::getInstance()->getMsgError());
}
}
$tab_admin_order_id = Tab::getIdFromClassName('AdminOrders');
//AdminCertissimController registration
$tab_controller_main = new Tab();
$tab_controller_main->active = 1;
$tab_controller_main->class_name = "AdminCertissim";
foreach (Language::getLanguages() as $language) {
$tab_controller_main->name[$language['id_lang']] = "Certissim";
}
$tab_controller_main->id_parent = $tab_admin_order_id;
$tab_controller_main->module = $this->name;
$tab_controller_main->add();
$tab_controller_main->move(Tab::getNewLastPosition(0));
return parent::install() && $this->registerHook('newOrder') && $this->registerHook('paymentConfirm') && $this->registerHook('adminOrder') && $this->registerHook('backOfficeHeader');
}