Example #1
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;
    }