Esempio n. 1
0
 public function __construct()
 {
     parent::__construct();
     $router = new Www_Controller_Router();
     $this->setAction($router->assemble(array(), 'contact'));
     $this->addElements(array('name' => array('type' => 'text', 'options' => array('label' => 'Your name')), 'email' => array('type' => 'text', 'options' => array('label' => 'Your email address', 'description' => 'Your email address will not be stored, and will be used solely to respond to your comments.')), 'comments' => array('type' => 'textarea', 'options' => array('label' => 'Your comments', 'rows' => 5, 'cols' => 60)), 'submit' => array('type' => 'submit', 'options' => array('label' => 'Submit', 'decorators' => array('ViewHelper')))));
 }
Esempio n. 2
0
 public function __construct()
 {
     parent::__construct();
     $router = new Www_Controller_Router();
     $this->setAction($router->assemble(array(), 'subscribe'));
     $times = array();
     for ($i = 0; $i < 24; $i++) {
         $times[$i] = sprintf('%02d:00', $i) . ' GMT';
     }
     $this->addElements(array('email' => array('type' => 'text', 'options' => array('label' => 'Your email address', 'placeholder' => 'Your email address', 'decorators' => array('ViewHelper'))), 'time' => array('type' => 'select', 'options' => array('label' => 'When would you like to receive your email updates?', 'multiOptions' => $times, 'value' => ((int) gmdate('H') + 1) % 24, 'decorators' => array('ViewHelper'))), 'name' => array('type' => 'text', 'options' => array('label' => 'Your name', 'placeholder' => 'Your name', 'decorators' => array('ViewHelper'))), 'submit' => array('type' => 'submit', 'options' => array('label' => 'Submit', 'decorators' => array('ViewHelper')))));
     foreach (Yadda_Model_Deal::$allowedSearchParams as $key => $value) {
         $this->addElement('hidden', $key, array('decorators' => array('ViewHelper')));
     }
 }
Esempio n. 3
0
<?php

include_once '../bootstrap.php';
set_time_limit(0);
$logger = Yadda_Log::getInstance();
// get base mailer URL
$config = Zend_Registry::get('config');
$router = new Www_Controller_Router();
$mailerUrl = 'http://' . $config->domain->www . $router->assemble(array(), 'mailer');
$unsubscribeUrl = 'http://' . $config->domain->www . $router->assemble(array(), 'unsubscribe');
// determine which subscriptions need to be sent
$hour = (int) gmdate('H');
$subscriptionDb = Yadda_Db_Table::getInstance('subscription');
$select = $subscriptionDb->select()->setIntegrityCheck(false)->from('subscription')->joinLeft('user', 'subscription.user_id = user.id', array('user_email' => 'email'))->where('subscription.status = ?', 'active')->where('user.status = ?', 'active')->where('subscription.hour = ?', $hour)->order('id');
$subscriptions = $subscriptionDb->fetchAll($select);
$since = gmdate('Y-m-d\\TH:00:00\\Z', strtotime('-24 hour'));
foreach ($subscriptions as $subscription) {
    $logger->log('Subscription #' . $subscription->id, Zend_Log::DEBUG);
    // run the search
    $params = array('query' => $subscription->query, 'region' => $subscription->region_id, 'price' => $subscription->price, 'since' => $since, 'count' => 10);
    try {
        $result = Yadda_Model_Deal::search($params);
    } catch (Yadda_Model_Exception $e) {
        $logger->log('Error while searching: ' . $e->getMessage(), Zend_Log::ERR);
        $logger->log('Skipping...', Zend_Log::ERR);
        continue;
    }
    $total = $result['total'];
    $logger->log('Found ' . $total . ' result(s)', Zend_Log::DEBUG);
    if ($total == 0) {
        continue;