PHP Method Yii::Import Code Examples

This page contains top rated real world PHP examples of method Yii::Import extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: Kyiv.php Project: snipesn/UkrYama-2
0
 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));
 }
Example #2
Show file File: HeaderController.php Project: beckblurry/Yii1-Base-Core-V.Alpha.1
0
<?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);