Gadget Objects

These are data gathering, and data rendering components. They can support a variety of output formats.

Examples

Thru the years many of these objects have become polluted with database calls in the render() operations, etc.. Recently revised Gadgets which operate correctly can be found in. Please use these as examples:

  • FrontGadget
  • WelcomeGadget
  • AWRiverGadget
  • SchedGadget

You can easily create a alternate rendering of Gadget data by following the examples in:

  • ~/code/wh2o/gadgets/rss/FrontGadget.inc
  • ~/code/wh2o/gadgets/mapxml/AWRiver.inc
  • ~/code/wh2o/gadgets/wap/River.inc

These are called using the content dispatcher. An example of an HTML rivers list is:

http://host/content/AWRiver/view/state/NC

the same list as XML is

http://host/content/AWRiver/!mapxml/view/state/NC

Most Important Functions

These are the most interesting of the Framework objects, they organize and output data. An example is found in AWArticle.inc. Notice two methods in these objects.

  • The render() function outputs HTML, XML, or some other form of output. It should not be used to gather data. Use it like you would a template.
  • The act() function gathers and formats information. It stuffs the internal members of the Gadget with the information they need to complete output. It is also useful in object state transition.
  • The static function gadGetStates() (see example) returns meta information about the Gadget. This includes information about required parameters, and information about how to manage state.

Interactions with the Page

The page object offers several important functions to the Gadget. It handles resolving references to output format specific resources (e.g. getting the XML version of a RiverGadget). It serves as the source for parameters and also serves as the dispatcher to other objects. See how AWArticle gets its parameters and interacts with the page. To get the gadget's page issue:

$this->getPage()

To get a reference to an object, say the configuration of the site issue:

$c = $this->getPage()->getObjectRef("ConfigInfo");

State & State Maintence

Gadgets progress through state, a gadget may display a form in one state and process information in another. State is maintained through the intervention of the page. Paremeters are everything else, such as the form submission data.

7.4.3PHP Version153msRequest Duration6MBMemory UsageGET content/{url}Route
    • Booting (20.52ms)
    • Application (132ms)
    • 1 x Application (86.58%)
      132ms
      1 x Booting (13.42%)
      20.52ms
      14 templates were rendered
      • legacy.views.container-view (resources/views/legacy/views/container-view.blade.php)6blade
        Params
        0
        components
        1
        controls
        2
        id
        3
        class
        4
        title
        5
        formRenderService
      • legacy.views.container-view (resources/views/legacy/views/container-view.blade.php)6blade
        Params
        0
        components
        1
        controls
        2
        id
        3
        class
        4
        title
        5
        formRenderService
      • app::layout.gadget (resources/views/layout/gadget.blade.php)2blade
        Params
        0
        contents
        1
        formRenderService
      • layout.columnstyle.one (resources/views/layout/columnstyle/one.blade.php)7blade
        Params
        0
        obLevel
        1
        __env
        2
        app
        3
        errors
        4
        contents
        5
        formRenderService
        6
        layout
      • layout.columnstyle.componentstack (resources/views/layout/columnstyle/componentstack.blade.php)9blade
        Params
        0
        obLevel
        1
        __env
        2
        app
        3
        errors
        4
        contents
        5
        formRenderService
        6
        layout
        7
        stack
        8
        component
      • layout.main (resources/views/layout/main.blade.php)7blade
        Params
        0
        obLevel
        1
        __env
        2
        app
        3
        errors
        4
        contents
        5
        formRenderService
        6
        layout
      • layout._headers (resources/views/layout/_headers.blade.php)7blade
        Params
        0
        obLevel
        1
        __env
        2
        app
        3
        errors
        4
        contents
        5
        formRenderService
        6
        layout
      • layout.header (resources/views/layout/header.blade.php)7blade
        Params
        0
        obLevel
        1
        __env
        2
        app
        3
        errors
        4
        contents
        5
        formRenderService
        6
        layout
      • layout._scripts (resources/views/layout/_scripts.blade.php)7blade
        Params
        0
        obLevel
        1
        __env
        2
        app
        3
        errors
        4
        contents
        5
        formRenderService
        6
        layout
      • layout.navigation (resources/views/layout/navigation.blade.php)8blade
        Params
        0
        obLevel
        1
        __env
        2
        app
        3
        errors
        4
        contents
        5
        formRenderService
        6
        layout
        7
        menu
      • includes.alert.membership (resources/views/includes/alert/membership.blade.php)17blade
        Params
        0
        obLevel
        1
        __env
        2
        app
        3
        errors
        4
        contents
        5
        formRenderService
        6
        layout
        7
        menu
        8
        searchurl
        9
        loginurl
        10
        logouturl
        11
        __currentLoopData
        12
        child
        13
        loop
        14
        otherchild
        15
        shouldNotifyUser
        16
        user
      • navigation.menu.static (resources/views/navigation/menu/static.blade.php)15blade
        Params
        0
        obLevel
        1
        __env
        2
        app
        3
        errors
        4
        contents
        5
        formRenderService
        6
        layout
        7
        menu
        8
        searchurl
        9
        loginurl
        10
        logouturl
        11
        __currentLoopData
        12
        child
        13
        loop
        14
        otherchild
      • includes.footer (resources/views/includes/footer.blade.php)8blade
        Params
        0
        obLevel
        1
        __env
        2
        app
        3
        errors
        4
        contents
        5
        formRenderService
        6
        layout
        7
        menu
      • layout.pagemap (resources/views/layout/pagemap.blade.php)7blade
        Params
        0
        obLevel
        1
        __env
        2
        app
        3
        errors
        4
        contents
        5
        formRenderService
        6
        layout
      uri
      GET content/{url}
      middleware
      web
      controller
      App\Http\Controllers\Wh2oController@content
      namespace
      App\Http\Controllers
      where
      as
      generated::Os9R4mqMKRF5ktoI
      file
      app/Http/Controllers/Wh2oController.php:34-68
      4 statements were executed, 4 of which were duplicated, 0 unique1.19ms
      • select * from "articles" where ("id" = '-SecurityGadget-explain' or "short_name" = '-SecurityGadget-explain') and "articles"."deleted_at" is null and "articles"."is_final" = 'true' limit 1
        380μs/app/Legacy/Repositories/NewsInfo.php:61wh2o
        Metadata
        Bindings
        • 0. -SecurityGadget-explain
        • 1. -SecurityGadget-explain
        • 2. true
        Backtrace
        • 15. /app/Legacy/Repositories/NewsInfo.php:61
        • 16. /code/wh2o/ArticleGadget.inc:128
        • 17. /code/wh2o/Page1.inc:930
        • 18. /code/wh2o/Page1.inc:1019
        • 19. /code/wh2o/SecurityGadget.inc:150
      • select * from "articles" where "short_name" = '-SecurityGadget-explain' limit 1
        250μs/app/Legacy/Repositories/NewsInfo.php:64wh2o
        Metadata
        Bindings
        • 0. -SecurityGadget-explain
        Backtrace
        • 15. /app/Legacy/Repositories/NewsInfo.php:64
        • 16. /code/wh2o/ArticleGadget.inc:128
        • 17. /code/wh2o/Page1.inc:930
        • 18. /code/wh2o/Page1.inc:1019
        • 19. /code/wh2o/SecurityGadget.inc:150
      • select * from "articles" where ("id" = '-SecurityGadget-explain' or "short_name" = '-SecurityGadget-explain') and "articles"."deleted_at" is null and "articles"."is_final" = 'true' limit 1
        330μs/app/Legacy/Repositories/NewsInfo.php:61wh2o
        Metadata
        Bindings
        • 0. -SecurityGadget-explain
        • 1. -SecurityGadget-explain
        • 2. true
        Backtrace
        • 15. /app/Legacy/Repositories/NewsInfo.php:61
        • 16. /code/wh2o/ArticleGadget.inc:128
        • 17. /code/wh2o/Page1.inc:930
        • 18. /code/wh2o/Page1.inc:1019
        • 19. /code/wh2o/SecurityGadget.inc:150
      • select * from "articles" where "short_name" = '-SecurityGadget-explain' limit 1
        230μs/app/Legacy/Repositories/NewsInfo.php:64wh2o
        Metadata
        Bindings
        • 0. -SecurityGadget-explain
        Backtrace
        • 15. /app/Legacy/Repositories/NewsInfo.php:64
        • 16. /code/wh2o/ArticleGadget.inc:128
        • 17. /code/wh2o/Page1.inc:930
        • 18. /code/wh2o/Page1.inc:1019
        • 19. /code/wh2o/SecurityGadget.inc:150
          _token
          QqL9ZzYXYvRlnJbkzvDRPFx9RvwPvlTVNJCM7YSa
          page
          array:1 [ "count" => 9 ]
          PHPDEBUGBAR_STACK_DATA
          []
          _previous
          array:1 [ "url" => "https://beta.americanwhitewater.org/wiki/lib/exe/js.php?edit=0&write=0" ]
          _flash
          array:2 [ "old" => [] "new" => [] ]
          path_info
          /content/Wiki/developer:gadget_objects
          status_code
          200
          
          status_text
          OK
          format
          html
          content_type
          text/html; charset=UTF-8
          request_query
          []
          
          request_request
          []
          
          request_headers
          0 of 0
          array:16 [ "cookie" => array:1 [ 0 => "PHPSESSID=idbhh7hpu21cmavqgic6prln06; XSRF-TOKEN=eyJpdiI6IkNydlFmVUN6NVVpa01ST3cxNDVoN3c9PSIsInZhbHVlIjoiY0FCTkUvSjk5eHRaYjYyaUV5U1J0RW5mbldBUkxQNEl2NmxOQnRFNnJWR2tjUnM4QU12Z2NrbFArWEtQMkZkM3pKUmlkTUxTckpKRG5KT001K2t4UmZWNlNEelRWdWJhSjFjSGJwOE1yNTAyb3dWRlNKeVVTNWM3bEJDa25leGsiLCJtYWMiOiIzOTI1MmUyNGY2MTdkOTNhMmU5MjI3OTYwMzEwZGEzZWUwNGQwNDdhNTM4MThlM2M0YzI1Nzk5YWRjMGFiN2M5In0%3D; americanwhitewater_session=GrdOj06mJ5FreO5M8RWYGdU4kE3oQJU3VrFLmHDgPHPSESSID=idbhh7hpu21cmavqgic6prln06; XSRF-TOKEN=eyJpdiI6IkNydlFmVUN6NVVpa01ST3cxNDVoN3c9PSIsInZhbHVlIjoiY0FCTkUvSjk5eHRaYjYyaUV5U1J0RW5mbldBUkxQNEl2NmxOQnRFNnJ" ] "priority" => array:1 [ 0 => "u=0, i" ] "accept-encoding" => array:1 [ 0 => "gzip, deflate, br, zstd" ] "sec-fetch-dest" => array:1 [ 0 => "document" ] "sec-fetch-user" => array:1 [ 0 => "?1" ] "sec-fetch-mode" => array:1 [ 0 => "navigate" ] "sec-fetch-site" => array:1 [ 0 => "none" ] "accept" => array:1 [ 0 => "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7" ] "user-agent" => array:1 [ 0 => "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)" ] "upgrade-insecure-requests" => array:1 [ 0 => "1" ] "sec-ch-ua-platform" => array:1 [ 0 => ""Windows"" ] "sec-ch-ua-mobile" => array:1 [ 0 => "?0" ] "sec-ch-ua" => array:1 [ 0 => ""HeadlessChrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"" ] "cache-control" => array:1 [ 0 => "no-cache" ] "pragma" => array:1 [ 0 => "no-cache" ] "host" => array:1 [ 0 => "beta.americanwhitewater.org" ] ]
          request_server
          0 of 0
          array:43 [ "USER" => "www-data" "HOME" => "/var/www" "HTTP_COOKIE" => "PHPSESSID=idbhh7hpu21cmavqgic6prln06; XSRF-TOKEN=eyJpdiI6IkNydlFmVUN6NVVpa01ST3cxNDVoN3c9PSIsInZhbHVlIjoiY0FCTkUvSjk5eHRaYjYyaUV5U1J0RW5mbldBUkxQNEl2NmxOQnRFNnJWR2tjUnM4QU12Z2NrbFArWEtQMkZkM3pKUmlkTUxTckpKRG5KT001K2t4UmZWNlNEelRWdWJhSjFjSGJwOE1yNTAyb3dWRlNKeVVTNWM3bEJDa25leGsiLCJtYWMiOiIzOTI1MmUyNGY2MTdkOTNhMmU5MjI3OTYwMzEwZGEzZWUwNGQwNDdhNTM4MThlM2M0YzI1Nzk5YWRjMGFiN2M5In0%3D; americanwhitewater_session=GrdOj06mJ5FreO5M8RWYGdU4kE3oQJU3VrFLmHDgPHPSESSID=idbhh7hpu21cmavqgic6prln06; XSRF-TOKEN=eyJpdiI6IkNydlFmVUN6NVVpa01ST3cxNDVoN3c9PSIsInZhbHVlIjoiY0FCTkUvSjk5eHRaYjYyaUV5U1J0RW5mbldBUkxQNEl2NmxOQnRFNnJ" "HTTP_PRIORITY" => "u=0, i" "HTTP_ACCEPT_ENCODING" => "gzip, deflate, br, zstd" "HTTP_SEC_FETCH_DEST" => "document" "HTTP_SEC_FETCH_USER" => "?1" "HTTP_SEC_FETCH_MODE" => "navigate" "HTTP_SEC_FETCH_SITE" => "none" "HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7" "HTTP_USER_AGENT" => "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)" "HTTP_UPGRADE_INSECURE_REQUESTS" => "1" "HTTP_SEC_CH_UA_PLATFORM" => ""Windows"" "HTTP_SEC_CH_UA_MOBILE" => "?0" "HTTP_SEC_CH_UA" => ""HeadlessChrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"" "HTTP_CACHE_CONTROL" => "no-cache" "HTTP_PRAGMA" => "no-cache" "HTTP_HOST" => "beta.americanwhitewater.org" "REDIRECT_STATUS" => "200" "SERVER_NAME" => "beta.americanwhitewater.org" "SERVER_PORT" => "443" "SERVER_ADDR" => "172.31.18.125" "REMOTE_PORT" => "55583" "REMOTE_ADDR" => "3.145.77.42" "SERVER_SOFTWARE" => "nginx/1.18.0" "GATEWAY_INTERFACE" => "CGI/1.1" "HTTPS" => true "REQUEST_SCHEME" => "https" "SERVER_PROTOCOL" => "HTTP/2.0" "DOCUMENT_ROOT" => "/opt/americanwhitewater.org/public" "DOCUMENT_URI" => "/index.php" "REQUEST_URI" => "/content/Wiki/developer:gadget_objects" "SCRIPT_NAME" => "/index.php" "CONTENT_LENGTH" => "" "CONTENT_TYPE" => "" "REQUEST_METHOD" => "GET" "QUERY_STRING" => "" "PHP_VALUE" => "post_max_size=20M" "SCRIPT_FILENAME" => "/opt/americanwhitewater.org/public/index.php" "FCGI_ROLE" => "RESPONDER" "PHP_SELF" => "/index.php" "REQUEST_TIME_FLOAT" => 1743749355.6977 "REQUEST_TIME" => 1743749355 ]
          request_cookies
          0 of 0
          array:3 [ "PHPSESSID" => null "XSRF-TOKEN" => "hbkNOWzsC8lwo6mhJZouylEIkCyjpC15dwvguPe7" "americanwhitewater_session" => null ]
          response_headers
          0 of 0
          array:5 [ "content-type" => array:1 [ 0 => "text/html; charset=UTF-8" ] "cache-control" => array:1 [ 0 => "no-cache, private" ] "date" => array:1 [ 0 => "Fri, 04 Apr 2025 06:49:15 GMT" ] "set-cookie" => array:2 [ 0 => "XSRF-TOKEN=eyJpdiI6IjMzU2I5SUtLNWpVYVdzT2ZTeVZQK3c9PSIsInZhbHVlIjoiUHNxMFhjNWkrUzVWbldLcU9iU0g1bnEvUitoNG1EbHo3bzNJbFJ0SExhK0RTNHhRbW5QOHZJQ3dWTzhrQnc0eDVIc3BsR2t4dzFtdk01MEl3ZGtEbVozc2FGTndackp1alNNWkNCckJjNFgyOHNIM09idWNhb2FiTUVBbGl5ODQiLCJtYWMiOiJhNTFmNzkwMzU2YjA0ODc4NjQ2ZDAzNGQ2ODlmY2NhZmJlMThjZDhkYWZlZWJjNzZlNWVlN2MwZDNlMTUxZjY0In0%3D; expires=Fri, 04-Apr-2025 08:49:15 GMT; Max-Age=7200; path=/XSRF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IjMzU2I5SUtLNWpVYVdzT2ZTeVZQK3c9PSIsInZhbHVlIjoiUHNxMFhjNWkrUzVWbldLcU9iU0g1bnEvUitoNG1EbHo3bzNJbFJ0SExhK0RTNHhRbW5QOHZJQ3dWTzhrQnc0eDVIc3BsR" 1 => "DWa976077ab53ea1a0f12b663e732b73c0=eyJpdiI6Ikd5V05WL3lUeEp5N0dwQkh3R01tMlE9PSIsInZhbHVlIjoiUVR0cEVSNURyRWx3ZU5Ea0RIUFVqMk1TZDIxK0hianFIUXo1bE82L0JDTll4RmhLL2MxWlZ0UnBIWElNNlY3UiIsIm1hYyI6IjM0ZTk0NjExNjUwZTgwZjViOTM0ZDJkYmYyZmE1Nzg3ZGU3MWRiZjliNDk2MGVhZDJiYjA4NGJlNzAwNzFiNTUifQ%3D%3D; expires=Fri, 04-Apr-2025 06:48:15 GMT; path=/; httponlyDWa976077ab53ea1a0f12b663e732b73c0=eyJpdiI6Ikd5V05WL3lUeEp5N0dwQkh3R01tMlE9PSIsInZhbHVlIjoiUVR0cEVSNURyRWx3ZU5Ea0RIUFVqMk1TZDIxK0hianFIUXo1bE82L0JDTll4RmhLL2MxW" ] ]
          session_attributes
          0 of 0
          array:5 [ "_token" => "QqL9ZzYXYvRlnJbkzvDRPFx9RvwPvlTVNJCM7YSa" "page" => array:1 [ "count" => 9 ] "PHPDEBUGBAR_STACK_DATA" => [] "_previous" => array:1 [ "url" => "https://beta.americanwhitewater.org/wiki/lib/exe/js.php?edit=0&write=0" ] "_flash" => array:2 [ "old" => [] "new" => [] ] ]