class lookerstudio extends deprecated_item

The lookerstudio class handles the creation, update, retrieval, and listing of Looker Studio dashboard instances.

It extends the base functionality provided by the item class.

Traits

Trait url_generator.

Constants

PERPAGE

STATUS_ACTIVE

STATUS_CANCELED

STATUS_COMPLETED

STATUS_DELETED

STATUS_DISABLED

STATUS_DISAPPROVED

STATUS_ENABLED

STATUS_EXPIRED

STATUS_FAILED

STATUS_FINISH

STATUS_INACTIVE

STATUS_INPROGRESS

STATUS_NEW

STATUS_PAUSED

STATUS_PLAYED

STATUS_SYNC

TYPE

Properties

$id
$type from  deprecated_item
$timecreated from  deprecated_model
$timemodified from  deprecated_model
protected $table from  deprecated_item
protected $table_metadata from  deprecated_item
protected $fillable
$contextid from  deprecated_item
$courseid from  deprecated_item
$userid from  deprecated_item
$parent from  deprecated_item
mixed $fullname
$shortname from  deprecated_item
$idnumber from  deprecated_item
$description from  deprecated_item
$descriptionformat from  deprecated_item
$status from  deprecated_item
$visible from  deprecated_item
$guid from  deprecated_item
$sortorder from  deprecated_item
$version from  deprecated_item
$usermodified from  deprecated_item
$embed_url
array|string $mapping_fields

Methods

static moodle_url
url_generator(string $route, array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)

Generate a URL based on the Symfony route name and parameters.

static moodle_url
webhook_url_generator(string $route, array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)

Generate a webhook URL.

__construct($id = null)

No description

__clone()

No description

string|null
get_path()

No description

string|null
get_table()

No description

string
get_table_metadata()

No description

update(array $formdata = [])

Update the model with form data.

bool
delete()

No description

array
all()

No description

array
get_records(array $searchcriteria, int $page, int $totalcount, string $sort = '', int $perpage = 0)

No description

array
get_items(array $searchcriteria, int $page, int $totalcount, string $sort = '', bool $includedeleted = false, int $perpage = 0)

No description

mixed
get_meta(string $meta_key)

Get metadata value by key.

array
get_all_metadata()

No description

void
set_meta(string $meta_key, mixed $meta_value)

Set metadata key-value pair.

void
set_metas(array $metas)

Set multiple metadata key-value pairs.

mixed
get_file(object $context, string $component, string $filearea, bool $validimage = false)

Get file associated with the model.

static mixed
get_fileurl(object $file)

Get file URL.

false|mixed|stdClass
get($id)

Get record by ID.

false|mixed|stdClass
get_by_idnumber($idnumber)

Get record by idnumber.

save()

No description

from_record(stdClass $r)

No description

void
load(bool $reload = false)

No description

bool
enabled()

No description

bool
disabled()

No description

bool
deleted()

No description

static 
get_item_or_create(int|string|null $contextid, string $type = '')

No description

array
get_items_by_metadata(array $searchcriteriaitem, array $searchcriteriameta, int $page, int $totalcount, string|null $sort = '', bool $includedeleted = false, int $perpage = 0) deprecated

No description

static lookerstudio
create_or_update(object $data, int $id = 0)

Creates a new instance or updates an existing one with the provided data.

static array
list()

Retrieves a list of records with relevant details.

static string
render(array $att)

Renders a Looker Studio dashboard based on the provided attributes.

string
prepare_lookerstudio_iframe(array $params)

Prepares an iframe embedding Looker Studio report with the provided parameters.

array
prepare_lookerstudio_params(mixed $courseid, mixed $att = [])

Prepares and returns the parameters for Looker Studio based on the mapping fields.

static array
get_user_cohorts_by_course_context(int $userid, int $courseid)

No description

Details

in url_generator at line 42
static moodle_url url_generator(string $route, array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)

Generate a URL based on the Symfony route name and parameters.

Parameters

string $route
array $parameters
int $referenceType

Return Value

moodle_url

in url_generator at line 56
static moodle_url webhook_url_generator(string $route, array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)

Generate a webhook URL.

Parameters

string $route
array $parameters
int $referenceType

Return Value

moodle_url

at line 49
__construct($id = null)

No description

Parameters

$id

Exceptions

Exception

in deprecated_model at line 116
__clone()

No description

in deprecated_model at line 121
string|null get_path()

No description

Return Value

string|null

in deprecated_model at line 128
string|null get_table()

No description

Return Value

string|null

in deprecated_model at line 137
string get_table_metadata()

No description

Return Value

string

in deprecated_model at line 151
deprecated_model_interface update(array $formdata = [])

Update the model with form data.

Parameters

array $formdata

Return Value

deprecated_model_interface

in deprecated_model at line 165
bool delete()

No description

Return Value

bool

in deprecated_model at line 172
array all()

No description

Return Value

array

in deprecated_model at line 193
array get_records(array $searchcriteria, int $page, int $totalcount, string $sort = '', int $perpage = 0)

No description

Parameters

array $searchcriteria
int $page
int $totalcount

Output parameter

string $sort
int $perpage

Return Value

array

Exceptions

coding_exception
dml_exception

in deprecated_model at line 302
array get_items(array $searchcriteria, int $page, int $totalcount, string $sort = '', bool $includedeleted = false, int $perpage = 0)

No description

Parameters

array $searchcriteria
int $page
int $totalcount
string $sort
bool $includedeleted
int $perpage

Return Value

array

Exceptions

coding_exception
dml_exception

in deprecated_model at line 414
mixed get_meta(string $meta_key)

Get metadata value by key.

Parameters

string $meta_key

Return Value

mixed

Exceptions

dml_exception

in deprecated_model at line 428
array get_all_metadata()

No description

Return Value

array

in deprecated_model at line 456
void set_meta(string $meta_key, mixed $meta_value)

Set metadata key-value pair.

Parameters

string $meta_key
mixed $meta_value

Return Value

void

Exceptions

dml_exception

in deprecated_model at line 478
void set_metas(array $metas)

Set multiple metadata key-value pairs.

Parameters

array $metas

Return Value

void

in deprecated_model at line 497
mixed get_file(object $context, string $component, string $filearea, bool $validimage = false)

Get file associated with the model.

Parameters

object $context
string $component
string $filearea
bool $validimage

Return Value

mixed

Exceptions

coding_exception

in deprecated_model at line 523
static mixed get_fileurl(object $file)

Get file URL.

Parameters

object $file

Return Value

mixed

in deprecated_model at line 544
protected false|mixed|stdClass get($id)

Get record by ID.

Parameters

$id

Return Value

false|mixed|stdClass

Exceptions

dml_exception

in deprecated_model at line 560
protected false|mixed|stdClass get_by_idnumber($idnumber)

Get record by idnumber.

Parameters

$idnumber

Return Value

false|mixed|stdClass

Exceptions

dml_exception

in deprecated_model at line 575
protected save()

No description

in deprecated_model at line 616
static protected deprecated_model from_record(stdClass $r)

No description

Parameters

stdClass $r

Return Value

deprecated_model

in deprecated_item at line 105
void load(bool $reload = false)

No description

Parameters

bool $reload

Return Value

void

in deprecated_item at line 116
bool enabled()

No description

Return Value

bool

in deprecated_item at line 121
bool disabled()

No description

Return Value

bool

in deprecated_item at line 129
bool deleted()

No description

Return Value

bool

Exceptions

dml_exception

in deprecated_item at line 148
static get_item_or_create(int|string|null $contextid, string $type = '')

No description

Parameters

int|string|null $contextid
string $type

Exceptions

dml_exception

in deprecated_item at line 190
array get_items_by_metadata(array $searchcriteriaitem, array $searchcriteriameta, int $page, int $totalcount, string|null $sort = '', bool $includedeleted = false, int $perpage = 0) deprecated

deprecated Migrate to core\repository\item_search_repository

No description

Parameters

array $searchcriteriaitem
array $searchcriteriameta
int $page
int $totalcount
string|null $sort
bool $includedeleted
int $perpage

Return Value

array

Exceptions

coding_exception
dml_exception

at line 77
static lookerstudio create_or_update(object $data, int $id = 0)

Creates a new instance or updates an existing one with the provided data.

Parameters

object $data

An object containing the fields to create or update the instance. Expected properties include:

  • name (string): The name to assign to the instance.
  • embedUrl (string): The URL to embed.
  • mappings (array): The mapping fields to associate with the instance.
int $id

Optional. The ID of the instance to update. Defaults to 0 for creating a new instance.

Return Value

lookerstudio

the created or updated instance

Exceptions

Exception

at line 105
static array list()

Retrieves a list of records with relevant details.

Return Value

array

An array of records, where each record contains:

  • id (int): The unique identifier of the record.
  • fullname (string): The full name associated with the record, or 'N/A' if not available.
  • createdAt (mixed): The creation timestamp of the record.
  • updateUrl (string): The URL for updating the specific record.

at line 120
static string render(array $att)

Renders a Looker Studio dashboard based on the provided attributes.

Parameters

array $att

An associative array of attributes. Expected keys include:

  • id (int): The ID of the Looker Studio dashboard to render. Required.

Return Value

string

the HTML content for the Looker Studio iframe or an error message if rendering fails

at line 145
string prepare_lookerstudio_iframe(array $params)

Prepares an iframe embedding Looker Studio report with the provided parameters.

Parameters

array $params

An associative array of parameters to be included in the report URL. These parameters are JSON-encoded and attached as a query string.

Return Value

string

the HTML string for the iframe element embedding the Looker Studio report

at line 176
array prepare_lookerstudio_params(mixed $courseid, mixed $att = [])

Prepares and returns the parameters for Looker Studio based on the mapping fields.

This method iterates through the defined mapping fields, retrieves corresponding values for each field, and generates an associative array of parameters. The values are formatted to replace the character '°' with 'º'.

Parameters

mixed $courseid
mixed $att

Return Value

array

An associative array where the keys are variable names from the mapping fields and the values are the corresponding user data retrieved and formatted. If no mapping fields are defined, an empty array is returned.

at line 320
static array get_user_cohorts_by_course_context(int $userid, int $courseid)

No description

Parameters

int $userid
int $courseid

Return Value

array