public static function getFavouriteComponentIds($favouritesModel)
    {
        $ret = array();
        $userId = Kwf_Registry::get('userModel')->getAuthedUserId();
        if ($userId) {
            $cacheIdUser = 'favCIds'.$userId;
            $ret = Kwf_Cache_Simple::fetch($cacheIdUser, $success);
            if (!$success) {
                // get all favourites related to user
                $select = new Kwf_Model_Select();
                $select->whereEquals('user_id', $userId);
                $favouritesModel = Kwf_Model_Abstract::getInstance($favouritesModel);
                $favourites = $favouritesModel->getRows($select);
                $componentIds = array();
                foreach ($favourites as $favourite) {
                    $component = Kwf_Component_Data_Root::getInstance()
                        ->getComponentById($favourite->component_id);
                    // check if component is visible and existent
                    if ($component) {
                        // if component is visible create list of users related to component
                        $componentIds[] = $component->componentId;
                    }
                }
                // cache relation of visible components to user
                Kwf_Cache_Simple::add($cacheIdUser, $componentIds);
                $ret = $componentIds;
            }
        }
        return $ret;
    }
public static function getFavouriteComponentIds($favouritesModel)
    {
        $ret = array();
        $userId = Kwf_Registry::get('userModel')->getAuthedUserId();
        if ($userId) {
            $cacheIdUser = 'favCIds'.$userId;
            $ret = Kwf_Cache_Simple::fetch($cacheIdUser, $success);
            if (!$success) {
                // get all favourites related to user
                $select = new Kwf_Model_Select();
                $select->whereEquals('user_id', $userId);
                $favouritesModel = Kwf_Model_Abstract::getInstance($favouritesModel);
                $favourites = $favouritesModel->getRows($select);
                $componentIds = array();
                foreach ($favourites as $favourite) {
                    $component = Kwf_Component_Data_Root::getInstance()
                        ->getComponentById($favourite->component_id);
                    // check if component is visible and existent
                    if ($component) {
                        // if component is visible create list of users related to component
                        $componentIds[] = $component->componentId;
                    }
                }
                // cache relation of visible components to user
                Kwf_Cache_Simple::add($cacheIdUser, $componentIds);
                $ret = $componentIds;
            }
        }
        return $ret;
    }
public static function getFavouriteComponentIds ( $ favouritesModel ) { $ ret = array ( ) ; $ userId = Kwf_Registry :: get ( 'userModel' ) -> getAuthedUserId ( ) ; if ( $ userId ) { $ cacheIdUser = 'favCIds' . $ userId ; $ ret = Kwf_Cache_Simple :: fetch ( $ cacheIdUser , $ success ) ; if ( ! $ success ) { // get all favourites related to user $ select = new Kwf_Model_Select ( ) ; $ select -> whereEquals ( 'user_id' , $ userId ) ; $ favouritesModel = Kwf_Model_Abstract :: getInstance ( $ favouritesModel ) ; $ favourites = $ favouritesModel -> getRows ( $ select ) ; $ componentIds = array ( ) ; foreach ( $ favourites as $ favourite ) { $ component = Kwf_Component_Data_Root :: getInstance ( ) -> getComponentById ( $ favourite -> component_id ) ; // check if component is visible and existent if ( $ component ) { // if component is visible create list of users related to component $ componentIds [ ] = $ component -> componentId ; } } // cache relation of visible components to user Kwf_Cache_Simple :: add ( $ cacheIdUser , $ componentIds ) ; $ ret = $ componentIds ; } } return $ ret ; }
returns a list of all visible favourite componentIds
returns a list of all visible favourite componentIds