Example #1
0
 public function add()
 {
     $form = $this->formModel->initForm();
     if ($form->Validate(\FormEngine\FE::SubmittedData())) {
         $this->model->addView($form->getSubmitValues(\FormEngine\Elements\Form::FORMAT_FLAT));
         Session::setActiveViewIds(NULL);
         if (\FormEngine\FE::IsAction('next')) {
             App::redirect(__ADMINPANE__ . '/view/add');
         } else {
             App::redirect(__ADMINPANE__ . '/view');
         }
     }
     $this->renderLayout(array('form' => $form->Render()));
 }
Example #2
0
    public function getViewForHelperAll()
    {
        $globaluser = Session::getActiveUserIsGlobal();
        $Data = Session::getActiveViewIds();
        if ($Data == NULL) {
            if ($globaluser == 1) {
                $sql = 'SELECT 
							V.idview AS id
						FROM view V
						GROUP BY V.idview
					';
                $stmt = Db::getInstance()->prepare($sql);
                $stmt->execute();
                while ($rs = $stmt->fetch()) {
                    $Data[] = $rs['id'];
                }
            } else {
                $sql = 'SELECT
							UGV.viewid
						FROM usergroupview UGV 
						lEFT JOIN view V ON UGV.viewid = V.idview
						lEFT JOIN store S ON V.storeid = S.idstore
						WHERE UGV.userid = :userid
						GROUP BY UGV.viewid';
                $stmt = Db::getInstance()->prepare($sql);
                $stmt->bindValue('userid', Session::getActiveUserid());
                $stmt->execute();
                while ($rs = $stmt->fetch()) {
                    $Data[] = $rs['viewid'];
                }
            }
            Session::setActiveViewIds($Data);
        }
        return $Data;
    }