本文整理汇总了PHP中Yii::Import方法的典型用法代码示例。如果您正苦于以下问题:PHP Yii::Import方法的具体用法?PHP Yii::Import怎么用?PHP Yii::Import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yii
的用法示例。
在下文中一共展示了Yii::Import方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
Yii::Import('application.widgets.kyiv.models.*');
$dir = dirname(__FILE__) . '/assets';
$this->assetsDir = Yii::app()->assetManager->publish($dir);
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile($this->assetsDir . '/js/bootstrap.min.js');
$cs->registerScriptFile($this->assetsDir . '/js/jquery.min.js');
$cs->registerScriptFile($this->assetsDir . '/js/jquery-ui.min.js');
$cs->registerCssFile($this->assetsDir . '/css/bootstrap.css');
$this->assetsDir = Yii::app()->assetManager->publish($dir);
$events = new Event();
$events = $events->findAll();
$gr = new EventTree();
$tree = $gr->findAll("lang=:lang", array(":lang" => "ua"));
$this->render('main', array('tree' => $tree, 'events' => $events));
}
示例2: actionIndex
<?php
Yii::Import('models.form.*');
class HeaderController extends CmsController
{
// layouts
public $layout = 'webroot.themes.admin.views.admin.content_app';
// layout for this controller
// general settings
public function actionIndex()
{
$model = new Form_Headers();
$setting = array();
foreach (get_object_vars($model) as $key => $null) {
$setting[$key] = $this->loadSetting($key);
$model->{$key} = $setting[$key]->option_value;
}
if (isset($_POST['Form_Headers'])) {
$transaction = Yii::app()->db->beginTransaction();
try {
$model->attributes = $_POST['Form_Headers'];
if ($model->validate()) {
foreach (get_object_vars($model) as $key => $null) {
$setting[$key]->option_value = str_replace(Helper::rootImg('content'), '', $_POST['Form_Headers'][$key]);
if (!$setting[$key]->save()) {
throw new Exception($setting[$key]->getError('value'));
}
}
$transaction->commit();
$message = "<strong>Well done!</strong> You successfully Update Settings";
Yii::app()->user->setFlash('info', $message);