$accessToken
$accessToken : \Bright\The
This is the base object for interacting w/ Bright from PHP.
It should never be instantiated itself, but rather through creating a singleton of an inheriting class, like:
$bright = \Bright[WebStackClass]::getInstance(); // Wordpress, Drupal, etc.
Once instantiated, for most useful functions it is required to acquire an API token.
Note the leading \ before the Bright Namespace. While not always necessarily, this will always take you to the root namespace and should generally be included.
$bright->setCurrentUser(...); // replace ... with a the current user object; however you derive it.
$bright->getAuthenticationCodeForUser(); // ... initializes the api and/or fetches an accessToken
$instance : \Bright\Singleton
getInstance() : \Bright\Singleton
Returns the *Singleton* instance of this class.
The Singleton instance.
expandShortcode(array $attr, string $content = null) : \Bright\the
Converts a [bright] shortcode into two things: 1. a piece of converted content, most likely a <div> tag to be populated by the Bright.js templating library.
For more about the functionality of this method, see http://help.aura-software.com/bright-shortcode-reference
array | $attr | |
string | $content |
content string.
writeToPage( $msg)
Manages 'echo' statements. Originally we ran in a webserver and errors were written to the page. Now, for command line mode, it's nice to be able shut these statement off if necessary [like in the test chassis].
Thus, if the class variable $runQuiet is set, we won't generate echo statements.
$msg |
curl(string $url, array $args = array()) : string
Call the PHP base curl function, based on arguments below. As a side effect the following are set: * $this->curlInfo * $this->curlHttpCode * $this->curlError
string | $url | Full url to get/post |
array | $args |
|
The returned data. Use the $curlError and $curlInfo public class variables to get additional data about the curl call.
callApi(string $apiController, array $args = array()) : mixed
Calls the Bright Api and returns the result.
Defined keys for the $args array() include:
string | $apiController | this is the app interface to hit (course|registration|api_key|...) |
array | $args | An array of arguments. See description for the arguments. |
an array parsed json; unless raw is set, then the raw response data.
getRegistrationDataForCourse(string $courseGuid, array $args = array()) : mixed
string | $courseGuid | the course ID aka SCORMCloud course ID for the registration to be fetched. Note, on the most recent non-deleted registration is returned per the 'last_only' attribute as passed to bright server via the Bright API. |
array | $args | a set of args to pass to Bright::Base->callApi(). See the documentation of that function for more details. |
Null if not found, or a stdObject with the registration data.
getCourseDataByGuid(string $courseGuid, array $args = array()) : mixed
string | $courseGuid | the course ID aka SCORMCloud course ID for the course to be fetched. |
array | $args | a set of args to pass to Bright::Base->callApi(). See the documentation of that function for more details. |
Null if not found, or a stdObject with the course data.
setAccessTokenFromValidCachedKey( $user)
Checks in the webstack DB and looks for a valid cached API key that hasn't expired, and was generated from the same Bright URL we are currently talking to.
Also lift out the expiration data and provide that in a Bright instance variable.
$user |
updateBrightUserMeta(mixed $user) : string
Initiates a call to the Bright API, to update user attributes from this site for the user.
mixed | $user | A user object in the native format for the Webstack. |
Returns the data passed back from the bright API in raw format [as a string].
getLocalTemplates() : Array
Returns all the local templates available before filtering. Currently keys in the global $bright_embedder_templates will override the keys in the Bright class variable $embedderTemplates.
all the local templates available before filtering.
getTemplateText(array $args = array()) : string
Returns the template text. Searches in the following order:
array | $args |
the template text
get_course_data_by_custom_key( $key, $args = array())
takes a key, and returns any course that has that key defined in it's custom metadata
Example:
$key = 'my-custom-key'; $courses = $this->get_course_data_by_custom_key($key,$args);
// $courses is an array();
$key | ||
$args |
get_course_data_for_learning_path( $key, $args = array())
takes the learning path as $key, and returns an array of course records which are the courses in the learning path, ordered by learning path id.
Example:
$bright = Bright\Wordpress::getInstance(); $courses = $bright->get_course_data_for_learning_path('dashboard_test');
// get custom $json json_decode($courses[0]->custom);
$key | ||
$args |