included get_latest text function to class text.php

This commit is contained in:
Naeltard 2015-09-15 21:54:06 +02:00
parent 04f0f76f2f
commit 711ea543d4
2 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<?php
namespace SYSTEM\SQL;
class SYS_TEXT_GET_LATEST extends \SYSTEM\DB\QP {
public static function get_class(){return \get_class();}
public static function mysql(){return
'SELECT system_text.id,text FROM system_text
LEFT JOIN system_text_tag ON system_text.id = system_text_tag.id
WHERE tag = ? ORDER BY time_create DESC LIMIT ?;';
}
}

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 get_latest($tag, $limit){
return \SYSTEM\SQL\SYS_TEXT_GET_LATEST::QA(array($tag, $limit));
}
public static function search($search,$tag/*=null*/){
$search = '%'.$search.'%';
return \SYSTEM\SQL\SYS_TEXT_SEARCH_TAG::QA(array($tag,$search,$search,$search));}