/** * Saves attributes into database */ public function save() { $widget = SystemWidgets::model()->findByPk($this->id); if (!$widget) { $widget = new SystemWidgets(); } $widget->attributes = $this->attributes; $widget->setParams(array('width' => $this->width, 'height' => $this->height, 'banner_id' => $this->banner_id)); $widget->save(); }
/** * Delete page by Pk */ public function actionDelete() { if (Yii::app()->request->isPostRequest) { $model = SystemWidgets::model()->findAllByPk($_REQUEST['id']); if (!empty($model)) { foreach ($model as $page) { $page->delete(); } } if (!Yii::app()->request->isAjaxRequest) { $this->redirect('index'); } } }
$id = 'copyMe'; $chosen = false; } ?> <tr class="<?php echo $class; ?> " data-id = "<?php echo $id; ?> "> <td><span class="ui-icon ui-icon-arrowthick-2-n-s"></span></td> <td> <?php echo CHtml::dropDownList('widgets[' . $id . '][widget_id]', $model->widget_id, CHtml::listData(SystemWidgets::model()->findAll(), 'id', 'name'), array('id' => 'widget_id_' . $id)); if ($chosen) { $this->widget('application.modules.admin.widgets.schosen.SChosen', array('elements' => array('widget_id_' . $id))); } ?> </td> <td> <?php echo CHtml::dropDownList('widgets[' . $id . '][position]', $model->position, $model->listPositions(), array('id' => 'position_' . $id)); echo CHtml::hiddenField('widgets[' . $id . '][sort]', $model->sort, array('class' => 'j-sort')); ?> </td> <td>