本文整理汇总了PHP中template::setLangId方法的典型用法代码示例。如果您正苦于以下问题:PHP template::setLangId方法的具体用法?PHP template::setLangId怎么用?PHP template::setLangId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类template
的用法示例。
在下文中一共展示了template::setLangId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addTemplate
public function addTemplate($v435ed7e9f07f740abf511a62c00eef6e, $vd5d3db1765287eef77d7927cc956f50a, $v662cbf1253ac7d8750ed9190c52163e5 = false, $v78e6dd7a49f5b0cb2106a3a434dd5c86 = false, $vf62baf4c4ead98d50d516eca0ac5a746 = false)
{
$this->disableCache();
cacheFrontend::getInstance()->flush();
$ve4e46deb7f9cc58c7abfb32e5570b6f3 = domainsCollection::getInstance();
$v5a05866850c28651fe234659f6c92ada = langsCollection::getInstance();
if (!$ve4e46deb7f9cc58c7abfb32e5570b6f3->isExists($v662cbf1253ac7d8750ed9190c52163e5)) {
if ($ve4e46deb7f9cc58c7abfb32e5570b6f3->getDefaultDomain()) {
$v662cbf1253ac7d8750ed9190c52163e5 = $ve4e46deb7f9cc58c7abfb32e5570b6f3->getDefaultDomain()->getId();
} else {
return false;
}
}
if (!$v5a05866850c28651fe234659f6c92ada->isExists($v78e6dd7a49f5b0cb2106a3a434dd5c86)) {
if ($v5a05866850c28651fe234659f6c92ada->getDefaultLang()) {
$v78e6dd7a49f5b0cb2106a3a434dd5c86 = $v5a05866850c28651fe234659f6c92ada->getDefaultLang()->getId();
} else {
return false;
}
}
$vac5c74b64b4b8352ef2f181affb5ac2a = "INSERT INTO cms3_templates VALUES()";
$result = l_mysql_query($vac5c74b64b4b8352ef2f181affb5ac2a);
$v74f5356453a69e438e0f58ef93103cc0 = l_mysql_insert_id();
$v66f6181bcb4cff4cd38fbc804a036db6 = new template($v74f5356453a69e438e0f58ef93103cc0);
$v66f6181bcb4cff4cd38fbc804a036db6->setFilename($v435ed7e9f07f740abf511a62c00eef6e);
$v66f6181bcb4cff4cd38fbc804a036db6->setTitle($vd5d3db1765287eef77d7927cc956f50a);
$v66f6181bcb4cff4cd38fbc804a036db6->setDomainId($v662cbf1253ac7d8750ed9190c52163e5);
$v66f6181bcb4cff4cd38fbc804a036db6->setLangId($v78e6dd7a49f5b0cb2106a3a434dd5c86);
$v66f6181bcb4cff4cd38fbc804a036db6->setIsDefault($vf62baf4c4ead98d50d516eca0ac5a746);
if ($vf62baf4c4ead98d50d516eca0ac5a746) {
$this->setDefaultTemplate($v74f5356453a69e438e0f58ef93103cc0);
}
$v66f6181bcb4cff4cd38fbc804a036db6->commit();
$v66f6181bcb4cff4cd38fbc804a036db6->update();
$this->templates[$v74f5356453a69e438e0f58ef93103cc0] = $v66f6181bcb4cff4cd38fbc804a036db6;
return $v74f5356453a69e438e0f58ef93103cc0;
}
示例2: save
public function save()
{
if (!$this->issetErrors() && (empty($this->values['d_name']) || empty($this->values['d_def_lang']) || empty($this->values['d_email']) || empty($this->values['d_sitename']))) {
$this->newError(61, 'Не все обязательные поля были заполнены!');
}
if ($this->issetErrors()) {
return false;
} else {
if (!empty($this->id)) {
// Изменение домена
$sql = $this->getSql();
if (!empty($sql)) {
db::q('UPDATE <<domains>> SET ' . $sql . ' WHERE d_id = "' . $this->id . '";');
}
system::log('Изменен домен "' . $this->values['d_name'] . '" (id:' . $this->id . ')', warning);
// Переименовываем папки с шаблонами
if ($this->old_name != $this->values['d_name']) {
$lang = languages::getAll();
while (list($key, $val) = each($lang)) {
if ($this->id != 1 || $val['l_id'] != 1) {
$old_name = '/__' . str_replace('.', '_', $this->old_name) . '_' . $val['l_prefix'];
$new_name = '/__' . str_replace('.', '_', $this->values['d_name']) . '_' . $val['l_prefix'];
@rename(TEMPL_DIR . $old_name, TEMPL_DIR . $new_name);
}
}
}
return true;
} else {
// Добавление домена
$sql = $this->getSql();
if (!empty($sql)) {
$this->id = db::q('INSERT INTO <<domains>> SET ' . $sql . ';');
}
if (!empty($this->id)) {
$lang = languages::getAll();
while (list($key, $val) = each($lang)) {
rights::createForStructure($this->id, $val['id']);
$templ = new template();
$templ->setName('default');
$templ->setFile('default');
$templ->setLangId($val['id']);
$templ->setDomainId($this->id);
$templ->save();
reg::setKey('/structure/' . $this->id . '/' . $val['id'] . '/title_prefix', '%text% | ' . $this->values['d_sitename']);
reg::setKey('/structure/' . $this->id . '/' . $val['id'] . '/view_as_tree', 1);
$dname = '/__' . str_replace('.', '_', $this->values['d_name']) . '_' . $val['l_prefix'];
$this->copyDir(TEMPL_DIR, TEMPL_DIR . $dname);
}
system::log('Создан домен "' . $this->values['d_name'] . '" (id:' . $this->id . ')', warning);
return true;
} else {
$this->newError(62, 'Произошла ошибка при добавлении домена!');
system::log('Произошла ошибка при добавлении домена!', error);
return false;
}
}
}
}
示例3: save
public function save()
{
if (!$this->issetErrors() && (empty($this->values['l_name']) || empty($this->values['l_prefix']))) {
$this->newError(52, 'Поля "Название" и "Префикс" обязательны для заполнения!');
}
if ($this->issetErrors()) {
return false;
} else {
if (!empty($this->id)) {
// Изменение языка
$sql = $this->getSql();
if (!empty($sql)) {
db::q('UPDATE <<langs>> SET ' . $sql . ' WHERE l_id = "' . $this->id . '";');
}
system::log('Изменена языковая версия сайта "' . $this->values['l_name'] . '" (id:' . $this->id . ')', warning);
// Переименовываем папки с шаблонами
if ($this->old_prefix != $this->values['l_prefix']) {
$domain = domains::getAll();
while (list($key, $val) = each($domain)) {
if ($this->id != 1 || $val['d_id'] != 1) {
$old_name = '/__' . str_replace('.', '_', $val['d_name']) . '_' . $this->old_prefix;
$new_name = '/__' . str_replace('.', '_', $val['d_name']) . '_' . $this->values['l_prefix'];
@rename(TEMPL_DIR . $old_name, TEMPL_DIR . $new_name);
}
}
}
return true;
} else {
// Добавление языка
$sql = $this->getSql();
if (!empty($sql)) {
$this->id = db::q('INSERT INTO <<langs>> SET ' . $sql . ';');
}
if (is_numeric($this->id)) {
// Добавляем для каждого домена право и шаблон
$domain = domains::getAll();
while (list($key, $val) = each($domain)) {
rights::createForStructure($val['id'], $this->id);
$templ = new template();
$templ->setName('default');
$templ->setFile('default');
$templ->setLangId($this->id);
$templ->setDomainId($val['id']);
$templ->save();
reg::setKey('/structure/' . $val['id'] . '/' . $this->id . '/title_prefix', '%text% | ' . $val['d_sitename']);
reg::setKey('/structure/' . $val['id'] . '/' . $this->id . '/view_as_tree', 1);
// Создаем папки с шаблонами
$dname = '/__' . str_replace('.', '_', $val['d_name']) . '_' . $this->values['l_prefix'];
$this->copyDir(TEMPL_DIR, TEMPL_DIR . $dname);
}
system::log('Создана новая языковая версия сайта "' . $this->values['l_name'] . '" (id:' . $this->id . ')', warning);
return true;
} else {
$this->newError(53, 'Произошла ошибка при добавление языка!');
system::log('Произошла ошибка при добавление языка!', error);
return false;
}
}
}
}
示例4: createTemplate
private function createTemplate($field_name)
{
$id = 0;
$type = $field_name == 'template_id' ? 0 : 1;
if (!empty($_POST[$field_name . '_new_val']) && !empty($_POST[$field_name . '_new_val2'])) {
$templ = new template($id);
$templ->setName($_POST[$field_name . '_new_val']);
$templ->setFile($_POST[$field_name . '_new_val2']);
$templ->setDestination($type);
$templ->setLangId(languages::curId());
$templ->setDomainId(domains::curId());
$id = $templ->save();
}
if (!empty($id)) {
$_POST[$field_name] = $id;
}
}
示例5: changeTempl
function changeTempl($id, $obj, $form_name)
{
$type = $form_name == 'page_tpl' ? 0 : 1;
$templ = new template($id);
$templ->setName($obj['t_name']);
$templ->setFile($obj['t_file']);
$templ->setDestination($type);
$templ->setLangId(languages::curId());
$templ->setDomainId(domains::curId());
$templ->save();
return true;
}