function checkin($oid = null) { if (!array_key_exists('checked_out', get_class_vars(strtolower(get_class($this))))) { $this->_error = "WARNING: " . strtolower(get_class($this)) . " does not support checkins."; return false; } $k = $this->_tbl_key; if ($oid !== null) { $this->{$k} = $oid; } $query = "UPDATE " . $this->_db->NameQuote($this->_tbl) . "\n SET checked_out = 0, checked_out_time = " . $this->_db->Quote($this->_db->getNullDate()) . "\n WHERE " . $this->_db->NameQuote($this->_tbl_key) . " = " . $this->_db->Quote($this->{$k}); $this->_db->setQuery($query); return $this->_db->query(); }
/** * Converts non-numeric value to numeric, otherwise return null * * @param string $value * @param \CBDatabase $_CB_database * @return string|null */ private function fieldNameToId( $value, $_CB_database ) { if ( is_numeric( $value ) ) { return $value; } static $fieldNameIdMap = array(); if ( ! isset( $fieldNameIdMap[$value] ) ) { $_CB_database->setQuery( "SELECT f." . $_CB_database->NameQuote( 'fieldid' ) . "\n FROM " . $_CB_database->NameQuote( '#__comprofiler_fields' ) . " AS f" . "\n WHERE f." . $_CB_database->NameQuote( 'name' ) . ' = ' . $_CB_database->Quote( $value ) ); $fieldNameIdMap[$value] = $_CB_database->loadResult(); } return $fieldNameIdMap[$value]; }