예제 #1
0
<?php

include_once '../includes/easyparliament/init.php';
$view = new MySociety\TheyWorkForYou\Homepage();
$data = $view->display();
MySociety\TheyWorkForYou\Renderer::output('index', $data);
예제 #2
0
function preview_featured()
{
    $title = get_http_var('title');
    $context = get_http_var('context');
    $url = get_http_var('url');
    $related1 = get_http_var('related1');
    $related2 = get_http_var('related2');
    $related3 = get_http_var('related3');
    $gid = $url ? get_gid_from_url($url) : NULL;
    $related_gid1 = $related1 ? get_gid_from_url($related1) : NULL;
    $related_gid2 = $related2 ? get_gid_from_url($related2) : NULL;
    $related_gid3 = $related3 ? get_gid_from_url($related3) : NULL;
    print "<h2>Preview Content</h2>";
    if ($gid !== NULL) {
        $h = new MySociety\TheyWorkForYou\Homepage();
        $featured = $h->getFeaturedDebate($gid, $title, $context, array($related_gid1, $related_gid2, $related_gid3));
        include INCLUDESPATH . 'easyparliament/templates/html/homepage/featured.php';
    } else {
        print "<p>A random debate from the last 7 days will be displayed</p>";
    }
    ?>
<style>
.confirm-panel {
    margin-left: 18px;
    margin-bottom: 2em;
}

.confirm-panel input {
    font-size: 2em;
    font-weight: bold;
}
</style>
<p><small>(Preview for content only, not look)</small></p>
<div class="confirm-panel">
    <form action="featured.php" method="POST">
        <input type="hidden" name="title" id="featured_title" value="<?php 
    echo _htmlspecialchars($title);
    ?>
"><br>
        <input type="hidden" name="context" id="featured_context" value="<?php 
    echo _htmlspecialchars($context);
    ?>
"><br>
        <input type="hidden" name="confirm" id="confirm" value="1"><br>
        <input type="hidden" name="gid" id="gid" value="<?php 
    echo $gid;
    ?>
"><br>
        <input type="hidden" name="related_gid1" id="related_gid1" value="<?php 
    echo $related_gid1;
    ?>
"><br>
        <input type="hidden" name="related_gid2" id="related_gid2" value="<?php 
    echo $related_gid2;
    ?>
"><br>
        <input type="hidden" name="related_gid3" id="related_gid3" value="<?php 
    echo $related_gid3;
    ?>
"><br>
        <span class="formw"><input name="btnaction" type="submit" value="Confirm"</span>
    </form>
</div>

<h2>Or</h2>
<?php 
}