/** * Support ajax paging pattern */ public function actionPaging() { list($page, $query, $lp) = $this->request->getList('page', 'query', 'lp'); $lp = new BlockParams($lp); $paging = app()->groupService()->loadGroupPaging($query, $page); $html = $this->partial($lp->script(), ['paging' => $paging]); $this->response = ['html' => $html, 'pager' => $paging->getPager(), 'hasNext' => $paging->hasNext(), 'hasPrev' => $paging->hasPrev()]; }
/** * Show report dialog */ public function actionDialog() { list($type, $id) = $this->request->getList('type', 'id'); $about = app()->find($type, $id); if (null == $about) { throw new \InvalidArgumentException("Invalid Report Item"); } $form = new AddReport(['about' => $about]); $lp = new BlockParams(['base_path' => 'platform/report/dialog/report-about']); $html = $this->partial($lp->script(), ['form' => $form, 'about' => $about, 'lp' => $lp]); $this->response = ['html' => $html, 'directive' => 'update']; }
/** * Show up edit avatar dialog */ public function actionDialog() { list($type, $id) = $this->request->getList('type', 'id'); $photo = null; $photoSrc = null; $data = ['photoSource' => '', 'photoId' => '', 'fileId' => '', 'photoFileId' => '']; if (!empty($type) && !empty($id)) { $photo = app()->find($type, $id); if (!$photo instanceof Photo) { throw new \InvalidArgumentException(app()->text('photo.invalid_photo')); } } if ($photo) { $photoSrc = $photo->getPhoto('origin'); $data = ['photoSource' => $photoSrc, 'photoFileId' => $photo->getPhotoFileId(), 'photoId' => $photo->getId()]; } $lp = new BlockParams(['base_path' => 'platform/photo/dialog/field-avatar']); $this->response = ['html' => $this->partial($lp->script(), $data)]; }
/** * @param array|string $params * */ public function __construct($params = null) { $this->view = new View(); $this->lp = new BlockParams($params); $this->view->setScript($this->lp->script()); }
/** * Report general data */ public function actionDialog() { $form = new AddGeneralReport([]); $lp = new BlockParams(['base_path' => 'platform/report/dialog/report-general']); $this->response = ['html' => $this->partial($lp->script(), ['form' => $form, 'lp' => $lp]), 'directive' => 'update']; }