本文整理汇总了PHP中CHtml::decode方法的典型用法代码示例。如果您正苦于以下问题:PHP CHtml::decode方法的具体用法?PHP CHtml::decode怎么用?PHP CHtml::decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHtml
的用法示例。
在下文中一共展示了CHtml::decode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionSave
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;
}
示例2: formatMoney
/**
* 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);
}
示例3: PrintPosterName
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;
}
示例4: buildTreePages
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;
}
示例5: foreach
<?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>";
}
示例6: array
<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'));
?>
示例7: array
<?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
示例8: search
/**
* 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;
}
示例9: array
<?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)))));
示例10: array
$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>
示例11: foreach
<?php
echo '<h3>' . $data->title . '</h3>';
foreach ($data->hm_dc_did as $dccontent) {
echo CHtml::decode($dccontent->content);
}
示例12: decodeArray
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;
}
示例13: trim
$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>
示例14: array
$.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'];
}
示例15: foreach
</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>