31 public function loadNews( $iFrom = 0, $iLimit = 10 )
37 $sNewsViewName = getViewName(
'oxnews' );
39 $sSelectFields = $oBaseObject->getSelectFields();
41 if ( $oUser = $this->
getUser() ) {
43 $sSelect =
"select $sSelectFields from $sNewsViewName ";
44 $sSelect .=
"left join oxobject2group on oxobject2group.oxobjectid=$sNewsViewName.oxid where ";
45 $sSelect .=
"oxobject2group.oxgroupsid in ( select oxgroupsid from oxobject2group where oxobjectid='".$oUser->getId().
"' ) or ";
46 $sSelect .=
"( oxobject2group.oxgroupsid is null ) ";
48 $sSelect =
"select $sSelectFields, oxobject2group.oxgroupsid from $sNewsViewName ";
49 $sSelect .=
"left join oxobject2group on oxobject2group.oxobjectid=$sNewsViewName.oxid where oxobject2group.oxgroupsid is null ";
52 $sSelect .=
" and ".$oBaseObject->getSqlActiveSnippet();
53 $sSelect .=
" and $sNewsViewName.oxshortdesc <> '' ";
54 $sSelect .=
" group by $sNewsViewName.oxid order by $sNewsViewName.oxdate desc ";
69 $sNewsViewName = getViewName(
'oxnews' );
73 if ( $oUser = $this->
getUser() ) {
75 $sSelect =
"select COUNT($sNewsViewName.`oxid`) from $sNewsViewName ";
76 $sSelect .=
"left join oxobject2group on oxobject2group.oxobjectid=$sNewsViewName.oxid where ";
77 $sSelect .=
"oxobject2group.oxgroupsid in ( select oxgroupsid from oxobject2group where oxobjectid='".$oUser->getId().
"' ) or ";
78 $sSelect .=
"( oxobject2group.oxgroupsid is null ) ";
80 $sSelect =
"select COUNT($sNewsViewName.`oxid`) from $sNewsViewName ";
81 $sSelect .=
"left join oxobject2group on oxobject2group.oxobjectid=$sNewsViewName.oxid where oxobject2group.oxgroupsid is null ";
84 $sSelect .=
" and ".$oBaseObject->getSqlActiveSnippet();
87 $iRecCnt = (int) $oDb->getOne( $sSelect );
101 $this->_oUser = $oUser;
111 if ( $this->_oUser == null ) {