Beispiel #1
0
 public function init()
 {
     $site = Sites::model()->getCurrentSite();
     //echo $site->theme;
     Yii::app()->theme = $site->theme;
     $this->site_id = $site->id;
     Yii::import('application.extensions.sesmail.*');
     require_once 'vendors/aws-sdk/sdk.class.php';
     $this->ses = new YiiSesMail();
     if (stristr($_SERVER['REQUEST_URI'], 'admin')) {
         //if(!Yii::app()->user->isSuperUser) {
         //	$this->redirect("/");
         //	exit;
         //}
         $session = new CHttpSession();
         $session->open();
         $site_id = $session['site_id'];
         // override the site_id (since switched)
         if ($site_id) {
             $this->site_id = $site_id;
         }
         $this->sites = CHtml::listData(Sites::model()->findAll(), 'id', 'name');
         $this->admin = 1;
         $this->layout = '//layouts/admin';
     } else {
         $this->isEditor = Yii::app()->user->checkAccess('admin');
         $this->niches = Offers::model()->getNiches($this->site_id);
         //$this->site_id = $site->getCurrentSite();
         //Yii::import('application.extensions.sesmail.*');
         //require_once('protected/extensions/sesmail/YiiSesMail.php');
         //require_once('vendors/aws-sdk/sdk.class.php');
         $session = new CHttpSession();
         $session->open();
         $seenOffer = $session['seenBackout'];
         if ($seenOffer) {
             $this->hideBackout = true;
         }
         Yii::import('application.modules.user.models.*');
         $this->registration_model = new RegistrationForm();
         $this->login_model = new UserLogin();
     }
     parent::init();
 }
Beispiel #2
0
 /**
  * Populate the array of site links
  * @param array[] &$list The array which holds the array of link information: loc, frequency, priority
  */
 public function populateSitemap(&$list)
 {
     $offers = Offers::model()->published()->currentSite()->findAll();
     $niches = Niches::model()->published()->currentSite()->findAll();
     // Add primary items here
     $list[] = array('loc' => $this->createAbsoluteUrl('/'), 'frequency' => 'weekly', 'priority' => '1');
     $list[] = array('loc' => $this->createAbsoluteUrl('/registration'), 'frequency' => 'yearly', 'priority' => '0.5');
     $list[] = array('loc' => $this->createAbsoluteUrl('/login'), 'frequency' => 'monthly', 'priority' => '0.5');
     $list[] = array('loc' => $this->createAbsoluteUrl('/past'), 'frequency' => 'monthly', 'priority' => '0.5');
     $list[] = array('loc' => $this->createAbsoluteUrl('/privacy.html'), 'frequency' => 'yearly', 'priority' => '0.5');
     $list[] = array('loc' => $this->createAbsoluteUrl('/offers/index'), 'frequency' => 'weekly', 'priority' => '1');
     foreach ($niches as $row) {
         $list[] = array('loc' => $this->createAbsoluteUrl('/niches/view', array('slug' => $row->name)), 'frequency' => 'weekly', 'priority' => '1');
     }
     foreach ($offers as $row) {
         $list[] = array('loc' => $this->createAbsoluteUrl('/offers/view', array('slug' => $row->slug)), 'frequency' => 'weekly', 'priority' => '1');
     }
 }
Beispiel #3
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Offers::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Beispiel #4
0
<legend>Past Deals</legend>
<p>No past deals yet.  Check back soon!</p>
<?php 
$this->beginClip('bottomoffers');
?>
        <ul class="thumbnails">    
            <?php 
$this->widget('bootstrap.widgets.TbListView', array('dataProvider' => Offers::model()->getSideOffers(null, $this->site_id, 3), 'summaryText' => false, 'emptyText' => false, 'itemView' => '//offers/_smallthumb'));
?>
        </ul>
        <div style="text-align:right;margin-right:5px;clear:both;margin-bottom:15px;">
            <a align="text-align:right;clear:both;" class="btn btn-large btn-success" href="<?php 
echo $this->createUrl('offers/');
?>
">See More <i class="icon-chevron-right icon-white"></i></a>
        </div>
<?php 
$this->endClip();