本文整理汇总了PHP中X2Html::mergeHtmlOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP X2Html::mergeHtmlOptions方法的具体用法?PHP X2Html::mergeHtmlOptions怎么用?PHP X2Html::mergeHtmlOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X2Html
的用法示例。
在下文中一共展示了X2Html::mergeHtmlOptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderInput
public function renderInput(CModel $model, $attribute, array $htmlOptions = array())
{
$action = new Actions();
$action->setAttributes($model->getAttributes(), false);
$defaultOptions = array('id' => $this->resolveId($attribute));
$htmlOptions = X2Html::mergeHtmlOptions($defaultOptions, $htmlOptions);
return preg_replace('/Actions(\\[[^\\]]*\\])/', get_class($this->formModel) . '$1', $action->renderInput($attribute, $htmlOptions));
}
示例2: photoAttachmentsContainer
public function photoAttachmentsContainer(CModel $model, $attr, $uploadAttr, array $htmlOptions = array())
{
$htmlOptions = X2Html::mergeHtmlOptions(array('class' => 'photo-attachments-container'), $htmlOptions);
$attachmentTags = array();
foreach ($model->{$attr} as $attachment) {
$attachmentTags[] = $this->photoAttachment($model, $uploadAttr, $attachment);
}
return CHtml::tag('div', $htmlOptions, implode("\n", $attachmentTags));
}
示例3: run
public function run()
{
$this->htmlOptions = X2Html::mergeHtmlOptions($this->htmlOptions, array('id' => $this->namespace . "-multi-type-autocomplete-container"));
if (isset($this->model)) {
$selectAttr = $this->selectName;
$this->selectValue = $this->model->{$selectAttr};
}
$this->render('_multiTypeAutocomplete');
}
示例4: getGridViewConfig
/**
* @return array the config array passed to widget ()
*/
public function getGridViewConfig()
{
if (!isset($this->_gridViewConfig)) {
$this->_gridViewConfig = array_merge(parent::getGridViewConfig(), array('possibleResultsPerPage' => array(5, 10, 20, 30, 40, 50, 75, 100), 'defaultGvSettings' => array('isActive' => 65, 'fullName' => 125, 'lastLogin' => 80, 'emailAddress' => 100), 'template' => CHtml::openTag('div', X2Html::mergeHtmlOptions(array('class' => 'page-title'), array('style' => !CPropertyValue::ensureBoolean($this->getWidgetProperty('showHeader')) && !CPropertyValue::ensureBoolean($this->getWidgetProperty('hideFullHeader')) ? 'display: none;' : ''))) . '<h2 class="grid-widget-title-bar-dummy-element">' . '</h2>{buttons}{filterHint}' . '{summary}{topPager}</div>{items}{pager}', 'includedFields' => array('tagLine', 'username', 'officePhone', 'cellPhone', 'emailAddress', 'googleId', 'isActive', 'leadRoutingAvailability'), 'specialColumns' => array('fullName' => array('name' => 'fullName', 'header' => Yii::t('profile', 'Full Name'), 'value' => 'CHtml::link(CHtml::encode($data->fullName),array("view","id"=>$data->id))', 'type' => 'raw'), 'lastLogin' => array('name' => 'lastLogin', 'header' => Yii::t('profile', 'Last Login'), 'value' => '$data->user ? ($data->user->lastLogin == 0 ? "" : ' . 'Formatter::formatDateDynamic ($data->user->lastLogin)) : ""', 'type' => 'raw'), 'isActive' => array('name' => 'isActive', 'header' => Yii::t('profile', 'Active'), 'value' => '"<span title=\'' . '".(Session::isOnline ($data->username) ? ' . '"' . Yii::t('profile', 'Active User') . '" : "' . Yii::t('profile', 'Inactive User') . '")."\'' . ' class=\'".(Session::isOnline ($data->username) ? ' . '"active-indicator" : "inactive-indicator")."\'></span>"', 'type' => 'raw'), 'username' => array('name' => 'username', 'header' => Yii::t('profile', 'Username'), 'value' => '$data->user ? CHtml::encode($data->user->alias) : ""', 'type' => 'raw'), 'leadRoutingAvailability' => array('name' => 'leadRoutingAvailability', 'header' => Yii::t('profile', 'Lead Routing Availability'), 'value' => 'CHtml::encode($data->leadRoutingAvailability ?
Yii::t("profile", "Available") :
Yii::t("profile", "Unavailable"))', 'type' => 'raw')), 'enableControls' => false));
}
return $this->_gridViewConfig;
}
示例5: generateColumns
protected function generateColumns()
{
$unsortedColumns = array();
foreach ($this->columns as &$column) {
$name = isset($column['name']) ? $column['name'] : '';
if (!isset($column['id'])) {
if (isset($column['class']) && is_subclass_of($column['class'], 'CCheckboxColumn')) {
$column['id'] = $this->namespacePrefix . 'C_gvCheckbox' . $name;
} else {
$column['id'] = $this->namespacePrefix . 'C_' . $name;
}
} else {
$column['id'] = $this->namespacePrefix . $column['id'];
}
if (!isset($this->gvSettings[$name])) {
if ($name === 'gvCheckbox') {
$column = $this->getGvCheckboxColumn(null, $column);
}
$unsortedColumns[] = $column;
continue;
}
$width = $this->gvSettings[$name];
$width = $this->formatWidth($width);
if ($width) {
$column['headerHtmlOptions'] = array_merge(isset($column['headerHtmlOptions']) ? $column['headerHtmlOptions'] : array(), array('style' => 'width:' . $width . ';'));
$column['htmlOptions'] = X2Html::mergeHtmlOptions(isset($column['htmlOptions']) ? $column['htmlOptions'] : array(), array('width' => $width));
}
}
unset($column);
// unset lingering reference
if (isset($this->gvSettings['gvControls']) && $this->enableControls) {
$width = $this->gvSettings['gvControls'];
$width = !empty($width) && is_numeric($width) ? $width : null;
$this->columns[] = $this->getGvControlsColumn($width);
}
if (isset($this->gvSettings['gvCheckBox'])) {
$width = $this->gvSettings['gvCheckBox'];
$width = !empty($width) && is_numeric($width) ? $width : null;
$this->columns[] = $this->getGvCheckboxColumn($width);
}
if ($this->rememberColumnSort) {
$sortedColumns = array();
foreach ($this->gvSettings as $columnName => $width) {
foreach ($this->columns as $column) {
$name = isset($column['name']) ? $column['name'] : '';
if ($name === $columnName) {
$sortedColumns[] = $column;
break;
}
}
}
$this->columns = array_merge($sortedColumns, $unsortedColumns);
}
}
示例6: render
public function render()
{
if ($this->isSelected) {
$this->htmlOptions = X2Html::mergeHtmlOptions($this->htmlOptions, array('class' => 'selected'));
}
$html = CHtml::openTag('li', $this->htmlOptions);
$html .= CHtml::openTag('a', X2Html::mergeHtmlOptions(array('href' => $this->getHref()), $this->linkHtmlOptions));
$html .= "<i class='icon " . lcfirst($this->getId()) . "'></i>";
$html .= CHtml::encode($this->getTitle());
$html .= '</a>';
$html .= '</li>';
return $html;
}
示例7: renderFilterWithOptions
/**
* Like renderFilter, but with html attribute options
* This method is Copyright (c) 2008-2014 by Yii Software LLC
* http://www.yiiframework.com/license/
*/
public function renderFilterWithOptions(array $htmlOptions = array())
{
if ($this->filter !== null) {
/* x2modstart */
echo CHtml::openTag('tr', X2Html::mergeHtmlOptions(array('class' => $this->filterCssClass), $htmlOptions)) . "\n";
/* x2modend */
foreach ($this->columns as $column) {
$column->renderFilterCell();
}
echo "</tr>\n";
}
}
示例8: getMainOptions
/**
* Modified to add half-width tag and extra classes
*/
public function getMainOptions()
{
$width = $this->halfWidth ? 'half-width' : '';
return X2Html::mergeHtmlOptions(array('class' => "x2-layout detail-view {$width}", 'id' => $this->namespace . 'detail-view'), $this->htmlOptions);
}
示例9: renderMenuItem
/**
* Renders the content of a menu item.
* Note that the container and the sub-menus are not rendered here.
* @param array $item the menu item to be rendered. Please see {@link items} on what data might be in the item.
* @since 0.6
*/
protected function renderMenuItem($item)
{
if (isset($item['url'])) {
$url = $item['url'];
$params = array();
if (!is_string($url)) {
$route = $url[0];
$params = array_splice($url, 1);
}
// absolute url needed for phonegap app
$route = $this->getController()->createAbsoluteUrl($route, $params);
//Yii::trace('url|route='.(is_string ($url) ? $url : 'Array').'|'.$route);
$label = $this->linkLabelWrapper === null ? $item['label'] : '<' . $this->linkLabelWrapper . '>' . $item['label'] . '</' . $this->linkLabelWrapper . '>';
$options = X2Html::mergeHtmlOptions(isset($item['left']) ? $this->leftOptions : $this->rightOptions, isset($item['linkOptions']) ? $item['linkOptions'] : array());
return CHtml::link($label, $route, $options);
}
}
示例10: renderModelInput
//.........这里部分代码省略.........
var label = "<a style=\\"line-height: 1;\\">" + item.label;
label += "<span style=\\"font-size: 0.6em;\\">";
// add email if defined
if(item.subject) {
label += "<br>";
label += item.subject;
}
label += "</span>";
label += "</a>";
return $( "<li>" )
.data( "item.autocomplete", item )
.append( label )
.appendTo( ul );
};
}' : '')), 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions)), true);
if (isset($oldLinkFieldVal)) {
$model->{$fieldName} = $oldLinkFieldVal;
}
return $input;
case 'rating':
return Yii::app()->controller->widget('X2StarRating', array('model' => $model, 'attribute' => $field->fieldName, 'readOnly' => isset($htmlOptions['disabled']) && $htmlOptions['disabled'], 'minRating' => Fields::RATING_MIN, 'maxRating' => Fields::RATING_MAX, 'starCount' => Fields::RATING_MAX - Fields::RATING_MIN + 1, 'cssFile' => Yii::app()->theme->getBaseUrl() . '/css/rating/jquery.rating.css', 'htmlOptions' => $htmlOptions, 'callback' => 'function(value, link){
if (typeof x2 !== "undefined" &&
typeof x2.InlineEditor !== "undefined" &&
typeof x2.InlineEditor.ratingFields !== "undefined") {
x2.InlineEditor.ratingFields["' . $field->modelName . '[' . $field->fieldName . ']"] = value;
}
}'), true);
case 'boolean':
$checkbox = CHtml::openTag('div', X2Html::mergeHtmlOptions($htmlOptions, array('class' => 'checkboxWrapper')));
$checkbox .= CHtml::activeCheckBox($model, $field->fieldName, array_merge(array('unchecked' => 0, 'title' => $field->attributeLabel), $htmlOptions));
$checkbox .= CHtml::closeTag('div');
return $checkbox;
case 'assignment':
$oldAssignmentVal = $model->{$fieldName};
$model->{$fieldName} = !empty($model->{$fieldName}) ? $field->linkType == 'multiple' && !is_array($model->{$fieldName}) ? explode(', ', $model->{$fieldName}) : $model->{$fieldName} : X2Model::getDefaultAssignment();
$dropdownList = CHtml::activeDropDownList($model, $fieldName, X2Model::getAssignmentOptions(true, true), array_merge(array('title' => $field->attributeLabel, 'id' => $field->modelName . '_' . $fieldName . '_assignedToDropdown', 'multiple' => $field->linkType == 'multiple' ? 'multiple' : null), $htmlOptions));
$model->{$fieldName} = $oldAssignmentVal;
return $dropdownList;
case 'optionalAssignment':
// optional assignment for users (can be left blank)
$users = User::getNames();
unset($users['Anyone']);
return CHtml::activeDropDownList($model, $fieldName, $users, array_merge(array('title' => $field->attributeLabel, 'empty' => ''), $htmlOptions));
case 'visibility':
$permissionsBehavior = Yii::app()->params->modelPermissions;
return CHtml::activeDropDownList($model, $field->fieldName, $permissionsBehavior::getVisibilityOptions(), array_merge(array('title' => $field->attributeLabel, 'id' => $field->modelName . "_visibility"), $htmlOptions));
// 'varchar', 'email', 'url', 'int', 'float', 'currency', 'phone'
// case 'int':
// return CHtml::activeNumberField($model, $field->fieldNamearray_merge(array(
// 'title' => $field->attributeLabel,
// ), $htmlOptions));
// 'varchar', 'email', 'url', 'int', 'float', 'currency', 'phone'
// case 'int':
// return CHtml::activeNumberField($model, $field->fieldNamearray_merge(array(
// 'title' => $field->attributeLabel,
// ), $htmlOptions));
case 'percentage':
$htmlOptions['class'] = empty($htmlOptions['class']) ? 'input-percentage' : $htmlOptions['class'] . ' input-percentage';
return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions));
case 'currency':
$fieldName = $field->fieldName;
示例11: renderAvatarImage
public static function renderAvatarImage($id, $width, $height, array $htmlOptions = array())
{
$model = Profile::model()->findByPk($id);
$file = Yii::app()->file->set($model->avatar);
if ($file->exists) {
return CHtml::tag('img', X2Html::mergeHtmlOptions(array('id' => "avatar-image", 'class' => "avatar-upload", 'width' => $width, 'height' => $height, 'src' => "data:image/x-icon;base64," . base64_encode($file->getContents())), $htmlOptions));
}
}
示例12: getImage
public function getImage($link = false, array $htmlOptions = array())
{
if (!$this->fileExists() || !$this->isImage()) {
return '';
}
if ($this->drive) {
return $this->googlePreview;
}
$img = CHtml::image($this->getPublicUrl(), '', X2Html::mergeHtmlOptions(array('class' => 'attachment-img'), $htmlOptions));
if (!$link) {
return $img;
}
return X2Html::link($img, $this->getPublicUrl());
}
示例13: htmlOptions
public function htmlOptions($name, $options = array())
{
return X2Html::mergeHtmlOptions(parent::htmlOptions($name, $options), array('class' => 'google-credential-input'));
}
示例14: addNewColumn
/**
* @param int $width
* @param string $columnName
* @return array the new column
*/
protected function addNewColumn($columnName, $width)
{
$newColumn = array();
if (array_key_exists($columnName, $this->specialColumnNames)) {
$newColumn = $this->createSpecialColumn($columnName, $width);
} else {
if ($columnName == 'gvControls') {
$newColumn = $this->getGvControlsColumn($width);
if (!$this->isAdmin) {
$newColumn['template'] = '{view}{update}';
}
} else {
if ($columnName == 'gvCheckbox') {
$newColumn = $this->getGvCheckboxColumn($width);
} else {
$newColumn = $this->createDefaultStyleColumn($columnName, $width);
}
}
}
if ($newColumn === array()) {
return $newColumn;
}
$newColumn['htmlOptions'] = X2Html::mergeHtmlOptions(isset($newColumn['htmlOptions']) ? $newColumn['htmlOptions'] : array(), array('width' => $width));
if (isset($this->columnOverrides[$columnName])) {
$newColumn = array_merge($newColumn, $this->columnOverrides[$columnName]);
}
return $newColumn;
}
示例15: renderThemeColorSelector
public static function renderThemeColorSelector($label, $key, $value, $htmlOptions = array(), $disabled = false)
{
$htmlOptions = X2Html::mergeHtmlOptions(array('class' => 'row theme-color-selector'), $htmlOptions);
echo X2Html::openTag('div', $htmlOptions);
echo "\n <label>\n " . CHtml::encode($label) . "\n </label>\n <input type='text' name='preferences[{$key}]' id='preferences_{$key}' value='{$value}'\n class='color-picker-input theme-attr' " . ($disabled ? 'disabled="disabled"' : '') . "> \n </input>\n </div>";
}