public static function getCurrentUserLevel() { $userLevel = Base::getCurrentUser()->getUserLevel(); return $userLevel; }
public function listCEFERelations($idEntityCxn, $idEntityFrame, $relationEntry) { $idLanguage = \Manager::getSession()->idLanguage; $cxnElement = new ConstructionElement(); $criteria1 = $cxnElement->getCriteria()->select('idEntity'); Base::relation($criteria1, 'constructionelement', 'construction', 'rel_elementof'); $criteria1->where("construction.idEntity = {$idEntityCxn}"); $ce = $criteria1->asQuery()->chunkResult('idEntity', 'idEntity'); $frameElement = new FrameElement(); $criteria2 = $frameElement->getCriteria()->select('idEntity'); Base::relation($criteria2, 'frameelement', 'frame', 'rel_elementof'); $criteria2->where("frame.idEntity = {$idEntityFrame}"); $fe = $criteria2->asQuery()->chunkResult('idEntity', 'idEntity'); $criteria = $this->getCriteria()->select('idEntity1, relationtype.entry as idType, idEntity2'); $criteria->where("relationtype.entry = '{$relationEntry}'"); $criteria->where("idEntity1", "in", $ce); $criteria->where("idEntity2", "in", $fe); return $criteria; }