'.$lang.''; $languages[] = $lang; } $con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo()); if(\SYSTEM\system::isSystemDbInfoPG()){ $res = $con->query('SELECT * FROM system.locale_string ORDER BY "category" ASC;'); } else { $res = $con->query('SELECT * FROM system_locale_string ORDER BY category ASC;'); } $vars['content'] = ''; while($r = $res->next()){ $content = ''; foreach ($languages as $columns){ $content .= ''.$r[$columns].''; } $r['content'] = $content; $vars['content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/list_entry.tpl'), $r); } return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/list.tpl'), $vars); } public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_edit($id, $lang, $newtext){ $charset = 'utf-8'; $con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo()); $res = null; if(\SYSTEM\system::isSystemDbInfoPG()){ $res = $con->prepare('newText' ,'UPDATE system.locale_string SET "'.$lang.'"=$1 WHERE id=$2;', array($newtext, $id)); } else { $res = $con->prepare('newText' ,'UPDATE system_locale_string SET '.$lang.'=? WHERE id=?;', array($newtext, $id)); } return $res->affectedRows() == 0 ? \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no rows affected")) : \SYSTEM\LOG\JsonResult::ok(); } public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_add($id, $category){ $con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo()); $res = null; if(\SYSTEM\system::isSystemDbInfoPG()){ throw new \SYSTEM\LOG\ERROR("action_edit failed"); } else { $res = $con->prepare('addText' ,'INSERT INTO system_locale_string (id, category) VALUES (?, ?);', array($id, $category)); } return $res->affectedRows() == 0 ? \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no data added")) : \SYSTEM\LOG\JsonResult::ok(); } public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_addmode(){ $vars = array(); return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/add.tpl'), $vars); } public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_delete($id){ $con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo()); $res = null; if(\SYSTEM\system::isSystemDbInfoPG()){ throw new \SYSTEM\LOG\ERROR("action_delete failed"); } else { $res = $con->prepare('deleteText' ,'DELETE FROM system_locale_string WHERE id=?;', array($id)); } return $res->affectedRows() == 0 ? \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("could not delete the permitted data")) : \SYSTEM\LOG\JsonResult::ok(); } public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_editmode($entry){ $con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo()); $res = null; if(\SYSTEM\system::isSystemDbInfoPG()){ $res = $con->prepare( 'edit', 'SELECT * FROM system.locale_string WHERE id = $1 ORDER BY "category" ASC;', array($entry)); } else { $res = $con->prepare( 'edit', 'SELECT * FROM system_locale_string WHERE id = ? ORDER BY "category" ASC;', array($entry)); } if(!$r = $res->next()){ throw new \SYSTEM\LOG\ERROR("No such Entry found!");} $vars = array(); $vars['entry'] = $entry; $vars['langhead'] = ''; foreach (self::getLanguages() as $lang){ $vars['langhead'] .= ''.$lang.''; $languages[] = $lang; } $vars['content'] = ''; foreach ($languages as $lang){ $r['lang'] = $lang; $r['value'] = $r[$lang]; $vars['content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/edit_entry.tpl'), $r);} return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/edit.tpl'), $vars); } public static function html_li_menu(){return '
  • DB Text
  • ';} public static function right_public(){return false;} public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);} public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_flag_css(){} public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_flag_js(){ return \SYSTEM\LOG\JsonResult::toString( array( \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/saimod_sys_locale.js')));} }