本文整理汇总了PHP中Dropdowns::getItems方法的典型用法代码示例。如果您正苦于以下问题:PHP Dropdowns::getItems方法的具体用法?PHP Dropdowns::getItems怎么用?PHP Dropdowns::getItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dropdowns
的用法示例。
在下文中一共展示了Dropdowns::getItems方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quickNoteSelector
public function quickNoteSelector(CFormModel $formModel)
{
ob_start();
ob_implicit_flush(false);
echo CHtml::label(Yii::t('app', 'Quick Note'), 'quickNote', array('style' => 'display:inline-block; margin-right: 10px;'));
echo X2Html::dropDownList('quickNote', '', array_merge(array('' => '-'), Dropdowns::getItems(117)), array('ajax' => array('type' => 'GET', 'url' => Yii::app()->controller->createUrl('/site/dynamicDropdown'), 'data' => 'js:{"val":$(this).val(),"dropdownId":"117"}', 'update' => $this->resolveIds('#quickNote2')), 'id' => $this->resolveId('quickNote'), 'class' => 'quick-note'));
echo X2Html::dropDownList('quickNote2', '', array('' => '-'), array('id' => $this->resolveId('quickNote2'), 'class' => 'quick-note'));
Yii::app()->clientScript->registerScript('quickNoteSelector', "\n \$('#{$this->resolveId('quickNote2')}').change (function () {\n \$(this).next ().val (\$(this).val ());\n });\n ");
return ob_get_clean();
}
示例2: actionConvertToInvoice
/**
* Convert the Quote into an Invoice
* An invoice is a quote with field type='invoice'. The only difference is that
* when listing, printing, or emailing an invoice, we call it an invoice instead
* of a quote.
*
* @param $id id of the quote to convert to invoice
*
*/
public function actionConvertToInvoice($id)
{
$model = $this->getModel($id);
// get model
// convert to invoice
$model->type = 'invoice';
$model->invoiceCreateDate = time();
// set invoice status to the top choice in the invoice status drop down
$field = $model->getField('invoiceStatus');
if ($field) {
$dropDownId = $field->linkType;
if ($dropDownId) {
$dropdowns = Dropdowns::getItems($field->linkType);
if ($dropdowns) {
reset($dropdowns);
$status = key($dropdowns);
if ($status) {
$model->invoiceStatus = $status;
}
}
}
}
$model->update();
// ajax request from a contact view, don't reload page, instead return a list of quotes
// for this contact
if (isset($_GET['modelName']) && isset($_GET['recordId'])) {
//$contact = X2Model::model('Contacts')->findByPk($_GET['contactId']);
if ($model) {
Yii::app()->clientScript->scriptMap['*.js'] = false;
$this->renderPartial('quoteFormWrapper', array('modelId' => $_GET['recordId'], 'modelName' => $_GET['modelName']), false, true);
return;
}
}
$this->redirect(array('view', 'id' => $model->id));
// view quote
}
示例3: array_keys
</div>
</div>
</div>
<form id='feed-post-publisher'><!-- submitted via ajax, doesn't need csrf token -->
<textarea class='x2-textarea' type='text' name='name' id='feed-post-editor'
placeholder='<?php
echo Yii::t('app', 'Enter text here...');
?>
'></textarea>
<div id='feed-post-controls' style='display:none;'>
<?php
$users = User::getUserIds();
$userIds = array_keys($users);
$firstUser = $userIds[0];
echo CHtml::dropDownList('subtype', 1, Dropdowns::getItems(113), array('class' => 'x2-select', 'id' => 'feed-post-subtype'));
echo CHtml::dropDownList('associationId', $firstUser, $users, array('class' => 'x2-select', 'id' => 'feed-post-association-id'));
?>
<div class='post-button-row-2'>
<button type='submit' class='x2-button' id='feed-post-button'
data-inline='true'><?php
echo Yii::t('app', 'Submit Post');
?>
</button>
<?php
echo CHtml::dropDownList('visibility', 1, array(1 => Yii::t('actions', 'Public'), 0 => Yii::t('actions', 'Private')), array('class' => 'x2-select', 'id' => 'feed-post-visibility'));
?>
</div>
</div>
</form>
示例4: actionStatusFilter
/**
* Show or hide a certain status in the gridview
*
* Called through ajax with a status and if that status should be shown or hidden.
* Saves the result in the user's profile.
*
*/
public function actionStatusFilter()
{
if (isset($_POST['all'])) {
// show all the things!!
Yii::app()->params->profile->hideCasesWithStatus = CJSON::encode(array());
// hide none
Yii::app()->params->profile->update(array('hideCasesWithStatus'));
} elseif (isset($_POST['none'])) {
// hide all the things!!!!11
$statuses = array();
$dropdownId = Yii::app()->db->createCommand()->select('linkType')->from('x2_fields')->where('modelName="Services" AND fieldName="status" AND type="dropdown"')->queryScalar();
if ($dropdownId !== null) {
$statuses = Dropdowns::getItems($dropdownId);
}
// get the actual statuses
Yii::app()->params->profile->hideCasesWithStatus = CJSON::encode($statuses);
Yii::app()->params->profile->update(array('hideCasesWithStatus'));
} elseif (isset($_POST['checked'])) {
$checked = CJSON::decode($_POST['checked']);
$status = isset($_POST['status']) ? $_POST['status'] : false;
// var_dump($checked);
// var_dump($status);
$hideStatuses = CJSON::decode(Yii::app()->params->profile->hideCasesWithStatus);
// get a list of statuses the user wants to hide
if ($hideStatuses === null || !is_array($hideStatuses)) {
$hideStatuses = array();
}
// var_dump($checked);
// var_dump(in_array($status, $hideStatuses));
if ($checked && ($key = array_search($status, $hideStatuses)) !== false) {
// if we want to show the status, and it's not being shown
unset($hideStatuses[$key]);
// show status
} else {
if (!$checked && !in_array($status, $hideStatuses)) {
// if we want to hide the status, and it's not being hidden
$hideStatuses[] = $status;
}
}
Yii::app()->params->profile->hideCasesWithStatus = CJSON::encode($hideStatuses);
Yii::app()->params->profile->update(array('hideCasesWithStatus'));
}
}
示例5: array
<div id='<?php
echo $this->resolveId('log-a-call');
?>
' class='publisher-form'
<?php
echo $startVisible ? '' : "style='display: none;'";
?>
>
<div class="row">
<div>
<?php
echo CHtml::label(Yii::t('app', 'Quick Note'), 'quickNote', array('style' => 'display:inline-block; margin-right: 10px;'));
echo X2Html::dropDownList('quickNote', '', array_merge(array('' => '-'), Dropdowns::getItems(117)), array('ajax' => array('type' => 'GET', 'url' => Yii::app()->controller->createUrl('/site/dynamicDropdown'), 'data' => 'js:{"val":$(this).val(),"dropdownId":"117"}', 'update' => $this->resolveIds('#quickNote2'), 'complete' => $this->resolveIds('function() {
auxlib.getElement("#call-action-description").val("");
}')), 'id' => $this->resolveId('quickNote')));
echo X2Html::dropDownList('quickNote2', '', array('' => '-'), array('id' => $this->resolveId('quickNote2')));
?>
</div>
</div>
<div class="row">
<div class="text-area-wrapper">
<?php
echo $model->renderInput('actionDescription', array('rows' => 3, 'cols' => 40, 'class' => 'action-description x2-textarea', 'id' => $this->resolveId('call-action-description')));
?>
</div>
</div>
<div class='row action-event-panel'>
示例6: getDropdownOptions
public function getDropdownOptions()
{
if ($this->linkType instanceof X2StaticDropdown) {
return array('options' => $this->linkType->options, 'multi' => false);
} else {
return Dropdowns::getItems($this->linkType, null, true);
}
}
示例7: renderInput
/**
* @param type $fieldName
* @param type $htmlOptions
*/
public function renderInput($fieldName, $htmlOptions = array())
{
if ($fieldName === 'color') {
$field = $this->getField($fieldName);
$options = Dropdowns::getItems($field->linkType, null, false);
$enableDropdownLegend = Yii::app()->settings->enableColorDropdownLegend;
if ($enableDropdownLegend) {
$htmlOptions['options'] = array();
foreach ($options as $value => $label) {
$brightness = X2Color::getColorBrightness($value);
$fontColor = $brightness > 127.5 ? 'black' : 'white';
$htmlOptions['options'][$value] = array('style' => 'background-color: ' . $value . ';
color: ' . $fontColor);
}
}
return CHtml::activeDropDownList($this, $field->fieldName, $options, $htmlOptions);
} elseif ($fieldName == 'priority') {
return CHtml::activeDropdownList($this, 'priority', self::getPriorityLabels());
}
return parent::renderInput($fieldName, $htmlOptions);
}
示例8: listOption
public static function listOption($attributes, $name)
{
if ($attributes instanceof Fields) {
$attributes = $attributes->getAttributes();
}
$data = array('name' => $name, 'label' => $attributes['attributeLabel']);
if (isset($attributes['type']) && $attributes['type']) {
$data['type'] = $attributes['type'];
}
if (isset($attributes['required']) && $attributes['required']) {
$data['required'] = 1;
}
if (isset($attributes['readOnly']) && $attributes['readOnly']) {
$data['readOnly'] = 1;
}
if (isset($attributes['type'])) {
if ($attributes['type'] === 'assignment' || $attributes['type'] === 'optionalAssignment') {
$data['options'] = AuxLib::dropdownForJson(X2Model::getAssignmentOptions(true, true));
} elseif ($attributes['type'] === 'dropdown' && isset($attributes['linkType'])) {
$data['linkType'] = $attributes['linkType'];
$data['options'] = AuxLib::dropdownForJson(Dropdowns::getItems($attributes['linkType']));
} elseif ($attributes['type'] === 'link' && isset($attributes['linkType'])) {
$staticLinkModel = X2Model::model($attributes['linkType']);
if (array_key_exists('X2LinkableBehavior', $staticLinkModel->behaviors())) {
$data['linkType'] = $attributes['linkType'];
$data['linkSource'] = Yii::app()->controller->createUrl($staticLinkModel->autoCompleteSource);
}
}
}
return $data;
}
示例9: actionGetFields
public function actionGetFields($model)
{
if (!class_exists($model)) {
echo 'false';
return;
}
$fieldModels = X2Model::model($model)->getFields();
$fields = array();
foreach ($fieldModels as &$field) {
if ($field->isVirtual) {
continue;
}
$data = array('name' => $field->fieldName, 'label' => $field->attributeLabel, 'type' => $field->type);
if ($field->required) {
$data['required'] = 1;
}
if ($field->readOnly) {
$data['readOnly'] = 1;
}
if ($field->type === 'assignment' || $field->type === 'optionalAssignment') {
$data['options'] = AuxLib::dropdownForJson(X2Model::getAssignmentOptions(true, true));
} elseif ($field->type === 'dropdown') {
$data['linkType'] = $field->linkType;
$data['options'] = AuxLib::dropdownForJson(Dropdowns::getItems($field->linkType));
}
if ($field->type === 'link') {
$staticLinkModel = X2Model::model($field->linkType);
if (array_key_exists('X2LinkableBehavior', $staticLinkModel->behaviors())) {
$data['linkType'] = $field->linkType;
$data['linkSource'] = Yii::app()->controller->createUrl($staticLinkModel->autoCompleteSource);
}
}
$fields[] = $data;
}
echo CJSON::encode($fields);
}
示例10: array
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* X2Engine" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by X2Engine".
*****************************************************************************************/
$menuOptions = array('index', 'create', 'createWebForm', 'import', 'export');
$this->insertMenu($menuOptions);
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('services-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
/*
?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
'model'=>$model,
)); ?>
</div><!-- search-form -->
<?php
*/
$field = Fields::model()->findByAttributes(array('modelName' => 'Services', 'fieldName' => 'status', 'type' => 'dropdown'));
if ($field) {
$statuses = Dropdowns::getItems($field->linkType);
if ($statuses) {
// var_dump(json_decode($dropdown->options));
$this->serviceCaseStatuses = $statuses;
}
}
$this->widget('X2GridView', array('id' => 'services-grid', 'title' => Yii::t('services', 'Service Cases'), 'buttons' => array('advancedSearch', 'clearFilters', 'columnSelector', 'autoResize', 'showHidden'), 'template' => '<div id="x2-gridview-top-bar-outer" class="x2-gridview-fixed-top-bar-outer">' . '<div id="x2-gridview-top-bar-inner" class="x2-gridview-fixed-top-bar-inner">' . '<div id="x2-gridview-page-title" ' . 'class="page-title icon services x2-gridview-fixed-title">' . '{title}{buttons}{filterHint}' . '{summary}{topPager}{items}{pager}', 'fixedHeader' => true, 'dataProvider' => $model->searchWithStatusFilter(), 'filter' => $model, 'pager' => array('class' => 'CLinkPager', 'maxButtonCount' => 10), 'modelName' => 'Services', 'viewName' => 'services', 'defaultGvSettings' => array('gvCheckbox' => 30, 'id' => 43, 'impact' => 80, 'status' => 233, 'assignedTo' => 112, 'lastUpdated' => 79, 'updatedBy' => 111), 'specialColumns' => array('id' => array('name' => 'id', 'type' => 'raw', 'value' => 'CHtml::link($data->id, array("view","id"=>$data->id))'), 'account' => array('name' => 'account', 'header' => Yii::t('contacts', 'Account'), 'type' => 'raw', 'value' => 'isset ($data->contactIdModel) ? ($data->contactIdModel ? (isset($data->contactIdModel->companyModel) ? $data->contactIdModel->companyModel->getLink() : "") : "") : ""'), 'status' => array('name' => 'status', 'type' => 'raw', 'value' => 'Yii::t("services",$data->renderAttribute("status"))'), 'impact' => array('name' => 'impact', 'type' => 'raw', 'value' => 'Yii::t("services",$data->renderAttribute("impact"))')), 'enableControls' => true, 'fullscreen' => true));
示例11: array
* X2Engine" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by X2Engine".
*****************************************************************************************/
if (!Yii::app()->user->isGuest) {
if ($this->action->id === 'view') {
} else {
// get a list of statuses the user wants to hide
$hideStatus = CJSON::decode(Yii::app()->params->profile->hideBugsWithStatus);
if (!$hideStatus) {
$hideStatus = array();
}
$this->beginWidget('zii.widgets.CPortlet', array('title' => Yii::t('services', 'Filter By Status'), 'id' => 'service-case-status-filter'));
echo '<ul id="bug-statuses-picker" style="font-size: 0.8em; font-weight: bold; color: black;">';
$i = 1;
foreach (Dropdowns::getItems(115) as $status) {
$checked = !in_array($status, $hideStatus);
echo "<li>\n";
echo CHtml::checkBox("service-case-status-filter-{$i}", $checked, array('id' => "service-case-status-filter-{$i}", 'ajax' => array('type' => 'POST', 'url' => Yii::app()->controller->createUrl('/bugReports/bugReports/statusFilter'), 'success' => 'js:function(response) {
$.fn.yiiGridView.update("bugReports-grid"); }', 'data' => 'js:{
checked: $(this).attr("checked")=="checked", status:"' . $status . '"
}', 'complete' => 'function(){
if($("#service-case-status-filter-' . $i . '").
attr("checked")=="checked") {
$("#service-case-status-filter-' . $i . '").removeAttr(
"checked","checked");
} else {
$("#service-case-status-filter-' . $i . '").attr(
"checked","checked");
}
示例12: paramRules
public function paramRules()
{
// $eventTypes = array('auto'=>Yii::t('app','Auto')) + Dropdowns::getItems(113,'app');
$eventTypes = Dropdowns::getItems(113, 'studio');
return array('title' => Yii::t('studio', $this->title), 'info' => Yii::t('studio', $this->info), 'options' => array(array('name' => 'type', 'label' => Yii::t('studio', 'Post Type'), 'type' => 'dropdown', 'options' => $eventTypes), array('name' => 'text', 'label' => Yii::t('studio', 'Text'), 'type' => 'text'), array('name' => 'user', 'optional' => 1, 'label' => 'User (optional)', 'type' => 'dropdown', 'options' => array('' => '----------', 'auto' => 'Auto') + X2Model::getAssignmentOptions(false, false)), array('name' => 'createNotif', 'label' => Yii::t('studio', 'Create Notification?'), 'type' => 'boolean', 'defaultVal' => true)));
}
示例13: paramRules
public function paramRules()
{
// $eventTypes = array('auto'=>Yii::t('app','Auto')) + Dropdowns::getItems(113,'app');
$eventTypes = Dropdowns::getItems(113, 'studio');
return array_merge(parent::paramRules(), array('title' => Yii::t('studio', $this->title), 'info' => Yii::t('studio', $this->info), 'options' => array(array('name' => 'type', 'label' => Yii::t('studio', 'Post Type'), 'type' => 'dropdown', 'options' => $eventTypes), array('name' => 'text', 'label' => Yii::t('studio', 'Text'), 'type' => 'text'), array('name' => 'visibility', 'label' => Yii::t('studio', 'Visibility'), 'type' => 'dropdown', 'options' => array(1 => Yii::t('admin', 'Public'), 0 => Yii::t('admin', 'Private')), 'defaultVal' => 1), array('name' => 'feed', 'optional' => 1, 'label' => 'User (optional)', 'type' => 'dropdown', 'options' => array('' => '----------', 'auto' => 'Auto') + X2Model::getAssignmentOptions(false, false)), array('name' => 'user', 'optional' => 1, 'label' => 'Author', 'type' => 'dropdown', 'options' => array('admin' => 'admin', 'auto' => Yii::t('studio', 'Auto')) + array_diff_key(X2Model::getAssignmentOptions(false, false), array('admin' => '')), 'defaultVal' => 'admin'), array('name' => 'createNotif', 'label' => Yii::t('studio', 'Create Notification?'), 'type' => 'boolean', 'defaultVal' => true))));
}
示例14: getDropdownIndex
/**
* Returns dropdown value(s) for given key(s)
* @return array|string
*/
public function getDropdownIndex($id, $key)
{
$arr = Dropdowns::getItems($id);
if (is_array($key)) {
return array_map(function ($value) use($arr) {
$index = array_search($value, $arr);
if ($index === false) {
return $value;
} else {
return $index;
}
}, $key);
} else {
if (array_search($key, $arr) !== false) {
return array_search($key, $arr);
} else {
return $key;
}
}
}
示例15: array
echo '<div class="formInputBox" style="width:' . $item['width'] . 'px;height:' . $item['height'] . ';">';
$default = $model->{$fieldName} == $field->attributeLabel;
if ($field->type == 'varchar' || $field->type == 'email' || $field->type == 'url' || $field->type == 'int' || $field->type == 'float' || $field->type == 'currency') {
echo $form->textField($model, $field->fieldName, array('tabindex' => isset($item['tabindex']) ? $item['tabindex'] : null, 'disabled' => $item['readOnly'] ? 'disabled' : null, 'title' => $field->attributeLabel, 'style' => $default ? 'color:#aaa;' : null));
} else {
if ($field->type == 'text') {
echo $form->textArea($model, $field->fieldName, array('tabindex' => isset($item['tabindex']) ? $item['tabindex'] : null, 'disabled' => $item['readOnly'] ? 'disabled' : null, 'title' => $field->attributeLabel, 'style' => $default ? 'color:#aaa;' : null));
} else {
if ($field->type == 'text') {
echo $form->textArea($model, $field->fieldName, array('tabindex' => isset($item['tabindex']) ? $item['tabindex'] : null, 'disabled' => $item['readOnly'] ? 'disabled' : null, 'title' => $field->attributeLabel, 'onfocus' => $default ? 'toggleText(this);' : null, 'onblur' => $default ? 'toggleText(this);' : null, 'style' => $default ? 'color:#aaa;' : null));
} elseif ($field->type == 'date') {
$model->{$fieldName} = $this->formatDate($model->{$fieldName});
Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$this->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => $field->fieldName, 'mode' => 'date', 'options' => array('dateFormat' => $this->formatDatePicker()), 'htmlOptions' => array('tabindex' => isset($item['tabindex']) ? $item['tabindex'] : null, 'disabled' => defined($item['readOnly']) && $item['readOnly'] ? 'disabled' : null, 'title' => $field->attributeLabel), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()));
} elseif ($field->type == 'dropdown') {
$dropdowns = Dropdowns::getItems($field->linkType);
echo $form->dropDownList($model, $field->fieldName, $dropdowns, array('tabindex' => isset($item['tabindex']) ? $item['tabindex'] : null, 'disabled' => $item['readOnly'] ? 'disabled' : null, 'title' => $field->attributeLabel));
} elseif ($field->type == 'link') {
// if(empty($model->$fieldName))
// $model->$fieldName = '';
$linkSource = null;
$linkId = '';
if (class_exists($field->linkType)) {
// if the field is an ID, look up the actual name
if (isset($model->{$fieldName}) && ctype_digit($model->{$fieldName})) {
$linkModel = CActiveRecord::model($field->linkType)->findByPk($model->{$fieldName});
if (isset($linkModel)) {
$model->{$fieldName} = $linkModel->name;
$linkId = $linkModel->id;
} else {
$model->{$fieldName} = '';