3 # FILE: ItemFactory.php 5 # Part of the Collection Workflow Integration System (CWIS) 6 # Copyright 2013 Edward Almasy and Internet Scout Research Group 7 # http://scout.wisc.edu/cwis/ 32 switch ($this->Field->Status())
39 return "Duplicate field name";
41 return "Duplicate database column";
43 return "Field does not exist";
45 return "Illegal field name";
47 return "Duplicate label name";
49 return "Illegal label name";
70 return $this->Field->TypeAsName();
79 return $this->Field->GetDisplayName();
88 return $this->Field->Name();
106 $Value = $this->Field->GetAllowedConversionTypes();
118 return $this->
GetYesNo($this->Field->IsTempItem());
127 return $this->Field->Id();
136 return $this->Field->DBFieldName();
145 # for our purposes, HTML code and some whitespace are not human-readable 146 $Value = strip_tags($this->Field->Description());
147 $Value = trim(str_replace(array(
"\r",
"\n",
"\t"),
" ", $Value));
148 $Value = preg_replace(
'/ +/',
" ", $Value);
159 # for our purposes, HTML code and some whitespace are not human-readable 160 $Value = strip_tags($this->Field->Instructions());
161 $Value = trim(str_replace(array(
"\r",
"\n",
"\t"),
" ", $Value));
162 $Value = preg_replace(
'/ +/',
" ", $Value);
183 return $this->
GetYesNo($this->Field->RequiredBySPT());
192 return $this->
GetYesNo($this->Field->Enabled());
201 return $this->
GetYesNo($this->Field->Optional());
210 return $this->
GetYesNo($this->Field->Editable());
219 return $this->
GetYesNo($this->Field->Viewable());
230 return $this->
GetYesNo($this->Field->AllowMultiple());
241 return $this->
GetYesNo($this->Field->IncludeInKeywordSearch());
252 return $this->
GetYesNo($this->Field->IncludeInAdvancedSearch());
263 return $this->
GetYesNo($this->Field->IncludeInFacetedSearch());
274 return $this->
GetYesNo($this->Field->IncludeInSortOptions());
285 return $this->
GetYesNo($this->Field->IncludeInRecommender());
463 return $this->
GetYesNo($this->Field->UsesQualifiers());
474 return $this->
GetYesNo($this->Field->ShowQualifiers());
483 $DefaultQualifier = $this->Field->DefaultQualifier();
485 if ($DefaultQualifier > 0)
487 $Qualifier =
new Qualifier($DefaultQualifier);
489 return $Qualifier->Name();
502 return $this->
GetYesNo($this->Field->AllowHTML());
513 return $this->
GetYesNo($this->Field->UseWysiwygEditor());
524 return $this->
GetYesNo($this->Field->UseForOaiSets());
534 return $this->Field->NumAjaxResults();
543 $Value = $this->
MapPrivilege($this->Field->ViewingPrivilege());
554 $Value = $this->
MapPrivilege($this->Field->AuthoringPrivilege());
565 $Value = $this->
MapPrivilege($this->Field->EditingPrivilege());
577 $Value = $this->
MapPrivilege($this->Field->ImagePreviewPrivilege());
590 return $this->
GetYesNo($this->Field->EnableOnOwnerReturn());
599 $Value = $this->
MapUserIsValue($this->Field->ViewingUserIsValue());
610 $Value = $this->
MapUserIsValue($this->Field->AuthoringUserIsValue());
621 $Value = $this->
MapUserIsValue($this->Field->EditingUserIsValue());
632 $Value = $this->
MapUserValue($this->Field->ViewingUserValue());
643 $Value = $this->
MapUserValue($this->Field->AuthoringUserValue());
654 $Value = $this->
MapUserValue($this->Field->EditingUserValue());
665 $Value = $this->Field->UserPrivilegeRestrictions();
668 # need to map each privilege ID to its text 669 foreach ($Value as $Id)
701 $Type = $this->Field->Type();
702 $Value = $this->Field->DefaultValue();
717 return (strlen($XText) ? $XText .
", " :
"") .
"Y: " . $Y;
725 # multiple default values are set 726 if (is_array($Value))
728 foreach ($Value as $Id)
732 $Names[] = $ControlledName->Name();
735 return implode(
", ", $Names);
738 # only one default value 743 return $ControlledName->Name();
763 $Value = $this->Field->UpdateMethod();
776 $Value = $this->Field->GetPossibleValues();
799 return $this->
GetYesNo($this->Field->HasItemLevelQualifiers());
808 $Value = $this->Field->AssociatedQualifierList();
818 $Value = $this->Field->UnassociatedQualifierList();
869 $this->NotSetText = $Text;
879 return $Value ?
"Yes" :
"No";
901 $Privilege = $this->
MapPrivilege($this->Field->{$Mode.
"Privileges"}());
902 $UserIsValue = $this->
MapUserIsValue($this->Field->{$Mode.
"UserIsValue"}());
903 $UserValue = $this->
MapUserValue($this->Field->{$Mode.
"UserValue"}());
907 # add the user privilege constraint first, if set 908 if (!is_null($Privilege))
910 $String = $Privilege;
913 # then add the "user is value of field" constraint, if set 914 if (!is_null($UserIsValue) && !is_null($UserValue))
916 if (is_null($String))
918 $String =
"User is value of " . $UserValue;
923 $String .=
" " . $UserIsValue .
" user is value of ";
924 $String .= $UserValue;
928 return is_null($String) ? $this->NotSetText : $String;
938 if (!isset(self::$PrivilegeList))
953 self::$PrivilegeList = $PrivilegeFactory->GetPrivileges(TRUE, FALSE);
973 if (!isset(self::$UserFieldList))
989 # make sure the list is set to something even if there are no user 991 self::$UserFieldList = array();
993 foreach ($UserFields as
$Field)
995 self::$UserFieldList[$Field->Id()] = $Field->GetDisplayName();
1011 return array_key_exists($Key, $Array) ? $Array[$Key] : $Default;
Factory which extracts all defined privileges from the database.
Metadata type representing non-hierarchical controlled vocabulary values.