shop-old/core/text_translation.class.php
2026-04-20 01:03:43 +02:00

132 lines
3.2 KiB
PHP

<?php
/*
* @version $Id: index.php 10381 2008-06-01 03:35:53Z $
* @package Carteasy
* @copyright Copyright (C) 2005 - 2011 Wlanium
* @license proprietary
* @author Thomas Bartelt
* Carteasy is a web shop system
*/
include_once './core/main.class.php';
class Text_translation extends Main {
protected $base_object;
protected $db;
public $list_table_config = array (
'title' => 'Sprachübersetzung',
'db_table' => 'text_translation',
'list_fields' => array(
array(
'db_field' => 'var_id',
'name' => 'Bezeichner',
'sortable' => 1
),
array(
'db_field' => 'modul',
'name' => 'Modul',
'sortable' => 1
),
array(
'db_field' => 'text',
'name' => 'Text',
'sortable' => 1
)
),
'search_fields' => array('var_id', 'modul', 'text'),
'db_id_field' => 'var_id',
'db_selectable_field' => 'name',
'edit_link' => 'index.php?admin_modul=admin_object_edit&object=text_translation&object_id=',
'toolbar' => array(
'delete' => '1',
'new' => 'index.php?admin_modul=admin_object_edit&object=text_translation',
'copy' => 0,
'select_all' => 1,
'edit' => 0,
'actions' => 0,
'filter' => 0,
'search' => 1
),
'edit_title' => 'Sprachübersetzung',
'edit_fields' => array (
array(
'name' => 'Allgemein',
'type' => 'form_title'
),
array(
'db_field' => 'var_id',
'name' => 'Bezeichner',
'type' => 'text'
),
array(
'db_field' => 'modul',
'name' => 'Modul',
'type' => 'text'
),
/*array(
'db_field' => 'text',
'name' => 'Text',
'multi_lang' => 1,
'type' => 'text'
)*/
),
'edit_mandatory_fields' => array('var_id', 'modul', 'text'),
'edit_toolbar' => array(
'close' => 'index.php?admin_modul=admin_object_list&object=text_translation',
'copy' => 0,
'undo' => 0,
'redo' => 0,
'save' => 1,
'send' => 0,
'language' => 1,
'delete' => 1
),
);
function __construct($base_object) {
$this->base_object = $base_object;
$this->db = Registry::get('base')->db;
include_once './core/language.class.php';
$language_object = new Language($base_object);
$languages = $language_object->get_all_objects();
foreach ($languages as $language) {
if ($language->iso_639_1 == 'de') {
$this->list_table_config['edit_fields'][] = array(
'db_field' => 'text',
'name' => 'Text ('.$language->name.')',
'type' => 'text'
);
} else {
$this->list_table_config['edit_fields'][] = array(
'db_field' => 'text_'.$language->iso_639_1,
'name' => 'Text ('.$language->name.')',
'type' => 'text'
);
}
}
}
public function get_text ($lang) {
$data = array();
if ($lang && $lang != 'de') {
$sql = "SELECT text_".$this->db->real_escape_string($lang)." AS text, var_id, modul FROM text_translation";
} else {
$sql = "SELECT text, var_id, modul FROM text_translation";
}
$result = $this->db->query($sql);
if ($this->db->error) {
$log_object = Logger::get_instance();
$log_object->info('Error in /core/text_translation.php->get_text()', $this->db->error.', sql:'.$sql);
}
while ($obj = $result->fetch_object()) {
$data[$obj->modul][$obj->var_id] = $obj->text;
}
return $data;
}
}