Exemple #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;
    }
Exemple #2
0
 public function getLayerIdByViewId($id)
 {
     $globaluser = Session::getActiveUserIsGlobal();
     $Stores = Session::getActiveStoreData();
     if ($globaluser == 1) {
         return 0;
     }
     if ($id == 0) {
         if (isset($Stores['global'])) {
             return 0;
         } else {
             // throw new Exception('No privileges '.$id);
         }
     }
     foreach ($Stores as $key => $store) {
         if ($key != 'global') {
             foreach ($store as $storeKey => $view) {
                 if ($id == $view) {
                     return $key;
                 }
             }
         }
     }
     // throw new Exception('No privileges '.$id);
 }