bugfixes on saimod text
This commit is contained in:
parent
07c3629606
commit
64620a8225
11
dbd/qq/SYS_TEXT_GET_ID_TAGS.php
Normal file
11
dbd/qq/SYS_TEXT_GET_ID_TAGS.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_TEXT_GET_ID_TAGS extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'SELECT tag FROM system_text_tag WHERE id = ?'
|
||||
);}}
|
||||
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace SYSTEM\PAGE;
|
||||
class text {
|
||||
public static function id_tags($id){
|
||||
return \SYSTEM\DBD\SYS_TEXT_GET_ID_TAGS::QA(array($id));}
|
||||
//return all text values with certain tag and lang - array(id => text)
|
||||
public static function tag($tag, $lang = NULL,$fallback = true) {
|
||||
if($lang == NULL){
|
||||
@ -20,7 +22,7 @@ class text {
|
||||
while($row = $res->next()){
|
||||
$result2[$row['id']] = $row['text'];}
|
||||
if(count($result) < count($result2)){
|
||||
new \SYSTEM\LOG\WARNING('Texts with tag: '.$tag.' '.(count($result2)-count($result)).' - ids not found for lang: '.$lang.' - fallback to default lang.');}
|
||||
new \SYSTEM\LOG\WARNING('Texts with tag: '.$tag.' - '.(count($result2)-count($result)).' ids not found for lang: '.$lang.' - fallback to default lang.');}
|
||||
$result = array_merge($result2,$result);
|
||||
}
|
||||
return $result;
|
||||
|
||||
@ -45,16 +45,19 @@ class saimod_sys_text extends \SYSTEM\SAI\SaiModule {
|
||||
$vars['id'] = $id;
|
||||
$vars['lang'] = $lang;
|
||||
$vars['content'] = \SYSTEM\PAGE\text::get($id,$lang,false);
|
||||
$vars['tags'] = '';
|
||||
$tags = \SYSTEM\PAGE\text::id_tags($id);
|
||||
foreach($tags as $tag){
|
||||
$vars['tags'] .= $tag['tag'].', ';
|
||||
}
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/saimod_sys_text_edit_editor.tpl'), $vars);
|
||||
}
|
||||
|
||||
//Dont rename/save to id self::NEW_ENTRY
|
||||
/*public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_rename($id, $newid, $tags){}*/
|
||||
|
||||
/*public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_save($id, $lang, $tags){
|
||||
//Dont save to id self::NEW_ENTRY
|
||||
/*public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_save($id, $new_id, $lang, $tags){
|
||||
return \SYSTEM\DBD\SYS_SAIMOD_LOCALE_ADD::QI(array($id, $category)) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no data added"));}*/
|
||||
|
||||
/*public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_delete($id){
|
||||
/*public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_delete($id, $lang = null){
|
||||
return \SYSTEM\DBD\SYS_SAIMOD_LOCALE_DEL::QI(array($id)) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("could not delete the permitted data"));}*/
|
||||
|
||||
public static function html_li_menu(){return '<li><a id="menu_text" href="#!text">Text</a></li>';}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<b>Text ID:</b> <input type="text" value="${id}"/><button id="btn_add" class="btn-danger" style="margin-left: 15px; height: 32px; font-size: 13px;">Edit</button>
|
||||
<b>Text ID:</b> <input type="text" value="${id}"/>
|
||||
<textarea id="texteditor" name="texteditor">${content}</textarea>
|
||||
<br>
|
||||
<input type="text" placeholder="Tags..." style="width: 98%;"/>
|
||||
<input type="text" placeholder="Tags..." value="${tags}" style="width: 98%;"/>
|
||||
<br>
|
||||
<button id="btn_back" class="btn" onClick="system.load('text');" style="margin-right: 15px; height: 32px; font-size: 13px; float: left;">Back</button>
|
||||
<button id="btn_add" class="btn-danger" style="margin-right: 15px; height: 32px; font-size: 13px; float: right;">Delete</button>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user