本文整理汇总了PHP中db::order方法的典型用法代码示例。如果您正苦于以下问题:PHP db::order方法的具体用法?PHP db::order怎么用?PHP db::order使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db
的用法示例。
在下文中一共展示了db::order方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cache
function cache()
{
admin::components('shiftable');
db::table('pages');
db::where('site_id', ADMIN_SITE_ID);
db::where('page_pub', '2', '!=');
db::order('page_map');
$res = db::select();
while ($row = mysql_fetch_assoc($res)) {
if ($row['page_cache'] == '1') {
$row['page_cache'] = ' checked="checked"';
} else {
$row['page_cache'] = '';
}
if ($row['page_folder'] == '/') {
$page_path = 'http://' . ADMIN_SITE;
} else {
$page_path = 'http://' . ADMIN_SITE . '' . $row['page_folder'];
}
$row['page_line'] = $row['page_title'];
if ($row['page_dynamic'] == '0') {
$row['page_line'] = $row['page_line'] . ' <a href="' . $page_path . '" style="top: 0;" class="ico ico16 ico_goto" title="Посмотреть на сайте"> </a>';
}
$page_tree[$row['page_parent']][$row['page_id']] = $row;
}
s::tree('page_tree', $page_tree);
}
示例2: setup
function setup()
{
db::table('pages_content');
db::where('page_id', PAGE_ID);
db::where('content_pub', '1');
db::order('content_id');
$res = db::select('content');
$i = 0;
if ($res) {
while ($row = mysql_fetch_assoc($res)) {
$i++;
s::set('page_content' . $i, $row['content']);
}
}
db::table('pages_files');
db::where('page_id', PAGE_ID);
$r = db::select();
if (db::rows() != 0) {
s::section('page_files_show');
}
while ($a = mysql_fetch_assoc($r)) {
$a['file_icon'] = files::getFileIco($a['file_type']);
$a['file_size'] = files::parseSizeSmart($a['file_size']);
s::roll('page_files', $a);
}
}
示例3: getMenus
function getMenus($site_id)
{
db::table('menus');
db::where('site_id', $site_id);
db::where('menu_pub', '1');
db::order('menu_title');
$res = db::select();
while ($row = mysql_fetch_assoc($res)) {
s::roll('menus', $row);
}
}
示例4: getBlocks
function getBlocks($site_id = 1)
{
db::table('blocks');
db::where('site_id', $site_id);
db::where('block_pub', '1');
db::order('block_name');
$res = db::select();
while ($row = mysql_fetch_assoc($res)) {
s::roll('blocks', $row);
}
}
示例5: view
function view()
{
db::table('admin_log_actions');
db::join('admin_users', 'admin_log_actions', 'user_id');
db::order('log_date', 'DESC');
db::limit(30);
$res = db::select();
while ($row = mysql_fetch_assoc($res)) {
$row['log_date'] = dt::format('%d.%m.%Y %H:%M', $row['log_date']);
s::roll('logs_list', $row);
}
}
示例6: view
function view()
{
db::table('news');
db::order('news_date', 'DESC');
$res = db::select();
while ($row = mysql_fetch_assoc($res)) {
$row = filter::get('news_pub', array('unpub', 'pub'), $row);
$row['news_title'] = strip_tags($row['news_title']);
$row['news_date'] = dt::date2print('%d %F %Y, %H:%i', $row['news_date']);
s::roll('news', $row);
}
}
示例7: show
function show()
{
$event = web::getEvent();
if ($event === false) {
$year = date('Y');
} else {
$year = $event;
}
s::set('info_date_select', htmlspecialchars($year));
$sql = "SELECT `section_year` as date FROM `info_sections` WHERE `section_view`='0' GROUP BY `date` ORDER BY `date` DESC";
$res = db::query($sql);
$rows = mysql_num_rows($res);
if ($rows > 1) {
s::add('info_date_selector', '<ul class="years">');
while ($row = mysql_fetch_assoc($res)) {
if ($row['date'] == $year) {
$row['date'] = '<li><span>' . $row['date'] . '</span></li>';
} else {
$row['date'] = '<li><a href="' . web::get('page_folder') . '' . $row['date'] . '/">' . $row['date'] . '</a></li>';
}
s::add('info_date_selector', $row['date']);
}
s::add('info_date_selector', '</ul>');
}
$files = array();
db::table('info_files');
$r = db::select();
while ($a = mysql_fetch_assoc($r)) {
$files[$a['section_id']][] = $a;
}
db::table('info_sections');
db::order('section_order', 'DESC');
db::where('section_year', $year);
$r = db::select();
if (db::rows() == 0) {
web::error404();
}
while ($a = mysql_fetch_assoc($r)) {
if ($a['section_view'] == '0') {
s::roll('sections', $a);
} else {
s::roll('sections_view', $a);
}
if (isset($files[$a['section_id']])) {
foreach ($files[$a['section_id']] as $v) {
$v['file_icon'] = files::getFileIco($v['file_type']);
$v['file_size'] = files::parseSizeSmart($v['file_size']);
s::roll('items' . $a['section_id'], $v);
}
}
}
}
示例8: getTmpls
function getTmpls($site_id = 1)
{
db::table('templates');
db::where('site_id', $site_id);
db::where('tmpl_pub', '1');
db::order('tmpl_name');
$res = db::select();
if (db::rows() == 0) {
s::section('no_data');
} else {
s::section('yes_data');
}
while ($row = mysql_fetch_assoc($res)) {
s::roll('tmpls', $row);
}
}
示例9: show
function show()
{
$list = params::get('list');
$event = web::getEvent();
if ($event === false) {
$year = date('Y');
} else {
$year = $event;
}
s::set('news_date_select', htmlspecialchars($year));
$sql = "SELECT DATE_FORMAT(`news_date`, '%Y') as date FROM `news` GROUP BY `date` ORDER BY `date` DESC";
$res = db::query($sql);
$rows = mysql_num_rows($res);
if ($rows > 1) {
s::add('news_date_selector', '<ul class="years">');
while ($row = mysql_fetch_assoc($res)) {
if ($row['date'] == $year) {
$row['date'] = '<li><span>' . $row['date'] . '</span></li>';
} else {
$row['date'] = '<li><a href="' . web::get('page_folder') . '' . $row['date'] . '/">' . $row['date'] . '</a></li>';
}
s::add('news_date_selector', $row['date']);
}
s::add('news_date_selector', '</ul>');
}
db::table('news');
db::where('news_pub', '1');
db::where('news_date', $year . '-01-01 00:00:00', '>=');
db::where('news_date', $year . '-12-31 23:59:59', '<=');
db::order('news_date', 'DESC');
if ($list !== false) {
db::limit($list);
}
$res = db::select();
if (db::rows() == 0) {
web::error404();
}
while ($row = mysql_fetch_assoc($res)) {
$row['news_date'] = dt::date2print('%d %F %Y', $row['news_date']);
s::roll('news', $row);
}
}
示例10: dump
function dump()
{
$tables = implode(', ', self::$tables);
$conf = implode(', ', self::$conf);
db::table('admin_log_trash');
db::order('log_id', 'DESC');
db::limit(31, 100);
$res = db::select('log_id');
if (db::rows() > 0) {
while ($row = mysql_fetch_assoc($res)) {
self::delete($row['log_id']);
}
}
if (self::$files) {
$log_tmpl = 1;
} else {
$log_tmpl = 0;
}
db::table('admin_log_trash');
db::insert('', 'NOW()', '', $tables, $conf, '', $log_tmpl, ADMIN_USER_ID);
$log_id = mysql_insert_id();
dump::tables(self::$tables);
dump::backup(SYS_ROOT . 'var/trash/' . $log_id . '_base.zip');
if (self::$conf) {
foreach (self::$conf as $v) {
zipfile::add(SYS_ROOT . 'conf/web/' . $v . '.ini');
}
zipfile::create(SYS_ROOT . 'var/trash/' . $log_id . '_conf.zip');
}
if (self::$files) {
foreach (self::$files as $v) {
zipfile::add($v);
}
zipfile::create(SYS_ROOT . 'var/trash/' . $log_id . '_files.zip');
}
}
示例11: view
function view()
{
db::table('admin_log_trash');
db::limit(30);
db::order('log_date', 'DESC');
$res = db::select();
while ($row = mysql_fetch_assoc($res)) {
if ($row['log_restored'] != '0000-00-00 00:00:00') {
$row['log_restored'] = dt::date2print('%H:%i:%s<br />%d %F %y', $row['log_restored']);
} else {
$row['log_restored'] = '';
}
$row['log_date'] = dt::date2print('%H:%i:%s<br />%d %F %y', $row['log_date']);
$tables = '';
$array = explode(",", $row['log_tables']);
foreach ($array as $v) {
if (!empty($v)) {
$tables .= T_ . $v . '<br />';
}
}
$row['log_tables'] = $tables;
s::roll('basket', $row);
}
}
示例12: livesearch
function livesearch()
{
$search = params::get('search');
if (empty($search)) {
self::view();
return true;
}
db::table('blocks');
db::where('site_id', ADMIN_SITE_ID);
db::whereGroup(array('block_name', $search, 'LIKE'), 'OR', array('block_title', $search, 'LIKE'));
db::order('block_name');
$res = db::select();
while ($row = mysql_fetch_assoc($res)) {
if ($row['block_pub'] == '1') {
$row['block_pub'] = 'pub';
} else {
$row['block_pub'] = 'unpub';
}
if (empty($row['block_title'])) {
$row['block_title'] = $row['block_name'];
}
s::roll('blocks', $row);
}
}
示例13: showPoints
function showPoints($menu_id = false)
{
if (!$menu_id) {
$menu_id = params::get('menu_id');
}
$menu_tree = array();
db::table('menus_points');
db::where('menu_id', $menu_id);
db::order('point_order');
$res = db::select();
if (db::rows() == 0) {
buffer::setTmpl();
return false;
}
while ($row = mysql_fetch_assoc($res)) {
if ($row['point_pub'] == '1') {
$row['point_pub'] = '_pub';
} else {
$row['point_pub'] = '_unpub';
}
$menu_tree[$row['point_parent']][$row['point_id']] = $row;
}
s::tree('menu_tree', $menu_tree);
}
示例14: loadGroupSetups
function loadGroupSetups()
{
$array = ini::parse(SYS_ROOT . 'conf/global/apps.ini');
$check = array();
foreach ($array as $k => $v) {
if ($v) {
$check['apps'][$k] = 1;
s::roll('apps', array('app' => $k, 'app_title' => $v['title']));
}
}
$rules = ini::parse(SYS_ROOT . 'conf/admin/rules.ini');
foreach ($rules as $k => $v) {
s::roll('rules', array('rule' => $k, 'rule_name' => $v));
}
db::table('admin_sites');
db::order('site_domain');
$res = db::select();
while ($row = mysql_fetch_assoc($res)) {
$check['sites'][$row['site_id']] = 1;
s::roll('sites', $row);
}
return $check;
}
示例15: loadPageData
public function loadPageData()
{
$arr_t = self::$page_tree;
unset($arr_t[0], $arr_t[1]);
$arr = array();
$arr[0] = self::$page_tree[0];
$arr[1] = self::$page_tree[1];
$i = 2;
foreach ($arr_t as $k => $v) {
$v = string::clearBoth($v);
$t = explode('/', $v);
$count = count($t);
$tt = array();
$g = array();
// start matrix
for ($z = 1; $z <= $count; $z++) {
$g = $t;
$g[$z] = str_replace($t[$z], '[dynamic]', $t[$z]);
$tt = implode('/', $g);
$arr[$i] = '/' . string::clearBoth($tt) . '/';
$i++;
}
$matrix = array();
$x = 1;
$y = 2;
for ($z = 0; $z < $count * 2; $z++) {
$m = $x + $y;
if ($m < $count) {
$matrix[] = array($x, $m);
$y++;
} elseif ($m == $count) {
$x++;
$y = 2;
}
}
foreach ($matrix as $u => $r) {
$g = $t;
$g[$r[0]] = str_replace($t[$r[0]], '[dynamic]', $t[$r[0]]);
$g[$r[1]] = str_replace($t[$r[1]], '[dynamic]', $t[$r[1]]);
$tt = implode('/', $g);
$arr[$i] = '/' . string::clearBoth($tt) . '/';
$i++;
}
// end matrix
}
$list_path = "";
foreach ($arr as $v) {
if (!empty($v)) {
$list_path .= "'" . $v . "',";
}
}
$list_path = ereg_replace(",\$", "", $list_path);
db::table('pages');
db::join('templates', 'pages', 'tmpl_id');
db::where('page_folder', $list_path, 'IN');
db::where('site_id', SITE_ID, '=', 'pages');
db::order('page_level');
$res = db::select();
$t_pages = array();
$path_pages = array();
if (db::rows() > 0) {
while ($row = mysql_fetch_assoc($res)) {
$t_pages[] = $row;
}
}
$max_level = arrays::maxKey($t_pages, 'page_level');
$new_array = arrays::sliceByKey($t_pages, $max_level, 'page_level');
$tested = array();
$et = explode('/', string::clearBoth(URI_SELF));
/*
Data of current page
*/
if ($new_array) {
foreach ($new_array as $k => $v) {
$folder = explode('/', string::clearBoth($v['page_folder']));
$tested[$k] = 0;
foreach ($folder as $d => $f) {
if (isset($et[$d])) {
if ($f == $et[$d]) {
$tested[$k]++;
}
}
}
}
$path_pages[] = self::$page = $t_pages[arrays::maxValueKey($tested)];
} else {
$path_pages[] = self::$page = arrays::lastValue($t_pages);
}
$t_pages = array_reverse($t_pages);
$parent = self::$page['page_parent'];
if ($parent != 0) {
foreach ($t_pages as $k => $v) {
if ($v['page_id'] != $parent && $v['page_folder'] != '/') {
unset($t_pages[$k]);
} else {
$path_pages[] = $v;
$parent = $v['page_parent'];
}
}
}
//.........这里部分代码省略.........