Example #1
0
if ($model->isNewRecord) {
    $model->base_template_head = $model->base_template_head_val;
    $model->base_template_body_link = $model->base_template_body_link_val;
    $model->base_template_body_menu = $model->base_template_body_menu_val;
}
echo $form->textAreaRow($model, 'base_template_head', array('rows' => 6, 'cols' => 50, 'style' => 'width:100%;'));
echo $form->textAreaRow($model, 'base_template_body_link', array('rows' => 6, 'cols' => 50, 'style' => 'width:100%;'));
echo $form->textAreaRow($model, 'base_template_body_menu', array('rows' => 6, 'cols' => 50, 'style' => 'width:100%;'));
?>

<!--Создаю форму меню-->
<div id="menu_form_create" style="min-height:100px;padding: 10px; ">
    <?php 
if (!$model->isNewRecord && !empty($model->param_menu)) {
    $numElm = 0;
    $getParamArr = MenuTemplate::model()->getModelsByParam($model->param_menu);
    $elm_img = array('menu' => '/../uploads/filestorage/menu/rubrics/', 'link' => '/../uploads/filestorage/menu/elements/');
    foreach ($getParamArr as $value) {
        foreach ($value as $key => $data) {
            ?>
                    <div class="btn btn-mini"  style="<?php 
            echo $model->float == 1 ? 'float:left;' : '';
            ?>
 margin-left: 10px; text-align: center;">
                        <p>
                            <?php 
            echo !empty($data->image) ? '<img width=15px; src="' . $elm_img[$key] . 'menu-' . $data->id . '.' . $data->image . '" />' : '';
            ?>
                            <?php 
            echo $key == 'menu' ? $data->name : $data->title;
            ?>
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = MenuTemplate::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }