Beispiel #1
0
?>
>
            <?php 
echo $form->label($model, 'defaultView');
?>
            <div class='view-layout-container layout-container'>
            <?php 
if ($model->defaultView) {
    list($selected, $unselected) = MobileLayouts::getFieldOptions($model->defaultView, $model->modelName);
    echo $form->dropDownList($model, 'defaultView', array_merge($selected, $unselected), array('style' => 'display: none;', 'multiple' => 'multiple', 'class' => 'x2-multiselect'));
}
?>
            </div>
            <?php 
echo $form->label($model, 'defaultForm');
?>
            <div class='form-layout-container layout-container'>
            <?php 
if ($model->defaultForm) {
    list($selected, $unselected) = MobileLayouts::getFieldOptions($model->defaultForm, $model->modelName);
    echo $form->dropDownList($model, 'defaultForm', array_merge($selected, $unselected), array('style' => 'display: none;', 'multiple' => 'multiple', 'class' => 'x2-multiselect'));
}
?>
            </div>
        </div>
        <?php 
echo CHtml::submitButton(Yii::t('admin', "Save"), array('class' => 'x2-button'));
$this->endWidget();
?>
</div>
Beispiel #2
0
 public function actionGetMobileLayouts($modelName)
 {
     Yii::import('application.modules.mobile.models.*');
     // find or generate layouts
     $formLayout = MobileLayouts::model()->findByAttributes(array('modelName' => $modelName, 'defaultView' => 1));
     $viewLayout = MobileLayouts::model()->findByAttributes(array('modelName' => $modelName, 'defaultForm' => 1));
     $formLayout = $formLayout ? $formLayout->layout : null;
     $viewLayout = $viewLayout ? $viewLayout->layout : null;
     if (!$formLayout) {
         $formLayout = MobileLayouts::generateDefaultLayout('form', $modelName);
     }
     if (!$viewLayout) {
         $viewLayout = MobileLayouts::generateDefaultLayout('view', $modelName);
     }
     list($formLayout, $unselectedForm) = MobileLayouts::getFieldOptions($formLayout, $modelName);
     list($viewLayout, $unselectedView) = MobileLayouts::getFieldOptions($viewLayout, $modelName);
     echo CJSON::encode(array('defaultForm' => $formLayout, 'defaultView' => $viewLayout, 'defaultFormUnselected' => $unselectedForm, 'defaultViewUnselected' => $unselectedView));
 }