コード例 #1
0
ファイル: index.php プロジェクト: udp12/theyworkforyou
<?php

$this_page = "houserules";
include_once '../../includes/easyparliament/init.php';
MySociety\TheyWorkForYou\Renderer::output('static/houserules', array());
コード例 #2
0
ファイル: index.php プロジェクト: udp12/theyworkforyou
<?php

$new_style_template = TRUE;
include_once '../../includes/easyparliament/init.php';
include_once INCLUDESPATH . "easyparliament/glossary.php";
include_once INCLUDESPATH . 'easyparliament/member.php';
if (!DEVSITE) {
    header('Cache-Control: max-age=900');
}
if (get_http_var('pid') == 16407) {
    header('Location: /search/?pid=10133');
    exit;
}
$search = new MySociety\TheyWorkForYou\Search();
$data = $search->display();
MySociety\TheyWorkForYou\Renderer::output($data['template'], $data);
コード例 #3
0
ファイル: index.php プロジェクト: udp12/theyworkforyou
<?php

$this_page = "contact";
include_once '../../includes/easyparliament/init.php';
MySociety\TheyWorkForYou\Renderer::output('static/contact', array());
コード例 #4
0
ファイル: section.php プロジェクト: udp12/theyworkforyou
<?php

# For displaying any debate calendar, day, debate, speech page or related.
include_once '../includes/easyparliament/init.php';
include_once INCLUDESPATH . "easyparliament/glossary.php";
# Redirect shortcut.
# We no longer want to use the gid parameter, it's all id.
if (get_http_var('gid')) {
    $url = str_replace('gid', 'id', $_SERVER['REQUEST_URI']);
    redirect($url);
}
if ($type = ucfirst(get_http_var('type'))) {
    $class_name = "MySociety\\TheyWorkForYou\\SectionView\\{$type}View";
    $view = new $class_name();
    $data = $view->display();
    if ($data) {
        MySociety\TheyWorkForYou\Renderer::output('section/section', $data);
    }
} else {
    $PAGE->error_message("No type specified", true);
}
コード例 #5
0
ファイル: index.php プロジェクト: vijo/theyworkforyou
<?php

$this_page = "wales_overview";
include_once '../../includes/easyparliament/init.php';
MySociety\TheyWorkForYou\Renderer::output('wales/index', array());
コード例 #6
0
ファイル: index.php プロジェクト: udp12/theyworkforyou
<?php

include_once '../../includes/easyparliament/init.php';
$view = new MySociety\TheyWorkForYou\SPHomepage();
$data = $view->display();
MySociety\TheyWorkForYou\Renderer::output('scotland/index', $data);
コード例 #7
0
ファイル: index.php プロジェクト: vijo/theyworkforyou
<?php

include_once '../../includes/easyparliament/init.php';
include_once INCLUDESPATH . "easyparliament/people.php";
if (get_http_var('msp')) {
    $type = 'MSPs';
} elseif (get_http_var('mla')) {
    $type = 'MLAs';
} elseif (get_http_var('peer')) {
    $type = 'Peers';
} else {
    $type = 'MPs';
}
$class = "MySociety\\TheyWorkForYou\\People\\{$type}";
$people = new $class();
$args = $people->getArgs();
$people->setMetaData($args);
$data = $people->getData($args);
if (isset($args['f']) && $args['f'] == 'csv') {
    $people->sendAsCSV($data);
} else {
    MySociety\TheyWorkForYou\Renderer::output("people/index", $data);
}
コード例 #8
0
ファイル: index.php プロジェクト: vijo/theyworkforyou
<?php

$new_style_template = TRUE;
include_once '../../includes/easyparliament/init.php';
include_once INCLUDESPATH . 'easyparliament/member.php';
$alert = new MySociety\TheyWorkForYou\AlertView\Standard($THEUSER);
$data = $alert->display($THEUSER);
MySociety\TheyWorkForYou\Renderer::output('alert/index', $data);
コード例 #9
0
ファイル: index.php プロジェクト: udp12/theyworkforyou
<?php

include_once '../../includes/easyparliament/init.php';
$this_page = 'help';
MySociety\TheyWorkForYou\Renderer::output('static/help', array());
コード例 #10
0
ファイル: index.php プロジェクト: vijo/theyworkforyou
<?php

$new_style_template = TRUE;
include_once '../../../includes/easyparliament/init.php';
include_once INCLUDESPATH . 'easyparliament/member.php';
$alert = new MySociety\TheyWorkForYou\AlertView\Simple($THEUSER);
$data = $alert->display();
MySociety\TheyWorkForYou\Renderer::output('alert/update-mp', $data);
コード例 #11
0
function regional_list($pc, $area_type, $rep_type)
{
    $constituencies = postcode_to_constituencies($pc);
    if ($constituencies == 'CONNECTION_TIMED_OUT') {
        throw new MySociety\TheyWorkForYou\MemberException('Sorry, we couldn&rsquo;t check your postcode right now, as our postcode lookup server is under quite a lot of load.');
    } elseif (!$constituencies) {
        throw new MySociety\TheyWorkForYou\MemberException('Sorry, ' . htmlentities($pc) . ' isn&rsquo;t a known postcode');
    } elseif (!isset($constituencies[$area_type])) {
        throw new MySociety\TheyWorkForYou\MemberException(htmlentities($pc) . ' does not appear to be a valid postcode');
    }
    global $PAGE;
    $a = array_values($constituencies);
    $db = new ParlDB();
    $query_base = "SELECT member.person_id, given_name, family_name, constituency, house\n        FROM member, person_names pn\n        WHERE constituency IN ('" . join("','", $a) . "')\n            AND member.person_id = pn.person_id AND pn.type = 'name'\n            AND pn.end_date = (SELECT MAX(end_date) FROM person_names WHERE person_names.person_id = member.person_id)";
    $q = $db->query($query_base . " AND left_reason = 'still_in_office' AND house in (" . HOUSE_TYPE_NI . "," . HOUSE_TYPE_SCOTLAND . ")");
    $current = true;
    if (!$q->rows()) {
        # XXX No results implies dissolution, fix for 2011.
        $current = false;
        $q = $db->query($query_base . " AND ( (house=" . HOUSE_TYPE_NI . " AND left_house='2011-03-24') OR (house=" . HOUSE_TYPE_SCOTLAND . " AND left_house='2011-03-23') )");
    }
    $mcon = array();
    $mreg = array();
    for ($i = 0; $i < $q->rows(); $i++) {
        $house = $q->field($i, 'house');
        $pid = $q->field($i, 'person_id');
        $cons = $q->field($i, 'constituency');
        if ($house == HOUSE_TYPE_COMMONS) {
            continue;
        } elseif ($house == HOUSE_TYPE_NI) {
            $mreg[] = $q->row($i);
        } elseif ($house == HOUSE_TYPE_SCOTLAND) {
            if ($cons == $constituencies['SPC']) {
                $mcon = $q->row($i);
            } elseif ($cons == $constituencies['SPE']) {
                $mreg[] = $q->row($i);
            }
        } else {
            throw new MySociety\TheyWorkForYou\MemberException('Odd result returned!' . $house);
        }
    }
    if ($rep_type == 'msp') {
        if ($current) {
            $data['members_statement'] = '<p>You have one constituency MSP (Member of the Scottish Parliament) and multiple region MSPs.</p>';
            $data['members_statement'] .= '<p>Your <strong>constituency MSP</strong> is <a href="/msp/?p=' . $mcon['person_id'] . '">';
            $data['members_statement'] .= $mcon['given_name'] . ' ' . $mcon['family_name'] . '</a>, MSP for ' . $mcon['constituency'];
            $data['members_statement'] .= '.</p> <p>Your <strong>' . $constituencies['SPE'] . ' region MSPs</strong> are:</p>';
        } else {
            $data['members_statement'] = '<p>You had one constituency MSP (Member of the Scottish Parliament) and multiple region MSPs.</p>';
            $data['members_statement'] .= '<p>Your <strong>constituency MSP</strong> was <a href="/msp/?p=' . $mcon['person_id'] . '">';
            $data['members_statement'] .= $mcon['given_name'] . ' ' . $mcon['family_name'] . '</a>, MSP for ' . $mcon['constituency'];
            $data['members_statement'] .= '.</p> <p>Your <strong>' . $constituencies['SPE'] . ' region MSPs</strong> were:</p>';
        }
    } else {
        if ($current) {
            $data['members_statement'] = '<p>You have multiple MLAs (Members of the Legislative Assembly) who represent you in ' . $constituencies['NIE'] . '. They are:</p>';
        } else {
            $data['members_statement'] = '<p>You had multiple MLAs (Members of the Legislative Assembly) who represented you in ' . $constituencies['NIE'] . '. They were:</p>';
        }
    }
    foreach ($mreg as $reg) {
        $data['members'][] = array('url' => '/' . $rep_type . '/?p=' . $reg['person_id'], 'name' => $reg['given_name'] . ' ' . $reg['family_name']);
    }
    // Send the output for rendering
    MySociety\TheyWorkForYou\Renderer::output('mp/regional_list', $data);
}
コード例 #12
0
ファイル: index.php プロジェクト: udp12/theyworkforyou
<?php

$new_style_template = TRUE;
include_once '../../../includes/easyparliament/init.php';
include_once INCLUDESPATH . 'easyparliament/member.php';
$alert = new MySociety\TheyWorkForYou\AlertView($THEUSER);
$data = $alert->display();
MySociety\TheyWorkForYou\Renderer::output('alert/postcode', $data);
コード例 #13
0
ファイル: index.php プロジェクト: udp12/theyworkforyou
<?php

$this_page = "privacy";
include_once '../../includes/easyparliament/init.php';
MySociety\TheyWorkForYou\Renderer::output('static/privacy', array());
コード例 #14
0
<?php

/**
 * "Where to next?" Action Page
 */
include_once '../../includes/easyparliament/init.php';
MySociety\TheyWorkForYou\Renderer::output('action/where-next');
コード例 #15
0
ファイル: index.php プロジェクト: udp12/theyworkforyou
<?php

include_once '../../../includes/easyparliament/init.php';
$this_page = "linktous";
MySociety\TheyWorkForYou\Renderer::output('static/linktous', array());