public function actionGet_product_view() { if (Yii::$app->request->isAjax) { $id = $_POST['id']; $response['update_view'] = \yii\base\Controller::renderPartial('view', ['model' => $this->findModel($id)]); return json_encode($response); } }
public function show($type = 'T') { $model = new Controller(); $userMenu = ArrayHelper::map(self::find()->where(['type' => $type])->all(), 'title', 'url'); $pageMenu = ArrayHelper::map(Pages::find()->where(['menu' => $type])->all(), 'title', 'url'); foreach ($pageMenu as $title => $url) { $pageMenu[$title] = Url::toRoute(['/page/view', 'url' => $url]); } $items = array_merge($userMenu, $pageMenu); return $model->renderPartial('/report/menu', ['items' => $items]); }
/** * Displays an e-mail in preview mode. * @param string $view the view name. Please refer to [[render()]] on how to specify a view name. example: '//mail/register', the view file in backend backend/views folder. * @param array $vars the parameters (name-value pairs) that should be made available in the view. example: ['name' => 'harry', 'link' => 'http://wm.com/XXXX']. * @param string $layout example: '//layouts/email', the view file in backend backend/layouts folder. */ public function setView($view, $vars = array(), $layout = null) { // Get default controller $controller = Yii::$app->controller; if (empty($controller)) { $controller = new Controller('site', Yii::$app->module); } $body = $controller->renderPartial($view, $vars); if ($layout === null) { $this->_view = $body; } else { // Render the layout file with content $this->_view = $controller->renderPartial($layout, array('content' => $body)); } }
public function actionProduct_view() { if (Yii::$app->request->isAjax) { $this->layout = 'blank'; $id = $_POST['id']; $model = ProductCategory::find()->where(['id' => $id])->one(); $data = ProductCategoryRel::find()->where(['category_id' => $id])->orderBy('sort_order', 'DESC')->all(); $response['upload_view'] = \yii\base\Controller::renderPartial('product_list_product_view', ['model' => $model, 'data' => $data]); $response['Category_name'] = $model->cat_title; return json_encode($response); } }