Exemplo n.º 1
0
 public function testBanner()
 {
     $banner = new MySociety\TheyWorkForYou\Model\Banner();
     $banner->set_text('');
     $page = $this->fetch_page(array('url' => '/'));
     $this->assertNotContains('This is a banner', $page);
     $banner->set_text('This is a banner');
     $page = $this->fetch_page(array('url' => '/'));
     $this->assertContains('This is a banner', $page);
     $banner->set_text('');
     $page = $this->fetch_page(array('url' => '/'));
     $this->assertNotContains('This is a banner', $page);
 }
Exemplo n.º 2
0
    public function page_body()
    {
        global $this_page;
        $banner = new MySociety\TheyWorkForYou\Model\Banner();
        $banner_text = $banner->get_text();
        // Start the body, put in the page headings.
        ?>
<body>

<?php 
        if ($banner_text) {
            ?>
<div id="surveyPromoBanner" style="clear:both;padding:1em;margin-top:24px;background:#DDD;">
<?php 
            echo $banner_text;
            ?>
</div>
<?php 
        }
        ?>


<div id="fb-root"></div>
<script>
window.fbAsyncInit = function () {
    FB.init({
    appId      : '227648394066332',
    xfbml      : true
    });

    FB.Event.subscribe('edge.create', function (targetUrl) {
        ga('send', 'social', 'facebook', 'like', targetUrl);
    });

    FB.Event.subscribe('edge.remove', function (targetUrl) {
        ga('send', 'social', 'facebook', 'unlike', targetUrl);
    });

};

(function (d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_GB/all.js";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>

<div id="container">
<?php 
        twfy_debug("PAGE", "This page: {$this_page}");
        print "\t<a name=\"top\"></a>\n\n";
        if (defined('OPTION_GAZE_URL') && OPTION_GAZE_URL) {
            $country = gaze_get_country_from_ip($_SERVER["REMOTE_ADDR"]);
            if (get_http_var('country')) {
                $country = strtoupper(get_http_var('country'));
            }
            if ($country == 'NZ') {
                print '<p class="informational banner">You&rsquo;re in New Zealand, so check out <a href="http://www.theyworkforyou.co.nz">TheyWorkForYou.co.nz</a></p>';
            } elseif ($country == 'AU') {
                print '<p class="informational banner">You&rsquo;re in Australia, so check out <a href="http://www.openaustralia.org">OpenAustralia</a>, a TheyWorkForYou for down under</p>';
            } elseif ($country == 'IE') {
                print '<p class="informational banner">Check out <a href="http://www.kildarestreet.com/">KildareStreet</a>, a TheyWorkForYou for the Houses of the Oireachtas</p>';
            } elseif ($country == 'CA') {
                print '<p class="informational banner">Check out <a href="http://www.openparliament.ca/">OpenParliament.ca</a></p>';
            } elseif ($this_page != 'overview') {
                #print '<p class="informational banner"><a href="http://election.theyworkforyou.com/">Find out what your candidates said on local and national issues in our quiz</a></p>';
            }
        }
        # # 2009-01 interstitial
        # include INCLUDESPATH . '../docs/foiorder2009/fns.php';
        # echo '<div id="everypage" style="display:none">
        # <p style="float:right"><a href="#top" onclick="$.cookie(\'seen_foi2\', 1, { expires: 7, path: \'/\' }); $(\'#everypage\').hide(\'slow\'); return false;">Close</a></p>
        # <h2>Blimey. It looks like the Internets won &ndash; <small>a message from TheyWorkForYou</small></h2>
        # <p>Sorry to interrupt, but we thought you&rsquo;d like to know that <strong>you won</strong>!';
        # echo $foi2009_message;
        # echo '<p align="right"><a href="#top" onclick="$.cookie(\'seen_foi2\', 1, { expires: 7, path: \'/\' }); $(\'#everypage\').hide(\'slow\'); return false;">Close</a></p>
        # </div>';
        $this->mysociety_bar();
        $this->title_bar();
        $this->menu();
    }