コード例 #1
0
ファイル: SiteController.php プロジェクト: jwerd/coupon
 /**
  * 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');
     }
 }
コード例 #2
0
ファイル: NichesController.php プロジェクト: jwerd/coupon
 /**
  * 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=Niches::model()->findByPk($id);
     $model = Niches::model()->find('LOWER(name) = :slug', array(':slug' => strtolower($id)));
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #3
0
ファイル: Offers.php プロジェクト: jwerd/coupon
 public function getNiches($site_id)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'site_id = :site_id';
     $criteria->params = array(':site_id' => $site_id);
     $criteria->order = 'name';
     $niches = CHtml::listData(Niches::model()->findAll($criteria), 'id', 'name');
     return $niches;
 }