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());
578 $Value = $this->
MapPrivilege($this->Field->ImagePreviewPrivilege());
591 return $this->
GetYesNo($this->Field->EnableOnOwnerReturn());
600 $Value = $this->
MapUserIsValue($this->Field->ViewingUserIsValue());
611 $Value = $this->
MapUserIsValue($this->Field->AuthoringUserIsValue());
622 $Value = $this->
MapUserIsValue($this->Field->EditingUserIsValue());
633 $Value = $this->
MapUserValue($this->Field->ViewingUserValue());
644 $Value = $this->
MapUserValue($this->Field->AuthoringUserValue());
655 $Value = $this->
MapUserValue($this->Field->EditingUserValue());
666 $Value = $this->Field->UserPrivilegeRestrictions();
669 # need to map each privilege ID to its text 670 foreach ($Value as $Id)
702 $Type = $this->Field->Type();
703 $Value = $this->Field->DefaultValue();
718 return (strlen($XText) ? $XText .
", " :
"") .
"Y: " . $Y;
726 # multiple default values are set 727 if (is_array($Value))
729 foreach ($Value as $Id)
733 $Names[] = $ControlledName->Name();
736 return implode(
", ", $Names);
739 # only one default value 744 return $ControlledName->Name();
764 $Value = $this->Field->UpdateMethod();
777 $Value = $this->Field->GetPossibleValues();
800 return $this->
GetYesNo($this->Field->HasItemLevelQualifiers());
809 $Value = $this->Field->AssociatedQualifierList();
820 $Value = $this->Field->UnassociatedQualifierList();
871 $this->NotSetText = $Text;
881 return $Value ?
"Yes" :
"No";
903 $Privilege = $this->
MapPrivilege($this->Field->{$Mode.
"Privileges"}());
904 $UserIsValue = $this->
MapUserIsValue($this->Field->{$Mode.
"UserIsValue"}());
905 $UserValue = $this->
MapUserValue($this->Field->{$Mode.
"UserValue"}());
909 # add the user privilege constraint first, if set 910 if (!is_null($Privilege))
912 $String = $Privilege;
915 # then add the "user is value of field" constraint, if set 916 if (!is_null($UserIsValue) && !is_null($UserValue))
918 if (is_null($String))
920 $String =
"User is value of " . $UserValue;
925 $String .=
" " . $UserIsValue .
" user is value of ";
926 $String .= $UserValue;
930 return is_null($String) ? $this->NotSetText : $String;
940 if (!isset(self::$PrivilegeList))
955 self::$PrivilegeList = $PrivilegeFactory->GetPrivileges(TRUE, FALSE);
975 if (!isset(self::$UserFieldList))
991 # make sure the list is set to something even if there are no user 993 self::$UserFieldList = array();
995 foreach ($UserFields as
$Field)
997 self::$UserFieldList[$Field->Id()] = $Field->GetDisplayName();
1013 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.