public function actionSave(array $attributes) { if (isset($attributes['id']) && $attributes['id']) { $this->actionGet($attributes['id']); if (!is_object($this->result)) { return; } $model = $this->result; } else { $model = new SettingParam(); } $model->attributes = $attributes; $model->value = CHtml::decode($model->value); $isNew = !$model->id; if (!$model->save()) { errorHandler()->log(new XException($model, 0)); } else { //remove user custom setting if (!$model->customizable) { UserSetting::model()->deleteAllByAttributes(array('param_name' => $model->name)); } //rebuild cache Constant Settings class Yii::app()->XService->run('Xpress.Settings.db2php', array('module' => $model->module)); } $this->result = $model; }
/** * Format money * @param type $currency * @param type $amount * @param type $decimals * @param type $symbol */ public function formatMoney($currency, $amount, $decimals = 2, $symbol = true) { $amount = number_format($amount, $decimals); if ($symbol) { $currency = $this->getSymbol($currency); } return CHtml::decode($currency . $amount); }
public static function PrintPosterName($name, $groupId) { $html = null; switch ($groupId) { case Admin::USER_GROUP_ID: case SuperAdmin::USER_GROUP_ID: $html .= CHtml::decode($name . " <span class='admin'>(Admin)</span>"); break; case CollegeAdmin::USER_GROUP_ID: $html .= CHtml::encode($name . " <span class='college_admin'>(College Admin)</span>"); break; default: $html .= CHtml::encode($name); break; } return $html; }
public static function buildTreePages($parentId, $depth = 0) { /*if ($depth == 2) { return array(); }*/ $sub = self::model(); $sub = $sub->findAll(array('condition' => "parentId=:parentId", 'params' => array('parentId' => $parentId), 'order' => 't.number')); if (!count($sub)) { return array(); } $treePages = array(); foreach ($sub as $v) { $children = self::buildTreePages($v->id, $depth + 1); $treePages[] = array('id' => $v->id, 'attr' => array('pid' => $v->id, 'class' => $v->active ? 'jstree-checked' : '', 'special' => $v->special, 'level' => $depth + 1), 'data' => CHtml::decode($v->getTitle()), 'state' => count($children) ? 'open' : null, 'children' => $children); } return $treePages; }
<?php if ($news) { foreach ($news as $n) { $d = strtotime($n->date); $time = Yii::app()->dateFormatter->formatDateTime($d, null, "short"); $date = Yii::app()->dateFormatter->formatDateTime($d, "medium", null); echo '<div class="post clearfix">'; echo '<div class="title clearfix">'; echo '<time>' . $date . ($time != "0:00" ? " в " . $time : "") . "</time>"; echo CHTml::link(stripslashes($n->title), array("/news/news/show", "title" => $n->alias)); echo "</div>"; echo "<div class=\"content\">" . CHtml::decode(stripslashes($n->short_text)) . "</div>"; echo "</div>"; } } else { echo "<h1>По данному запросу ничего не найдено</h1>"; }
<div class="media-body well"> <div class="forum-text-area"> <?php if ($data['child_reply']) { ?> <?php $childReply = Reply::model()->getChildReplyPosting($data['child_reply']); $this->widget('bootstrap.widgets.TbBox', array('title' => "In reply to <a href='#'>" . PostHelper::PrintPosterName($childReply['username'], $childReply['user_group_id']) . "</a>", 'headerIcon' => 'icon-arrow-left', 'content' => $childReply['is_active'] ? CHtml::decode($childReply['message']) : PostHelper::PrintDisabledMessage())); ?> <?php } ?> <?php echo $data['is_active'] ? CHtml::decode($data['message']) : PostHelper::PrintDisabledMessage(); ?> </div> <?php if ($data['is_active']) { ?> <div class="forum-post-bottom-bar"> <?php echo CHtml::link("<i class='icon-warning-sign'></i>" . Yii::t('forum', 'forum.view.report'), array('post/report', 'id' => $data['id']), array('class' => 'forum-report pull-right')); ?> <?php echo CHtml::hiddenField('reply_id', $data['id']); echo CHtml::link(Yii::t('forum', 'forum.view.reply'), '#', array('class' => 'forum-reply pull-right')); ?>
<?php /* @var $this CaptionController */ /* @var $data Caption */ ?> <div class="view"> <b><?php echo CHtml::encode($data->getAttributeLabel('content')); ?> :</b> <?php echo CHtml::link(CHtml::decode($data->content), array('view', 'id' => $data->id, 'slide_id' => $this->slide->id)); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('t')); ?> :</b> <?php echo CHtml::encode($data->t); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('t2')); ?> :</b> <?php
/** * Searching for patients. * * @param string $term search term */ public function search($term) { $search_terms = $this->parseTerm($term); $model = new Patient(); $model->hos_num = $search_terms['hos_num']; $model->nhs_num = $search_terms['nhs_num']; // Get the valuse from URL $currentPage = Yii::app()->request->getParam('Patient_page'); $pageSize = Yii::app()->request->getParam('pageSize', 20); // if no GET param we try to fetch the value from the $criteria, default value 0 is none of them set $sortDir = Yii::app()->request->getParam('sort_dir', 0); $sortDir = $sortDir == 0 || $sortDir == 'asc' ? 'asc' : 'desc'; $sortBy = Yii::app()->request->getParam('sort_by'); switch ($sortBy) { case 0: $sortBy = 'hos_num*1'; break; case 1: $sortBy = 'title'; break; case 2: $sortBy = 'first_name'; break; case 3: $sortBy = 'last_name'; break; case 4: $sortBy = 'dob'; break; case 5: $sortBy = 'gender'; break; case 6: $sortBy = 'nhs_num*1'; break; default: $sortBy = 'hos_num*1'; } $patientCriteria = array('pageSize' => $pageSize, 'sortBy' => $sortBy, 'sortDir' => $sortDir, 'currentPage' => $currentPage, 'first_name' => CHtml::decode($search_terms['first_name']), 'last_name' => CHtml::decode($search_terms['last_name'])); $dataProvider = $model->search($patientCriteria); return $dataProvider; }
<?php /** * Вьюшка деталей записи системного лога */ /** * @author Craft-Soft Team * @package CS:Bans * @version 1.4.0 * @copyright (C)2016 Craft-Soft.ru. Все права защищены. * @link http://craft-soft.ru/ * @license http://creativecommons.org/licenses/by-nc-sa/4.0/deed.ru «Attribution-NonCommercial-ShareAlike» */ $this->pageTitle = Yii::app()->name . ' :: Админцентр - Системный лог'; $this->breadcrumbs = array('Logs' => array('index'), $model->id); $this->menu = array(array('label' => 'Все записи', 'url' => array('admin'))); $this->renderPartial('/admin/mainmenu', array('active' => 'site', 'activebtn' => 'logs')); ?> <h2>Запись №<?php echo $model->id; ?> </h2> <?php $this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('id', array('name' => 'timestamp', 'type' => 'datetime', 'value' => $model->timestamp), 'ip', 'username', array('name' => 'action', 'value' => Logs::getLogType($model->action)), array('name' => 'remarks', 'type' => 'raw', 'value' => CHtml::decode($model->remarks)))));
$this->menu = array(array('label' => 'Volver', 'url' => array('index', 'tipo' => 'pub')), array('label' => 'Editar', 'url' => array('update', 'id' => $model->id, 'tipo' => 'pub'))); } } ?> <div class="col-md-12 col-lg-12 blogShort"> <h1><?php echo $model->titulo; ?> </h1> <img class="img-thumbnail" src="<?php echo Yii::app()->baseUrl . '/images/noticias/' . $model->ruta; ?> " /> <article><p> <?php echo CHtml::decode($model->mensaje); ?> </p> </article> <span class="label lable-info pull-right"><?php $model->usuario->nombre; ?> </span> </div> <div class="row"> <div class="col-md-12 col-lg-12"> <?php echo $model->estatus_did == 1 ? CHtml::link('No publicar', array('noticia/cambiar', 'id' => $model->id, 'estatus' => 2, 'tipo' => $_GET["tipo"]), array('class' => 'btn btn-danger btn-sm')) : CHtml::link('Publicar', array('noticia/cambiar', 'id' => $model->id, 'estatus' => 1, 'tipo' => $_GET["tipo"]), array('class' => 'btn btn-primary btn-sm')); ?> </div>
<?php echo '<h3>' . $data->title . '</h3>'; foreach ($data->hm_dc_did as $dccontent) { echo CHtml::decode($dccontent->content); }
public function decodeArray($data) { $d = array(); foreach ($data as $key => $value) { if (is_string($key)) { $key = CHtml::decode($key); } if (is_string($value)) { $value = CHtml::decode($value); } else { if (is_array($value)) { $value = $this->decodeArray($value); } } $d[$key] = $value; } return $d; }
$screenDays .= $data->sat == "1" ? CHtml::encode($data->getAttributeLabel('sat')) . ", " : ""; ?> <?php echo trim($screenDays, "\t\n\r, "); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('duration')); ?> :</b> <?php echo CHtml::decode($data->duration); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('html')); ?> :</b> <div class="nymediaHtmlData"><?php echo CHtml::decode($data->html); ?> </div> <br /> <?php $this->endWidget(); ?> </div>
$.post("<?php echo Yii::app()->createAbsoluteUrl('advertising/main/banneractivate'); ?> ", { id: "<?php echo $item['id']; ?> ", "<?php echo Yii::app()->request->csrfTokenName; ?> " : "<?php echo Yii::app()->request->csrfToken; ?> "}); } </script> <?php } ?> <?php if ($item['type'] == 'file') { if ($item['url']) { echo CHtml::link(CHtml::image(Yii::app()->getBaseUrl(false) . "/uploads/rkl/{$item['file_path']}", $item['alt_text']), $item['url'], array('target' => '_blank', 'onclick' => 'doAdvertClick()', 'alt' => isset($item['alt']) && $item['alt'] ? $item['alt'] : '')); } else { echo CHtml::image(Yii::app()->getBaseUrl(false) . "/uploads/rkl/{$item['file_path']}", $item['alt_text']); } } elseif ($item['type'] == 'html') { echo CHtml::decode($item['html']); } elseif ($item['type'] == 'js') { echo $item['js']; }
</div> </div> <?php if (!empty($data)) { ?> <ol class="doc-list"> <?php foreach ($data as $row) { ?> <li> <h4><?php echo CHtml::encode($row['topic']); ?> </h4> <p><?php echo CHtml::decode($row['body']); ?> </p> </li> <?php } ?> </ol> <?php } else { ?> <div style="display: block;" class="doc-empty">Nothing Found</div> <?php } ?> </div>
array('label'=>'Update Tutorial', 'url'=>array('update', 'id'=>$model->id)), array('label'=>'Delete Tutorial', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')), array('label'=>'Manage Tutorial', 'url'=>array('admin')), ); ?> <h1><?php echo $model->title; ?></h1> <div class="tutorial"> <div class="tutorial-user"> </div> <div class="tutorial-content"> <?php echo CHtml::decode($model->content);?> </div> </div> <?php if($model->commentCount>=1 ):?> <h3> <?php echo $model->commentCount>1 ? $model->commentCount.' comments': ' comments';?> </h3> <?php $this->renderPartial('_comments',array('comments'=>$model->comments));?> <?php endif;?> <h3>Leave a comment</h3> <?php if(Yii::app()->user->hasFlash('commentSubmitted')):?> <div class="flash-success">
<div class="col-xs-6 col-sm-4 col-md-4 col-lg-4"> <img src="<?php echo Yii::app()->baseUrl . '/administracion/images/noticias/' . $noticia->ruta; ?> " width="200" class="img-thumbnail"/> </div> <div class="col-xs-6 col-sm-8 col-md-8 col-lg-8"> <h4 class="lead"><?php echo CHtml::decode($noticia->titulo); ?> <small class="text-primary pull-right"><?php echo CHtml::decode(date("d-m-Y H:i:s", strtotime($noticia->fecha_f))); ?> </small></h4> <?php echo substr(CHtml::decode($noticia->mensaje), 0, 500); if (count_chars($noticia->mensaje) >= 500) { ?> <span>...</span> <a class="btn btn-warning btn-sm" href="<?php echo CController::createUrl("noticia/view", array('id' => $noticia->id)); ?> " > <span class="glyphicon glyphicon-eye-open"></span> Leer Más</a> <br/> <?php } ?> </div> </div> <hr> <?php
public function getDescription() { return CHtml::decode($this->description); }
/** * CmsInput::decode() * * @param mixed $str * @return */ public function decode($str) { if (is_array($str)) { foreach ($str as $k => $v) { $str[$k] = $this->decode($v); } return $str; } return CHtml::decode($str); }
public function actionSearch() { // Check that we have a valid set of search criteria $search_terms = array('hos_num' => null, 'nhs_num' => null, 'first_name' => null, 'last_name' => null); foreach ($search_terms as $search_term => $search_value) { if (isset($_GET[$search_term]) && ($search_value = trim($_GET[$search_term]))) { // Pad hos_num if ($search_term == 'hos_num') { $search_value = sprintf('%07s', $search_value); } $search_terms[$search_term] = $search_value; } } // if we are on a dev environment, this allows more flexible search terms (i.e. just a first name or surname - useful for testing // the multiple search results view. If we are live, enforces controls over search terms. if (!YII_DEBUG && !$search_terms['hos_num'] && !$search_terms['nhs_num'] && !($search_terms['first_name'] && $search_terms['last_name'])) { Yii::app()->user->setFlash('warning.invalid-search', 'Please enter a valid search.'); $this->redirect(Yii::app()->homeUrl); } $search_terms = CHtml::encodeArray($search_terms); switch (@$_GET['sort_by']) { case 0: $sort_by = 'hos_num*1'; break; case 1: $sort_by = 'title'; break; case 2: $sort_by = 'first_name'; break; case 3: $sort_by = 'last_name'; break; case 4: $sort_by = 'dob'; break; case 5: $sort_by = 'gender'; break; case 6: $sort_by = 'nhs_num*1'; break; default: $sort_by = 'hos_num*1'; } $sort_dir = @$_GET['sort_dir'] == 0 ? 'asc' : 'desc'; $page_num = (int) @$_GET['page_num']; $page_size = 20; $model = new Patient(); $model->hos_num = $search_terms['hos_num']; $model->nhs_num = $search_terms['nhs_num']; $dataProvider = $model->search(array('currentPage' => $page_num, 'pageSize' => $page_size, 'sortBy' => $sort_by, 'sortDir' => $sort_dir, 'first_name' => CHtml::decode($search_terms['first_name']), 'last_name' => CHtml::decode($search_terms['last_name']))); $nr = $model->search_nr(array('first_name' => CHtml::decode($search_terms['first_name']), 'last_name' => CHtml::decode($search_terms['last_name']))); if ($nr == 0) { Audit::add('search', 'search-results', implode(',', $search_terms) . " : No results"); $message = 'Sorry, no results '; if ($search_terms['hos_num']) { $message .= 'for Hospital Number <strong>"' . $search_terms['hos_num'] . '"</strong>'; } elseif ($search_terms['nhs_num']) { $message .= 'for NHS Number <strong>"' . $search_terms['nhs_num'] . '"</strong>'; } elseif ($search_terms['first_name'] && $search_terms['last_name']) { $message .= 'for Patient Name <strong>"' . $search_terms['first_name'] . ' ' . $search_terms['last_name'] . '"</strong>'; } else { $message .= 'found for your search.'; } Yii::app()->user->setFlash('warning.no-results', $message); $this->redirect(Yii::app()->homeUrl); } elseif ($nr == 1) { foreach ($dataProvider->getData() as $item) { $this->redirect(array('patient/view/' . $item->id)); } } else { $this->renderPatientPanel = false; $pages = ceil($nr / $page_size); $this->render('results', array('data_provider' => $dataProvider, 'pages' => $pages, 'page_num' => $page_num, 'items_per_page' => $page_size, 'total_items' => $nr, 'search_terms' => $search_terms, 'sort_by' => (int) @$_GET['sort_by'], 'sort_dir' => (int) @$_GET['sort_dir'])); } }
<?php } ?> <?php if (Yii::app()->user->hasFlash('notice')) { ?> <div class="alert alert-block alert-warning"> <button type="button" class="close" data-dismiss="alert"><i class="icon-remove"></i></button> <div><?php echo CHtml::decode(Yii::app()->user->getFlash('notice')); ?> </div> </div> <?php } ?> <?php if (Yii::app()->user->hasFlash('info')) { ?> <div class="alert alert-block alert-info"> <button type="button" class="close" data-dismiss="alert"><i class="icon-remove"></i></button> <div><?php echo CHtml::decode(Yii::app()->user->getFlash('info')); ?> </div> </div> <?php } ?> </div>
/** query the current field value must return: scalar. */ public function eyuiform_getFieldValue($formId, $fieldId, $fullFieldName) { $row = $this->getDb()->createCommand()->select('field_value')->from($this->getTablename())->where('model_id=:modelid AND form_id=:formid AND field_name=:fieldname', array(':modelid' => $this->_instanceid, ':formid' => $formId, ':fieldname' => $fullFieldName))->queryRow(); if ($row !== false) { return trim(CHtml::decode($row['field_value'])); } else { return ""; } }
$this->breadcrumbs = [Yii::t('main', 'Email Templates') => ['admin'], $model->slug]; $this->menu = [['label' => Yii::t('main', 'Manage Email Templates'), 'url' => ['admin']], ['label' => Yii::t('main', 'Update Email Template'), 'url' => ['update', 'id' => $model->id]]]; ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <?php echo $model->subject; ?> <span class="label label-success"><?php echo $model->slug; ?> </span> </h3> <?php echo CHtml::link(Yii::t('main', 'Back'), ['admin'], ['class' => 'btn btn-primary pull-right']); ?> </div> <div class="panel-body"> <pre><?php echo CHtml::decode($model->body); ?> </pre> </div> <div class="panel-footer"> <?php echo CHtml::link(Yii::t('main', 'Update'), ['emailTemplate/update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> </div> </div>
<?php /* @var $this AdController */ /* @var $model Ad */ $this->breadcrumbs = array(YII::t('ad', 'Ads') => array('screen/' . $this->getScreen()->id), $model->name); $this->menu = array(array('label' => YII::t('ad', 'Create Ad'), 'url' => array('create', 'screen_id' => $this->getScreen()->id)), array('label' => YII::t('ad', 'Update Ad'), 'url' => array('update', 'id' => $model->id, 'screen_id' => $this->getScreen()->id)), array('label' => YII::t('ad', 'Delete Ad'), 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id, 'screen_id' => $this->getScreen()->id), 'confirm' => Yii::t('default', 'Are you sure you want to delete this item?')))); ?> <h1><?php echo YII::t('ad', 'View Ad') . ' #' . $model->id; ?> </h1> <?php $days = $model->sun ? $model->getAttributeLabel('sun') . ', ' : ' '; $days .= $model->mon ? $model->getAttributeLabel('mon') . ', ' : ' '; $days .= $model->tue ? $model->getAttributeLabel('tue') . ', ' : ' '; $days .= $model->wed ? $model->getAttributeLabel('wed') . ', ' : ' '; $days .= $model->thu ? $model->getAttributeLabel('thu') . ', ' : ' '; $days .= $model->fri ? $model->getAttributeLabel('fri') . ', ' : ' '; $days .= $model->sat ? $model->getAttributeLabel('sat') . ', ' : ' '; $days = trim($days, "\t\n\r, "); $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('name', 'start', 'expire', array('name' => Yii::t('ad', 'Days'), 'type' => 'raw', 'value' => $days), 'duration', array('name' => $model->getAttributeLabel('html'), 'type' => 'html', 'value' => CHtml::decode($model->html), 'cssClass' => 'detailedViewWidth'))));
/** * @dataProvider providerEncodeDecode * * @param string $assertion * @param string $text */ public function testDecode($assertion, $text) { $this->assertEquals($assertion, CHtml::decode($text)); }
<?php echo CHtml::link(CHtml::encode($data->post_item_id), array('view', 'id' => $data->post_item_id)); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('title')); ?> :</b> <?php echo CHtml::encode($data->title); ?> <br /> <b><?php echo CHtml::decode($data->getAttributeLabel('description')); ?> :</b> <?php echo CHtml::encode($data->description); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('post_type_id')); ?> :</b> <?php echo CHtml::encode($data->post_type_id); ?> <br />
<div class="my-widget height5 bg-blue horizental-center" id="display-name"> <div class="" id="address"><?php echo $screen->name . ', ' . $yeshuv; ?> </div> </div> <!-- ################# House Holder Area ADs ################ --> <div class="my-widget width100 bg-white horizental-center" id="house-holder"> <div class="horizental-center" id="slider-house-holder"> <!-- Slides Container --> <div u="slides" class="horizental-center" id="house-holder-slides"> <?php foreach ($ads as $ad) { echo CHtml::openTag('div', array('slideDelay' => $ad->duration * 1000, 'class' => 'houseHolderSlide')); echo CHtml::decode($ad->html); echo CHtml::closeTag('div'); } ?> </div> </div> </div> </div> </div> <!-- ################# Bottom Row ################ --> <div id="bottom-row">
<?php echo CHtml::link('<span class="icon-heart"></span> ' . ($this->favorited ? '已' : '') . '收藏', 'javascript:;', array('action' => 'favorite', 'action-data' => $info['id'], 'action-type' => 'poi')); ?> </li> </ul> <!-- Tab panes --> <div class="tab-content"> <div role="tabpanel" class="tab-pane active" id="home"> <div class="media poi-info"> <div class="media-body" style="width: 100%;"> <h1><?php echo CHtml::decode($_title); ?> </h1> <p><?php echo CHtml::decode($_address); ?> </p> <p><?php echo zmf::starCss($info['score']); ?> <span class="pull-right poi-btn"></span></p> <div class="clearfix"></div> <?php if ($info['title_en'] != '' && $_titleEn) { echo '<p><span class="color-bold">英文名:</span>' . CHtml::encode($info['title_en']) . '</p>'; } ?> <?php if ($info['title_local'] != '' && $_titleLocal) { echo '<p><span class="color-bold">当地名:</span>' . CHtml::encode($info['title_local']) . '</p>';
}); ', CClientScript::POS_READY); /*echo '<div>'.CHtml::button(tc('Delete'), array( 'onclick' => 'document.location.href="'.Yii::app()->controller->createUrl('deletevideo', array('id' => $video->id, 'apId' => $model->id)).'";' )).'</div>';*/ echo '<div><br/>'; $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'button', 'type' => 'danger', 'icon' => 'remove white', 'label' => tc('Delete'), 'htmlOptions' => array('onclick' => 'document.location.href="' . Yii::app()->controller->createUrl('deletevideo', array('id' => $video->id, 'apId' => $model->id)) . '";'))); echo '</div><br/>'; } } if ($video->isHtml()) { echo '<div class="video-html-block" id="video-block-html-' . $count . '"></div>'; echo '<div>'; $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'button', 'type' => 'danger', 'icon' => 'remove white', 'label' => tc('Delete'), 'htmlOptions' => array('onclick' => 'document.location.href="' . Yii::app()->controller->createUrl('deletevideo', array('id' => $video->id, 'apId' => $model->id)) . '";'))); echo '</div><br/>'; $videoHtml[$count] = CHtml::decode($video->video_html); $count++; } } if ($videoFileExists) { Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/flowplayer/flowplayer-3.2.12.min.js', CClientScript::POS_END); } $script = ''; if ($videoHtml) { foreach ($videoHtml as $key => $value) { $script .= '$("#video-block-html-' . $key . '").html("' . CJavaScript::quote($value) . '");'; } } if ($script) { Yii::app()->clientScript->registerScript('chrome-xss-alert-preventer', $script, CClientScript::POS_READY); }
public function actionGetVideoFile() { $id = Yii::app()->request->getParam('id'); $apId = Yii::app()->request->getParam('apId'); if ($id && $apId) { $sql = 'SELECT video_file, video_html FROM {{apartment_video}} WHERE id = "' . $id . '" AND apartment_id = "' . $apId . '"'; $result = Yii::app()->db->createCommand($sql)->queryRow(); if ($result['video_file']) { $this->renderPartial('_video_file', array('video' => $result['video_file'], 'apartment_id' => $apId, 'id' => $id), false, true); } elseif ($result['video_html']) { echo CHtml::decode($result['video_html']); } } }