summaryrefslogtreecommitdiff
path: root/portal/system/page/quotes.php
blob: 2a05c5292158c28f21ab33ce4972f27bb2b77c29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

//
// Single quote
//
class Page_Quotes extends PgPage {
    private $id;
    function __construct($id) {
        $this->id = $id;
        $this->navsection = 'about';
        $this->content_template = 'about/quotes.html';
    }

    function Render() {
        $rs = $this->pg_query_params("SELECT COALESCE(qt1.quote,qt2.quote) AS quote, COALESCE(qt1.tagline,qt2.tagline) AS tagline FROM quotes q INNER JOIN quotes_text qt2 ON q.id=qt2.quoteid LEFT JOIN (SELECT quoteid,quote,tagline FROM quotes_text WHERE language=$1) qt1 ON qt1.quoteid=q.id WHERE q.approved AND q.id=$2 AND qt2.language='en'", array($this->language, $this->id));
        if (pg_num_rows($rs) != 1)
            throw new NotFoundException('Quote not found');
        $r = pg_fetch_assoc($rs);
        $this->tpl->setVariable($r);
        $this->tpl->setVariable('title_headline', $r['tagline']);
    }
}
?>