Example #1
0
<?php

/**
 * List Topic Pages
 */
namespace MySociety\TheyWorkForYou;

// Disable the old PAGE class.
$new_style_template = TRUE;
// Include all the things this page needs.
include_once '../../includes/easyparliament/init.php';
// Array of topic page names (must exist in metadata.php) and titles to display.
$data['topics'] = array('topicbenefits' => 'Benefits', 'topiccrimestats' => 'Crime Statistics', 'topicnhs' => 'NHS');
// Send for rendering!
Renderer::output('topic/list', $data);
Example #2
0
            }
        } elseif ($THEUSER->postcode_is_set()) {
            $member = new Member(array('postcode' => $THEUSER->postcode(), 'house' => HOUSE_TYPE_COMMONS));
        } else {
            $data['display_postcode_form'] = true;
        }
    }
    // If a member exists then we can go and do policies
    if (isset($member)) {
        $data['member_name'] = $member->full_name();
        $data['member_id'] = $member->member_id();
        $data['member_url'] = $member->url();
        $data['member_image'] = $member->image();
        $data['member_constituency'] = $member->constituency();
        // Build the policy set
        $policies = new Policies();
        $policies = $policies->limitToSet($data['policyset']);
        // Grab extra member info
        // TODO: Shouldn't this be loaded on request?
        $member->load_extra_info();
        // Get their position on relevant policies!
        $policyPositions = new PolicyPositions($policies, $member);
        $data['positions'] = $policyPositions->positions;
        $data['sinceString'] = $policyPositions->sinceString;
    }
    // Send for rendering!
    Renderer::output('topic/topic', $data);
} else {
    header('HTTP/1.0 404 Not Found');
    Renderer::output('topic/error', array('error' => 'Sorry, but there isn&rsquo;t a topic page by that name.'));
}