本文整理汇总了PHP中Export::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Export::model方法的具体用法?PHP Export::model怎么用?PHP Export::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Export
的用法示例。
在下文中一共展示了Export::model方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadModel
/**
* @param $id
* @return Export
* @throws CHttpException
*/
public function loadModel($id)
{
$model = Export::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, Yii::t('YmlModule.default', 'Page not found!'));
}
return $model;
}
示例2: actionView
public function actionView($id)
{
$model = Export::model()->findByPk($id);
if (false === $model) {
throw new CHttpException(404);
}
$criteria = new CDbCriteria();
$criteria->compare('t.status', Product::STATUS_ACTIVE);
if (!empty($model->categories)) {
$criteria->addInCondition('t.category_id', (array) $model->categories);
}
if (!empty($model->brands)) {
$criteria->addInCondition('t.producer_id', (array) $model->brands);
}
$dataProvider = new CActiveDataProvider('Product', ['criteria' => $criteria]);
$offers = new CDataProviderIterator($dataProvider, 100);
ContentType::setHeader(ContentType::TYPE_XML);
$this->renderPartial('view', ['model' => $model, 'currencies' => Yii::app()->getModule('store')->getCurrencyList(), 'categories' => StoreCategory::model()->published()->findAll(), 'offers' => $offers]);
}
示例3: actionView
public function actionView($id)
{
/* @var $model Export */
$model = Export::model()->findByPk($id);
if (!$model) {
throw new CHttpException(404);
}
$cacheKey = $this->cacheKey . $model->id;
if (!($xml = Yii::app()->getCache()->get($cacheKey))) {
$xml = $this->getXmlHead();
$xml .= CHtml::openTag('yml_catalog', ['date' => date('Y-m-d H:i')]);
$xml .= CHtml::openTag('shop');
$xml .= $this->getShopInfo($model->shop_name, $model->shop_company, $model->shop_url ?: Yii::app()->getBaseUrl(true), $model->shop_platform, $model->shop_version, $model->shop_agency, $model->shop_email, $model->shop_cpa);
$xml .= $this->getCurrenciesElement([['id' => 'RUR', 'rate' => 1]]);
$xml .= $this->getCategoriesElement();
$xml .= $this->getOffersElement($model->categories, $model->brands);
$xml .= CHtml::closeTag('shop');
$xml .= CHtml::closeTag('yml_catalog');
Yii::app()->getCache()->set($cacheKey, $xml, 60 * 60);
}
header("Content-type: text/xml");
echo $xml;
Yii::app()->end();
}