public function getArray() { $malls = Malls::model()->findAll(array('order' => 'name')); $array = array(0 => '-выберите-'); foreach ($malls as $k => $v) { $array[$v->id] = $v->name; } return $array; }
public function actionSingle($id) { $mall = Malls::model()->findByPk($id); if (!$mall) { $this->render('/errors/404'); } $rubric = Rubrics::model()->findByPk($mall->rubric_id); $data = array('rubric' => $rubric, 'mall' => $mall); $crumbs = Yii::app()->params['crumbs']; $crumbs[] = $mall; Yii::app()->params['crumbs'] = $crumbs; $this->render('single', $data); }
public function actionGetData() { $id = Yii::app()->request->getParam('mall_id'); if (is_numeric($id)) { $mall = Malls::model()->findByPk($id); if ($mall) { if (Yii::app()->request->isAjaxRequest) { exit('{ "status":"success", "coords":"' . $mall->coords . '", "address": "' . str_replace("\r\n", "", 'г. ' . $this->cities[$mall->city_id] . ', ' . $mall->address) . '", "work": "' . $mall->work . '" }'); } else { return $mall; } } } exit('{"status":"faild"}'); }
echo $form->textArea($model, 'address'); ?> <?php echo $form->error($model, 'address'); ?> </div> </div> <div class="row"> <div class="label"> <?php echo $form->labelEx($model, 'mall_id'); ?> </div> <div class="field"> <?php echo $form->dropDownList($model, 'mall_id', Malls::model()->getArray(), array('onchange' => 'updateAddressesForm(this.value)')); ?> <?php echo $form->error($model, 'mall_id'); ?> </div> </div> <div class="row"> <div class="label"> <?php echo $form->labelEx($model, 'phone'); ?> </div> <div class="field"> <?php