NOCL_Element_Types

(Concept - Properties - Functions - Values

Version: 1.0 (Versions)

Location: cl_objects.php

A class to provide a reference for Element Types.

 

Concept

The large number of different types of elements necessitates a way to reference their names in some sort of reference library.

This class provides the element Type names for parent and child elements.  The difference being that there may be something liike an ingredient element being used as an item ingredient child of an item.

The element Type in this situation will be an Item, while the field, or child, will be an item ingredient.

This class is to be loaded once, and then linked back to by any child elements.

Future versions aere planned to allow for external population of the values, to enable different modules to be available and not.

 

Properties

      • $elementType
         - (Public) The basic element type names in lower case

      • $elementName
         - (Public) The Element Type, except as public facing friendly text (e.g: capitals, and spaces instead of underscores) .

      • $childElementField
         - (Public) The child Element field names in lower case .

      • $childElementFieldName
         - (Private) The Child Emenet Field, except as public facing friendly text (e.g: capitals, and spaces instead of underscores)

 

Functions

 

__construct()

Version: 1.0

Called when class is instantiated

Usage:

$elementReference = new NOCL_ElementyTypes();

 

Paramenters:

None

 

Returns:

Silently after setting property values internally.  Actually, returns this class as an object.

 

Process:

          • Set the value arrays for each element.  See below for breakdown of their contents

 

elementTypeNames()

Version: 1.0

Get an $elementType, except with an upper case first letter.  Used for building Element Class names

Usage:

$elementReference = new NOCL_ElementyType_Names($indexId);

 

Paramenters:

$indexId
 - The Array Index ID of the Element being looked for.

 

Returns:

A string containing the name of the requested element, except with its first letter in upper case.

 

Process:

          • Get the $elementType array element at $indexId

          • Set the first character to uppercase

          • Return the result

 

elementTypeId()

Version: 1.0

Return the Array Element ID of a named Element Type

Usage:

$elementReferenceNumber = elementTypeId($inputString);

 

Paramenters:

$inputString
- The name of the Element to get the ID of

 

Returns:

An integer representing the Array Index of the requested Element. Or false if the name is not found

 

Process:

          • For each Element in the $this->elementType array

            • Check to see if its value is the same as the input text.  Trim white space from before and after both strings

              • If there is a match, return the ID of the current Array Element
          • If there has been no match, return false

 

Values

 

$this->elementType

        1. restaurant
        2. location
        3. address
        4. phone_number
        5. image
        6. document
        7. menu
        8. category
        9. item
        10. base
        11. sauce
        12. ingredient
        13. ingredient
        14. size
        15. size
        16. price_collection
        17. price
        18. customer
        19. customer_group
        20. order
        21. order_line
        22. delivery_type
        23. prep_stage
        24. payment
        25. payment_type
        26. payment_item
        27. map
        28. map_position
        29. barcode
        30. special
        31. special_ingredient
        32. loyalty_point
        33. visitor
        34. action
        35. entity
        36. relationship
        37. dietary_info
        38. dietary_info_item


$this->elementName

        1. Restaurant
        2. Location
        3. Address
        4. Phone Number
        5. Image
        6. Document
        7. Menu
        8. Category
        9. Item
        10. Base
        11. Sauce
        12. Ingredient
        13. Ingredient
        14. Size
        15. Size
        16. Price Collection
        17. Price
        18. Customer
        19. Customer Group
        20. Order
        21. Order Line
        22. Delivery Type
        23. Prep Stage
        24. Payment
        25. Payment Type
        26. Payment Item
        27. Map
        28. Map Position
        29. Barcode
        30. Special
        31. Special Ingredient
        32. Loyalty Point
        33. Visitor
        34. Action
        35. Entity
        36. Relationship
        37. Dietary Info
        38. Dietary Info Item


$this->childElementField

        1. restaurant
        2. location
        3. address
        4. phone_number
        5. image
        6. document
        7. menu
        8. category
        9. item
        10. base
        11. sauce
        12. ingredient
        13. item_ingredient
        14. size
        15. ingredient_size
        16. price_collection
        17. price
        18. customer
        19. customer_group
        20. order
        21. order_line
        22. delivery_type
        23. prep_stage
        24. payment
        25. payment_type
        26. payment_item
        27. map
        28. map_position
        29. barcode
        30. special
        31. special_ingredient
        32. loyalty_point
        33. visitor
        34. action
        35. entity
        36. relationship
        37. dietary_info
        38. dietary_info_item


$this->childElementFieldName

        1. Restaurant
        2. Location
        3. Address
        4. Phone Number
        5. Image
        6. Document
        7. Menu
        8. Category
        9. Item
        10. Base
        11. Sauce
        12. Ingredient
        13. Item Ingredient
        14. Size
        15. Ingredient Size
        16. Price Collection
        17. Price
        18. Customer
        19. Customer Group
        20. Order
        21. Order Line
        22. Delivery Type
        23. Prep Stage
        24. Payment
        25. Payment Type
        26. Payment Item
        27. Map
        28. Map Position
        29. Barcode
        30. Special
        31. Special Ingredient
        32. Loyalty Point
        33. Visitor
        34. Action
        35. Entity
        36. Relationship
        37. Dietary Info
        38. Dietary Info Item

 

Module is here