本文整理汇总了PHP中Setting::getLangs方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::getLangs方法的具体用法?PHP Setting::getLangs怎么用?PHP Setting::getLangs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Setting
的用法示例。
在下文中一共展示了Setting::getLangs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertNew
static function insertNew()
{
$id_vat = NEnvironment::getService('Vat')->getDefault();
$id_product_template_group = NEnvironment::getService('ProductTemplateGroupModel')->getIdDefaultTemplate();
$id_product = self::add(array('active' => 0, 'adddate' => new DibiDateTime(), 'added' => 0, 'id_vat' => $id_vat, 'id_product_template_group' => $id_product_template_group));
$langs = Setting::getLangs();
foreach ($langs as $l) {
$lang_val = array('id_product' => $id_product, 'id_lang' => $l['id_lang']);
ProductModel::addProductLang($lang_val);
}
return $id_product;
}
示例2: save
function save(NFORM $form)
{
$values = $form->getValues();
$langs = Setting::getLangs();
$id_product = $values['id_product'];
$table_product_cols = Tools::getCollum('product');
$table_product_lang_cols = Tools::getCollum('product_lang');
//ulozenie jazuka
foreach ($langs as $l) {
$save_val = array();
foreach ($table_product_lang_cols as $k => $c) {
if (isset($values[$c . CategoryFormControl::$_separator . $l['iso']])) {
$save_val[$c] = $values[$c . CategoryFormControl::$_separator . $l['iso']];
}
}
//pridanie linky rewrite
if ($save_val['link_rewrite'] == '') {
$save_val['link_rewrite'] = NStrings::webalize($values['name' . CategoryFormControl::$_separator . $l['iso']]);
} else {
$save_val['link_rewrite'] = NStrings::webalize($save_val['link_rewrite']);
}
ProductModel::save($save_val, $id_product, $l['id_lang']);
}
//ulozenie zakladnych hodnot
$save_val = array();
foreach ($table_product_cols as $p) {
if (isset($values[$p])) {
$save_val[$p] = $values[$p];
}
}
ProductModel::save($save_val, $id_product, $l['id_lang']);
//ulozit param
/*
* Iba ak je product bez parametrov
*/
$val_product_param = Tools::getValuesForTable('product_param', $values);
//prvy parameter
$id_product_param = dibi::fetchSingle("SELECT id_product_param FROM [product_param] WHERE id_product = %i", $id_product, "ORDER BY sequence");
ProductModel::setProductParamValue($val_product_param, $id_product_param);
ProductModel::saveProductAlternative($id_product, $values['product_alternative']);
dibi::begin();
ProductModel::deleteProductFromCategories($id_product);
ProductModel::addProductToCategory($values['id_categories'], $id_product);
dibi::commit();
ProductModel::invalidateCache();
$this->flashMessage(_('Produkt bol uložený'));
if ($form['btn_save']->isSubmittedBy()) {
$s = NEnvironment::getSession("Admin_Eshop");
$back_url = $s['back_url'];
if ($back_url != '') {
$this->redirectUrl($back_url);
} else {
$this->redirect('Eshop:default');
}
} else {
$this->redirect('this');
}
}
示例3: renderTopMenu
public static function renderTopMenu()
{
self::getInstance()->topmenu_template->setFile(APP_DIR . '/templates/admin/menu/menuHolder.phtml');
$session = NEnvironment::getSession('page');
self::getInstance()->topmenu_template->langs = Setting::getLangs();
self::getInstance()->topmenu_template->section = $session['section'];
// $t->setFile ( APP_DIR . '/templates/admin/menu/menuHolder.phtml' );
return (string) self::getInstance()->topmenu_template;
}
示例4: categoryAction
function categoryAction(NForm $form)
{
$values = $form->getValues();
$langs = Setting::getLangs();
switch ($this->mode) {
case 'edit':
$id_category = $values['id_category'];
foreach ($langs as $l) {
$lang_val = array();
foreach ($values as $k => $v) {
if (strpos($k, self::$_separator . $l['iso'])) {
list($name) = explode(self::$_separator . $l['iso'], $k);
$lang_val[$name] = $v;
//pridanie linky rewrite
if ($name == 'link_rewrite' and $v == '') {
$lang_val[$name] = NStrings::webalize($values['name' . self::$_separator . $l['iso']]);
} elseif ($name == 'link_rewrite') {
$lang_val[$name] = NStrings::webalize($lang_val[$name]);
}
// unset($values[$k]);
}
}
$lang_val += array('id_parent' => $values['id_parent'], 'active' => $values['active'], 'show_on_bottom' => $values['show_on_bottom']);
$c = new CategoryModel($l['id_lang']);
$c->save($lang_val, $id_category);
}
$c = new CategoryModel(1);
$c->repairSequence();
// print_r($values);
CategoryModel::repairCategoryRewriteLink();
CategoryModel::invalidateCache();
$this->getPresenter()->flashMessage(_('Kategória bola upravená.'));
$this->getPresenter()->redirect("this");
break;
case 'add':
$id_category = CategoryModel::add(array('id_parent' => $values['id_parent'], 'active' => $values['active']));
unset($values['id_parent'], $values['active']);
foreach ($langs as $l) {
$lang_val = array();
foreach ($values as $k => $v) {
if (strpos($k, self::$_separator . $l['iso'])) {
list($name) = explode(self::$_separator . $l['iso'], $k);
$lang_val[$name] = $v;
//pridanie linky rewrite
if ($name == 'link_rewrite' and $v == '') {
$lang_val[$name] = NStrings::webalize($values['name' . self::$_separator . $l['iso']]);
}
}
}
$lang_val += array('id_category' => $id_category, 'id_lang' => $l['id_lang']);
CategoryModel::addCategoryLang($lang_val);
}
$c = new CategoryModel(1);
$c->repairSequence();
// prepisanie file_node na novy id_category
dibi::query("UPDATE [file_node] SET id_module = %i", $id_category, "WHERE id_module = 999999 AND type_module = 'category'");
CategoryModel::repairCategoryRewriteLink();
CategoryModel::invalidateCache();
// print_r($values);
$this->getPresenter()->flashMessage(_('Kategória bola pridaná.'));
$this->getPresenter()->redirect("Eshop:default");
break;
}
}