当前位置: 首页>>代码示例>>PHP>>正文


PHP Sites::model方法代码示例

本文整理汇总了PHP中Sites::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Sites::model方法的具体用法?PHP Sites::model怎么用?PHP Sites::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sites的用法示例。


在下文中一共展示了Sites::model方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeFind

 public function beforeFind()
 {
     $attrs = $this->attributeLabels();
     if ($this->tableName() != "sites") {
         if (@$attrs['site_id']) {
             $this->getDbCriteria()->mergeWith(array('alias' => 't', 'condition' => "t.site_id=" . (int) Sites::model()->getCurrentSite()->id));
         }
     }
     //var_dump($this->dbCriteria);
     parent::beforeFind();
 }
开发者ID:jwerd,项目名称:coupon,代码行数:11,代码来源:MasterActiveRecord.php

示例2: init

 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();
 }
开发者ID:jwerd,项目名称:coupon,代码行数:43,代码来源:Controller.php

示例3: loadModel

 /**
  * 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 = Sites::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:jwerd,项目名称:coupon,代码行数:13,代码来源:SitesController.php

示例4: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     if (@$_GET['term']) {
         //$this->title = CHtml::encode($_GET['term']);
         $criteria->addSearchCondition('title', CHtml::encode($_GET['term']));
         $criteria->addSearchCondition('slug', CHtml::encode($_GET['term']));
         //$this->url   = CHtml::encode($_GET['term']);
         //$this->slug  = CHtml::encode($_GET['term']);
     }
     $criteria->compare('site_id', (int) Sites::model()->getCurrentSite()->id);
     $criteria->compare('id', $this->id);
     $criteria->compare('title', $this->title, true);
     $criteria->compare('description', $this->description, true);
     $criteria->compare('featured', $this->featured);
     $criteria->compare('taken_count', $this->taken_count);
     $criteria->compare('taken_max', $this->taken_max);
     $criteria->compare('slug', $this->slug, true);
     $criteria->compare('url', $this->url, true);
     $criteria->compare('our_price', $this->our_price, true);
     $criteria->compare('regular_price', $this->regular_price, true);
     $criteria->compare('valid_from', $this->valid_from, true);
     $criteria->compare('valid_to', $this->valid_to, true);
     $criteria->compare('created', $this->created, true);
     $criteria->compare('updated', $this->updated, true);
     return new CActiveDataProvider($this, array('criteria' => $criteria));
 }
开发者ID:jwerd,项目名称:coupon,代码行数:33,代码来源:Offers.php

示例5: getAllSites

 public function getAllSites()
 {
     $sites = CHtml::listData(Sites::model()->findAll(), 'id', 'name');
     return $sites;
 }
开发者ID:jwerd,项目名称:coupon,代码行数:5,代码来源:Sites.php

示例6: array

	<?php 
echo $form->errorSummary($model);
?>


	<?php 
echo $form->textFieldRow($model, 'name', array('class' => 'span5', 'maxlength' => 255));
?>


	<?php 
echo $form->label($model, 'site_id');
?>

	<?php 
echo $form->dropDownList($model, 'site_id', Sites::model()->getAllSites());
?>
<br />
	
	<div class="form-actions">
		<?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => $model->isNewRecord ? 'Create' : 'Save'));
?>

	</div>

<?php 
$this->endWidget();
?>

开发者ID:jwerd,项目名称:coupon,代码行数:29,代码来源:_form.php

示例7: scopes

 public function scopes()
 {
     return array('published' => array('condition' => 'published = 1'), 'currentSite' => array('condition' => 'site_id = :siteId', 'params' => array(':siteId' => (int) Sites::model()->getCurrentSite()->id)));
 }
开发者ID:jwerd,项目名称:coupon,代码行数:4,代码来源:Niches.php


注:本文中的Sites::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。