本文整理汇总了PHP中Dropdowns::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Dropdowns::model方法的具体用法?PHP Dropdowns::model怎么用?PHP Dropdowns::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dropdowns
的用法示例。
在下文中一共展示了Dropdowns::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDownAfterClass
public static function tearDownAfterClass()
{
$leadSourceDropdown = Dropdowns::model()->findByPk(103);
$leadSourceDropdown->multi = 0;
$leadSourceDropdown->save();
return parent::tearDownAfterClass();
}
示例2: getSocialSubtypes
public static function getSocialSubtypes()
{
$dropdown = Dropdowns::model()->findByPk(113);
if (!$dropdown) {
return array();
}
return json_decode($dropdown->options, true);
}
示例3: statusList
public static function statusList()
{
$field = Fields::model()->findByAttributes(array('modelName' => 'Quotes', 'fieldName' => 'status'));
$dropdown = Dropdowns::model()->findByPk($field->linkType);
return json_decode($dropdown->options);
/*
return array(
'Draft'=>Yii::t('quotes','Draft'),
'Presented'=>Yii::t('quotes','Presented'),
"Issued"=>Yii::t('quotes','Issued'),
"Won"=>Yii::t('quotes','Won')
); */
}
示例4: array
?>
</div>
<div class="cell">
<?php
echo CHtml::label(Yii::t('dashboard', 'Date Range'), 'range');
?>
<?php
echo CHtml::dropDownList('range', $dateRange['range'], array('custom' => Yii::t('dashboard', 'Custom'), 'thisWeek' => Yii::t('dashboard', 'This Week'), 'thisMonth' => Yii::t('dashboard', 'This Month'), 'lastWeek' => Yii::t('dashboard', 'Last Week'), 'lastMonth' => Yii::t('dashboard', 'Last Month'), 'thisYear' => Yii::t('dashboard', 'This Year'), 'lastYear' => Yii::t('dashboard', 'Last Year')), array('id' => 'dateRange'));
?>
</div>
</div>
<div class="row">
<div class="cell">
<?php
echo $form->label($model, 'leadSource');
$dropdown = Dropdowns::model()->findByPk(4);
// lead source
$dropdowns = json_decode($dropdown->options, true);
foreach (array_keys($dropdowns) as $key) {
$dropdowns[$key] = Yii::t(strtolower(Yii::app()->controller->id), $dropdowns[$key]);
}
$dropdowns = array('' => '---') + $dropdowns;
echo $form->dropDownList($model, 'leadSource', $dropdowns, array());
?>
</div>
<div class="cell">
<?php
echo $form->label($model, 'company');
$linkId = '';
// if the field is an ID, look up the actual name
if (isset($model->company) && ctype_digit($model->company)) {
示例5: getDropdown
public function getDropdown()
{
if ($this->type !== 'dropdown') {
return null;
}
if (!isset($this->_dropdown)) {
$this->_dropdown = Dropdowns::model()->findByPk($this->linkType);
}
return $this->_dropdown;
}
示例6: Social
<div class="form">
<?php
$feed = new Social();
?>
<?php
$form = $this->beginWidget('CActiveForm', array('id' => 'feed-form', 'enableAjaxValidation' => false, 'method' => 'post', 'action' => array('addPost', 'id' => Yii::app()->user->getId(), 'redirect' => 'index')));
?>
<div class="float-row">
<?php
$feed->data = Yii::t('app', 'Enter text here...');
echo $form->textArea($feed, 'data', array('style' => 'width:558px;height:50px;color:#aaa;display:block;clear:both;'));
echo $form->dropDownList($feed, 'associationId', $users);
$feed->visibility = 1;
echo $form->dropDownList($feed, 'visibility', array(1 => Yii::t('actions', 'Public'), 0 => Yii::t('actions', 'Private')));
echo $form->dropDownList($feed, 'subtype', json_decode(Dropdowns::model()->findByPk(14)->options, true));
echo CHtml::submitButton(Yii::t('app', 'Post'), array('class' => 'x2-button', 'id' => 'save-button'));
echo CHtml::button(Yii::t('app', 'Attach A File/Photo'), array('class' => 'x2-button', 'onclick' => "\$('#attachments').toggle();"));
?>
</div>
<?php
$this->endWidget();
?>
</div>
<div id="attachments" style="display:none;">
<?php
$this->widget('Attachments', array('associationType' => 'feed', 'associationId' => Yii::app()->user->getId()));
?>
</div>
示例7: array
?>
<?php
$form = $this->beginWidget('CActiveForm', array('id' => 'feed-form', 'enableAjaxValidation' => false, 'method' => 'post'));
?>
<div class="float-row" style='overflow:visible;'>
<?php
echo $form->textArea($feed, 'text', array('style' => 'width:99%;height:25px;color:#aaa;display:block;clear:both;'));
echo "<div id='post-buttons' style='display:none;'>";
echo $form->dropDownList($feed, 'associationId', $users, array('style' => $isMyProfile ? '' : 'display:none;', 'class' => 'x2-select'));
$feed->visibility = 1;
echo $form->dropDownList($feed, 'visibility', array(1 => Yii::t('actions', 'Public'), 0 => Yii::t('actions', 'Private')), array('class' => 'x2-select'));
function translateOptions($item)
{
return Yii::t('app', $item);
}
echo $form->dropDownList($feed, 'subtype', array_map('translateOptions', json_decode(Dropdowns::model()->findByPk(113)->options, true)), array('class' => 'x2-select'));
?>
<div id='second-row-buttons-container'>
<?php
echo CHtml::submitButton(Yii::t('app', 'Post'), array('class' => 'x2-button', 'id' => 'save-button'));
if ($isMyProfile) {
echo CHtml::button(Yii::t('app', 'Attach A File/Photo'), array('class' => 'x2-button', 'onclick' => "\$('#attachments').slideToggle();", 'id' => "toggle-attachment-menu-button"));
}
?>
</div>
</div>
<?php
?>
</div>
<?php
$this->endWidget();
示例8: 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));
if ($field->type === 'assignment') {
$data['multiple'] = $field->linkType === 'multiple' ? 1 : 0;
}
} elseif ($field->type === 'dropdown') {
$data['linkType'] = $field->linkType;
$dropdown = Dropdowns::model()->findByPk($field->linkType);
if (!$dropdown) {
continue;
}
$data['options'] = AuxLib::dropdownForJson(Dropdowns::getItems($field->linkType));
$data['multiple'] = $dropdown->multi ? 1 : 0;
}
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;
}
usort($fields, function ($a, $b) {
return strcmp($a['label'], $b['label']);
});
echo CJSON::encode($fields);
}
示例9: array
}
$fieldTypes = Fields::getFieldTypes('title');
echo $form->dropDownList($model, 'type', ArrayUtil::asorti($fieldTypes), array('id' => 'fieldType', 'class' => $new ? 'new' : 'existing'));
?>
<?php
echo $form->error($model, 'type');
?>
</div>
<div class="row">
<?php
// Render a dropdown menu and any other fields
// for the "linkType" field
$genericLabel = CHtml::label(Yii::t('app', 'Type'), CHtml::resolveName($model, $assignTypeName));
switch ($model->type) {
case "dropdown":
$dropdowns = Dropdowns::model()->findAll();
$arr = array();
foreach ($dropdowns as $dropdown) {
$arr[$dropdown->id] = $dropdown->name;
}
echo CHtml::activeDropDownList($model, 'linkType', $arr, array('id' => 'dropdown-type', 'class' => $new ? 'new' : 'existing'));
break;
case "assignment":
$assignTypeName = 'linkType';
echo $genericLabel;
echo CHtml::activeDropDownList($model, 'linkType', array(NULL => Yii::t('app', 'Single'), 'multiple' => Yii::t('app', 'Multiple')), array('id' => 'assignment-multiplicity', 'class' => $new ? 'new' : 'existing'));
break;
case "link":
$linkTypes = Fields::getLinkTypes();
$options = array();
foreach ($linkTypes as $type) {
示例10: array_keys
?>
' value='' />-->
<textarea type='text' name='name' id='feed-post-editor'
placeholder='<?php
echo Yii::t('app', 'Enter text here...');
?>
'></textarea>
<fieldset data-role='controlgroup' data-type='horizontal'>
<?php
$userIds = array_keys($users);
$firstUser = $userIds[0];
echo CHtml::dropDownList('associationId', $firstUser, $users, array('data-mini' => 'true', 'id' => 'feed-post-association-id'));
echo CHtml::dropDownList('visibility', 1, array(1 => Yii::t('actions', 'Public'), 0 => Yii::t('actions', 'Private')), array('data-mini' => 'true', 'id' => 'feed-post-visibility'));
echo CHtml::dropDownList('subtype', 1, array_map(function ($item) {
return Yii::t('app', $item);
}, json_decode(Dropdowns::model()->findByPk(113)->options, true)), array('data-mini' => 'true', 'id' => 'feed-post-subtype'));
?>
</fieldset>
<button type='submit' class='x2-button' id='feed-post-button'
data-inline='true'><?php
echo Yii::t('app', 'Submit Post');
?>
</button>
<?php
echo X2Html::csrfToken();
?>
</form>
<div id="attachments" style='display: none;'>
<?php
$this->widget('Attachments', array('associationType' => 'feed', 'associationId' => Yii::app()->user->getId(), 'mobile' => true));
?>
示例11: array
break;
case 'percentage':
$type = 'percentageIcon';
break;
case 'credentials':
$type = 'dropdownIcon';
break;
default:
$type = 'varcharIcon';
}
echo '<div class="formItem leftLabel" id="formItem_' . $field->fieldName . '"><div class="formTabOrder"></div><label class="' . $type . '">' . X2Model::model($modelName)->getAttributeLabel($field->fieldName) . '</label>';
echo '<div class="formInputBox">';
if ($field->type == 'text') {
echo CHtml::textArea($modelName . '_' . $field->fieldName, '', array('title' => $field->attributeLabel));
} elseif ($field->type == 'dropdown') {
$dropdown = Dropdowns::model()->findByPk($field->linkType);
if (isset($dropdown)) {
echo CHtml::dropDownList($modelName . '_' . $field->fieldName, '', json_decode($dropdown->options), array('title' => $field->attributeLabel));
} else {
echo CHtml::textField($modelName . '_' . $field->fieldName, '', array('title' => $field->attributeLabel));
}
} elseif ($field->type == 'boolean') {
echo '<div class="checkboxWrapper">';
echo CHtml::checkBox($modelName . '_' . $field->fieldName, false, array('title' => $field->attributeLabel)) . '</div>';
} elseif ($field->type == 'assignment') {
echo CHtml::dropDownList($field->fieldName, '', array('Users'), array('title' => $field->attributeLabel));
} elseif ($field->type == 'visibility') {
echo CHtml::dropDownList($field->fieldName, '', array(1 => 'Public', 0 => 'Private', 2 => 'User\'s Groups'), array('title' => $field->attributeLabel));
} else {
echo CHtml::textField($modelName . '_' . $field->fieldName, '', array('title' => $field->attributeLabel));
}
示例12: fieldOptions
/**
* Gets possible values for a field.
*
* Note, this is meant to be a stripped-down imitation of what is in
* {@link X2Model} already. I know this is code duplication, but considering
*
* Note, does not yet handle multiple choice (selecting more than one).
*
* @param Fields $field
*/
public function fieldOptions(Fields $field)
{
switch ($field->type) {
case 'assignment':
return X2Model::getAssignmentOptions(true, true, false);
case 'credentials':
$typeArr = explode(':', $field->linkType);
$type = $typeArr[0];
if (count($typeAlias) > 1) {
$uid = Credentials::$sysUseId[$typeAlias[1]];
} else {
$uid = Yii::app()->getSuId();
}
if (count($typeArr > 0)) {
$uid = $typeArr[1];
}
$config = Credentials::getCredentialOptions($this->staticModel, $field->fieldName, $type, $uid);
return $config['credentials'];
case 'dropdown':
// Dropdown options
$dropdown = Dropdowns::model()->findByPk($field->linkType);
if ($dropdown instanceof Dropdowns) {
return json_decode($dropdown->options, 1);
}
break;
case 'optionalAssignment':
$options = X2Model::getAssignmentOptions(true, true, false);
unset($options['Anyone']);
$options[''] = '';
return $options;
case 'rating':
return range(Fields::RATING_MIN, Fields::RATING_MAX);
case 'varchar':
// Special kludge for actions priority dropdown mapping
if ($field->modelName == 'Actions' && $field->fieldName == 'priority') {
return Actions::getPriorityLabels();
}
break;
case 'visibility':
$permissionsBehavior = Yii::app()->params->modelPermissions;
return $permissionsBehavior::getVisibilityOptions();
}
return array();
}
示例13: getViewFileParams
public function getViewFileParams()
{
if (!isset($this->_viewFileParams)) {
$this->_viewFileParams = array_merge(parent::getViewFileParams(), array('userNames' => User::getNames(), 'socialSubtypes' => json_decode(Dropdowns::model()->findByPk(113)->options, true), 'visibilityFilters' => array('1' => 'Public', '0' => 'Private'), 'chartSettingsDataProvider' => self::getChartSettingsProvider($this->chartType), 'suppressChartSettings' => false, 'metricTypes' => array('any' => Yii::t('app', 'All Events'), 'notif' => Yii::t('app', 'Notifications'), 'feed' => Yii::t('app', 'Feed Events'), 'comment' => Yii::t('app', 'Comments'), 'record_create' => Yii::t('app', 'Records Created'), 'record_deleted' => Yii::t('app', 'Records Deleted'), 'weblead_create' => Yii::t('app', 'Webleads Created'), 'workflow_start' => Yii::t('app', '{Process} Started', array('{Process}' => Modules::displayName(false, 'Workflow'))), 'workflow_complete' => Yii::t('app', '{Process} Complete', array('{Process}' => Modules::displayName(false, 'Workflow'))), 'workflow_revert' => Yii::t('app', '{Process} Reverted', array('{Process}' => Modules::displayName(false, 'Workflow'))), 'email_sent' => Yii::t('app', 'Emails Sent'), 'email_opened' => Yii::t('app', 'Emails Opened'), 'web_activity' => Yii::t('app', 'Web Activity'), 'case_escalated' => Yii::t('app', 'Cases Escalated'), 'calendar_event' => Yii::t('app', '{Calendar} Events', array('{Calendar}' => Modules::displayName(false, 'Calendar'))), 'action_reminder' => Yii::t('app', '{Action} Reminders', array('{Action}' => Modules::displayName(false, 'Actions'))), 'action_complete' => Yii::t('app', '{Actions} Completed', array('{Actions}' => Modules::displayName(true, 'Actions'))), 'doc_update' => Yii::t('app', 'Doc Updates'), 'email_from' => Yii::t('app', 'Email Received'), 'voip_calls' => Yii::t('app', 'VOIP Calls'), 'media' => Yii::t('app', '{Media}', array('{Media}' => Modules::displayName(true, 'Media')))), 'chartType' => 'eventsChart', 'widgetUID' => $this->widgetUID));
}
return $this->_viewFileParams;
}
示例14: array
* 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".
*****************************************************************************************/
Yii::app()->clientScript->registerCss('feedFiltersCSs', "\n#feed-filters .x2-multiselect-dropdown-menu {\n margin-right: 3px;\n margin-bottom: 4px;\n}\n\n\n#feed-filters-button {\n color: inherit;\n text-decoration: none;\n opacity: 0.5;\n margin-right: 9px;\n margin-top: 3px;\n}\n#feed-filters-button > span {\n display: block;\n}\n#feed-filters-button:hover {\n opacity: 0.7;\n}\n\na#toggle-filters-link {\n margin-bottom: 4px;\n}\n\n\n#full-controls-button-container {\n margin-top: 5px;\n}\n\n#full-controls-button-container > a {\n margin-right: 3px;\n}\n\n#full-controls,\n#simple-controls {\n padding-left: 5px;\n}\n\n#execute-feed-filters-button {\n margin-left: 11px;\n height: 18px;\n line-height: 18px;\n}\n\n#filter-default {\n margin-top: 6px;\n margin-left: 8px;\n}\n\n#feed-filters .x2-button-group {\n margin-top: 8px;\n}\n\n#filter-controls > .portlet-content {\n padding: 5px 0px !important;\n}\n\n#filter-controls > .portlet-content > .x2-button-group {\n margin-bottom: 5px;\n}\n\n");
?>
<div id='feed-filters' style='display: none;'>
<?php
if (isset($_SESSION['filters'])) {
$filters = $_SESSION['filters'];
} else {
$filters = array('visibility' => array(), 'users' => array(), 'types' => array(), 'subtypes' => array());
}
$visibility = array('1' => 'Public', '0' => 'Private');
$socialSubtypes = json_decode(Dropdowns::model()->findByPk(113)->options, true);
$users = User::getNames();
$eventTypeList = Yii::app()->db->createCommand()->select('type')->from('x2_events')->group('type')->queryAll();
$eventTypes = array();
foreach ($eventTypeList as $key => $value) {
if ($value['type'] != 'comment') {
$eventTypes[$value['type']] = Events::parseType($value['type']);
}
}
$profile = Yii::app()->params->profile;
echo '<div class="x2-button-group">';
echo '<a href="#" class="simple-filters x2-button' . ($profile->fullFeedControls ? "" : " disabled-link") . '" style="width:42px">' . Yii::t('app', 'Simple') . '</a>';
echo '<a href="#" class="full-filters x2-button x2-last-child' . ($profile->fullFeedControls ? " disabled-link" : "") . '" style="width:42px">' . Yii::t('app', 'Full') . '</a>';
echo "</div>\n";
echo "<div id='full-controls'" . ($profile->fullFeedControls ? "" : "style='display:none;'") . ">";
echo CHtml::dropDownList('visibilityFilters', array_map(function ($a) use($visibility) {
示例15: array
<a href="#" onclick="$('#deleteDropdown').toggle();$('#createDropdown').hide();$('#editDropdown').hide();return false;" class="x2-button"><?php
echo Yii::t('admin', 'Delete Dropdown');
?>
</a>
<a href="#" onclick="$('#editDropdown').toggle();$('#createDropdown').hide();$('#deleteDropdown').hide();return false;" class="x2-button"><?php
echo Yii::t('admin', 'Edit Dropdown');
?>
</a>
<br>
<br>
</div>
<div id="createDropdown" style="display:none;">
<?php
$this->renderPartial('createDropdown', array('model' => $model));
?>
</div>
<div id="deleteDropdown" style="display:none;">
<?php
$customDropdowns = Dropdowns::model()->findAll('id>=1000');
usort($customDropdowns, function ($a, $b) {
return strcmp($a->name, $b->name);
});
$this->renderPartial('deleteDropdown', array('dropdowns' => $customDropdowns));
?>
</div>
<div id="editDropdown" style="display:none;">
<?php
$this->renderPartial('editDropdown', array('model' => $model));
?>
</div>