• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CHtml类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CHtml的典型用法代码示例。如果您正苦于以下问题:PHP CHtml类的具体用法?PHP CHtml怎么用?PHP CHtml使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CHtml类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $voting = null;
     if (is_numeric(HU::post('id_voting'))) {
         $voting = Voting::model()->onlyActive()->with('answer')->findByPk(HU::post('id_voting'));
     }
     if ($voting == null) {
         //echo CHtml::encode($this->controller->widget('vote.widgets.VoteWidget', null, true));
         return;
     }
     if (Yii::app()->vote->check($voting->id_voting)) {
         $answers = $_POST['VotingAnswer']['name'];
         $cr = new CDbCriteria();
         $cr->addColumnCondition(array('id_voting' => $voting->id_voting));
         if (is_array($answers)) {
             $cr->addInCondition('id_voting_answer', $answers);
         } else {
             if (is_numeric($answers)) {
                 $cr->addColumnCondition(array('id_voting_answer' => $answers));
             }
         }
         VotingAnswer::model()->updateCounters(array('count' => 1), $cr);
         VisitSite::saveCurrentVisit(Voting::ID_OBJECT, $voting->id_voting);
         Yii::app()->user->setState('vote_' . $voting->id_voting, time());
         // перегружаем голосовалку, чтоб обновились показатели счетчиков
         $voting = Voting::model()->onlyActive()->with('answer')->findByPk($voting->id_voting);
     }
     $voteCount = $voting->getSumVote();
     echo CHtml::encode($this->controller->renderPartial("vote.widgets.views.statistic", array('voting' => $voting, 'voteCount' => $voteCount)), null, true);
 }
开发者ID:kot-ezhva,项目名称:ygin,代码行数:30,代码来源:VoteAction.php


示例2: getRightsReturnUrl

 /**
  * Returns the URL that the user should be redirected to 
  * after updating an authorization item.
  * @param string $defaultUrl the default return URL in case it was not set previously. If this is null,
  * the application entry URL will be considered as the default return URL.
  * @return string the URL that the user should be redirected to 
  * after updating an authorization item.
  */
 public function getRightsReturnUrl($defaultUrl = null)
 {
     if (($returnUrl = $this->getState('Rights_returnUrl')) !== null) {
         $this->returnUrl = null;
     }
     return $returnUrl !== null ? CHtml::normalizeUrl($returnUrl) : CHtml::normalizeUrl($defaultUrl);
 }
开发者ID:fobihz,项目名称:cndiesel,代码行数:15,代码来源:RWebUser.php


示例3: renderContent

 /**
  * (non-PHPdoc)
  * @see CPortlet::renderContent()
  */
 protected function renderContent()
 {
     $themesList = array_combine(Yii::app()->themeManager->themeNames, Yii::app()->themeManager->themeNames);
     echo CHtml::form('', 'post', array());
     echo CHtml::dropDownList('themeSelector', Yii::app()->theme->name, $themesList, $this->dropDownOptions);
     echo CHtml::endForm();
 }
开发者ID:jackycgq,项目名称:advanced,代码行数:11,代码来源:EThemePicker.php


示例4: renderButton

 /**
  * Renders a link button.
  * @param string $id the ID of the button
  * @param array $button the button configuration which may contain 'label', 'url', 'imageUrl' and 'options' elements.
  * @param integer $row the row number (zero-based)
  * @param mixed $data the data object associated with the row
  */
 protected function renderButton($id, $button, $row, $data)
 {
     if (isset($button['visible']) && !$this->evaluateExpression($button['visible'], array('row' => $row, 'data' => $data))) {
         return;
     }
     $url = \bootstrap\helpers\BSArray::popValue('url', $button, '#');
     if (strcmp($url, '#') !== 0) {
         $url = $this->evaluateExpression($url, array('data' => $data, 'row' => $row));
     }
     $imageUrl = \bootstrap\helpers\BSArray::popValue('imageUrl', $button, false);
     $label = \bootstrap\helpers\BSArray::popValue('label', $button, $id);
     $options = \bootstrap\helpers\BSArray::popValue('options', $button, array());
     \bootstrap\helpers\BSArray::defaultValue('data-title', $label, $options);
     \bootstrap\helpers\BSArray::defaultValue('title', $label, $options);
     \bootstrap\helpers\BSArray::defaultValue('data-toggle', 'tooltip', $options);
     if ($icon = \bootstrap\helpers\BSArray::popValue('icon', $button, false)) {
         echo CHtml::link(BSHtml::icon($icon), $url, $options);
     } else {
         if ($imageUrl && is_string($imageUrl)) {
             echo CHtml::link(CHtml::image($imageUrl, $label), $url, $options);
         } else {
             echo CHtml::link($label, $url, $options);
         }
     }
 }
开发者ID:bafio89,项目名称:qea-u,代码行数:32,代码来源:BsButtonColumn.php


示例5: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Modelo();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Modelo'])) {
         $model->attributes = $_POST['Modelo'];
         if ($model->save()) {
             if (!empty($_POST['yt1'])) {
                 Yii::app()->user->setFlash('modelo-created', "¡El modelo <b><i>&quot;{$model->name}&quot;</i></b> fue creado exitosamente!");
                 //$this->redirect(array('create'));
                 $modelSaved = $model;
                 $model = new Modelo();
                 $model->equipment_type_id = $modelSaved->equipment_type_id;
                 $model->brand_id = $modelSaved->brand_id;
             } else {
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
     }
     if (EquipmentType::model()->count('active = 1') == 0 && Brand::model()->count('active = 1') == 0) {
         throw new CHttpException('', 'Primero debe ' . CHtml::link('crear un Tipo de Equipo', array('equipmentType/create')) . ' y ' . CHtml::link('crear una Marca', array('brand/create')) . '.');
     } else {
         if (EquipmentType::model()->count('active = 1') == 0) {
             throw new CHttpException('', 'Primero debe ' . CHtml::link('crear un Tipo de Equipo', array('equipmentType/create')) . '.');
         } else {
             if (Brand::model()->count('active = 1') == 0) {
                 throw new CHttpException('', 'Primero debe ' . CHtml::link('crear una Marca', array('brand/create')) . '.');
             } else {
                 $this->render('create', array('model' => $model));
             }
         }
     }
 }
开发者ID:rodespsan,项目名称:LMEC,代码行数:38,代码来源:ModeloController.php


示例6: renderButton

 /**
  * Render the link or ajax link
  * @param string $id the ID of the button
  * @param array $button the button configuration which may contain 'label', 'url', 'imageUrl' and 'options' elements.
  * See {@link buttons} for more details.
  * @param integer $row the row number (zero-based)
  * @param mixed $data the data object associated with the row
  */
 protected function renderButton($id, $button, $row, $data)
 {
     if (isset($button['visible']) && !$this->evaluateExpression($button['visible'], array('row' => $row, 'data' => $data))) {
         return;
     }
     $label = isset($button['label']) ? $button['label'] : $id;
     if (isset($button['url'])) {
         $url = $this->evaluateExpression($button['url'], array('data' => $data, 'row' => $row));
         // Not Coding Standard
     } else {
         $url = '#';
     }
     $options = isset($button['options']) ? $button['options'] : array();
     if (!isset($options['title'])) {
         $options['title'] = $label;
     }
     if (isset($button['ajaxOptions'])) {
         unset($options['ajaxOptions']);
         echo ZurmoHtml::ajaxLink($label, $url, $button['ajaxOptions'], $options);
     } else {
         if (isset($button['imageUrl']) && is_string($button['imageUrl'])) {
             echo ZurmoHtml::link(CHtml::image($button['imageUrl'], $label), $url, $options);
         } else {
             echo ZurmoHtml::link($label, $url, $options);
         }
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:35,代码来源:ButtonColumn.php


示例7: reject

function reject($vcid)
{
    return CHtml::ajaxLink('Reject', Yii::app()->createAbsoluteUrl('videoConference/reject/' . $vcid), array('type' => 'get', 'data' => array('id' => $vcid, 'type' => 'get'), 'update' => 'message', 'success' => 'function(response) {
                                $(".message").html(response);
                                location.reload();
                                }'), array('confirm' => 'Are you sure you want to reject this invitation?', 'role' => "button", "class" => "btn btn-danger"));
}
开发者ID:acuba001,项目名称:Collaborative-Platform,代码行数:7,代码来源:index.php


示例8: actionLogin

 /**
  * 会员登录
  */
 public function actionLogin()
 {
     $model = new Admin('login');
     if (XUtils::method() == 'POST') {
         $model->attributes = $_POST['Admin'];
         if ($model->validate()) {
             $data = $model->find('username=:username', array('username' => $model->username));
             if ($data === null) {
                 $model->addError('username', '用户不存在');
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '登录失败,用户不存在:' . CHtml::encode($model->username), 'user_id' => 0));
             } elseif (!$model->validatePassword($data->password)) {
                 $model->addError('password', '密码不正确');
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '登录失败,密码不正确:' . CHtml::encode($model->username) . ',使用密码:' . CHtml::encode($model->password), 'user_id' => 0));
             } elseif ($data->group_id == 2) {
                 $model->addError('username', '用户被锁定,请联系网站管理');
             } else {
                 parent::_stateWrite(array('userId' => $data->id, 'userName' => $data->username, 'groupId' => $data->group_id, 'super' => $data->group_id == 1 ? 1 : 0), array('prefix' => '_admini'));
                 $data->last_login_ip = XUtils::getClientIP();
                 $data->last_login_time = time();
                 $data->login_count = $data->login_count + 1;
                 $data->save();
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '用户登录成功:' . CHtml::encode($model->username)));
                 $this->redirect(array('default/index'));
             }
         }
     }
     $this->render('login', array('model' => $model));
 }
开发者ID:zywh,项目名称:maplecity,代码行数:31,代码来源:PublicController.php


示例9: textField

 public function textField($model, $attribute, $htmlOptions = array())
 {
     if (empty($htmlOptions['class'])) {
         $htmlOptions['class'] = 't_input';
     }
     return CHtml::activeTextField($model, $attribute, $htmlOptions);
 }
开发者ID:vangogogo,项目名称:justsns,代码行数:7,代码来源:YiicmsActiveForm.php


示例10: run

 /**
  * Run this widget.
  * This method registers necessary javascript and renders the needed HTML code.
  */
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     if (isset($this->htmlOptions['id'])) {
         $id = $this->htmlOptions['id'];
     } else {
         $this->htmlOptions['id'] = $id;
     }
     if (isset($this->htmlOptions['name'])) {
         $name = $this->htmlOptions['name'];
     } else {
         $this->htmlOptions['name'] = $name;
     }
     if ($this->hasModel()) {
         echo CHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo CHtml::textField($name, $this->value, $this->htmlOptions);
     }
     $options = CJavaScript::encode($this->options);
     $js = "jQuery('#{$id}').datepicker({$options});";
     if (isset($this->language)) {
         $this->registerScriptFile($this->i18nScriptFile);
         $js = "jQuery('#{$id}').datepicker(jQuery.extend({showMonthAfterYear:false}, jQuery.datepicker.regional['{$this->language}'], {$options}));";
     }
     $cs = Yii::app()->getClientScript();
     $cs->registerScript(__CLASS__, $this->defaultOptions ? 'jQuery.datepicker.setDefaults(' . CJavaScript::encode($this->defaultOptions) . ');' : '');
     $cs->registerScript(__CLASS__ . '#' . $id, $js);
 }
开发者ID:BGCX261,项目名称:zii-svn-to-git,代码行数:32,代码来源:CJuiDatePicker.php


示例11: renderValue

 /**
  * @param $attribute
  * @param $value
  * @return string
  */
 public static function renderValue(Attribute $attribute, $value, $template = '<p>{item}</p>')
 {
     $unit = $attribute->unit ? ' ' . $attribute->unit : '';
     $res = null;
     switch ($attribute->type) {
         case Attribute::TYPE_TEXT:
         case Attribute::TYPE_SHORT_TEXT:
         case Attribute::TYPE_NUMBER:
             $res = $value;
             break;
         case Attribute::TYPE_DROPDOWN:
             $data = CHtml::listData($attribute->options, 'id', 'value');
             if (is_array($value)) {
                 $value = array_shift($value);
             }
             if (isset($data[$value])) {
                 $res .= $data[$value];
             }
             break;
         case Attribute::TYPE_CHECKBOX_LIST:
             $data = CHtml::listData($attribute->options, 'id', 'value');
             if (is_array($value)) {
                 foreach (array_intersect(array_keys($data), $value) as $val) {
                     $res .= strtr($template, ['{item}' => $data[$val]]);
                 }
             }
             break;
         case Attribute::TYPE_CHECKBOX:
             $res = $value ? Yii::t("StoreModule.store", "Yes") : Yii::t("StoreModule.store", "No");
             break;
     }
     return $res . $unit;
 }
开发者ID:yupe,项目名称:yupe,代码行数:38,代码来源:AttributeRender.php


示例12: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     $id = $this->id;
     echo CHtml::tag('input', $this->htmlOptions);
     $options = !empty($this->options) ? CJavaScript::encode($this->options) : '';
     Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').typeahead({$options});");
 }
开发者ID:nisarg709,项目名称:yii-bootstrap,代码行数:10,代码来源:BootTypeahead.php


示例13: etiquetaExtranjero

 /**
  * @return html nombre de partida compuesto con el nombre
  */
 public function etiquetaExtranjero()
 {
     //echo count($this->id);
     //die;
     $extranjero = ProveedoresExtranjeros::model()->findByAttributes(array('proveedor_id' => $this->id));
     return CHtml::encode($this->rif . ' - ' . $this->razon_social . ' - ' . $extranjero->num_identificacion . ' - ' . $extranjero->pais->nombre);
 }
开发者ID:EurekaSolutions,项目名称:sistemanc,代码行数:10,代码来源:Proveedores.php


示例14: actionLogin

 public function actionLogin()
 {
     if (isset($_POST['token'])) {
         $this->networkLogin();
     }
     $this->layout = null;
     $this->breadCrumbs = array('Управление сайтом' => array('/users/default/siteManagment'));
     $form = new LoginForm();
     if (isset($_POST['LoginForm'])) {
         $form->attributes = $_POST['LoginForm'];
         if ($form->validate()) {
             $backUrl = $form->getBackUrl();
             if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                 echo CHtml::script("document.location='" . $backUrl . "'");
                 return;
             } else {
                 $this->redirect($backUrl);
             }
         }
     }
     if (Yii::app()->getRequest()->getIsAjaxRequest()) {
         $this->renderPartial('form/login', array('form' => $form, 'backUrl' => $backurl));
     } else {
         $this->render('login', array('user' => $form, 'backUrl' => $backurl));
     }
 }
开发者ID:hit-shappens,项目名称:testapp,代码行数:26,代码来源:DefaultController.php


示例15: renderDataCellContent

 protected function renderDataCellContent($row, $data)
 {
     if (!$data instanceof CommentYii) {
         return;
     }
     $key = $data->id_object . '_' . $data->id_instance;
     $owner = null;
     if (isset($this->cache[$key])) {
         $owner = $this->cache[$key];
     }
     if ($owner || !$owner && ($owner = $data->getOwnerModel())) {
         $this->cache[$key] = $owner;
         $method = '';
         if (method_exists($owner, 'getCommentsUrl')) {
             $method = 'getCommentsUrl';
         } elseif (method_exists($owner, 'getUrl')) {
             $method = 'getUrl';
         } elseif (method_exists($owner, 'getViewUrl')) {
             $method = 'getViewUrl';
         }
         if ($method) {
             Yii::app()->urlManager->frontendMode = true;
             $link = Yii::app()->createUrl($owner->{$method}());
             Yii::app()->urlManager->frontendMode = false;
             echo CHtml::link('<i class=" glyphicon glyphicon-share"></i> просмотреть на сайте', $link, array('target' => '_blank'));
         }
     }
 }
开发者ID:kot-ezhva,项目名称:ygin,代码行数:28,代码来源:CommentsViewLinkColumn.php


示例16: init

 public function init()
 {
     if (isset($this->htmlOptions['id'])) {
         $id = $this->htmlOptions['id'];
     } else {
         $id = $this->htmlOptions['id'] = $this->getId();
     }
     if ($this->url !== null) {
         $this->url = CHtml::normalizeUrl($this->url);
     }
     $cs = Yii::app()->getClientScript();
     //$cs->registerCoreScript('treeview');
     $baseUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('ext.yii-jqTree.source'));
     $cs->registerScriptFile($baseUrl . '/tree.jquery.js');
     $options = $this->getClientOptions();
     $options = $options === array() ? '{}' : CJavaScript::encode($options);
     $cs->registerScript('Yii.JQTree#0' . $id, "if (jQuery.jqTree == undefined) {jQuery.jqTree = new Array;}");
     $cs->registerScript('Yii.JQTree#' . $id, "jQuery.jqTree[\"{$id}\"] = jQuery(\"#{$id}\").tree({$options});");
     if ($this->cssFile === null) {
         $cs->registerCssFile($baseUrl . '/jqtree.css');
     } else {
         if ($this->cssFile !== false) {
             $cs->registerCssFile($this->cssFile);
         }
     }
     echo CHtml::tag('ul', $this->htmlOptions, false, false) . "\n";
 }
开发者ID:asdmundt,项目名称:templateYiiApp,代码行数:27,代码来源:JQTree.php


示例17: hiddenField

 public function hiddenField($model, $attribute, $htmlOptions = array(), $value = null)
 {
     if ($value !== null) {
         $model->{$attribute} = $value;
     }
     return CHtml::activeHiddenInput($model, $attribute, $htmlOptions);
 }
开发者ID:VasileGabriel,项目名称:humhub,代码行数:7,代码来源:CActiveForm.php


示例18: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['EvaAttributesMatrix'])) {
         $model->attributes = $_POST['EvaAttributesMatrix'];
         if ($model->save()) {
             $this->redirect(['index']);
         }
     }
     $dropDownData = [];
     $survObjCriteria = new CDbCriteria();
     $survObjCriteria->with = ['options'];
     $survObjCriteria->select = 'inputName';
     $survObjCriteria->condition = "inputName='survObj' AND options.frameworkFieldId=t.id";
     $rsSurveillanceObjective = FrameworkFields::model()->find($survObjCriteria);
     $dropDownData['objectives'] = CHtml::listData($rsSurveillanceObjective->options, 'optionId', 'label');
     $rsQuestionGrp = EvaQuestionGroups::model()->find(['select' => 'questions']);
     $questionsArray = array_keys((array) json_decode($rsQuestionGrp->questions));
     $dropDownData['groups'] = array_combine($questionsArray, range(1, count($questionsArray)));
     //print_r($dropDownData['groups']); die;
     $dropDownData['attributes'] = CHtml::listData(EvaAttributes::model()->findAll(), 'attributeId', 'name');
     $this->menu = [['label' => 'Add Attribute Relevance', 'url' => $this->createUrl('create')], ['label' => 'List Attribute Relevance', 'url' => $this->createUrl('index')]];
     $this->render('update', ['model' => $model, 'dropDownData' => $dropDownData]);
 }
开发者ID:schrapps,项目名称:risksur,代码行数:31,代码来源:AdminattributerelevanceController.php


示例19: actionSetSorters

 public function actionSetSorters()
 {
     $sql = 'SELECT id, name_' . Yii::app()->language . ' AS name FROM {{location_country}} ORDER BY name_' . Yii::app()->language . ' ASC';
     $res = Yii::app()->db->createCommand($sql)->queryAll();
     $countries = CHtml::listData($res, 'id', 'name');
     $co = 1;
     foreach ($countries as $coid => $coname) {
         $sql = 'UPDATE {{location_country}} SET sorter="' . $co . '" WHERE id = ' . $coid . ' LIMIT 1';
         Yii::app()->db->createCommand($sql)->execute();
         $sql = 'SELECT id, name_' . Yii::app()->language . ' AS name FROM {{location_region}} WHERE country_id = :country ORDER BY name_' . Yii::app()->language . ' ASC';
         $res = Yii::app()->db->createCommand($sql)->queryAll(true, array(':country' => $coid));
         $regions = CHtml::listData($res, 'id', 'name');
         $r = 1;
         foreach ($regions as $rid => $rname) {
             $sql = 'UPDATE {{location_region}} SET sorter="' . $r . '" WHERE id = ' . $rid . ' LIMIT 1';
             Yii::app()->db->createCommand($sql)->execute();
             $sql = 'SELECT id, name_' . Yii::app()->language . ' AS name FROM {{location_city}} WHERE region_id = :region ORDER BY name_' . Yii::app()->language . ' ASC';
             $res = Yii::app()->db->createCommand($sql)->queryAll(true, array(':region' => $rid));
             $cities = CHtml::listData($res, 'id', 'name');
             $c = 1;
             foreach ($cities as $cid => $cname) {
                 $sql = 'UPDATE {{location_city}} SET sorter="' . $c . '" WHERE id = ' . $cid . ' LIMIT 1';
                 Yii::app()->db->createCommand($sql)->execute();
                 $c++;
             }
             $r++;
         }
         $co++;
     }
     echo 'ok';
 }
开发者ID:barricade86,项目名称:raui,代码行数:31,代码来源:CountryController.php


示例20: run

	/**
	 * Run widget.
	 */
	public function run()
	{
		if($this->hasModel())
			echo CHtml::activeTextArea($this->model,$this->attribute,$this->htmlOptions);
		else
			echo CHtml::textArea($this->name,$this->value,$this->htmlOptions);
	}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:10,代码来源:EImperaviRedactorWidget.php



注:本文中的CHtml类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CHtmlPurifier类代码示例发布时间:2022-05-23
下一篇:
PHP CHTTP类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap