text search capabilities

This commit is contained in:
Ulf Gebhardt 2015-08-31 02:38:03 +02:00
parent 45543a45b8
commit ab1f4a62e8
2 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,12 @@
<?php
namespace SYSTEM\DBD;
class SYS_TEXT_SEARCH_TAG extends \SYSTEM\DB\QP {
public static function get_class(){return \get_class();}
public static function mysql(){return
'SELECT system_text.*, system_text_tag.*, a.username as author_name, ae.username as author_edit_name FROM system_text'.
' LEFT JOIN system_text_tag ON system_text.id = system_text_tag.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 (system_text.id LIKE ? OR system_text.text LIKE ? OR tag LIKE ?);';
}
}

View File

@ -78,6 +78,9 @@ class text {
return self::get_adv($id, \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_LANG));}
return $res;
}
public static function search($search,$tag/*=null*/){
$search = '%'.$search.'%';
return \SYSTEM\DBD\SYS_TEXT_SEARCH_TAG::QA(array($tag,$search,$search,$search));}
public static function save($id, $new_id, $lang, $tags, $text){
if($new_id == self::NEW_ENTRY){