Output
class Output
Traits
Properties
$launch | A reference to our containing launch | ||
$buffer |
Methods
Pull a keyed variable from the original LTI post data in the current session with default
Update a keyed variable from the original LTI post data in the current session with default
Pull a keyed variable from the original LTI post data in the current session with default
Pull out a custom variable from the LTIX session. Do not include the "custom_" prefix - this is automatic.
Set the JSON header
No description
Start the header material of a normal Tsugi Page
Set the header variables for a Tsugi Page
Finish the head and start the body of a Tsugi HTML page.
Outputs a splash page used if the tool is not configured or instructor has never been there before.
No description
No description
No description
No description
templateInclude - Include a handlebars template, dealing with i18n
templateProcess - Process a handlebars template, dealing with i18n
No description
getUtilUrl - Get a URL in the utility script space - does not add session
Handle the heartbeat calls. This is UI code basically.
No description
No description
No description
Welcome the user to the course
Emit a properly styled done button for use in the launched frame/window
Emit a properly styled close button for use in own popup
No description
No description
No description
No description
No description
Set header Content for any Tsugi-generated pages.
Set footer Content for any Tsugi-generated pages.
Store the top navigation in the session
Emit the top navigation block and optionally the tool navigation
No description
The embedded menu - for now just one button.
Dump a debug array with messages and optional detail
Get a fully-qualified URL for the spinner.
Get a fully-qualified URL for the default icon image.
Return the text for a full-screen loader
Embed a YouTube video using the standard pattern
Redirect to a local URL, adding session if necessary
Gets an absolute static path to the specified file
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Retrieves or generates a theme based on optional specs (base color, dark mode flag).
Adjust the theme from various places based on the following low-to-high precedence
No description
Details
in SessionTrait at line 17
session_get($key, $default = null)
Get a key from the session
in SessionTrait at line 24
session_put($key, $value)
Set a key in the session
in SessionTrait at line 31
session_forget($key)
Forget a key in the session
in SessionTrait at line 38
session_flush()
Flush the session
in SessionTrait at line 45
ltiRawPostArray()
Return the original $_POST array
in SessionTrait at line 53
ltiParameter($varname, $default = false)
Pull a keyed variable from the original LTI post data in the current session with default
in SessionTrait at line 61
ltiParameterUpdate($varname, $value)
Update a keyed variable from the original LTI post data in the current session with default
in SessionTrait at line 70
ltiRawParameter($varname, $default = false)
Pull a keyed variable from the original LTI post data in the current session with default
in SessionTrait at line 79
ltiCustomGet($varname, $default = false)
Pull out a custom variable from the LTIX session. Do not include the "custom_" prefix - this is automatic.
at line 71
static
headerJson()
Set the JSON header
at line 76
flashMessages()
at line 122
header()
Start the header material of a normal Tsugi Page
This outputs everything but does not close the
tag so the tool can add its own head material before calling bodyStart().If this class is set to buffer, the output is returned in a string instead of being printed to the response.
at line 217
headerData()
Set the header variables for a Tsugi Page
If this class is set to buffer, the output is returned in a string instead of being printed to the response.
at line 285
bodyStart($checkpost = true)
Finish the head and start the body of a Tsugi HTML page.
By default this demands that we are in a GET request. It is a fatal error to call this code if we are responding to a POST request unless this behavior is overidden.
at line 340
false|string
splashPage($title, $msg, bool $link = false)
Outputs a splash page used if the tool is not configured or instructor has never been there before.
at line 363
pageTitle($title, $show_help = false, $show_settings = false)
at line 380
modalString($title, $msg, $id)
at line 401
helpModal($help_title = "Help", $help_msg = '<em>No help for this page.</em>')
at line 407
helpButton()
at line 418
static
templateInclude($name)
templateInclude - Include a handlebars template, dealing with i18n
Deprecated - Moved to HandleBars
at line 427
static
templateProcess($template)
templateProcess - Process a handlebars template, dealing with i18n
Deprecated - Moved to HandleBars
at line 431
footerStart()
at line 540
static
getUtilUrl($path)
getUtilUrl - Get a URL in the utility script space - does not add session
at line 575
static
handleHeartBeat($cookie)
Handle the heartbeat calls. This is UI code basically.
Make sure when you call this, you have handled whether the session is cookie based or not and included config.php appropriately
if ( isset($_GET[session_name()]) ) { $cookie = false; } else { define('COOKIE_SESSION', true); $cookie = true; }
require_once "../config.php";
\Tsugi\UI\Output::handleHeartBeat($cookie);
at line 618
footerEnd()
at line 627
footer()
at line 637
doAnalytics()
at line 656
welcomeUserCourse()
Welcome the user to the course
at line 692
exitButton($text = false)
Emit a properly styled done button for use in the launched frame/window
This is a bit tricky because custom settings can control the "Done" behavior. These settings can come from one of three places: (1) in the link settings, (2) from a custom parameter named 'done', or (3) from a GET parameter done=
The value for this is a URL, "_close", or "_return".
TODO: Implement _return
at line 718
closeButton($text = false)
Emit a properly styled close button for use in own popup
at line 725
togglePre($title, $html)
at line 738
togglePreScript()
at line 752
returnMenuSet($return_url)
at line 760
closeMenuSet()
at line 768
defaultMenuSet()
at line 810
setAppHeader($head)
Set header Content for any Tsugi-generated pages.
at line 819
setAppFooter($foot)
Set footer Content for any Tsugi-generated pages.
at line 828
topNavSession($menuset)
Store the top navigation in the session
at line 844
topNav($tool_menu = false)
Emit the top navigation block and optionally the tool navigation
Priority order: (1) Navigation in the session (2) If we are launched via LTI w/o a session
at line 969
menuNav($set, $is_tool_menu = false)
at line 1035
static
embeddedMenu($url, $profile_email, $user_email)
The embedded menu - for now just one button.
..
at line 1089
dumpDebugArray($debug_log)
Dump a debug array with messages and optional detail
This kind of debug array comes back from some of the grade calls. We loop through printing the messages and put the detail into a togglable pre tag is present.
at line 1110
getSpinnerUrl()
Get a fully-qualified URL for the spinner.
at line 1118
getDefaultIcon()
Get a fully-qualified URL for the default icon image.
at line 1133
getScreenOverlay($show = true)
Return the text for a full-screen loader
echo($OUTPUT->getScreenOverlay(false)); ...
at line 1146
embedYouTube($id, $title)
Embed a YouTube video using the standard pattern
at line 1162
static
doRedirect($location)
Redirect to a local URL, adding session if necessary
Note that this is only needed for AJAX and header() calls as <form> and <a href tags are properly handled already by the PHP built-in "don't use cookies for session" support.
at line 1182
static
getLocalStatic()
Gets an absolute static path to the specified file
at line 1188
static
noCacheHeader()
at line 1194
static
maxCacheHeader($max_age = 604800)
at line 1198
static
displaySize($size)
at line 1203
static
safe_var_cleanup($x, $depth)
at line 1219
static
safe_var_dump($x)
at line 1227
static
safe_print_r($x)
at line 1235
static
htmlError($message, $detail, $next = false)
at line 1294
static
jsonError($message, $detail = "")
at line 1300
static
jsonAuthError($message, $detail = "")
at line 1306
static
jsonOutput($json_data)
at line 1312
static
json_encode_string_value($json_string)
at line 1316
static
xmlError($message, $detail = "", $code = 400)
at line 1331
static
xmlAuthError($message, $detail = "")
at line 1335
static
xmlOutput($xml_data)
at line 1341
static
noBuffer()
at line 1351
static
get_theme()
Retrieves or generates a theme based on optional specs (base color, dark mode flag).
$TSUGI_LAUNCH theme data is provided, it will override the $CFG data. Otherwise, $CFG theme data will be used (either a theme_base or legacy theme data) If $CFG and $TSUGI_LAUNCH theme data aren't provided, regular defaults will be used.
at line 1454
static
adjust_theme($theme)
Adjust the theme from various places based on the following low-to-high precedence
(4) From a Key Setting (3) From a Context Setting (2) From a Link Setting (1) From a custom launch variable prefixed by "tsugi_theme_"