Example #1
0
 public function DeleteFromRecordNumber($mt_select, $vocab_number)
 {
     $db = $this->DB();
     if (!$db) {
         return false;
     }
     $save = $db->SetFetchMode(ADODB_FETCH_NUM);
     $sqlarray = array();
     if (!is_array($vocab_number)) {
         $vocab_number = array($vocab_number);
     }
     $sqlarray[] = "DELETE from mt_vocab WHERE vocab_number in ('" . implode("','", $vocab_number) . "')";
     $sqlarray[] = "DELETE from mt_vocab_l10n WHERE msgid in ('" . implode("','", $vocab_number) . "')";
     $mtIndex = new MtIndex();
     $mt_table = 'mt_' . $mt_select . '_' . $mtIndex->getTermforCode($mt_select);
     $sqlarray[] = "DELETE from {$mt_table} WHERE vocab_number in ('" . implode("','", $vocab_number) . "')";
     foreach ($sqlarray as $sql) {
         $db->Execute($sql);
     }
 }
//overide conf values from db
require_once APPROOT . 'inc/handler_config.inc';
include_once APPROOT . 'inc/lib_entity_forms.inc';
//include_once APPROOT.'3rd/phpgacl/gacl.class.php';
include_once APPROOT . 'inc/lib_form_util.inc';
include_once APPROOT . 'inc/lib_files.inc';
include_once APPROOT . 'inc/security/lib_acl.inc';
include_once APPROOT . 'inc/security/handler_acl.inc';
include_once APPROOT . 'inc/lib_form.inc';
include_once APPROOT . 'inc/lib_form_util.inc';
require_once APPROOT . 'data/Browse.php';
require_once APPROOT . 'data/MtField.php';
require_once APPROOT . 'data/MtFieldWrapper.php';
require_once APPROOT . 'data/MtIndex.php';
require_once APPROOT . 'data/MtTerms.php';
$mtIndex = new MtIndex();
$index_terms = $mtIndex->Find('');
$options = array();
$options[''] = '';
foreach ($index_terms as $index_term) {
    $data_array = MtFieldWrapper::getMTList($index_term->no);
    $count = count($data_array);
    $level = 0;
    $levelsarray = array();
    $term_order = 1;
    for ($i = 0; $i < $count;) {
        $element1 = $data_array[$i];
        $element2 = $data_array[++$i];
        $h1 = strlen(rtrim($element1['huri_code'], '0'));
        $h2 = strlen(rtrim($element2['huri_code'], '0'));
        if ($h1 % 2 == 1) {
 public function act_mt_translate()
 {
     global $conf, $global;
     include_once APPROOT . 'inc/lib_form.inc';
     include_once APPROOT . 'inc/lib_form_util.inc';
     //if the locale is changed need to display extra column in label customization
     $this->locale = $conf['locale'];
     include_once APPROOT . 'inc/i18n/lib_l10n.inc';
     $locales = l10n_get_locals();
     $this->locales = $locales;
     $mtIndex = new MtIndex();
     $index_terms = $mtIndex->Find('');
     $mts = array();
     foreach ($index_terms as $index_term) {
         $mts[$index_term->no] = $index_term->term;
     }
     $this->mts = $mts;
     if ($_POST['save']) {
         foreach ($index_terms as $index_term) {
             $no = $index_term->no;
             $term = $index_term->term;
             if (isset($_POST['label_' . $no]) && is_array($_POST['label_' . $no])) {
                 $labels = $_POST['label_' . $no];
                 foreach ($locales as $code => $loc) {
                     if (!trim($labels[$code])) {
                         continue;
                     }
                     $l10nValues = array();
                     $l10nValues['value'] = $global['db']->qstr($labels[$code]);
                     $l10nValues['name'] = "'mt-" . $no . "-label'";
                     $l10nValues['context'] = "'mt'";
                     $l10nValues['language'] = "'{$code}'";
                     $l10nValues['status'] = "1";
                     $global['db']->Replace('string_translations', $l10nValues, array('context', 'name', 'language'));
                 }
             }
         }
     }
     $this->translations = StringTranslations::getMtTranslations();
 }