View difference between Paste ID: ZdJaiCEK and BYbjkpi3
SHOW: | | - or go back to the newest paste.
1
// Controller code:
2
3
    function PortfolioItems() {
4-
        if (!isset($this->urlParams['Action']) || $this->urlParams['Action'] == 'All')
4+
$filter = array ('ParentID' => $this->ID);
5-
            $typeFilter = "";
5+
        if (isset($this->urlParams['Action']) && $this->urlParams['Action'] != 'All')
6-
        else
6+
$filter['`PortfolioPage`.ProjectType'] = $this->urlParams['Action'];
7-
            $typeFilter = "AND `PortfolioPage`.ProjectType='" . $this->urlParams['Action'] . "'";
7+
        $records = PortfolioPage::get()->filter($filter)->limit(3);
8
return PaginatedList::create($records, $this->request);
9-
        $records = PortfolioPage::get()->filter(array(
9+
10-
"ParentID => $this->ID,
10+
11-
))->where($typeFilter)->limit(3);
11+
12
13
// template render:
14
15
    <% if PortfolioItems.MoreThanOnePage %>
16
    <div class="pagination">
17
        <% if PortfolioItems.PrevLink %>
18
        <a href="$PortfolioItems.PrevLink"><span><img src="/themes/LittleMonkey2011/images/buttons/previous_off.png" id="previous" width="27" height="27" alt="previous" /></span></a>
19
        <% end_if %>
20
21
        <% control PortfolioItems.Pages %>
22
        <% if CurrentBool %>
23
            <span><img src="/themes/XX/images/buttons/page{$PageNum}_on.png" id="page{$PageNum}" width="27" height="27" alt="page{$PageNum}" /></span>
24
        <% else %>
25
            <a href="$Link"><span><img src="/themes/XX/images/buttons/page{$PageNum}_off.png" id="page{$PageNum}" width="27" height="27" alt="page{$PageNum}" /></span></a>
26
        <% end_if %>
27
        <% end_control %>
28
        <% if PortfolioItems.NextLink %>
29
        <a href="$PortfolioItems.NextLink"><span><img src="/themes/XX/images/buttons/next_off.png" id="next" width="27" height="27" alt="next" /></span></a>
30
        <% end_if %>
31
    </div>
32
    <% end_if %>