本文整理汇总了PHP中CHtml::encodeArray方法的典型用法代码示例。如果您正苦于以下问题:PHP CHtml::encodeArray方法的具体用法?PHP CHtml::encodeArray怎么用?PHP CHtml::encodeArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHtml
的用法示例。
在下文中一共展示了CHtml::encodeArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionEdit
/**
* Edits or adds a Procedure.
*
* @param bool|int $id
*
* @throws CHttpException
*/
public function actionEdit($id = false)
{
$admin = new Admin(FormularyDrugs::model(), $this);
if ($id) {
$admin->setModelId($id);
}
$admin->setModelDisplayName('Formulary Drugs');
$criteria = new CDbCriteria();
$admin->setEditFields(array('id' => 'label', 'name' => 'text', 'type_id' => array('widget' => 'DropDownList', 'options' => CHtml::listData(DrugType::model()->findAll(), 'id', 'name'), 'htmlOptions' => null, 'hidden' => false, 'layoutColumns' => null), 'aliases' => 'text', 'tallman' => 'text', 'form_id' => array('widget' => 'DropDownList', 'options' => CHtml::listData(DrugForm::model()->findAll(), 'id', 'name'), 'htmlOptions' => null, 'hidden' => false, 'layoutColumns' => null), 'dose_unit' => 'text', 'default_dose' => 'text', 'default_route_id' => array('widget' => 'DropDownList', 'options' => CHtml::listData(DrugRoute::model()->findAll(), 'id', 'name'), 'htmlOptions' => array('empty' => '-- Please select --'), 'hidden' => false, 'layoutColumns' => null), 'default_frequency_id' => array('widget' => 'DropDownList', 'options' => CHtml::listData(DrugFrequency::model()->findAll(), 'id', 'name'), 'htmlOptions' => array('empty' => '-- Please select --'), 'hidden' => false, 'layoutColumns' => null), 'default_duration_id' => array('widget' => 'DropDownList', 'options' => CHtml::listData(DrugDuration::model()->findAll(), 'id', 'name'), 'htmlOptions' => array('empty' => '-- Please select --'), 'hidden' => false, 'layoutColumns' => null), 'preservative_free' => 'checkbox', 'active' => 'checkbox', 'allergy_warnings' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'Allergy Warnings', 'options' => CHtml::encodeArray(CHtml::listData(Allergy::model()->findAll($criteria->condition = "name != 'Other'"), 'id', 'name')))));
$admin->editModel();
}
示例2: actionEdit
/**
* Edits or adds a Procedure.
*
* @param bool|int $id
*
* @throws CHttpException
*/
public function actionEdit($id = false)
{
$admin = new Admin(Procedure::model(), $this);
if ($id) {
$admin->setModelId($id);
}
$admin->setEditFields(array('term' => 'text', 'short_format' => 'text', 'default_duration' => 'text', 'snomed_code' => 'text', 'snomed_term' => 'text', 'aliases' => 'text', 'unbooked' => 'checkbox', 'active' => 'checkbox', 'opcsCodes' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'OPCS Code', 'options' => CHtml::encodeArray(CHtml::listData(OPCSCode::model()->findAll(), 'id', function ($model) {
return $model->name . ': ' . $model->description;
}))), 'benefits' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'Benefit', 'options' => CHtml::encodeArray(CHtml::listData(Benefit::model()->findAll(), 'id', 'name'))), 'complications' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'Complication', 'options' => CHtml::encodeArray(CHtml::listData(Complication::model()->findAll(), 'id', 'name')))));
if (isset($admin->getModel()->operationNotes)) {
$admin->setEditFields(array_merge($admin->getEditFields(), array('operationNotes' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'Operation Note Element', 'options' => CHtml::encodeArray(CHtml::listData(ElementType::model()->findAllByAttributes(array(), 'event_type_id in (select id from event_type where name = "Operation Note")'), 'id', 'name'))))));
}
$admin->editModel();
}
示例3: parseTerm
/**
* Checking the search term if it is a NHS number, Hospital number or Patient name.
*
* @param string $term
*/
public function parseTerm($term)
{
$term = trim($term);
$search_terms = array('hos_num' => null, 'nhs_num' => null, 'first_name' => null, 'last_name' => null);
// NHS number
if ($nhs = $this->getNHSnumber($term)) {
$search_terms['nhs_num'] = $nhs;
// Hospital number (assume a < 10 digit number is a hosnum)
} elseif ($hos_num = $this->getHospitalNumber($term)) {
$search_terms['hos_num'] = $hos_num;
// Patient name
} elseif ($name = $this->getPatientName($term)) {
$search_terms['first_name'] = trim($name['first_name']);
$search_terms['last_name'] = trim($name['last_name']);
}
$this->searchTerms = CHtml::encodeArray($search_terms);
return $this->searchTerms;
}
示例4: actionImport
public function actionImport()
{
$data = CHtml::encodeArray($_POST);
//检查文章标题
$news = News::model()->findByAttributes(array('title' => $data['title']));
if (!empty($news)) {
die('文章已存在');
} else {
$data['content'] = NewsService::instance()->ubb2html($data['content']);
$news = new News();
$news->attributes = array('title' => $data['title'], 'description' => mb_substr(trim(strip_tags($data['content'])), 0, 20, 'UTF-8'), 'thumb' => $data['thumb'], 'content' => $data['content'], 'wechat' => $data['wechat'], 'created_at' => strtotime($data['created_at']), 'category_id' => $data['category_id'], 'collected_at' => time());
$news->save();
if (empty($news->errors)) {
echo 1;
} else {
$error = array_shift($news->errors);
echo $error[0];
}
}
}
示例5: CAST
?>
</td><td>
<?php
echo CHtml::activeCheckBox($repParam, "[{$n}]allowCustomer");
?>
</td><td>
<?php
echo CHtml::activeCheckBox($repParam, "[{$n}]allowNotes");
?>
</td><td>
<?php
echo CHtml::activeCheckBox($repParam, "[{$n}]isFinalBalance");
?>
</td><td>
<?php
$accounts = CHtml::encodeArray(CHtml::listData(Account::model()->findAll(array('join' => ' LEFT JOIN TemplateRowAccount ON t.id=TemplateRowAccount.accountId', 'select' => 't.id as id, CAST(CONCAT(code,\' \',name) AS CHAR CHARACTER SET utf8) as name', 'order' => 'code', 'condition' => 'templateRowId=' . $repParam->id)), 'id', 'name'));
$accounts[0] = '-- ' . ' ' . ' --';
echo CHtml::activeDropDownList($repParam, "[{$n}]defaultAccountId", $accounts, array('title' => Yii::t('lazy8', 'contexthelp.template.defaultAccountId')));
echo CHtml::submitButton(Yii::t('lazy8', 'edit'), array('name' => "editrow[{$n}]", 'title' => Yii::t('lazy8', 'contexthelp.template.edit')));
?>
</td><td>
<?php
echo CHtml::activeTextField($repParam, "[{$n}]defaultValue", array('size' => 8));
?>
</td><td>
<?php
echo CHtml::activeTextField($repParam, "[{$n}]phpFieldCalc", array('size' => 8));
?>
</td><td>
<?php
echo CHtml::submitButton(Yii::t('lazy8', 'Remove Row'), array('name' => "deleterow[{$n}]", 'title' => Yii::t('lazy8', 'contexthelp.Remove Row')));
示例6: IN
$accountList = ' AND id IN (' . $accountID_string . ')';
}
$sqlList = CHtml::encodeArray(CHtml::listData(Account::model()->findAll(array('condition' => 'companyId=' . Yii::app()->user->getState('selectedCompanyId') . $accountList, 'select' => 'CONCAT(\'AND Account.id=\',id) as id, CAST(CONCAT(code,\' \',name) AS CHAR CHARACTER SET utf8) as name', 'order' => 'code')), 'id', 'name'));
$sqlList[''] = '';
// ********************************************************
$accountList = '';
if (Yii::app()->user->name == "ReportsOnlyUser") {
$accountNumbers = Yii::app()->session['accountNumbers'];
if (strpos($accountNumbers, '101059') == false) {
$accountNumbers .= ',101059';
}
$accountList = ' AND code IN (' . $accountNumbers . ')';
}
$sqlList = CHtml::encodeArray(CHtml::listData(Account::model()->findAll(array('condition' => 'companyId=' . Yii::app()->user->getState('selectedCompanyId') . $accountList, 'select' => 'CONCAT(\'AND Account.id=\',id) as id, CAST(CONCAT(code,\' \',name) AS CHAR CHARACTER SET utf8) as name', 'order' => 'code')), 'id', 'name'));
$sqlList[''] = '';
// ***********************************
$accountList = '';
if (Yii::app()->user->name == "ReportsOnlyUser") {
$accountNumbers = Yii::app()->session['accountNumbers'];
if (strpos($accountNumbers, '101059') == false) {
$accountNumbers .= ',101059';
}
$accountList = ' AND code IN (' . $accountNumbers . ')';
}
$sqlList = CHtml::encodeArray(CHtml::listData(Account::model()->findAll(array('condition' => 'companyId=' . Yii::app()->user->getState('selectedCompanyId') . $accountList, 'select' => 'CONCAT(\'AND Account.code=\',code) as code, CAST(CONCAT(code,\' \',name) AS CHAR CHARACTER SET utf8) as name', 'order' => 'code')), 'code', 'name'));
$sqlList[''] = '';
$sqlList = CHtml::encodeArray(CHtml::listData(Account::model()->findAll(array('condition' => 'companyId=' . Yii::app()->user->getState('selectedCompanyId'), 'select' => 'CONCAT(\'AND Account.id=\',id) as id, CAST(CONCAT(code,\' \',name) AS CHAR CHARACTER SET utf8) as name', 'order' => 'code')), 'id', 'name'));
$sqlList[''] = '';
?>
示例7: getDropDown
/**
* Builds the dropdown for saved webforms
* @return html constructed HTML
*/
public function getDropDown()
{
array_unshift($this->formAttrs, array('id' => '0', 'name' => '------------'));
$html = CHtml::dropDownList('saved-forms', '', CHtml::encodeArray(CHtml::listData($this->formAttrs, 'id', 'name')), array('class' => 'left'));
return $html;
}
示例8: array
* You should have received a copy of the GNU General Public License along with OpenEyes in a file titled COPYING. If not, see <http://www.gnu.org/licenses/>.
*
* @link http://www.openeyes.org.uk
*
* @author OpenEyes <info@openeyes.org.uk>
* @copyright Copyright (c) 2008-2011, Moorfields Eye Hospital NHS Foundation Trust
* @copyright Copyright (c) 2011-2013, OpenEyes Foundation
* @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0
*/
if (isset($_POST['comorbidities_items_valid']) && $_POST['comorbidities_items_valid']) {
$item_ids = @$_POST['comorbidities_items'];
} else {
$item_ids = $element->getItemIds();
}
?>
<div class="sub-element-fields">
<?php
echo CHtml::hiddenField('comorbidities_items_valid', 1, array('id' => 'comorbidities_items_valid'));
?>
<div class="field-row comorbidities-multi-select">
<?php
echo $form->multiSelectList($element, CHtml::modelName($element) . '[items]', 'items', 'id', CHtml::encodeArray(CHtml::listData(OEModule\OphCiExamination\models\OphCiExamination_Comorbidities_Item::model()->activeOrPk($element->comorbidityItemValues)->bySubspecialty($this->firm->getSubspecialty())->findAll(), 'id', 'name')), array(), array('empty' => '-- Add --', 'label' => 'Comorbidities', 'nowrapper' => true), false, true, 'No comorbidities', true, true);
?>
</div>
<div class="field-row">
<?php
echo $form->textArea($element, 'comments', array('rows' => '1', 'cols' => '80', 'class' => 'autosize', 'nowrapper' => true), false, array('placeholder' => 'Enter comments here'));
?>
</div>
</div>
示例9: array
}
//var_dump($arr);
echo $form->dropDownList($model, 'year', CHtml::encodeArray($arr));
?>
</td>
<td>
<?php
echo $form->label($model, 'month');
?>
</td>
<td>
<?php
echo $form->dropDownList($model, 'month', CHtml::encodeArray(Yii::app()->locale->getMonthNames()));
?>
</td>
<td style="padding: 0px 20px 0px 20px;">
<?php
echo $form->labelEx($model, 'm_short_code');
?>
</td>
<td>
<?php
$options = array();
$sql = "SELECT DISTINCT short_code from sdp.sdp_services order by short_code";
foreach (Yii::app()->db->createCommand($sql)->queryAll() as $row) {
$options[$row['short_code']] = $row['short_code'];
}
示例10: addError
private function addError($error)
{
$this->r['errors'][] = is_array($error) ? CHtml::encodeArray($error) : CHtml::encode($error);
return false;
}
示例11: array
<?php
/**
* OpenEyes
*
* (C) Moorfields Eye Hospital NHS Foundation Trust, 2008-2011
* (C) OpenEyes Foundation, 2011-2013
* This file is part of OpenEyes.
* OpenEyes is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* OpenEyes is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with OpenEyes in a file titled COPYING. If not, see <http://www.gnu.org/licenses/>.
*
* @package OpenEyes
* @link http://www.openeyes.org.uk
* @author OpenEyes <info@openeyes.org.uk>
* @copyright Copyright (c) 2008-2011, Moorfields Eye Hospital NHS Foundation Trust
* @copyright Copyright (c) 2011-2013, OpenEyes Foundation
* @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0
*/
?>
<div class="sub-element-fields">
<div class="field-row furtherfindings-multi-select">
<?php
echo $form->multiSelectListFreeText($element, CHtml::modelName($element) . '[further_findings_assignment]', 'further_findings_assignment', 'finding_id', CHtml::encodeArray(CHtml::listData(Finding::model()->activeOrPk($element->furtherFindingsAssigned)->bySubspecialty($this->firm->getSubspecialty())->findAll(), 'id', 'name')), array(), array('empty' => '-- Add --', 'label' => 'Findings', 'nowrapper' => true, 'requires_description_field' => 'requires_description'), false, true, 'No further findings', true, true, array(), 'Finding');
?>
</div>
</div>
开发者ID:across-health,项目名称:OphCiExamination,代码行数:27,代码来源:form_Element_OphCiExamination_FurtherFindings.php
示例12: getListChanges
public function getListChanges($project_id)
{
$result = Yii::app()->db->createCommand()->select('CONCAT("/' . self::$file_path . '/",file) as `file`, file as `filename`, comment, id, moderate, date_create')->from(self::tableName())->where('project_id =' . (int) $project_id . (User::model()->isAuthor() ? ' AND moderate=1' : ''))->queryAll();
return CHtml::encodeArray($result);
}
示例13: array_unshift
<div class="cell" style="width:400px;">
<div style="margin-bottom: 1em;">
<h4><?php
echo Yii::t('marketing', 'Saved Forms') . ':';
?>
</h4>
<div class="row">
<p class="fieldhelp-above" style="width: auto;">
<?php
echo Yii::t('marketing', 'Choose an existing form as a starting point.');
?>
</p>
<?php
// so the dropdown will have a blank choice
array_unshift($formAttrs, array('id' => '0', 'name' => '------------'));
echo CHtml::dropDownList('saved-forms', '', CHtml::encodeArray(CHtml::listData($formAttrs, 'id', 'name')), array('class' => 'left'));
echo CHtml::button(Yii::t('marketing', 'Reset Form'), array('id' => 'reset-form', 'class' => 'x2-button x2-small-button'));
/*echo CHtml::button (
Yii::t('marketing','Delete Form'),
array(
'id' => 'delete-form',
'class'=>'x2-button x2-small-button',
'style' => 'display: none;'
)); */
?>
</div>
</div>
</div>
<?php
echo CHtml::beginForm('', 'post', array('id' => 'web-form-designer-form'));
示例14: getListChanges
public function getListChanges($project_id)
{
$result = Yii::app()->db->createCommand()->select('CONCAT("/' . self::$file_path . '/",file) as `file`, file as `filename`, comment, id, moderate, date_create')->from($this->tableName())->where('project_id =' . (int) $project_id . (User::model()->isManager() || User::model()->isAdmin() ? '' : ' AND (user_id = ' . Yii::app()->user->id . ' OR moderate=1)'))->queryAll();
return CHtml::encodeArray($result);
}
示例15: array
echo $form->labelEx($model, 'number_of_offence');
?>
<?php
echo $form->textField($model, 'number_of_offence', array('value' => 0, 'span' => 5, 'disabled' => true, 'style' => 'font-weight: bold;color:red'));
?>
</div>
<div class="row1" style="margin-bottom:10px;width:700px !important;">
<div style="float:left;width:700px !important;height:auto;" >
<span>List of Offences</span>
<span style="margin-left:280px">Offence Commited</span>
<?php
//echo $form->labelEx($model,'offence_ids');
?>
<?php
echo $form->dropDownList($model, 'offence_ids[]', CHtml::encodeArray(CHtml::listData(OffenceList::model()->findAll(array('order' => 'id ASC')), 'id', 'fullOffence')), array('options' => $model->user_challan_list(), 'multiple' => 'multiple'), array('style' => 'width:700px !important;height:auto'));
?>
<?php
//echo "<pre>";print_r($model->user_challan_list());
//print_r(array('1'=>array('selected'=>true),'2'=>array('selected'=>true)));
?>
<div style="clear:both;" >
</div>
</div>
</div>
<div class="row" style="margin-bottom:10px;margin-top:80px;">
<h4 style="background-color: #49afcd;
background-image: linear-gradient(to bottom, #5bc0de, #2f96b4);color:#E7FDD6 !important;padding: 6px;background-image: linear-gradient(to bottom, #3AE8EB, #0e8eff) repeat-x scroll 0 0 #335a84; background-repeat: repeat-x;
border-radius: 4px;