saimod text pagination, search, filter
This commit is contained in:
parent
d4820a26b2
commit
51522c1646
@ -43,8 +43,8 @@ INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`,
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (105, 42, 'delright', 'security', 100, 0, 1, '#tab_security', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_security&action=deleterightconfirm&id=${id}', 'init_saimod_sys_security_delright', '\\SYSTEM\\SAI\\saimod_sys_security');
|
||||
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (110, 42, 'text', 'text', -1, 0, 0, '#content', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_text', 'init_saimod_sys_text', '\\SYSTEM\\SAI\\saimod_sys_text');
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (111, 42, 'tag', 'text', 110, 0, 0, '#tab_content', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_text&action=tag&tag=${tag}', 'init_saimod_sys_text_tag', '\\SYSTEM\\SAI\\saimod_sys_text');
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (112, 42, 'notag', 'text', 110, 0, 1, '#tab_content', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_text&action=notag', 'init_saimod_sys_text_notag', '\\SYSTEM\\SAI\\saimod_sys_text');
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (111, 42, 'tag', 'text', 110, 0, 0, '#tab_content', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_text&action=tag&tag=${tag}&filter=${filter}&search=${search}&page=${page}', 'init_saimod_sys_text_tag', '\\SYSTEM\\SAI\\saimod_sys_text');
|
||||
-- INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (112, 42, 'notag', 'text', 110, 0, 1, '#tab_content', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_text&action=notag', 'init_saimod_sys_text_notag', '\\SYSTEM\\SAI\\saimod_sys_text');
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (115, 42, 'edittext', 'text', 110, 0, 1, '#tab_content', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_text&action=edittext&id=${id}&lang=${lang}', '', '');
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (116, 42, 'editor', 'text', 115, 0, 1, '#tab_editor', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_text&action=editor&id=${id}&lang=${lang}', 'init_saimod_sys_text_editor', '\\SYSTEM\\SAI\\saimod_sys_text');
|
||||
|
||||
|
||||
@ -102,7 +102,10 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (700, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_text', 'action', NULL);
|
||||
--
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (703, 42, 3, 700, 'tag', 'tag', 'STRING');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (705, 42, 2, 700, 'loadByTag', 'lang', 'LANG');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (704, 42, 3, 700, 'tag', 'filter', 'STRING');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (705, 42, 3, 700, 'tag', 'search', 'STRING');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (706, 42, 3, 700, 'tag', 'page', 'UINT0');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (710, 42, 2, 700, 'loadByTag', 'lang', 'LANG');
|
||||
--
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (712, 42, 2, 700, 'edittext', 'id', 'STRING');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (713, 42, 2, 700, 'edittext', 'lang', 'LANG');
|
||||
|
||||
@ -270,6 +270,7 @@
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_placeholder_search', 'sai_todo');
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_placeholder_search', 'sai_security');
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_placeholder_search', 'sai_log');
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_placeholder_search', 'sai_text');
|
||||
|
||||
DELETE FROM `system_text` WHERE id = 'basic_progress';
|
||||
DELETE FROM `system_text_tag` WHERE id = 'basic_progress';
|
||||
@ -306,6 +307,7 @@
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_rows', 'basic');
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_rows', 'sai_log');
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_rows', 'sai_todo');
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_rows', 'sai_text');
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_rows', 'sai_security');
|
||||
|
||||
DELETE FROM `system_text` WHERE id = 'basic_save';
|
||||
@ -467,6 +469,7 @@
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_search', 'basic');
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_search', 'sai_security');
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_search', 'sai_todo');
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_search', 'sai_text');
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_search', 'sai_log');
|
||||
|
||||
DELETE FROM `system_text` WHERE id = 'basic_send_email';
|
||||
@ -604,6 +607,7 @@
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_page', 'basic');
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_page', 'sai_todo');
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_page', 'sai_log');
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_page', 'sai_text');
|
||||
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_page', 'sai_security');
|
||||
|
||||
DELETE FROM `system_text` WHERE id = 'basic_add_right';
|
||||
|
||||
@ -13,11 +13,17 @@ function init_saimod_sys_text() {
|
||||
});
|
||||
}
|
||||
|
||||
function register_search(){
|
||||
$('#btn_search').click(function(){
|
||||
system.load($(this).attr('state')+$('#input_search').val(),true);
|
||||
});
|
||||
}
|
||||
|
||||
function text_menu(){
|
||||
$('#tabs_text li').each(function(){
|
||||
$(this).removeClass('active');});
|
||||
if(system.cur_state().split('.')[1]){
|
||||
$('#menu_tag_'+system.cur_state().split(';')[1].split('.')[1]).parent().addClass('active');
|
||||
$('#menu_tag_'+system.cur_state().split(';')[1].split('.')[1].split(';')[0]).parent().addClass('active');
|
||||
} else {
|
||||
$('#menu_tag_all').parent().addClass('active');}
|
||||
};
|
||||
@ -26,22 +32,16 @@ function text2_menu(){
|
||||
$('#tabs2_text li').each(function(){
|
||||
$(this).removeClass('active');});
|
||||
if($('#menu_lang_'+system.cur_state().split('.')[2]).length){
|
||||
$('#menu_lang_'+system.cur_state().split('.')[2]).parent().addClass('active');
|
||||
$('#menu_lang_'+system.cur_state().split('.')[2].split(';')[0]).parent().addClass('active');
|
||||
} else {
|
||||
$('.menu_lang_default').parent().addClass('active');}
|
||||
};
|
||||
|
||||
function init_saimod_sys_text_notag(){
|
||||
$("#sai_mod_text_table").tablesorter();
|
||||
$('#tabs_text li').each(function(){
|
||||
$(this).removeClass('active');});
|
||||
$('#menu_tag_notag').parent().addClass('active');
|
||||
}
|
||||
|
||||
function init_saimod_sys_text_tag(){
|
||||
$("#sai_mod_text_table").tablesorter();
|
||||
text_menu();
|
||||
text2_menu();
|
||||
register_search();
|
||||
};
|
||||
|
||||
function init_saimod_sys_text_editor(){
|
||||
|
||||
15
sai/modules/saimod_sys_text/qq/SYS_SAIMOD_TEXT_COUNT.php
Normal file
15
sai/modules/saimod_sys_text/qq/SYS_SAIMOD_TEXT_COUNT.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_COUNT extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'todo',
|
||||
//mys
|
||||
'SELECT COUNT(*) as `count`'.
|
||||
' FROM system_text'.
|
||||
' LEFT JOIN system_user as a ON system_text.author = a.id'.
|
||||
' LEFT JOIN system_user as ae ON system_text.author_edit = ae.id'.
|
||||
' WHERE (a.username LIKE ? OR ae.username LIKE ? OR text LIKE ?);'
|
||||
);}}
|
||||
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_COUNT_FILTER extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'todo',
|
||||
//mys
|
||||
'SELECT COUNT(*) as `count`'.
|
||||
' FROM system_text'.
|
||||
' LEFT JOIN system_user as a ON system_text.author = a.id'.
|
||||
' LEFT JOIN system_user as ae ON system_text.author_edit = ae.id'.
|
||||
' WHERE lang = ?'.
|
||||
' AND (a.username LIKE ? OR ae.username LIKE ? OR text LIKE ?);'
|
||||
);}}
|
||||
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_COUNT_NOTAG extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'todo',
|
||||
//mys
|
||||
'SELECT COUNT(*) as `count`'.
|
||||
' FROM system_text'.
|
||||
' LEFT JOIN system_user as a ON system_text.author = a.id'.
|
||||
' LEFT JOIN system_user as ae ON system_text.author_edit = ae.id'.
|
||||
' WHERE (a.username LIKE ? OR ae.username LIKE ? OR system_text.text LIKE ?)'.
|
||||
' AND NOT EXISTS'.
|
||||
' (SELECT id'.
|
||||
' FROM system_text_tag'.
|
||||
' WHERE system_text_tag.id = system_text.id);'
|
||||
);}}
|
||||
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_COUNT_NOTAG_FILTER extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'todo',
|
||||
//mys
|
||||
'SELECT COUNT(*) as `count`'.
|
||||
' FROM system_text'.
|
||||
' LEFT JOIN system_user as a ON system_text.author = a.id'.
|
||||
' LEFT JOIN system_user as ae ON system_text.author_edit = ae.id'.
|
||||
' WHERE lang = ?'.
|
||||
' AND NOT EXISTS'.
|
||||
' (SELECT id'.
|
||||
' FROM system_text_tag'.
|
||||
' WHERE system_text_tag.id = system_text.id)'.
|
||||
' AND (a.username LIKE ? OR ae.username LIKE ? OR text LIKE ?);'
|
||||
);}}
|
||||
17
sai/modules/saimod_sys_text/qq/SYS_SAIMOD_TEXT_COUNT_TAG.php
Normal file
17
sai/modules/saimod_sys_text/qq/SYS_SAIMOD_TEXT_COUNT_TAG.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_COUNT_TAG extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'todo',
|
||||
//mys
|
||||
'SELECT COUNT(*) as `count`'.
|
||||
' FROM system_text_tag'.
|
||||
' LEFT JOIN system_text ON system_text_tag.id = system_text.id'.
|
||||
' LEFT JOIN system_user as a ON system_text.author = a.id'.
|
||||
' LEFT JOIN system_user as ae ON system_text.author_edit = ae.id'.
|
||||
' WHERE tag = ?'.
|
||||
' AND (a.username LIKE ? OR ae.username LIKE ? OR text LIKE ?);'
|
||||
);}}
|
||||
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_COUNT_TAG_FILTER extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'todo',
|
||||
//mys
|
||||
'SELECT COUNT(*) as `count`'.
|
||||
' FROM system_text_tag'.
|
||||
' LEFT JOIN system_text ON system_text_tag.id = system_text.id'.
|
||||
' LEFT JOIN system_user as a ON system_text.author = a.id'.
|
||||
' LEFT JOIN system_user as ae ON system_text.author_edit = ae.id'.
|
||||
' WHERE tag = ?'.
|
||||
' AND lang = ?'.
|
||||
' AND (a.username LIKE ? OR ae.username LIKE ? OR text LIKE ?);'
|
||||
);}}
|
||||
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_GETTEXTS extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'SELECT *, count(sub.id) as count
|
||||
FROM (
|
||||
SELECT system_text_tag.tag, system_text.*, a.username as author_name, ae.username as author_edit_name
|
||||
FROM system_text_tag
|
||||
LEFT JOIN system_text ON system_text_tag.id = system_text.id
|
||||
LEFT JOIN system_user as a ON system_text.author = a.id
|
||||
LEFT JOIN system_user as ae ON system_text.author_edit = ae.id
|
||||
WHERE tag = ?
|
||||
ORDER BY time_edit DESC
|
||||
) AS sub
|
||||
GROUP BY sub.id
|
||||
ORDER BY time_edit ASC;'
|
||||
);}}
|
||||
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_GETTEXTS_ALL extends \SYSTEM\DB\QQ {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'SELECT *, count(sub.id) as count
|
||||
FROM (
|
||||
SELECT system_text_tag.tag, system_text.*, a.username as author_name, ae.username as author_edit_name
|
||||
FROM system_text_tag
|
||||
LEFT JOIN system_text ON system_text_tag.id = system_text.id
|
||||
LEFT JOIN system_user as a ON system_text.author = a.id
|
||||
LEFT JOIN system_user as ae ON system_text.author_edit = ae.id
|
||||
ORDER BY time_edit DESC
|
||||
) AS sub
|
||||
GROUP BY sub.id
|
||||
ORDER BY time_edit ASC;'
|
||||
);}}
|
||||
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_GETTEXTS_NOTAG extends \SYSTEM\DB\QQ {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'SELECT *
|
||||
FROM (
|
||||
SELECT system_text.*, a.username as author_name, ae.username as author_edit_name
|
||||
FROM system_text
|
||||
LEFT JOIN system_user as a ON system_text.author = a.id
|
||||
LEFT JOIN system_user as ae ON system_text.author_edit = ae.id
|
||||
WHERE NOT EXISTS
|
||||
(SELECT id
|
||||
FROM system_text_tag
|
||||
WHERE system_text_tag.id = system_text.id)
|
||||
ORDER BY time_edit DESC
|
||||
) AS sub
|
||||
GROUP BY sub.id;'
|
||||
);}}
|
||||
18
sai/modules/saimod_sys_text/qq/SYS_SAIMOD_TEXT_TEXT.php
Normal file
18
sai/modules/saimod_sys_text/qq/SYS_SAIMOD_TEXT_TEXT.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_TEXT extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'todo',
|
||||
//mys
|
||||
'SELECT system_text_tag.tag, system_text.*, a.username as author_name, ae.username as author_edit_name'.
|
||||
' FROM system_text_tag'.
|
||||
' LEFT JOIN system_text ON system_text_tag.id = system_text.id'.
|
||||
' LEFT JOIN system_user as a ON system_text.author = a.id'.
|
||||
' LEFT JOIN system_user as ae ON system_text.author_edit = ae.id'.
|
||||
' WHERE (a.username LIKE ? OR ae.username LIKE ? OR text LIKE ?)'.
|
||||
' GROUP BY id, lang'.
|
||||
' ORDER BY time_edit DESC;'
|
||||
);}}
|
||||
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_TEXT_FILTER extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'todo',
|
||||
//mys
|
||||
'SELECT system_text_tag.tag, system_text.*, a.username as author_name, ae.username as author_edit_name'.
|
||||
' FROM system_text_tag'.
|
||||
' LEFT JOIN system_text ON system_text_tag.id = system_text.id'.
|
||||
' LEFT JOIN system_user as a ON system_text.author = a.id'.
|
||||
' LEFT JOIN system_user as ae ON system_text.author_edit = ae.id'.
|
||||
' WHERE lang = ?'.
|
||||
' AND(a.username LIKE ? OR ae.username LIKE ? OR text LIKE ?)'.
|
||||
' GROUP BY id, lang'.
|
||||
' ORDER BY time_edit DESC;'
|
||||
);}}
|
||||
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_TEXT_NOTAG extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'todo',
|
||||
//mys
|
||||
'SELECT system_text_tag.tag, system_text.*, a.username as author_name, ae.username as author_edit_name'.
|
||||
' FROM system_text_tag'.
|
||||
' LEFT JOIN system_text ON system_text_tag.id = system_text.id'.
|
||||
' LEFT JOIN system_user as a ON system_text.author = a.id'.
|
||||
' LEFT JOIN system_user as ae ON system_text.author_edit = ae.id'.
|
||||
' WHERE (a.username LIKE ? OR ae.username LIKE ? OR text LIKE ?)'.
|
||||
' AND NOT EXISTS'.
|
||||
' (SELECT id'.
|
||||
' FROM system_text_tag'.
|
||||
' WHERE system_text_tag.id = system_text.id)'.
|
||||
' GROUP BY id, lang'.
|
||||
' ORDER BY time_edit DESC;'
|
||||
);}}
|
||||
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_TEXT_NOTAG_FILTER extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'todo',
|
||||
//mys
|
||||
'SELECT system_text_tag.tag, system_text.*, a.username as author_name, ae.username as author_edit_name'.
|
||||
' FROM system_text_tag'.
|
||||
' LEFT JOIN system_text ON system_text_tag.id = system_text.id'.
|
||||
' LEFT JOIN system_user as a ON system_text.author = a.id'.
|
||||
' LEFT JOIN system_user as ae ON system_text.author_edit = ae.id'.
|
||||
' WHERE lang = ?'.
|
||||
' AND(a.username LIKE ? OR ae.username LIKE ? OR text LIKE ?)'.
|
||||
' AND NOT EXISTS'.
|
||||
' (SELECT id'.
|
||||
' FROM system_text_tag'.
|
||||
' WHERE system_text_tag.id = system_text.id)'.
|
||||
' GROUP BY id, lang'.
|
||||
' ORDER BY time_edit DESC;'
|
||||
);}}
|
||||
19
sai/modules/saimod_sys_text/qq/SYS_SAIMOD_TEXT_TEXT_TAG.php
Normal file
19
sai/modules/saimod_sys_text/qq/SYS_SAIMOD_TEXT_TEXT_TAG.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_TEXT_TAG extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'todo',
|
||||
//mys
|
||||
'SELECT system_text_tag.tag, system_text.*, a.username as author_name, ae.username as author_edit_name'.
|
||||
' FROM system_text_tag'.
|
||||
' LEFT JOIN system_text ON system_text_tag.id = system_text.id'.
|
||||
' LEFT JOIN system_user as a ON system_text.author = a.id'.
|
||||
' LEFT JOIN system_user as ae ON system_text.author_edit = ae.id'.
|
||||
' WHERE tag = ?'.
|
||||
' AND (a.username LIKE ? OR ae.username LIKE ? OR text LIKE ?)'.
|
||||
' GROUP BY id, lang'.
|
||||
' ORDER BY time_edit DESC;'
|
||||
);}}
|
||||
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_TEXT_TAG_FILTER extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'todo',
|
||||
//mys
|
||||
'SELECT system_text_tag.tag, system_text.*, a.username as author_name, ae.username as author_edit_name'.
|
||||
' FROM system_text_tag'.
|
||||
' LEFT JOIN system_text ON system_text_tag.id = system_text.id'.
|
||||
' LEFT JOIN system_user as a ON system_text.author = a.id'.
|
||||
' LEFT JOIN system_user as ae ON system_text.author_edit = ae.id'.
|
||||
' WHERE tag = ? AND lang = ?'.
|
||||
' AND(a.username LIKE ? OR ae.username LIKE ? OR text LIKE ?)'.
|
||||
' GROUP BY id, lang'.
|
||||
' ORDER BY time_edit DESC;'
|
||||
);}}
|
||||
@ -27,18 +27,59 @@ class saimod_sys_text extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/saimod_sys_text_list.tpl'), $vars);
|
||||
}
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_tag($tag = null){
|
||||
if ($tag) {
|
||||
$res = \SYSTEM\DBD\SYS_SAIMOD_TEXT_GETTEXTS::QQ(array($tag));
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_tag($tag = 'all',$filter = "all",$search="%",$page=0){
|
||||
if($tag == 'all'){
|
||||
if($filter == 'all'){
|
||||
$count = \SYSTEM\DBD\SYS_SAIMOD_TEXT_COUNT::Q1(array($search,$search,$search))['count'];
|
||||
$res = \SYSTEM\DBD\SYS_SAIMOD_TEXT_TEXT::QQ(array($search,$search,$search));
|
||||
|
||||
} else {
|
||||
$count = \SYSTEM\DBD\SYS_SAIMOD_TEXT_COUNT_FILTER::Q1(array($filter,$search,$search,$search))['count'];
|
||||
$res = \SYSTEM\DBD\SYS_SAIMOD_TEXT_TEXT_FILTER::QQ(array($filter,$search,$search,$search));
|
||||
}
|
||||
} elseif($tag == 'notag'){
|
||||
if($filter == 'all'){
|
||||
$count = \SYSTEM\DBD\SYS_SAIMOD_TEXT_COUNT_NOTAG::Q1(array($search,$search,$search))['count'];
|
||||
$res = \SYSTEM\DBD\SYS_SAIMOD_TEXT_TEXT_NOTAG::QQ(array($search,$search,$search));
|
||||
|
||||
} else {
|
||||
$count = \SYSTEM\DBD\SYS_SAIMOD_TEXT_COUNT_NOTAG_FILTER::Q1(array($filter,$search,$search,$search))['count'];
|
||||
$res = \SYSTEM\DBD\SYS_SAIMOD_TEXT_TEXT_NOTAG_FILTER::QQ(array($filter,$search,$search,$search));
|
||||
}
|
||||
} else {
|
||||
$res = \SYSTEM\DBD\SYS_SAIMOD_TEXT_GETTEXTS_ALL::QQ();}
|
||||
|
||||
$entries = '';
|
||||
while($r = $res->next()){
|
||||
$entries .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/saimod_sys_text_list_entry.tpl'), $r);
|
||||
if($filter == 'all'){
|
||||
$count = \SYSTEM\DBD\SYS_SAIMOD_TEXT_COUNT_TAG::Q1(array($tag,$search,$search,$search))['count'];
|
||||
$res = \SYSTEM\DBD\SYS_SAIMOD_TEXT_TEXT_TAG::QQ(array($tag,$search,$search,$search));
|
||||
} else {
|
||||
$count = \SYSTEM\DBD\SYS_SAIMOD_TEXT_COUNT_TAG_FILTER::Q1(array($tag,$filter,$search,$search,$search))['count'];
|
||||
$res = \SYSTEM\DBD\SYS_SAIMOD_TEXT_TEXT_TAG_FILTER::QQ(array($tag,$filter,$search,$search,$search));
|
||||
}
|
||||
}
|
||||
$vars = \SYSTEM\PAGE\text::tag(\SYSTEM\DBD\system_text::TAG_SAI_TEXT);
|
||||
$vars['entries'] = $entries;
|
||||
$vars = array();
|
||||
$vars['tag'] = $tag;
|
||||
$vars['filter'] = $filter;
|
||||
$vars['search'] = $search;
|
||||
$vars['page'] = $page;
|
||||
$vars['entries'] = '';
|
||||
$count_filtered = 0;
|
||||
$res->seek(100*$page);
|
||||
while(($r = $res->next()) && ($count_filtered < 100)){
|
||||
$vars['entries'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/saimod_sys_text_list_entry.tpl'), $r);
|
||||
$count_filtered++;}
|
||||
$vars['pagination'] = '';
|
||||
$vars['page_last'] = ceil($count/100)-1;
|
||||
for($i=0;$i < ceil($count/100);$i++){
|
||||
$data = array('page' => $i,'search' => $search, 'filter' => $filter, 'active' => ($i == $page) ? 'active' : '', 'tag' => $tag);
|
||||
$vars['pagination'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/saimod_sys_text_pagination.tpl'), $data);
|
||||
}
|
||||
$vars['count'] = $count_filtered.'/'.$count;
|
||||
$vars['lang_filter'] = '';
|
||||
$res = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_LANGS);
|
||||
foreach($res as $lang){
|
||||
$data = array('active' => ($filter == $lang ? 'active' : ''), 'filter' => $lang, 'search' => $search, 'name' => $lang, 'tag' => $tag);
|
||||
$vars['lang_filter'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/saimod_sys_text_lang_filter.tpl'),$data);}
|
||||
$vars['active'] = ($filter == 'all' ? 'active' : '');
|
||||
$vars = array_merge($vars,\SYSTEM\PAGE\text::tag(\SYSTEM\DBD\system_text::TAG_SAI_TEXT));
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/saimod_sys_text_list.tpl'), $vars);
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<div class="tabbable">
|
||||
<ul class="nav nav-tabs" id="tabs_text">
|
||||
<li><a href="#!text" id="menu_tag_all">${basic_all}</a></li>
|
||||
<li><a href="#!text(notag)" id="menu_tag_notag">${basic_no_tag}</a></li>
|
||||
<li><a href="#!text;tag.notag" id="menu_tag_notag">${basic_no_tag}</a></li>
|
||||
${tabopts}
|
||||
<button class="btn-sm btn btn-success content_add" onClick="system.load('text(edittext(editor));id.${new_id};lang.${new_lang}');" style="margin-left: 15px; float: right;"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> ${basic_add}</button>
|
||||
<button type="submit" value="${basic_show_all}" id="btn_show_all" class="btn-sm btn btn-primary" style="margin-left: 15px; float: right;"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span> ${basic_show_all}</button>
|
||||
|
||||
@ -0,0 +1 @@
|
||||
<li class="${active}"><a href="#!text;tag.${tag};filter.${filter};search.${search}">${name}</a></li>
|
||||
@ -1,5 +1,12 @@
|
||||
<table class="sai_table table table-hover table-condensed tablesorter" id="sai_mod_text_table" style="overflow: auto;">
|
||||
<thead>
|
||||
<ul class="nav nav-pills" id="right_filter">
|
||||
<li class="${active}"><a href="#!text;tag.${tag};filter.all;search.${search}">${basic_all}</a></li>
|
||||
${lang_filter}
|
||||
<button class="btn-sm btn btn-success" state="text;tag.${tag};filter.${filter};search." id="btn_search" type="submit" style="float: right; margin-left: 10px;"><span class="glyphicon glyphicon-search" aria-hidden="true"></span> ${basic_search}</button>
|
||||
<input class="input-medium search-query action-control" id="input_search" type="text" placeholder="${basic_placeholder_search}" size="20" style="float: right;" value="${search}"/>
|
||||
</ul>
|
||||
<div id="table_text">
|
||||
<h6>${basic_rows}: ${count} ${basic_page}: ${page}</h6>
|
||||
<table class="sai_table table table-hover table-condensed tablesorter" id="sai_mod_text_table" style="overflow: auto;">
|
||||
<tr>
|
||||
<th>${table_id}</th>
|
||||
<th>${table_lang}</th>
|
||||
@ -9,8 +16,11 @@
|
||||
<th>${table_author_edit}</th>
|
||||
<th>${table_time_edit}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
${entries}
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
<ul class="pagination">
|
||||
<li><a href="#!text;tag.${tag};filter.${filter};search.${search};page.0">«</a></li>
|
||||
${pagination}
|
||||
<li><a href="#!text;tag.${tag};filter.${filter};search.${search};page.${page_last}">»</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -1,6 +1,6 @@
|
||||
<tr class="tableentry" text_id="${id}" onClick="system.load('text(edittext(editor));id.${id};lang.${lang}');">
|
||||
<td>${id}</td>
|
||||
<td class="contenttext">${lang} (${count})</td>
|
||||
<td class="contenttext">${lang}</td>
|
||||
<td class="contenttext">${text}</td>
|
||||
<td class="contenttext">${author_name}</td>
|
||||
<td class="contenttext">${time_create}</td>
|
||||
|
||||
@ -0,0 +1 @@
|
||||
<li class="${active}"><a href="#!text;tag.${tag};filter.${filter};search.${search};page.${page}">${page}</a></li>
|
||||
Loading…
x
Reference in New Issue
Block a user