public function executeFeature()
 {
     $title = trim(StoreTable::value(StoreTable::PORTAL_HOME_TITLE, ''));
     $this->title = $title ? $title : 'Featured action';
     $markup = trim(StoreTable::value(StoreTable::PORTAL_HOME_MARKUP, ''));
     if ($markup) {
         $markup = preg_replace_callback('/#KEYVISUAL-(\\d+)#/', array($this, 'getKeyvisualUrl'), $markup);
         $markup = preg_replace('/#WIDGET-(\\d+)#/', 'PasjhkX\\1KmsownedS', $markup);
         // prevent markdown messing up widget
         $markup = UtilMarkdown::transform($markup, true, true);
         $this->markup = preg_replace_callback('/PasjhkX(\\d+)KmsownedS/', array('UtilWidget', 'renderWidget'), $markup);
         return;
     }
     $id = PetitionTable::getInstance()->createQuery('p')->where('p.status = ?', Petition::STATUS_ACTIVE)->andWhere('p.homepage = 1')->leftJoin('p.Campaign c')->andWhere('c.status = ?', CampaignTable::STATUS_ACTIVE)->leftJoin('p.PetitionText pt')->andWhere('pt.status = ?', PetitionText::STATUS_ACTIVE)->andWhere('pt.language_id = ?', 'en')->leftJoin('pt.DefaultWidget w')->andWhere('w.status = ?', Widget::STATUS_ACTIVE)->select('p.id')->addSelect('(SELECT count(z.id) FROM PetitionSigning z WHERE DATE_SUB(NOW(),INTERVAL 1 DAY) <= z.created_at  and z.petition_id = p.id and z.status = ' . PetitionSigning::STATUS_VERIFIED . ') as signings24')->limit(1)->orderBy('signings24 DESC, p.id ASC')->fetchArray();
     if ($id) {
         $id = $id[0]['id'];
         $petition = PetitionTable::getInstance()->createQuery('p')->where('p.id = ?', $id)->andWhere('p.status = ?', Petition::STATUS_ACTIVE)->andWhere('p.homepage = 1')->leftJoin('p.Campaign c')->andWhere('c.status = ?', CampaignTable::STATUS_ACTIVE)->leftJoin('p.PetitionText pt')->andWhere('pt.status = ?', PetitionText::STATUS_ACTIVE)->andWhere('pt.language_id = ?', 'en')->leftJoin('pt.DefaultWidget w')->andWhere('w.status = ?', Widget::STATUS_ACTIVE)->select('p.name, p.object_version, p.kind, p.language_id, p.twitter_tags, p.key_visual, p.read_more_url, pt.id, pt.object_version, pt.title, pt.target, pt.body, pt.footer, pt.email_subject, pt.email_body, w.id, w.object_version, w.title, w.target, w.intro, w.footer, w.email_subject, w.email_body, w.stylings')->fetchOne();
         if ($petition) {
             /* @var $petition Petition */
             $text = $petition['PetitionText'][0];
             $widget = $text['DefaultWidget'];
             $url = $this->generateUrl('sign_hp', array('id' => $widget['id'], 'hash' => $widget->getLastHash(true)), true);
             $this->count = $petition->getCount(60);
             $this->target = $this->count . '-' . Petition::calcTarget($this->count, $petition->getTargetNum());
             $this->widget_id = $widget['id'];
             $this->stylings = json_decode($widget->getStylings(), true);
             $this->stylings['type'] = 'embed';
             $this->stylings['url'] = $url;
             $this->stylings['width'] = 'auto';
         }
     }
 }
 protected function doSave($con = null)
 {
     $stats = $this->getValue('stats');
     if (is_array($stats)) {
         foreach ($this->getObject()->getWidgetOwner() as $widget_owner) {
             /* @var $widget_owner WidgetOwner */
             if (array_key_exists($widget_owner->getId(), $stats)) {
                 $new_stat = $stats[$widget_owner->getId()];
                 if (array_key_exists($new_stat, Owner::$STATUS_SHOW) && $new_stat != $widget_owner->getStatus()) {
                     $widget_owner->setStatus($new_stat);
                 }
             }
         }
     }
     parent::doSave($con);
     if ($this->getValue('send_email')) {
         list($subject, $body) = DefaultText::fetchText(DefaultText::TEXT_AGREEMENT_REPLY);
         $body = UtilMarkdown::transform($body);
         $owner = $this->getObject();
         UtilMail::send(null, null, array($owner->getEmail() => $owner->getFirstname() . ' ' . $owner->getLastname()), $subject, $body, 'text/html');
     }
 }
<div class="page-header">
  <h1><?php 
echo $imprint_title;
?>
</h1>
</div>
<?php 
echo UtilMarkdown::transform($sf_data->getRaw('imprint_content'), true, true);
示例#4
0
$orga = $data_owner ? $data_owner->getOrganisation() : '';
$name = $data_owner ? $data_owner->getFullName() : '';
$street = $data_owner ? $data_owner->getStreet() : '';
$postcode = $data_owner ? $data_owner->getPostCode() : '';
$city = $data_owner ? $data_owner->getCity() : '';
$country = $data_owner ? $data_owner->getCountry() : '';
if ($country) {
    $country = format_country($country);
}
$address = $orga . ($orga ? "<br />" : '');
$address .= $name . ($name ? "<br />" : '');
$address .= $street . ($street ? "<br />" : '');
$address .= $postcode . ' ' . $city . ($postcode || $city ? "<br />" : '');
$address .= $country . ($country ? "<br />" : '');
$privacy_policy = strtr($privacy_policy, array('#DATA-OFFICER-NAME#' => $name, '#DATA-OFFICER-ORGA#' => $orga, '#DATA-OFFICER-EMAIL#' => $data_owner ? $data_owner->getEmailAddress() : '', '#DATA-OFFICER-WEBSITE#' => $data_owner ? $data_owner->getWebsite() : '', '#DATA-OFFICER-PHONE#' => $data_owner ? $data_owner->getPhone() : '', '#DATA-OFFICER-MOBILE#' => $data_owner ? $data_owner->getMobile() : '', '#DATA-OFFICER-STREET#' => $street, '#DATA-OFFICER-POST-CODE#' => $postcode, '#DATA-OFFICER-CITY#' => $city, '#DATA-OFFICER-COUNTRY#' => $country, '#DATA-OFFICER-ADDRESS#' => $address));
echo UtilMarkdown::transform($privacy_policy);
?>
                            </div>
                        </div>
                        <a class="back button_color button_btn"><?php 
echo __('Back');
?>
</a>
                    </div>
                    <?php 
if (!$form_embed->isOneSide()) {
    ?>
                      <div id="embed_this_left" class="embed_this">
                          <h1 id="embed_h1"><?php 
    echo __('Customise your widget');
    ?>
示例#5
0
<?php

use_helper('Text');
$title = Util::enc($widget['title'] ? $widget['title'] : $text['title']);
if (in_array($petition['kind'], Petition::$EMAIL_KINDS, false)) {
    $body = Util::enc($widget['email_subject'] ? $widget['email_subject'] : $text['email_subject']) . ', ';
    $body .= Util::enc($widget['email_body'] ? $widget['email_body'] : $text['email_body']);
} else {
    $body = UtilMarkdown::transform(($widget['intro'] ? $widget['intro'] . " \n\n" : '') . $text['body']);
}
?>
<div class="row">
  <div class="span1"><?php 
if ($petition['key_visual']) {
    ?>
<img class="home_teaser" src="<?php 
    echo image_path('keyvisual/' . $petition['key_visual']);
    ?>
" alt="" /><?php 
} else {
    ?>
<div>&nbsp;</div><?php 
}
?>
</div>
  <div class="span3">
    <p><b><?php 
echo $title;
?>
</b> <?php 
echo truncate_text(strip_tags($body), 120);
示例#6
0
?>
      <?php 
echo UtilMarkdown::transform($petition_text->getPledgeExplantoryAnnotation());
?>
    </form>
    <?php 
if ($show_thankyou) {
    ?>
      <div class="modal hide modal_show" id="pledge_done_modal">
        <div class="modal-header">
          <a class="close" data-dismiss="modal">&times;</a>
          <h3><?php 
    echo __('Thank you');
    ?>
</h3>
        </div>
        <div class="modal-body">
          <?php 
    echo UtilMarkdown::transform($petition_text->getPledgeThankYou());
    ?>
        </div>
        <div class="modal-footer">
          <a class="btn" data-dismiss="modal">OK</a>
        </div>
      </div>
    <?php 
}
?>
    <div id="waiting"><b></b><i></i><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>
  </body>
</html>
示例#7
0
        <label><?php 
        echo __('Subject');
        ?>
</label>
        <input type="text" id="petition_signing_email_subject_copy" />
      </div>
      <div>
        <label><?php 
        echo __('Email body');
        ?>
</label>
        <textarea id="petition_signing_email_body_copy" cols="10" rows="10"></textarea>
      </div>
    </form>
    <?php 
    }
} else {
    ?>
  <div class="scroll"><div id="petition_text">
      <?php 
    $markdown = array();
    foreach (array('intro', 'body', 'footer') as $field) {
        $value = $widget_texts && isset($widget[$field]) ? $widget[$field] : $petition_text[$field];
        $markdown[] = $value;
    }
    echo trim(UtilMarkdown::transform(implode("\n\n", $markdown)), "\n") . "\n";
    ?>
    </div>
  </div>
<?php 
}
示例#8
0
<div class="page-header">
  <h1><?php 
echo $terms_title;
?>
</h1>
</div>
<?php 
echo UtilMarkdown::transform($sf_data->getRaw('terms_content'));
示例#9
0
  <channel>
    <title>policat.org - recent petitions</title>
    <link><?php 
echo url_for('homepage', array(), true);
?>
</link>
    <?php 
use_helper('Text');
foreach ($petitions as $petition) {
    $text = $petition['PetitionText'][0];
    $widget = $text['DefaultWidget'];
    $title = Util::enc($widget['title'] ? $widget['title'] : $text['title']);
    if (in_array($petition['kind'], Petition::$EMAIL_KINDS, true)) {
        $body = Util::enc(($widget['email_subject'] ? $widget['email_subject'] : $text['email_subject']) . ($widget['email_body'] ? $widget['email_body'] : $text['email_body']));
    } else {
        $body = UtilMarkdown::transform(($widget['intro'] ? $widget['intro'] . " \n\n" : '') . $text['body'] . ($widget['footer'] ? " \n\n" . $widget['footer'] : ''));
    }
    ?>
      <item>
        <title><?php 
    echo $title;
    ?>
</title>
        <description><?php 
    echo strip_tags($body);
    ?>
</description>
        <link><?php 
    echo $petition['read_more_url'];
    ?>
</link>