本文整理汇总了PHP中BsHtml::activeFileField方法的典型用法代码示例。如果您正苦于以下问题:PHP BsHtml::activeFileField方法的具体用法?PHP BsHtml::activeFileField怎么用?PHP BsHtml::activeFileField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BsHtml
的用法示例。
在下文中一共展示了BsHtml::activeFileField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: imageField
public function imageField($model, $attribute, $htmlOptions = array())
{
$controlOptions = BsArray::popValue('controlOptions', $htmlOptions, array());
$labelOptions = BsArray::popValue('labelOptions', $htmlOptions, array());
$layout = $this->layout;
$output = '';
//$htmlOptions = BsHtml::addClassName('form-control',$htmlOptions);
$output .= BsHtml::activeFileField($model, $attribute, $htmlOptions);
//@TODO: render in field type partial?
$attr = $model->{$attribute};
if (!empty($attr)) {
//Special logic for ContentTypes
$tmpModel = $model;
if ($model instanceof ContentType) {
$tmpModel = $model->Content;
}
$output .= CHtml::image(Yii::app()->controller->createFrontendUrl('/site/getImage', array('id' => $tmpModel->id, 'modelName' => get_class($tmpModel), 'field' => $attribute, 'w' => 200)), 'Image', array('class' => 'img'));
$output .= '<div class="checkbox">' . CHtml::checkBox($attribute . '_delete');
$output .= CHtml::label('Delete?', $attribute . '_delete') . '</div>';
}
$htmlOptions['input'] = $output;
$htmlOptions['labelOptions'] = BsHtml::setLabelOptionsByLayout($layout, $labelOptions);
if (!empty($layout)) {
if ($layout === BsHtml::FORM_LAYOUT_HORIZONTAL) {
$controlClass = BsArray::popValue('class', $controlOptions, BsHtml::$formLayoutHorizontalControlClass);
BsHtml::addCssClass($controlClass, $htmlOptions['controlOptions']);
}
}
return BsHTML::activeTextFieldControlGroup($model, $attribute, $htmlOptions);
}
示例2: fileField
/**
* Renders a file field for a model attribute.
* @param CModel $model the data model.
* @param string $attribute the attribute.
* @param array $htmlOptions additional HTML attributes
* @return string the generated input field.
* @see BsHtml::activeFileField
*/
public function fileField($model, $attribute, $htmlOptions = array())
{
return BsHtml::activeFileField($model, $attribute, $htmlOptions);
}