/var/www/hkosl.com/thebh/20161004/banquet/more.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
use Illuminate\Database\Capsule\Manager as DB;

require_once 
'../webadmin/configure.php';

//var_dump( $_POST['branchOpts']);
//var_dump( $_POST['filterOpts']);
$opts $_POST['filterOpts'];
$branch $_POST['branchOpts'];

$andOpts " and ";

if (empty(
$opts)){
    
// 0 checkboxes checked
    
$andOpts ' ';
} else {
    if(
count($opts) == 1){
      
// 1 checkbox checked
      
$andOpts .= 'c.newscategory_code = "' $opts[0] .'" ';
    } else {
      
// 2+ checkboxes checked
      
$andOpts .= 'c.newscategory_code = "' implode('" OR c.newscategory_code = "'$opts).'" ';
    }
}

$andBranch " and ";

if (empty(
$branch)){
    
// 0 checkboxes checked
    
$andBranch ' ';
} else {
    if(
count($branch) == 1){
      
// 1 checkbox checked
      
$andBranch .= 'l.location_id = "' $branch[0] .'" ';
    } else {
      
// 2+ checkboxes checked
      
$andBranch .= 'l.location_id = "' implode('" OR l.location_id = "'$branch).'" ';
    }
}


$row_per_request = !empty($_REQUEST['rpr']) ? $_REQUEST['rpr'] : 10;
$offset = !empty($_REQUEST['offset']) ? $_REQUEST['offset'] : 0;

$select 'SELECT distinct n.id, n.name_tc, n.shortdesc_tc, n.desc_tc';
$from ' FROM news n inner join news_newscategory c ON n.id=c.news_id inner join master_type_code m ON c.newscategory_code=m.code inner join news_location l ON n.id=l.news_id';
$where ' WHERE m.typeid=? and n.deleted=? and n.status=?';
$order ' ORDER BY n.docdate DESC limit ? offset ?';

$sql $select.$from.$where.$andOpts.$andBranch.$order;

//var_dump($sql);

$news DB::select($sql , array("NEWSCATEGORY_BANQUET"01$row_per_request$offset));

$counter 1;
foreach (
$news as $i=>$each) {
?>
    <div class="thumbdiv">
        <a class="fancybox fancybox.iframe" href="../include/post.php?id=<?= $each['id'?>">
        <!-- <?=date('His') . "i={$i}"?> -->
            <div class="Post" data-toggle="modal" data-target="#myModal" target="myiframe">
                <h3><?= _h($each['name_tc']) ?></h3>
                <p><?= $each['shortdesc_tc'?></p>
            </div>
        </a>
    </div>

<?php
$counter
++;
}

if(
count($news)<$row_per_request){
?>
    <!--END_PAGINATION-->
    <!--
    <div>
        <span class="more" style="cursor: default;">-- 完 --</span>
    </div>
    -->
    <script type="text/javascript" src="../js/jqueryscrollpagination/scripts/scrollpagination.js"></script>
<?php
}else{
?>
    <!--CONT_PAGINATION-->
<?php
}
?>