Example #1
0
function list_reps($type, $rep_plural, $search_sidebar)
{
    global $this_page, $PAGE, $DATA;
    $this_page = $type;
    $args = array();
    if ($type == 'peers') {
        $args['order'] = 'name';
    }
    $date = get_http_var('date');
    if ($date) {
        $date = parse_date($date);
        if ($date) {
            $DATA->set_page_metadata($this_page, 'title', $rep_plural . ', as on ' . format_date($date['iso'], LONGDATEFORMAT));
            $args['date'] = $date['iso'];
        }
    } elseif (get_http_var('all')) {
        $DATA->set_page_metadata($this_page, 'title', 'All ' . $rep_plural . ', including former ones');
        $args['all'] = true;
    } else {
        $DATA->set_page_metadata($this_page, 'title', 'All ' . $rep_plural);
    }
    if (get_http_var('f') != 'csv') {
        $PAGE->page_start();
        $PAGE->stripe_start();
        $format = 'html';
    } else {
        $format = 'csv';
    }
    $order = get_http_var('o');
    $orders = array('n' => 'name', 'f' => 'given_name', 'l' => 'family_name', 'c' => 'constituency', 'p' => 'party', 'd' => 'debates');
    if (array_key_exists($order, $orders)) {
        $args['order'] = $orders[$order];
    }
    $PEOPLE = new PEOPLE();
    $PEOPLE->display($type, $args, $format);
    if (get_http_var('f') != 'csv') {
        $PAGE->stripe_end(array(array('type' => 'include', 'content' => 'minisurvey'), array('type' => 'include', 'content' => 'people'), array('type' => 'include', 'content' => $search_sidebar)));
        $PAGE->page_end();
    }
}
Example #2
0
include_once "../../includes/easyparliament/init.php";
include_once INCLUDESPATH . "easyparliament/people.php";
$this_page = 'peers';
$args = array('order' => 'name');
if (get_http_var('all')) {
    $DATA->set_page_metadata($this_page, 'title', 'All Peers, including former ones');
    $args['all'] = true;
}
if (get_http_var('f') != 'csv') {
    $PAGE->page_start();
    $PAGE->stripe_start();
    $format = 'html';
} else {
    $format = 'csv';
}
if (get_http_var('o') == 'n') {
    $args['order'] = 'name';
} elseif (get_http_var('o') == 'p') {
    $args['order'] = 'party';
} elseif (get_http_var('o') == 'c') {
    $args['order'] = 'constituency';
} elseif (get_http_var('o') == 'd') {
    $args['order'] = 'debates';
}
$PEOPLE = new PEOPLE();
$PEOPLE->display('peers', $args, $format);
if (get_http_var('f') != 'csv') {
    $PAGE->stripe_end(array(array('type' => 'include', 'content' => 'people'), array('type' => 'include', 'content' => 'peer_search')));
    $PAGE->page_end();
}
Example #3
0
function display_form($details = array(), $errors = array())
{
    global $this_page, $ALERT, $PAGE, $THEUSER;
    $ACTIONURL = new URL($this_page);
    $ACTIONURL->reset();
    ?>

<p>This page allows you to request an email alert from OpenAustralia.org.</p>

<?php 
    if (!get_http_var('only')) {
        ?>
<ul>
<li>To receive an alert <strong>every time a particular person appears</strong>,
select their name from the drop-down list and
leave the word/phrase box blank.</li>

<li>To receive an alert <strong>every time a particular keyword or phrase appears</strong>,
select "Any Representative or Senator" from the drop-down list, and enter your search term in
the box underneath.  The results are selected using the same rules as for a
normal search (see the box to the right for help on setting your criteria).</li>

<li>You can also <strong>combine</strong> both types of criteria to be alerted
<strong>only</strong> when a particular person uses the keywords you have defined.
To do this, select the person from the drop-down list <em>and</em> enter the keyword(s) as
above.</li>
</ul>

<p>Please note that you should only enter one topic per alert - if you wish to receive alerts on more than one topic, or for more than one person, simply fill in this form as many times as you need.</p>
<?php 
    }
    ?>

	<form method="post" action="<?php 
    echo $ACTIONURL->generate();
    ?>
">
	
	<?php 
    if (!$THEUSER->loggedin()) {
        if (isset($errors["email"]) && (get_http_var('submitted') || get_http_var('only'))) {
            $PAGE->error_message($errors["email"]);
        }
        ?>
				<div class="row">
				<span class="label"><label for="email">Your email address:</label></span>
				<span class="formw"><input type="text" name="email" id="email" value="<?php 
        if (isset($details["email"])) {
            echo htmlentities($details["email"]);
        }
        ?>
" maxlength="255" size="30" class="form"></span>
				</div>
	<?php 
    }
    if (!get_http_var('only') || !$details['keyword']) {
        if (isset($errors['pid'])) {
            $PAGE->error_message($errors['pid']);
        }
        ?>
				<div class="row">
				<span class="label"><label for="pid">Person you wish to receive alerts for:</label></span>
				<span class="formw"><?php 
        if (get_http_var('only') && $details['pid']) {
            $MEMBER = new MEMBER(array('person_id' => $details['pid']));
            print $MEMBER->full_name();
            print '<input type="hidden" name="pid" value="' . htmlspecialchars($details['pid']) . '">';
        } else {
            ?>
<select name="pid">
				<option value="Any">Any Representative or Senator</option>
				<?php 
            // Get a list of MPs/Lords for displaying in the form using the PEOPLE class
            $LIST = new PEOPLE();
            $args['order'] = 'last_name';
            if ($details['pid']) {
                $args['pid'] = $details['pid'];
            }
            $LIST->listoptions($args);
            ?>
				</select>
			<?php 
        }
        ?>
				</span>
				</div>
	<?php 
    }
    if (!get_http_var('only') || !$details['pid']) {
        if (isset($errors["keyword"])) {
            $PAGE->error_message($errors["keyword"]);
        }
        ?>
				<div class="row"> 
				<span class="label"><label for="keyword">Word or phrase you wish to receive alerts for:</label></span>
				<span class="formw"><input type="text" name="keyword" id="keyword" value="<?php 
        if ($details['keyword']) {
            echo htmlentities($details['keyword']);
        }
        ?>
" maxlength="255" size="30" class="form"></span>
				</div>
	<?php 
    }
    $submittext = "Request Email Alert";
    ?>
						
				<div class="row">
				<span class="label">&nbsp;</span>
				<span class="formw"><input type="submit" class="submit" value="<?php 
    echo $submittext;
    ?>
"><!-- this space makes the submit button appear on Mac IE 5! --> </span>
				</div>
	<?php 
    if (!$THEUSER->loggedin()) {
        ?>
				<div class="row">
				If you join or log in, you won't need to confirm your email address for every alert you set.
				</div>
	<?php 
    }
    if (get_http_var('sign')) {
        echo '<input type="hidden" name="sign" value="' . htmlspecialchars(get_http_var('sign')) . '">';
    }
    if (get_http_var('site')) {
        echo '<input type="hidden" name="site" value="' . htmlspecialchars(get_http_var('site')) . '">';
    }
    // MJ OA-437 Recommendations
    if (get_http_var('r')) {
        echo '<input type="hidden" name="r" value="' . htmlspecialchars(get_http_var('r')) . '">';
    }
    echo '<input type="hidden" name="submitted" value="true"> </form>';
}
Example #4
0
include_once "../../includes/easyparliament/init.php";
include_once INCLUDESPATH . "easyparliament/people.php";
$this_page = 'mlas';
$args = array();
if (get_http_var('all')) {
    $DATA->set_page_metadata($this_page, 'title', 'All MLAs, including former ones');
    $args['all'] = true;
}
if (get_http_var('f') != 'csv') {
    $PAGE->page_start();
    $PAGE->stripe_start();
    $format = 'html';
} else {
    $format = 'csv';
}
if (get_http_var('o') == 'f') {
    $args['order'] = 'first_name';
} elseif (get_http_var('o') == 'l') {
    $args['order'] = 'last_name';
} elseif (get_http_var('o') == 'c') {
    $args['order'] = 'constituency';
} elseif (get_http_var('o') == 'p') {
    $args['order'] = 'party';
}
$PEOPLE = new PEOPLE();
$PEOPLE->display('mlas', $args, $format);
if (get_http_var('f') != 'csv') {
    $PAGE->stripe_end(array(array('type' => 'include', 'content' => 'people'), array('type' => 'include', 'content' => 'mla_search')));
    $PAGE->page_end();
}