CWIS Developer Documentation

- Home
- Main Page
- Classes
- Files

- File List
- File Members

MetadataFieldOrder.php
Go to the documentation of this file.
1 <?PHP
2 #
3 # FILE: MetadataFieldOrder.php
4 #
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
8 #
9
14 class MetadataFieldOrder extends Folder
15 {
16
21 const DEFAULT_FOLDER_NAME = "FieldOrder";
22
28 public function __construct($Id)
29 {
30 # being loading by calling the superclass method
31 parent::Folder($Id);
32
33 # create a class-wide database
34 $this->Database = new Database();
35
36 # query for order associations from the database
37 $this->Database->Query("
38 SELECT * FROM MetadataFieldOrders
39 WHERE OrderId = '".addslashes($Id)."'");
40
41 # the ID is invalid
42 if ($this->Database->NumRowsSelected() < 1)
43 {
44 throw new Exception("Unknown metadata field order ID");
45 }
46
47 # fetch the data
48 $Row = $this->Database->FetchRow();
49
50 # set the values
51 $this->SchemaId = $Row["SchemaId"];
52 $this->OrderName = $Row["OrderName"];
53 }
54
61 public function SchemaId()
62 {
63 return $this->SchemaId;
64 }
65
70 public function OrderName()
71 {
72 return $this->OrderName;
73 }
74
80 public function Delete()
81 {
82 # remove the order from the orders associated with schemas
83 $this->Database->Query("
84 DELETE FROM MetadataFieldOrders
85 WHERE OrderId = '".addslashes($this->Id())."'");
86
87 # remove the folder by calling the superclass method
88 parent::Delete();
89 }
90
94 public function MendIssues()
95 {
96 $Schema = new MetadataSchema($this->SchemaId);
97
98 # get all the fields including disabled fields but excluding temp fields
99 $Fields = $Schema->GetFields(NULL, NULL, TRUE);
100
101 foreach ($Fields as $Field)
102 {
103 # add the field if it isn't already in the order
104 if (!$this->ItemInOrder($Field))
105 {
106 $this->AppendItem($Field->Id(), "MetadataField");
107 }
108 }
109 }
110
115 public function GetItems()
116 {
117 $ItemIds = $this->GetItemIds();
118 $Items = array();
119
120 foreach ($ItemIds as $Info)
121 {
122 try
123 {
124 $Items[] = new $Info["Type"]($Info["ID"]);
125 }
126
127 # skip invalid fields
128 catch (InvalidArgumentException $Exception)
129 {
130 continue;
131 }
132 }
133
134 return $Items;
135 }
136
142 public function CreateGroup($Name)
143 {
144 $FolderFactory = new FolderFactory();
145
146 # create the new group
147 $Folder = $FolderFactory->CreateMixedFolder($Name);
148 $Group = new MetadataFieldGroup($Folder->Id());
149
150 # and add it to this ordering
151 $this->AppendItem($Group->Id(), "MetadataFieldGroup");
152
153 return $Group;
154 }
155
162 public function DeleteGroup(MetadataFieldGroup $Group)
163 {
164 if ($this->ContainsItem($Group->Id(), "MetadataFieldGroup"))
165 {
166 $this->MoveFieldsToOrder($Group);
167 $this->RemoveItem($Group->Id(), "MetadataFieldGroup");
168 }
169 }
170
175 public function GetFields()
176 {
177 $Fields = array();
178
179 foreach ($this->GetItems() as $Item)
180 {
181 # add fields to the list
182 if ($Item instanceof MetadataField)
183 {
184 $Fields[$Item->Id()] = $Item;
185 }
186
187 # add fields of groups to the list
188 else if ($Item instanceof MetadataFieldGroup)
189 {
190 foreach ($Item->GetFields() as $Field)
191 {
192 $Fields[$Field->Id()] = $Field;
193 }
194 }
195 }
196
197 return $Fields;
198 }
199
204 public function GetGroups()
205 {
206 $ItemIds = $this->GetItemIds();
207 $GroupIds = array_filter($ItemIds, array($this, "GroupFilterCallback"));
208
209 $Groups = array();
210
211 # transform group info to group objects
212 foreach ($GroupIds as $GroupId)
213 {
214 try
215 {
216 $Groups[$GroupId["ID"]] = new $GroupId["Type"]($GroupId["ID"]);
217 } catch (Exception $Exception) {}
218 }
219
220 return $Groups;
221 }
222
232 public function MoveItemUp($Item, $Filter=NULL)
233 {
234 # make sure the item is a field or group
235 if (!$this->IsFieldOrGroup($Item))
236 {
237 throw new Exception("Item must be a field or group");
238 }
239
240 # make sure the item is in the order
241 if (!$this->ItemInOrder($Item))
242 {
243 throw new Exception("Item must exist in the ordering");
244 }
245
246 # make sure the filter is callable if set
247 if (!is_null($Filter) && !is_callable($Filter))
248 {
249 throw new Exception("Filter callback must be callable");
250 }
251
252 $ItemType = $this->GetItemType($Item);
253 $Enclosure = $this->GetEnclosure($Item);
254 $EnclosureType = $this->GetItemType($Enclosure);
255 $Previous = $this->GetSiblingItem($Item, -1, $Filter);
256 $PreviousId = $this->GetItemId($Previous);
257 $PreviousType = $this->GetItemType($Previous);
258
259 # determine if the item is at the top of the list
260 $ItemAtTop = is_null($Previous);
261
262 # determine if a field needs to be moved into a group
263 $FieldToGroup = $ItemType == "MetadataField";
264 $FieldToGroup = $FieldToGroup && $EnclosureType == "MetadataFieldOrder";
265 $FieldToGroup = $FieldToGroup && $PreviousType == "MetadataFieldGroup";
266
267 # determine if a field needs to be moved out of a group
268 $FieldToOrder = $ItemType == "MetadataField";
269 $FieldToOrder = $FieldToOrder && $EnclosureType == "MetadataFieldGroup";
270 $FieldToOrder = $FieldToOrder && $ItemAtTop;
271
272 # move a field into a group if necessary
273 if ($FieldToGroup)
274 {
275 $this->MoveFieldToGroup($Previous, $Item, "append");
276 }
277
278 # or move a field from a group to the order if necessary
279 else if ($FieldToOrder)
280 {
281 $this->MoveFieldToOrder($Enclosure, $Item, "before");
282 }
283
284 # otherwise just move the item up if not at the top of the list
285 else if (!$ItemAtTop)
286 {
287 $this->MoveItemAfter($Item, $Previous);
288 }
289 }
290
300 public function MoveItemDown($Item, $Filter=NULL)
301 {
302 # make sure the item is a field or group
303 if (!$this->IsFieldOrGroup($Item))
304 {
305 throw new Exception("Item must be a field or group");
306 }
307
308 # make sure the item is in the order
309 if (!$this->ItemInOrder($Item))
310 {
311 throw new Exception("Item must exist in the ordering");
312 }
313
314 # make sure the filter is callable if set
315 if (!is_null($Filter) && !is_callable($Filter))
316 {
317 throw new Exception("Filter callback must be callable");
318 }
319
320 $ItemType = $this->GetItemType($Item);
321 $Enclosure = $this->GetEnclosure($Item);
322 $EnclosureType = $this->GetItemType($Enclosure);
323 $Next = $this->GetSiblingItem($Item, 1, $Filter);
324 $NextId = $this->GetItemId($Next);
325 $NextType = $this->GetItemType($Next);
326
327 # determine if the item is at the bottom of the list
328 $ItemAtBottom = is_null($Next);
329
330 # determine if a field needs to be moved into a group
331 $FieldToGroup = $ItemType == "MetadataField";
332 $FieldToGroup = $FieldToGroup && $EnclosureType == "MetadataFieldOrder";
333 $FieldToGroup = $FieldToGroup && $NextType == "MetadataFieldGroup";
334
335 # determine if a field needs to be moved out of a group
336 $FieldToOrder = $ItemType == "MetadataField";
337 $FieldToOrder = $FieldToOrder && $EnclosureType == "MetadataFieldGroup";
338 $FieldToOrder = $FieldToOrder && $ItemAtBottom;
339
340 # move a field into a group if necessary
341 if ($FieldToGroup)
342 {
343 $this->MoveFieldToGroup($Next, $Item, "prepend");
344 }
345
346 # or move a field from a group to the order if necessary
347 else if ($FieldToOrder)
348 {
349 $this->MoveFieldToOrder($Enclosure, $Item, "after");
350 }
351
352 # otherwise just move the item down if not at the bottom
353 else if (!$ItemAtBottom)
354 {
355 $this->MoveItemAfter($Next, $Item);
356 }
357 }
358
365 public function MoveItemToTop($Item)
366 {
367 # make sure the item is either a field or group
368 if (!$this->IsFieldOrGroup($Item))
369 {
370 throw new Exception("Item must be a either field or group");
371 }
372
373 # make sure the item is in the order
374 if (!$this->ItemInOrder($Item))
375 {
376 throw new Exception("Item must exist in the ordering");
377 }
378
379 $OrderId = $this->GetItemId($this);
380 $OrderType = $this->GetItemType($this);
381 $ItemId = $this->GetItemId($Item);
382 $ItemType = $this->GetItemType($Item);
383 $ItemEnclosure = $this->GetEnclosure($Item);
384 $ItemEnclosureId = $this->GetItemId($ItemEnclosure);
385 $ItemEnclosureType = $this->GetItemType($ItemEnclosure);
386
387 $SameEnclosureId = $OrderId == $ItemEnclosureId;
388 $SameEnclosureType = $OrderType == $ItemEnclosureType;
389
390 # remove the item from its enclosure if necessary
391 if (!$SameEnclosureId || !$SameEnclosureType)
392 {
393 $ItemEnclosure->RemoveItem($ItemId, $ItemType);
394 }
395
396 # move the item to the top of the order
397 $this->PrependItem($ItemId, $ItemType);
398 }
399
406 public function MoveFieldToTopOfGroup(
407 MetadataFieldGroup $Group,
408 MetadataField $Field)
409 {
410 # make sure the items are in the order
411 if (!$this->ItemInOrder($Group) || !$this->ItemInOrder($Field))
412 {
413 throw new Exception("Item must exist in the ordering");
414 }
415
416 $GroupId = $this->GetItemId($Group);
417 $GroupType = $this->GetItemType($Group);
418 $FieldId = $this->GetItemId($Field);
419 $FieldType = $this->GetItemType($Field);
420 $FieldEnclosure = $this->GetEnclosure($Field);
421 $FieldEnclosureId = $this->GetItemId($FieldEnclosure);
422 $FieldEnclosureType = $this->GetItemType($FieldEnclosure);
423
424 $SameEnclosureId = $GroupId == $FieldEnclosureId;
425 $SameEnclosureType = $GroupType == $FieldEnclosureType;
426
427 # remove the item from its enclosure if necessary
428 if (!$SameEnclosureId || !$SameEnclosureType)
429 {
430 $FieldEnclosure->RemoveItem($FieldId, $FieldType);
431 }
432
433 # move the item to the top of the group
434 $Group->PrependItem($FieldId, $FieldType);
435 }
436
446 public function MoveItemAfter($Target, $Item)
447 {
448 # make sure the items are either a field or group
449 if (!$this->IsFieldOrGroup($Target) || !$this->IsFieldOrGroup($Item))
450 {
451 throw new Exception("Items must be a either field or group");
452 }
453
454 # make sure the items are in the order
455 if (!$this->ItemInOrder($Target) || !$this->ItemInOrder($Item))
456 {
457 throw new Exception("Items must exist in the ordering");
458 }
459
460 $TargetId = $this->GetItemId($Target);
461 $TargetType = $this->GetItemType($Target);
462 $ItemId = $this->GetItemId($Item);
463 $ItemType = $this->GetItemType($Item);
464 $TargetEnclosure = $this->GetEnclosure($Target);
465 $TargetEnclosureId = $this->GetItemId($TargetEnclosure);
466 $TargetEnclosureType = $this->GetItemType($TargetEnclosure);
467 $ItemEnclosure = $this->GetEnclosure($Item);
468 $ItemEnclosureId = $this->GetItemId($ItemEnclosure);
469 $ItemEnclosureType = $this->GetItemType($ItemEnclosure);
470
471 $TargetInGroup = $TargetEnclosure instanceof MetadataFieldGroup;
472 $ItemIsField = $Item instanceof MetadataField;
473
474 # make sure only fields are placed in groups
475 if ($TargetInGroup && !$ItemIsField)
476 {
477 throw new Exception("Only fields can go into field groups");
478 }
479
480 $SameEnclosureId = $TargetEnclosureId == $ItemEnclosureId;
481 $SameEnclosureType = $TargetEnclosureType == $ItemEnclosureType;
482
483 # move a field into a group if necessary
484 if (!$SameEnclosureId || !$SameEnclosureType)
485 {
486 $ItemEnclosure->RemoveItem($ItemId, $ItemType);
487 }
488
489 # move the item after the target
490 $TargetEnclosure->InsertItemAfter(
491 $TargetId,
492 $ItemId,
493 $TargetType,
494 $ItemType);
495 }
496
502 public function ItemInOrder($Item)
503 {
504 # the item would have to be a field or group to be in the order
505 if (!$this->IsFieldOrGroup($Item))
506 {
507 return FALSE;
508 }
509
510 $ItemId = $this->GetItemId($Item);
511 $ItemType = $this->GetItemType($Item);
512
513 # if the item is in the order, i.e., not in a group
514 if ($this->ContainsItem($ItemId, $ItemType))
515 {
516 return TRUE;
517 }
518
519 # the item is in one of the groups, so search each one for it
520 foreach ($this->GetGroups() as $Group)
521 {
522 if ($Group->ContainsItem($ItemId, $ItemType))
523 {
524 return TRUE;
525 }
526 }
527
528 # the item was not found
529 return FALSE;
530 }
531
542 public static function Create(
543 MetadataSchema $Schema,
544 $Name,
545 array $FieldOrder=array())
546 {
547 $ExistingOrders = self::GetOrdersForSchema($Schema);
548
549 # remove existing orders with the same name
550 if (array_key_exists($Name, $ExistingOrders))
551 {
552 $ExistingOrders[$Name]->Delete();
553 }
554
555 # create the folder
556 $FolderFactory = new FolderFactory();
557 $Folder = $FolderFactory->CreateMixedFolder(self::DEFAULT_FOLDER_NAME);
558
559 # get all the fields including disabled fields but excluding temp fields
560 $Fields = $Schema->GetFields(NULL, NULL, TRUE);
561
562 # first, add each field from the given order
563 foreach ($FieldOrder as $FieldId)
564 {
565 # skip invalid field IDs
566 if (!array_key_exists($FieldId, $Fields))
567 {
568 continue;
569 }
570
571 # remove the field from the array of fields so that we'll know after
572 # looping which fields weren't added
573 unset($Fields[$FieldId]);
574
575 # add the metadata field to the folder
576 $Folder->AppendItem($FieldId, "MetadataField");
577 }
578
579 # finally, add any remaining fields that weren't removed in the loop
580 # above
581 foreach ($Fields as $FieldId => $Field)
582 {
583 $Folder->AppendItem($FieldId, "MetadataField");
584 }
585
586 $Database = new Database();
587
588 # associate the order with the schema in the database
589 $Database->Query("
590 INSERT INTO MetadataFieldOrders
591 SET SchemaId = '".addslashes($Schema->Id())."',
592 OrderId = '".addslashes($Folder->Id())."',
593 OrderName = '".addslashes($Name)."'");
594
595 # reconstruct the folder as a metadata schema order object and return
596 return new MetadataFieldOrder($Folder->Id());
597 }
598
607 public static function GetOrderForSchema(MetadataSchema $Schema, $Name)
608 {
609 return self::GetOrderForSchemaId($Schema->Id(), $Name);
610 }
611
620 public static function GetOrderForSchemaId($SchemaId, $Name)
621 {
622 $Orders = self::GetOrdersForSchemaId($SchemaId);
623
624 # return NULL if the order doesn't exist
625 if (!array_key_exists($Name, $Orders))
626 {
627 return NULL;
628 }
629
630 # return the order
631 return $Orders[$Name];
632 }
633
640 public static function GetOrdersForSchema(MetadataSchema $Schema)
641 {
642 return self::GetOrdersForSchemaId($Schema->Id());
643 }
644
651 public static function GetOrdersForSchemaId($SchemaId)
652 {
653 $Orders = array();
654 $Database = new Database();
655
656 # query the database for the orders associated with the schema
657 $Database->Query("
658 SELECT * FROM MetadataFieldOrders
659 WHERE SchemaId = '".addslashes($SchemaId)."'");
660
661 # loop through each found record
662 foreach ($Database->FetchRows() as $Row)
663 {
664 try
665 {
666 # construct an object using the ID and add it to the array
667 $Orders[$Row["OrderName"]] = new MetadataFieldOrder($Row["OrderId"]);
668 }
669
670 # remove invalid orders when encountered
671 catch (Exception $Exception)
672 {
673 $Database->Query("
674 DELETE FROM MetadataFieldOrders
675 WHERE OrderId = '".addslashes($Row["OrderId"])."'");
676 }
677 }
678
679 return $Orders;
680 }
681
687 protected function IsFieldOrGroup($Item)
688 {
689 if ($Item instanceof MetadataField)
690 {
691 return TRUE;
692 }
693
694 if ($Item instanceof MetadataFieldGroup)
695 {
696 return TRUE;
697 }
698
699 return FALSE;
700 }
701
707 protected function GetItemId($Item)
708 {
709 return is_object($Item) ? $Item->Id() : NULL;
710 }
711
717 protected function GetItemType($Item)
718 {
719 return is_object($Item) ? get_class($Item) : NULL;
720 }
721
728 protected function GroupFilterCallback($Item)
729 {
730 return $Item["Type"] == "MetadataFieldGroup";
731 }
732
740 protected function GetEnclosure($Item)
741 {
742 $ItemId = $this->GetItemId($Item);
743 $ItemType = $this->GetItemType($Item);
744
745 # the item is in the order, i.e., not in a group
746 if ($this->ContainsItem($ItemId, $ItemType))
747 {
748 return $this;
749 }
750
751 # the item is in one of the groups, so search each one for it
752 foreach ($this->GetGroups() as $Group)
753 {
754 if ($Group->ContainsItem($ItemId, $ItemType))
755 {
756 return $Group;
757 }
758 }
759
760 # the item was not found
761 return NULL;
762 }
763
771 protected function GetSiblingItem($Item, $Offset, $Filter=NULL)
772 {
773 $Id = $this->GetItemId($Item);
774 $Type = $this->GetItemType($Item);
775 $Sibling = NULL;
776
777 # the sibling is in the order, i.e., not in a group
778 if ($this->ContainsItem($Id, $Type))
779 {
780 return $this->FindSiblingItem($this, $Item, $Offset, $Filter);
781 }
782
783 # otherwise search for it in the groups
784 foreach ($this->GetGroups() as $Group)
785 {
786 if ($Group->ContainsItem($Id, $Type))
787 {
788 try
789 {
790 $Sibling = $this->FindSiblingItem(
791 $Group,
792 $Item,
793 $Offset,
794 $Filter);
795
796 if ($Sibling)
797 {
798 return $Sibling;
799 }
800 } catch (Exception $Exception) {}
801
802 break;
803 }
804 }
805
806 return NULL;
807 }
808
818 protected function FindSiblingItem($Enclosure, $Item, $Offset, $Filter=NULL)
819 {
820 $ItemIds = $Enclosure->GetItemIds();
821
822 # filter items if necessary
823 if (is_callable($Filter))
824 {
825 $ItemIds = array_filter($ItemIds, $Filter);
826
827 # maintain continuous indices
828 ksort($ItemIds);
829 $ItemIds = array_values($ItemIds);
830 }
831
832 $Id = $this->GetItemId($Item);
833 $Type = $this->GetItemType($Item);
834 $Index = array_search(array("ID" => $Id, "Type" => $Type), $ItemIds);
835
836 if (!is_null($Index) && array_key_exists($Index+$Offset, $ItemIds))
837 {
838 $SiblingInfo = $ItemIds[$Index+$Offset];
839 return new $SiblingInfo["Type"]($SiblingInfo["ID"]);
840 }
841
842 return NULL;
843 }
844
852 protected function MoveFieldToGroup(
853 MetadataFieldGroup $Group,
854 MetadataField $Field,
855 $Placement)
856 {
857 # determine which action to use based on the placement value
858 $Action = $Placement == "prepend" ? "PrependItem" : "AppendItem";
859
860 $GroupId = $this->GetItemId($Group);
861 $FieldId = $this->GetItemId($Field);
862
863 $OrderHasGroup = $this->ContainsItem($GroupId, "MetadataFieldGroup");
864 $OrderHasField = $this->ContainsItem($FieldId, "MetadataField");
865
866 # make sure the field and group are in the order before editing
867 if ($OrderHasGroup && $OrderHasField)
868 {
869 $this->RemoveItem($FieldId, "MetadataField");
870 $Group->$Action($FieldId, "MetadataField");
871 }
872 }
873
882 protected function MoveFieldToOrder(
883 MetadataFieldGroup $Group,
884 MetadataField $Field,
885 $Placement)
886 {
887 # determine which action to use based on the placement value
888 $Action = $Placement == "before" ? "InsertItemBefore" : "InsertItemAfter";
889
890 $GroupId = $this->GetItemId($Group);
891 $FieldId = $this->GetItemId($Field);
892
893 $OrderHasGroup = $this->ContainsItem($GroupId, "MetadataFieldGroup");
894 $GroupHasField = $Group->ContainsItem($FieldId, "MetadataField");
895
896 # make sure the field is in the group and the group is in the order
897 if ($OrderHasGroup && $GroupHasField)
898 {
899 $Group->RemoveItem($FieldId, "MetadataField");
900 $this->$Action(
901 $GroupId,
902 $FieldId,
903 "MetadataFieldGroup",
904 "MetadataField");
905 }
906 }
907
914 protected function MoveFieldsToOrder(MetadataFieldGroup $Group)
915 {
916 $ItemIds = $Group->GetItemIds();
917 $PreviousItemId = $Group->Id();
918 $PreviousItemType = "MetadataFieldGroup";
919
920 foreach ($ItemIds as $ItemInfo)
921 {
922 $ItemId = $ItemInfo["ID"];
923 $ItemType = $ItemInfo["Type"];
924
925 $this->InsertItemAfter(
926 $PreviousItemId,
927 $ItemId,
928 $PreviousItemType,
929 $ItemType);
930
931 $PreviousItemId = $ItemId;
932 $PreviousItemType = $ItemType;
933 }
934 }
935
939 protected $Database;
940
945 protected $SchemaId;
946
950 protected $OrderName;
951
952 }
MetadataFieldOrder\MoveFieldToOrder
MoveFieldToOrder(MetadataFieldGroup $Group, MetadataField $Field, $Placement)
Move the field with the given ID from the group with the given ID to the order, optionally specifying...
Definition: MetadataFieldOrder.php:882
MetadataFieldOrder\MoveFieldsToOrder
MoveFieldsToOrder(MetadataFieldGroup $Group)
Move all the metadata fields out of the given metadata field group and into the main order...
Definition: MetadataFieldOrder.php:914
MetadataFieldOrder\DEFAULT_FOLDER_NAME
const DEFAULT_FOLDER_NAME
The default name given to the folders that are really metadata field orders.
Definition: MetadataFieldOrder.php:21
MetadataSchema
Metadata schema (in effect a Factory class for MetadataField).
Definition: MetadataSchema.php:13
MetadataFieldOrder
Class to build metadata field ordering functionality on top of the foldering functionality.
Definition: MetadataFieldOrder.php:14
Folder\AppendItem
AppendItem($ItemOrItemId, $ItemType=NULL)
Add item to folder as the last item.
Definition: Folder.php:250
MetadataFieldOrder\$OrderName
$OrderName
The name of the metadata field order.
Definition: MetadataFieldOrder.php:950
Folder\Id
Id()
Get folder ID.
Definition: Folder.php:105
MetadataFieldOrder\GetGroups
GetGroups()
Get all the groups in this metadata field ordering in order.
Definition: MetadataFieldOrder.php:204
MetadataFieldOrder\GetSiblingItem
GetSiblingItem($Item, $Offset, $Filter=NULL)
Get the item object of the item that is the given distance from the item.
Definition: MetadataFieldOrder.php:771
Database
SQL database abstraction object with smart query caching.
Definition: Axis--Database.php:22
MetadataFieldOrder\MoveItemDown
MoveItemDown($Item, $Filter=NULL)
Move the given item down in the order.
Definition: MetadataFieldOrder.php:300
MetadataFieldOrder\GroupFilterCallback
GroupFilterCallback($Item)
Callback for the filter to retrieve groups only from the metadata field order.
Definition: MetadataFieldOrder.php:728
MetadataFieldOrder\__construct
__construct($Id)
Load an existing metadata field order.
Definition: MetadataFieldOrder.php:28
Database\FetchRow
FetchRow()
Get next database row retrieved by most recent query.
Definition: Axis--Database.php:580
MetadataFieldOrder\Delete
Delete()
Delete the metadata field order.
Definition: MetadataFieldOrder.php:80
MetadataFieldOrder\GetItems
GetItems()
Transform the item IDs of the metadata field order object into objects.
Definition: MetadataFieldOrder.php:115
MetadataFieldOrder\ItemInOrder
ItemInOrder($Item)
Determine whether the given item is a member of this order.
Definition: MetadataFieldOrder.php:502
Folder\GetItemIds
GetItemIds()
Retrieve array of IDs of items in folder, in the order that they appear in the folder.
Definition: Folder.php:299
FolderFactory
Factory object for Folder class, used to retrieve and manage Folders and groups of Folders...
Definition: FolderFactory.php:14
MetadataFieldGroup
Class that builds on the foldering functionality to provide groups of metadata fields.
Definition: MetadataFieldGroup.php:14
Folder
Folder object used to create and manage groups of items.
Definition: Folder.php:17
MetadataFieldOrder\GetItemType
GetItemType($Item)
Get the type of the given item.
Definition: MetadataFieldOrder.php:717
Folder\RemoveItem
RemoveItem($ItemId, $ItemType=NULL)
Remove item from folder, if present.
Definition: Folder.php:340
PHP
PHP
Definition: OAIClient.php:39
Folder\InsertItemAfter
InsertItemAfter($TargetItemOrItemId, $NewItemOrItemId, $TargetItemType=NULL, $NewItemType=NULL)
Insert item into folder after specified item.
Definition: Folder.php:221
MetadataFieldOrder\MoveItemUp
MoveItemUp($Item, $Filter=NULL)
Move the given item up in the order.
Definition: MetadataFieldOrder.php:232
MetadataFieldOrder\GetItemId
GetItemId($Item)
Get the ID of the given item.
Definition: MetadataFieldOrder.php:707
Database\NumRowsSelected
NumRowsSelected()
Get number of rows returned by last SELECT or SHOW query.
Definition: Axis--Database.php:537
MetadataFieldOrder\$SchemaId
$SchemaId
The ID of the metadata schema this metadata field order is associated with.
Definition: MetadataFieldOrder.php:945
MetadataFieldOrder\GetEnclosure
GetEnclosure($Item)
Get the metadata field order or metadata field group that encloses the given item.
Definition: MetadataFieldOrder.php:740
MetadataFieldOrder\MoveFieldToTopOfGroup
MoveFieldToTopOfGroup(MetadataFieldGroup $Group, MetadataField $Field)
Move the given item to the top of the order.
Definition: MetadataFieldOrder.php:406
Database\Query
Query($QueryString, $FieldName="")
Query database (with caching if enabled).
Definition: Axis--Database.php:279
MetadataFieldOrder\Create
static Create(MetadataSchema $Schema, $Name, array $FieldOrder=array())
Create a new metadata field order, optionally specifying the order of the fields. ...
Definition: MetadataFieldOrder.php:542
MetadataSchema\GetFields
GetFields($FieldTypes=NULL, $OrderType=NULL, $IncludeDisabledFields=FALSE, $IncludeTempFields=FALSE)
Retrieve array of fields.
Definition: MetadataSchema.php:1050
Folder\ContainsItem
ContainsItem($ItemId, $ItemType=NULL)
Check whether specified item is contained in folder.
Definition: Folder.php:390
MetadataFieldOrder\GetFields
GetFields()
Get all the fields in this metadata field ordering in order.
Definition: MetadataFieldOrder.php:175
MetadataField
Object representing a locally-defined type of metadata field.
Definition: MetadataField.php:13
MetadataFieldOrder\SchemaId
SchemaId()
Get the ID of the metadata schema with which the metadata field order is associated.
Definition: MetadataFieldOrder.php:61
MetadataFieldOrder\FindSiblingItem
FindSiblingItem($Enclosure, $Item, $Offset, $Filter=NULL)
Attempt to find the item that is the given distance from the item within the given enclosure...
Definition: MetadataFieldOrder.php:818
MetadataFieldOrder\GetOrderForSchema
static GetOrderForSchema(MetadataSchema $Schema, $Name)
Get a metadata field order with a specific name for a given metadata schema.
Definition: MetadataFieldOrder.php:607
MetadataFieldOrder\GetOrdersForSchema
static GetOrdersForSchema(MetadataSchema $Schema)
Get all of the orders associated with a schema.
Definition: MetadataFieldOrder.php:640
MetadataFieldOrder\MendIssues
MendIssues()
Fix any issues found in case an unfound bug causes something to go awry.
Definition: MetadataFieldOrder.php:94
MetadataSchema\Id
Id()
Get schema ID.
Definition: MetadataSchema.php:223
MetadataFieldOrder\MoveItemAfter
MoveItemAfter($Target, $Item)
Move the given item after the given target item.
Definition: MetadataFieldOrder.php:446
MetadataFieldOrder\CreateGroup
CreateGroup($Name)
Create a new metadata field group with the given name.
Definition: MetadataFieldOrder.php:142
MetadataFieldOrder\GetOrderForSchemaId
static GetOrderForSchemaId($SchemaId, $Name)
Get a metadata field order with a specific name for a given metadata schema ID.
Definition: MetadataFieldOrder.php:620
MetadataFieldOrder\DeleteGroup
DeleteGroup(MetadataFieldGroup $Group)
Move the metadata fields out of the given metadata group to the metadata field order and then delete ...
Definition: MetadataFieldOrder.php:162
MetadataFieldOrder\MoveItemToTop
MoveItemToTop($Item)
Move the given item to the top of the order.
Definition: MetadataFieldOrder.php:365
Folder\PrependItem
PrependItem($ItemOrItemId, $ItemType=NULL)
Add item to folder as the first item.
Definition: Folder.php:237
MetadataFieldOrder\MoveFieldToGroup
MoveFieldToGroup(MetadataFieldGroup $Group, MetadataField $Field, $Placement)
Move the field with the given ID to the group with the given ID, optionally specifying the place wher...
Definition: MetadataFieldOrder.php:852
MetadataFieldOrder\GetOrdersForSchemaId
static GetOrdersForSchemaId($SchemaId)
Get all of the orders associated with a schema ID.
Definition: MetadataFieldOrder.php:651
$Items
$Items
Definition: RSSClient--Test.php:26
MetadataFieldOrder\OrderName
OrderName()
Get the name of the metadata field order.
Definition: MetadataFieldOrder.php:70
MetadataFieldOrder\IsFieldOrGroup
IsFieldOrGroup($Item)
Determine if the given item is a metadata field or metadata field group.
Definition: MetadataFieldOrder.php:687
MetadataFieldOrder\$Database
$Database
Database object with which to query the database.
Definition: MetadataFieldOrder.php:939