/** * count notes * * @param Tinebase_Model_NoteFilter $_filter * @return int notes count */ public function searchNotesCount(Tinebase_Model_NoteFilter $_filter) { $select = $this->_db->select()->from(array('notes' => SQL_TABLE_PREFIX . 'notes'), array('count' => 'COUNT(' . $this->_db->quoteIdentifier('id') . ')')); Tinebase_Backend_Sql_Filter_FilterGroup::appendFilters($select, $_filter, $this); //$_filter->appendFilterSql($select); $result = $this->_db->fetchOne($select); return $result; }
/** * count notes * * @param Tinebase_Model_NoteFilter $_filter * @param boolean $ignoreACL * @return int notes count */ public function searchNotesCount(Tinebase_Model_NoteFilter $_filter, $ignoreACL = true) { $select = $this->_db->select()->from(array('notes' => SQL_TABLE_PREFIX . 'notes'), array('count' => 'COUNT(' . $this->_db->quoteIdentifier('id') . ')'))->where($this->_db->quoteIdentifier('is_deleted') . ' = 0'); if (!$ignoreACL) { $this->_checkFilterACL($_filter); } Tinebase_Backend_Sql_Filter_FilterGroup::appendFilters($select, $_filter, $this); $result = $this->_db->fetchOne($select); return $result; }
/** * returns all contexts of a given tag * * @param string $_tagId * @return array array of application ids */ public function getContexts($_tagId) { $select = $this->_db->select()->from(SQL_TABLE_PREFIX . 'tags_context', array('application_id' => Tinebase_Backend_Sql_Command::getAggregateFunction($this->_db, $this->_db->quoteIdentifier('application_id'))))->where($this->_db->quoteInto($this->_db->quoteIdentifier('tag_id') . ' = ?', $_tagId))->group('tag_id'); $apps = $this->_db->fetchOne($select); if ($apps === '0') { $apps = 'any'; } if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' got tag contexts: ' . $apps); } return explode(',', $apps); }
/** * Gets record count for current page * * @return int */ public function getCount() { $count = 0; $count = $this->adapter->fetchOne('SELECT COUNT(1) as fox_query_count FROM (' . $this->query . ') AS fox_subquery_count'); return $count; }