Пример #1
0
 /**
  * purges (removes from tabel) all contexts of a given tag
  *
  * @param  string $_tagId
  * @return void
  */
 public function purgeContexts($_tagId)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' removing contexts for tag ' . $_tagId);
     }
     $where = $this->_db->quoteInto($this->_db->quoteIdentifier('tag_id') . ' = ?', $_tagId);
     $this->_db->delete(SQL_TABLE_PREFIX . 'tags_context', $where);
 }
Пример #2
0
 /**
  * add single role rights 
  *
  * @param   int $_roleId
  * @param   int $_applicationId
  * @param   string $_right
  */
 public function addSingleRight($_roleId, $_applicationId, $_right)
 {
     // check if already in
     $select = $this->_roleRightsTable->select();
     $select->where($this->_db->quoteInto($this->_db->quoteIdentifier('role_id') . ' = ?', $_roleId))->where($this->_db->quoteInto($this->_db->quoteIdentifier('right') . ' = ?', $_right))->where($this->_db->quoteInto($this->_db->quoteIdentifier('application_id') . ' = ?', $_applicationId));
     if (!($row = $this->_roleRightsTable->fetchRow($select))) {
         $data = array('role_id' => $_roleId, 'application_id' => $_applicationId, 'right' => $_right);
         $this->_roleRightsTable->insert($data);
     }
 }
 /**
  * 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(array('tags_context' => SQL_TABLE_PREFIX . 'tags_context'), array('application_id' => $this->_dbCommand->getAggregate('application_id')))->where($this->_db->quoteInto($this->_db->quoteIdentifier('tag_id') . ' = ?', $_tagId))->group('tag_id');
     Tinebase_Backend_Sql_Abstract::traitGroup($select);
     $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);
 }
Пример #4
0
 /**
  * Quotes a value and places into a piece of text at a placeholder.
  *
  * Method revrited for handle empty arrays in value param
  *
  * @param string  $text  The text with a placeholder.
  * @param mixed   $value The value to quote.
  * @param string  $type  OPTIONAL SQL datatype
  * @param integer $count OPTIONAL count of placeholders to replace
  * @return string An SQL-safe quoted value placed into the orignal text.
  */
 public function quoteInto($text, $value, $type = null, $count = null)
 {
     if (is_array($value) && empty($value)) {
         $value = new Zend_Db_Expr('NULL');
     }
     return parent::quoteInto($text, $value, $type, $count);
 }
Пример #5
0
 /**
  * delete registration by username
  *
  * @param   string $_username
  * @return  int     number of rows affected
  */
 public function deleteRegistrationByLoginName($_username)
 {
     $where = $this->_db->quoteInto($this->_db->quoteIdentifier('login_name') . ' = ?', $_username);
     $result = $this->_registrationsTable->delete($where);
     return $result;
 }
Пример #6
0
 /**
  * Quotes a value and places into a piece of text at a placeholder.
  *
  * Method revrited for handle empty arrays in value param
  *
  * @param string  $text  The text with a placeholder.
  * @param mixed   $value The value to quote.
  * @param string  $type  OPTIONAL SQL datatype
  * @param integer $count OPTIONAL count of placeholders to replace
  * @return string An SQL-safe quoted value placed into the orignal text.
  */
 public function quoteInto($text, $value, $type = null, $count = null)
 {
     if (is_array($value) && empty($value)) {
         $value = new \Zend_Db_Expr('NULL');
     }
     if ($value instanceof \DateTimeInterface) {
         $value = $value->format('Y-m-d H:i:s');
     }
     return parent::quoteInto($text, $value, $type, $count);
 }
 /**
  * delete note type
  *
  * @param integer $_noteTypeId
  */
 public function deleteNoteType($_noteTypeId)
 {
     $this->_noteTypesTable->delete($this->_db->quoteInto($this->_db->quoteIdentifier('id') . ' = ?', $_noteTypeId));
 }