/**
  * get timeaccounts by grant
  * - this function caches its result (with cache tag 'container')
  *
  * @param integer $_grant
  * @param boolean $_onlyIds
  * @return Tinebase_Record_RecordSet|array
  */
 public static function getTimeaccountsByAcl($_grant, $_onlyIds = FALSE)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' get grant: ' . print_r($_grant, true));
     }
     $cache = Tinebase_Core::getCache();
     $cacheId = convertCacheId('getTimeaccountsByAcl' . Tinebase_Core::getUser()->getId() . $_grant . $_onlyIds);
     $result = $cache->load($cacheId);
     if ($result === FALSE) {
         $containerIds = Tinebase_Container::getInstance()->getContainerByACL(Tinebase_Core::getUser()->getId(), 'Timetracker', $_grant, TRUE);
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
             Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' got containers: ' . print_r($containerIds, true));
         }
         $filter = new Tinebase_Model_Filter_FilterGroup(array());
         $filter->addFilter(new Tinebase_Model_Filter_Container('container_id', 'in', $containerIds, array('applicationName' => 'Timetracker', 'ignoreAcl' => true)));
         $backend = new Timetracker_Backend_Timeaccount();
         $result = $backend->search($filter);
         if ($_onlyIds) {
             $result = $result->getArrayOfIds();
         }
         $cache->save($result, $cacheId, array('container'));
     }
     return $result;
 }
 /**
  * get timeaccounts by grant
  *
  * @param array|string $_grant
  * @param boolean $_onlyIds
  * @return Tinebase_Record_RecordSet|array
  */
 public static function getTimeaccountsByAcl($_grant, $_onlyIds = FALSE)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' get grant: ' . print_r($_grant, true));
     }
     $containerIds = Tinebase_Container::getInstance()->getContainerByACL(Tinebase_Core::getUser()->getId(), 'Timetracker', $_grant, TRUE);
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' got containers: ' . print_r($containerIds, true));
     }
     $filter = new Tinebase_Model_Filter_FilterGroup(array());
     // NOTE: use id filter instead of container filter because of poor performance of container filter (setValue)
     $filter->addFilter(new Tinebase_Model_Filter_Id('container_id', 'in', $containerIds));
     $backend = new Timetracker_Backend_Timeaccount();
     $result = $backend->search($filter);
     if ($_onlyIds) {
         $result = $result->getArrayOfIds();
     }
     return $result;
 }