function add_locale()
 {
     $this->setTemplate('edit_locale');
     if (!I18nLocale::canAdd(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectTo('i18n', 'index');
     }
     // if
     $locale = new I18nLocale();
     $locale_data = array_var($_POST, 'locale');
     if (is_array(array_var($_POST, 'locale'))) {
         $locale->setFromAttributes($locale_data);
         try {
             DB::beginWork();
             $locale->save();
             ApplicationLogs::createLog($locale, 0, ApplicationLogs::ACTION_ADD);
             if (plugin_active('tags')) {
                 //$locale->setTagsFromCSV($locale_data['tags']);
             }
             DB::commit();
             flash_success(lang('success add locale'));
             $this->redirectTo('i18n');
         } catch (Exception $e) {
             DB::rollback();
             tpl_assign('error', $e);
             flash_success(lang('error add locale'));
         }
         // try
     }
     tpl_assign('locale', $locale);
     tpl_assign('locale_data', $locale_data);
 }
示例#2
0
<?php

trace(__FILE__, 'begin');
set_page_title(lang('i18n edit locale values'));
administration_tabbed_navigation('i18n');
administration_crumbs(lang('i18n'), get_url('i18n'));
if (I18nLocale::canAdd(logged_user())) {
    add_page_action(lang('add locale'), get_url('i18n', 'add_locale'));
}
// if
add_stylesheet_to_page('i18n.css');
$counter = 0;
if (isset($values) && is_array($values) && count($values)) {
    ?>
<form action=""><?php 
    echo lang('search');
    ?>
: <input type="text" id="filter"> <span id="filter-count"></span></form><br>
<?php 
    $trx_url = trim($locale->getTranslationUrl());
    if ($trx_url) {
        ?>
<iframe src="<?php 
        echo $trx_url;
        ?>
" style="border: 1px solid black; width: 100%; height: 12em;"></iframe>
<?php 
    }
    ?>
<p><?php 
    echo lang('click to edit');