5 # Part of the Collection Workflow Integration System (CWIS) 6 # Copyright 2012-2013 Edward Almasy and Internet Scout Research Group 7 # http://scout.wisc.edu/cwis/ 13 # ---- PUBLIC INTERFACE -------------------------------------------------- 34 # assume the qualifier operations will be successful 35 $this->
Status = self::STATUS_OK;
38 if (func_num_args() == 0)
40 # determine next qualifier ID 41 $HighestId = $this->DB->Query(
" 42 SELECT QualifierId FROM Qualifiers 43 ORDER BY QualifierId DESC 46 $this->
Id = $HighestId > 0 ? $HighestId + 1 : 1;
48 # add record to database with that ID 50 INSERT INTO Qualifiers 51 SET QualifierId = ".addslashes($this->
Id));
55 else if (!is_null($QualifierId))
57 $this->
Id = intval($QualifierId);
59 # attempt to load qualifier info from database 61 SELECT * FROM Qualifiers 62 WHERE QualifierId = '".addslashes($this->
Id).
"'");
64 # if the qualifier was found 65 if ($this->DB->NumRowsSelected() > 0)
67 # set attributes to values returned by database 68 $this->DBFields = $this->DB->FetchRow();
71 # the qualifier was not found 74 $this->
Status = self::STATUS_DOES_NOT_EXIST;
81 $this->
Status = self::STATUS_DOES_NOT_EXIST;
100 # do not try deleting a qualifier with a bad status 101 if ($this->
Status != self::STATUS_OK)
106 # delete record from database 108 DELETE FROM Qualifiers 109 WHERE QualifierId = ".addslashes($this->
Id));
112 $this->
Status = self::STATUS_DOES_NOT_EXIST;
131 return $this->
UpdateValue(
"QualifierName", $NewValue);
141 return $this->
UpdateValue(
"QualifierNamespace", $NewValue);
151 return $this->
UpdateValue(
"QualifierUrl", $NewValue);
154 # ---- PRIVATE INTERFACE ------------------------------------------------- 188 return $this->DB->UpdateValue(
192 "QualifierId = '".addslashes($this->
Id).
"'",
$DBFields
Cached qualifier data from the database.
SQL database abstraction object with smart query caching.
Url($NewValue=DB_NOVALUE)
Get or set the qualifier URL.
Status()
Get the status of this qualifier.
UpdateValue($FieldName, $NewValue)
Convenience method to supply parameters to Database::UpdateValue().
Id()
Get the qualifier ID.
$Id
The ID of the qualifier.
Name($NewValue=DB_NOVALUE)
Get or set the qualifier name.
Delete()
Delete the qualifier if in a valid state.
__construct($QualifierId=NULL)
Load the qualifier with the given ID or create a new qualifier if no ID is given. ...
NSpace($NewValue=DB_NOVALUE)
Get or set the qualifier namespace.
$Status
The status code of the qualifier.
const STATUS_DOES_NOT_EXIST
Status code used for a non-existent qualifier.
const STATUS_OK
Status code used for an okay, valid qualifier.