本文整理汇总了PHP中Apartment::canShowInForm方法的典型用法代码示例。如果您正苦于以下问题:PHP Apartment::canShowInForm方法的具体用法?PHP Apartment::canShowInForm怎么用?PHP Apartment::canShowInForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Apartment
的用法示例。
在下文中一共展示了Apartment::canShowInForm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderFormRows
public static function renderFormRows($rows, Apartment $model)
{
if (!$rows) {
return '';
}
//print_r($rows);
$isShowTip = true;
foreach ($rows as $row) {
if (!$model->canShowInForm($row['field'])) {
continue;
}
// если есть файл отображения для формы
if ($row['standard_type'] == FormDesigner::STANDARD_TYPE_ORIGINAL_VIEW) {
Yii::app()->controller->renderPartial('//../views/common/apartments/backend/fields/' . $row['field'], array('model' => $model));
continue;
}
$required = $row->rules == FormDesigner::RULE_REQUIRED || $row->rules == FormDesigner::RULE_REQUIRED_NUMERICAL ? array('required' => true) : array();
echo '<div class="rowold">';
if ($row['standard_type'] == FormDesigner::STANDARD_TYPE_NEW) {
echo CHtml::label($row['label_' . Yii::app()->language], get_class($model) . '_' . $row['field'], $required);
} else {
echo $row['is_i18n'] ? '' : CHtml::activeLabel($model, $row['field']);
}
if ($row['is_i18n']) {
$isShowTip = false;
}
if ($isShowTip) {
echo Apartment::getTip($row['field']);
}
switch ($row['type']) {
case FormDesigner::TYPE_TEXT:
if ($row['is_i18n']) {
Yii::app()->controller->widget('application.modules.lang.components.langFieldWidget', array('model' => $model, 'field' => $row['field'], 'type' => 'string'));
} else {
echo CHtml::activeTextField($model, $row['field'], array('class' => 'width500', 'maxlength' => 255));
}
break;
case FormDesigner::TYPE_INT:
echo CHtml::activeTextField($model, $row['field'], array('class' => 'width70', 'maxlength' => 255));
if ($row->measure_unit) {
echo ' ' . $row->measure_unit;
}
break;
case FormDesigner::TYPE_TEXT_AREA:
if ($row['is_i18n']) {
Yii::app()->controller->widget('application.modules.lang.components.langFieldWidget', array('model' => $model, 'field' => $row['field'], 'type' => 'text'));
} else {
echo CHtml::activeTextArea($model, $row['field'], array('class' => 'width500 height200'));
}
break;
case FormDesigner::TYPE_TEXT_AREA_WS:
if ($row['is_i18n']) {
Yii::app()->controller->widget('application.modules.lang.components.langFieldWidget', array('model' => $model, 'field' => $row['field'], 'type' => 'text-editor'));
} else {
// даем пользователям ограниченый набор форматирования
$toolbar = array(array('Source', '-', 'Bold', 'Italic', 'Underline', 'Strike'), array('NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'));
$filebrowserImageUploadUrl = '';
if (Yii::app()->user->checkAccess('backend_access')) {
// if admin - enable upload image
$filebrowserImageUploadUrl = Yii::app()->createAbsoluteUrl('/site/uploadimage', array('type' => 'imageUpload', Yii::app()->request->csrfTokenName => Yii::app()->request->csrfToken));
$toolbar = array(array('Source', '-', 'Bold', 'Italic', 'Underline', 'Strike'), array('Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'), array('NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'), array('Styles', 'Format', 'Font', 'FontSize', 'TextColor', 'BGColor'), array('Image', 'Link', 'Unlink', 'SpecialChar'));
}
Yii::app()->controller->widget('application.extensions.editMe.widgets.ExtEditMe', array('model' => $model, 'attribute' => $row['field'], 'toolbar' => $toolbar, 'filebrowserImageUploadUrl' => $filebrowserImageUploadUrl, 'htmlOptions' => array('id' => $model->id)));
}
break;
case FormDesigner::TYPE_REFERENCE:
echo CHtml::activeDropDownList($model, $row['field'], CMap::mergeArray(array("" => Yii::t('common', 'Please select')), FormDesigner::getListByCategoryID($row->reference_id)));
break;
}
echo '</div>';
}
}