source/Application/Model/NewsList.php
public function loadNews($iFrom = 0, $iLimit = 10)
    {
        if ($iLimit) {
            $this->setSqlLimit($iFrom, $iLimit);
        }

        $sNewsViewName = getViewName('oxnews');
        $oBaseObject = $this->getBaseObject();
        $sSelectFields = $oBaseObject->getSelectFields();

        if ($oUser = $this->getUser()) {
            // performance - only join if user is logged in
            $sSelect = "select $sSelectFields from $sNewsViewName ";
            $sSelect .= "left join oxobject2group on oxobject2group.oxobjectid=$sNewsViewName.oxid where ";
            $sSelect .= "oxobject2group.oxgroupsid in ( select oxgroupsid from oxobject2group where oxobjectid='" . $oUser->getId() . "' ) or ";
            $sSelect .= "( oxobject2group.oxgroupsid is null ) ";
        } else {
            $sSelect = "select $sSelectFields, oxobject2group.oxgroupsid from $sNewsViewName ";
            $sSelect .= "left join oxobject2group on oxobject2group.oxobjectid=$sNewsViewName.oxid where oxobject2group.oxgroupsid is null ";
        }

        $sSelect .= " and " . $oBaseObject->getSqlActiveSnippet();
        $sSelect .= " and $sNewsViewName.oxshortdesc <> '' ";
        $sSelect .= " group by $sNewsViewName.oxid order by $sNewsViewName.oxdate desc ";

        $this->selectString($sSelect);
    }
public function loadNews($iFrom = 0, $iLimit = 10)
    {
        if ($iLimit) {
            $this->setSqlLimit($iFrom, $iLimit);
        }

        $sNewsViewName = getViewName('oxnews');
        $oBaseObject = $this->getBaseObject();
        $sSelectFields = $oBaseObject->getSelectFields();

        if ($oUser = $this->getUser()) {
            // performance - only join if user is logged in
            $sSelect = "select $sSelectFields from $sNewsViewName ";
            $sSelect .= "left join oxobject2group on oxobject2group.oxobjectid=$sNewsViewName.oxid where ";
            $sSelect .= "oxobject2group.oxgroupsid in ( select oxgroupsid from oxobject2group where oxobjectid='" . $oUser->getId() . "' ) or ";
            $sSelect .= "( oxobject2group.oxgroupsid is null ) ";
        } else {
            $sSelect = "select $sSelectFields, oxobject2group.oxgroupsid from $sNewsViewName ";
            $sSelect .= "left join oxobject2group on oxobject2group.oxobjectid=$sNewsViewName.oxid where oxobject2group.oxgroupsid is null ";
        }

        $sSelect .= " and " . $oBaseObject->getSqlActiveSnippet();
        $sSelect .= " and $sNewsViewName.oxshortdesc <> '' ";
        $sSelect .= " group by $sNewsViewName.oxid order by $sNewsViewName.oxdate desc ";

        $this->selectString($sSelect);
    }
public function loadNews ( $ iFrom = 0 , $ iLimit = 10 ) { if ( $ iLimit ) { $ this -> setSqlLimit ( $ iFrom , $ iLimit ) ; } $ sNewsViewName = getViewName ( 'oxnews' ) ; $ oBaseObject = $ this -> getBaseObject ( ) ; $ sSelectFields = $ oBaseObject -> getSelectFields ( ) ; if ( $ oUser = $ this -> getUser ( ) ) { // performance - only join if user is logged in $ sSelect = "select $sSelectFields from $sNewsViewName " ; $ sSelect .= "left join oxobject2group on oxobject2group.oxobjectid=$sNewsViewName.oxid where " ; $ sSelect .= "oxobject2group.oxgroupsid in ( select oxgroupsid from oxobject2group where oxobjectid='" . $ oUser -> getId ( ) . "' ) or " ; $ sSelect .= "( oxobject2group.oxgroupsid is null ) " ; } else { $ sSelect = "select $sSelectFields, oxobject2group.oxgroupsid from $sNewsViewName " ; $ sSelect .= "left join oxobject2group on oxobject2group.oxobjectid=$sNewsViewName.oxid where oxobject2group.oxgroupsid is null " ; } $ sSelect .= " and " . $ oBaseObject -> getSqlActiveSnippet ( ) ; $ sSelect .= " and $sNewsViewName.oxshortdesc <> '' " ; $ sSelect .= " group by $sNewsViewName.oxid order by $sNewsViewName.oxdate desc " ; $ this -> selectString ( $ sSelect ) ; }
Loads news stored in DB, filtered by user groups, returns array, filled with
objects, that keeps news data.

@param integer $iFrom  number from which start selecting
@param integer $iLimit Limit of records to fetch from DB(default 0)
Loads news stored in DB filtered by user groups returns array filled with objects that keeps news data .