id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
213,000
moodle/moodle
lib/dml/moodle_database.php
moodle_database.query_end
protected function query_end($result) { if ($this->loggingquery) { return; } if ($result !== false) { $this->query_log(); // free memory $this->last_sql = null; $this->last_params = null; $this->print_debug_time(); ...
php
protected function query_end($result) { if ($this->loggingquery) { return; } if ($result !== false) { $this->query_log(); // free memory $this->last_sql = null; $this->last_params = null; $this->print_debug_time(); ...
[ "protected", "function", "query_end", "(", "$", "result", ")", "{", "if", "(", "$", "this", "->", "loggingquery", ")", "{", "return", ";", "}", "if", "(", "$", "result", "!==", "false", ")", "{", "$", "this", "->", "query_log", "(", ")", ";", "// f...
This should be called immediately after each db query. It does a clean up of resources. It also throws exceptions if the sql that ran produced errors. @param mixed $result The db specific result obtained from running a query. @throws dml_read_exception | dml_write_exception | ddl_change_structure_exception @return void
[ "This", "should", "be", "called", "immediately", "after", "each", "db", "query", ".", "It", "does", "a", "clean", "up", "of", "resources", ".", "It", "also", "throws", "exceptions", "if", "the", "sql", "that", "ran", "produced", "errors", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L462-L494
213,001
moodle/moodle
lib/dml/moodle_database.php
moodle_database.print_debug
protected function print_debug($sql, array $params=null, $obj=null) { if (!$this->get_debug()) { return; } if (CLI_SCRIPT) { $separator = "--------------------------------\n"; echo $separator; echo "{$sql}\n"; if (!is_null($params)) { ...
php
protected function print_debug($sql, array $params=null, $obj=null) { if (!$this->get_debug()) { return; } if (CLI_SCRIPT) { $separator = "--------------------------------\n"; echo $separator; echo "{$sql}\n"; if (!is_null($params)) { ...
[ "protected", "function", "print_debug", "(", "$", "sql", ",", "array", "$", "params", "=", "null", ",", "$", "obj", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "get_debug", "(", ")", ")", "{", "return", ";", "}", "if", "(", "CLI_SCR...
Prints sql debug info @param string $sql The query which is being debugged. @param array $params The query parameters. (optional) @param mixed $obj The library specific object. (optional) @return void
[ "Prints", "sql", "debug", "info" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L592-L621
213,002
moodle/moodle
lib/dml/moodle_database.php
moodle_database.print_debug_time
protected function print_debug_time() { if (!$this->get_debug()) { return; } $time = $this->query_time(); $message = "Query took: {$time} seconds.\n"; if (CLI_SCRIPT) { echo $message; echo "--------------------------------\n"; } else if...
php
protected function print_debug_time() { if (!$this->get_debug()) { return; } $time = $this->query_time(); $message = "Query took: {$time} seconds.\n"; if (CLI_SCRIPT) { echo $message; echo "--------------------------------\n"; } else if...
[ "protected", "function", "print_debug_time", "(", ")", "{", "if", "(", "!", "$", "this", "->", "get_debug", "(", ")", ")", "{", "return", ";", "}", "$", "time", "=", "$", "this", "->", "query_time", "(", ")", ";", "$", "message", "=", "\"Query took: ...
Prints the time a query took to run. @return void
[ "Prints", "the", "time", "a", "query", "took", "to", "run", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L627-L643
213,003
moodle/moodle
lib/dml/moodle_database.php
moodle_database.where_clause
protected function where_clause($table, array $conditions=null) { // We accept nulls in conditions $conditions = is_null($conditions) ? array() : $conditions; if (empty($conditions)) { return array('', array()); } // Some checks performed under debugging only ...
php
protected function where_clause($table, array $conditions=null) { // We accept nulls in conditions $conditions = is_null($conditions) ? array() : $conditions; if (empty($conditions)) { return array('', array()); } // Some checks performed under debugging only ...
[ "protected", "function", "where_clause", "(", "$", "table", ",", "array", "$", "conditions", "=", "null", ")", "{", "// We accept nulls in conditions", "$", "conditions", "=", "is_null", "(", "$", "conditions", ")", "?", "array", "(", ")", ":", "$", "conditi...
Returns the SQL WHERE conditions. @param string $table The table name that these conditions will be validated against. @param array $conditions The conditions to build the where clause. (must not contain numeric indexes) @throws dml_exception @return array An array list containing sql 'where' part and 'params'.
[ "Returns", "the", "SQL", "WHERE", "conditions", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L652-L710
213,004
moodle/moodle
lib/dml/moodle_database.php
moodle_database.where_clause_list
protected function where_clause_list($field, array $values) { if (empty($values)) { return array("1 = 2", array()); // Fake condition, won't return rows ever. MDL-17645 } // Note: Do not use get_in_or_equal() because it can not deal with bools and nulls. $params = array(); ...
php
protected function where_clause_list($field, array $values) { if (empty($values)) { return array("1 = 2", array()); // Fake condition, won't return rows ever. MDL-17645 } // Note: Do not use get_in_or_equal() because it can not deal with bools and nulls. $params = array(); ...
[ "protected", "function", "where_clause_list", "(", "$", "field", ",", "array", "$", "values", ")", "{", "if", "(", "empty", "(", "$", "values", ")", ")", "{", "return", "array", "(", "\"1 = 2\"", ",", "array", "(", ")", ")", ";", "// Fake condition, won'...
Returns SQL WHERE conditions for the ..._list group of methods. @param string $field the name of a field. @param array $values the values field might take. @return array An array containing sql 'where' part and 'params'
[ "Returns", "SQL", "WHERE", "conditions", "for", "the", "...", "_list", "group", "of", "methods", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L719-L753
213,005
moodle/moodle
lib/dml/moodle_database.php
moodle_database.normalise_limit_from_num
protected function normalise_limit_from_num($limitfrom, $limitnum) { global $CFG; // We explicilty treat these cases as 0. if ($limitfrom === null || $limitfrom === '' || $limitfrom === -1) { $limitfrom = 0; } if ($limitnum === null || $limitnum === '' || $limitnum =...
php
protected function normalise_limit_from_num($limitfrom, $limitnum) { global $CFG; // We explicilty treat these cases as 0. if ($limitfrom === null || $limitfrom === '' || $limitfrom === -1) { $limitfrom = 0; } if ($limitnum === null || $limitnum === '' || $limitnum =...
[ "protected", "function", "normalise_limit_from_num", "(", "$", "limitfrom", ",", "$", "limitnum", ")", "{", "global", "$", "CFG", ";", "// We explicilty treat these cases as 0.", "if", "(", "$", "limitfrom", "===", "null", "||", "$", "limitfrom", "===", "''", "|...
Ensures that limit params are numeric and positive integers, to be passed to the database. We explicitly treat null, '' and -1 as 0 in order to provide compatibility with how limit values have been passed historically. @param int $limitfrom Where to start results from @param int $limitnum How many results to return @r...
[ "Ensures", "that", "limit", "params", "are", "numeric", "and", "positive", "integers", "to", "be", "passed", "to", "the", "database", ".", "We", "explicitly", "treat", "null", "and", "-", "1", "as", "0", "in", "order", "to", "provide", "compatibility", "wi...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1026-L1063
213,006
moodle/moodle
lib/dml/moodle_database.php
moodle_database.reset_caches
public function reset_caches($tablenames = null) { if (!empty($tablenames)) { $dbmetapurged = false; foreach ($tablenames as $tablename) { if ($this->temptables->is_temptable($tablename)) { $this->get_temp_tables_cache()->delete($tablename); ...
php
public function reset_caches($tablenames = null) { if (!empty($tablenames)) { $dbmetapurged = false; foreach ($tablenames as $tablename) { if ($this->temptables->is_temptable($tablename)) { $this->get_temp_tables_cache()->delete($tablename); ...
[ "public", "function", "reset_caches", "(", "$", "tablenames", "=", "null", ")", "{", "if", "(", "!", "empty", "(", "$", "tablenames", ")", ")", "{", "$", "dbmetapurged", "=", "false", ";", "foreach", "(", "$", "tablenames", "as", "$", "tablename", ")",...
Resets the internal column details cache @param array|null $tablenames an array of xmldb table names affected by this request. @return void
[ "Resets", "the", "internal", "column", "details", "cache" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1102-L1122
213,007
moodle/moodle
lib/dml/moodle_database.php
moodle_database.get_manager
public function get_manager() { global $CFG; if (!$this->database_manager) { require_once($CFG->libdir.'/ddllib.php'); $classname = $this->get_dbfamily().'_sql_generator'; require_once("$CFG->libdir/ddl/$classname.php"); $generator = new $classname($this...
php
public function get_manager() { global $CFG; if (!$this->database_manager) { require_once($CFG->libdir.'/ddllib.php'); $classname = $this->get_dbfamily().'_sql_generator'; require_once("$CFG->libdir/ddl/$classname.php"); $generator = new $classname($this...
[ "public", "function", "get_manager", "(", ")", "{", "global", "$", "CFG", ";", "if", "(", "!", "$", "this", "->", "database_manager", ")", "{", "require_once", "(", "$", "CFG", "->", "libdir", ".", "'/ddllib.php'", ")", ";", "$", "classname", "=", "$",...
Returns the sql generator used for db manipulation. Used mostly in upgrade.php scripts. @return database_manager The instance used to perform ddl operations. @see lib/ddl/database_manager.php
[ "Returns", "the", "sql", "generator", "used", "for", "db", "manipulation", ".", "Used", "mostly", "in", "upgrade", ".", "php", "scripts", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1130-L1143
213,008
moodle/moodle
lib/dml/moodle_database.php
moodle_database.get_recordset
public function get_recordset($table, array $conditions=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { list($select, $params) = $this->where_clause($table, $conditions); return $this->get_recordset_select($table, $select, $params, $sort, $fields, $limitfrom, $limitnum); }
php
public function get_recordset($table, array $conditions=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { list($select, $params) = $this->where_clause($table, $conditions); return $this->get_recordset_select($table, $select, $params, $sort, $fields, $limitfrom, $limitnum); }
[ "public", "function", "get_recordset", "(", "$", "table", ",", "array", "$", "conditions", "=", "null", ",", "$", "sort", "=", "''", ",", "$", "fields", "=", "'*'", ",", "$", "limitfrom", "=", "0", ",", "$", "limitnum", "=", "0", ")", "{", "list", ...
Get a number of records as a moodle_recordset where all the given conditions met. Selects records from the table $table. If specified, only records meeting $conditions. If specified, the results will be sorted as specified by $sort. This is added to the SQL as "ORDER BY $sort". Example values of $sort might be "time...
[ "Get", "a", "number", "of", "records", "as", "a", "moodle_recordset", "where", "all", "the", "given", "conditions", "met", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1240-L1243
213,009
moodle/moodle
lib/dml/moodle_database.php
moodle_database.get_recordset_list
public function get_recordset_list($table, $field, array $values, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { list($select, $params) = $this->where_clause_list($field, $values); return $this->get_recordset_select($table, $select, $params, $sort, $fields, $limitfrom, $limitnum); }
php
public function get_recordset_list($table, $field, array $values, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { list($select, $params) = $this->where_clause_list($field, $values); return $this->get_recordset_select($table, $select, $params, $sort, $fields, $limitfrom, $limitnum); }
[ "public", "function", "get_recordset_list", "(", "$", "table", ",", "$", "field", ",", "array", "$", "values", ",", "$", "sort", "=", "''", ",", "$", "fields", "=", "'*'", ",", "$", "limitfrom", "=", "0", ",", "$", "limitnum", "=", "0", ")", "{", ...
Get a number of records as a moodle_recordset where one field match one list of values. Only records where $field takes one of the values $values are returned. $values must be an array of values. Other arguments and the return type are like {@link function get_recordset}. @param string $table the table to query. @pa...
[ "Get", "a", "number", "of", "records", "as", "a", "moodle_recordset", "where", "one", "field", "match", "one", "list", "of", "values", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1263-L1266
213,010
moodle/moodle
lib/dml/moodle_database.php
moodle_database.get_recordset_select
public function get_recordset_select($table, $select, array $params=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { $sql = "SELECT $fields FROM {".$table."}"; if ($select) { $sql .= " WHERE $select"; } if ($sort) { $sql .= " ORDER BY $sort"; } ...
php
public function get_recordset_select($table, $select, array $params=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { $sql = "SELECT $fields FROM {".$table."}"; if ($select) { $sql .= " WHERE $select"; } if ($sort) { $sql .= " ORDER BY $sort"; } ...
[ "public", "function", "get_recordset_select", "(", "$", "table", ",", "$", "select", ",", "array", "$", "params", "=", "null", ",", "$", "sort", "=", "''", ",", "$", "fields", "=", "'*'", ",", "$", "limitfrom", "=", "0", ",", "$", "limitnum", "=", ...
Get a number of records as a moodle_recordset which match a particular WHERE clause. If given, $select is used as the SELECT parameter in the SQL query, otherwise all records from the table are returned. Other arguments and the return type are like {@link function get_recordset}. @param string $table the table to qu...
[ "Get", "a", "number", "of", "records", "as", "a", "moodle_recordset", "which", "match", "a", "particular", "WHERE", "clause", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1286-L1295
213,011
moodle/moodle
lib/dml/moodle_database.php
moodle_database.get_records
public function get_records($table, array $conditions=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { list($select, $params) = $this->where_clause($table, $conditions); return $this->get_records_select($table, $select, $params, $sort, $fields, $limitfrom, $limitnum); }
php
public function get_records($table, array $conditions=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { list($select, $params) = $this->where_clause($table, $conditions); return $this->get_records_select($table, $select, $params, $sort, $fields, $limitfrom, $limitnum); }
[ "public", "function", "get_records", "(", "$", "table", ",", "array", "$", "conditions", "=", "null", ",", "$", "sort", "=", "''", ",", "$", "fields", "=", "'*'", ",", "$", "limitfrom", "=", "0", ",", "$", "limitnum", "=", "0", ")", "{", "list", ...
Get a number of records as an array of objects where all the given conditions met. If the query succeeds and returns at least one record, the return value is an array of objects, one object for each record found. The array key is the value from the first column of the result set. The object associated with that key ha...
[ "Get", "a", "number", "of", "records", "as", "an", "array", "of", "objects", "where", "all", "the", "given", "conditions", "met", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1349-L1352
213,012
moodle/moodle
lib/dml/moodle_database.php
moodle_database.get_records_list
public function get_records_list($table, $field, array $values, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { list($select, $params) = $this->where_clause_list($field, $values); return $this->get_records_select($table, $select, $params, $sort, $fields, $limitfrom, $limitnum); }
php
public function get_records_list($table, $field, array $values, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { list($select, $params) = $this->where_clause_list($field, $values); return $this->get_records_select($table, $select, $params, $sort, $fields, $limitfrom, $limitnum); }
[ "public", "function", "get_records_list", "(", "$", "table", ",", "$", "field", ",", "array", "$", "values", ",", "$", "sort", "=", "''", ",", "$", "fields", "=", "'*'", ",", "$", "limitfrom", "=", "0", ",", "$", "limitnum", "=", "0", ")", "{", "...
Get a number of records as an array of objects where one field match one list of values. Return value is like {@link function get_records}. @param string $table The database table to be checked against. @param string $field The field to search @param array $values An array of values @param string $sort Sort order (as...
[ "Get", "a", "number", "of", "records", "as", "an", "array", "of", "objects", "where", "one", "field", "match", "one", "list", "of", "values", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1371-L1374
213,013
moodle/moodle
lib/dml/moodle_database.php
moodle_database.get_records_select
public function get_records_select($table, $select, array $params=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { if ($select) { $select = "WHERE $select"; } if ($sort) { $sort = " ORDER BY $sort"; } return $this->get_records_sql("SELECT $fields ...
php
public function get_records_select($table, $select, array $params=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { if ($select) { $select = "WHERE $select"; } if ($sort) { $sort = " ORDER BY $sort"; } return $this->get_records_sql("SELECT $fields ...
[ "public", "function", "get_records_select", "(", "$", "table", ",", "$", "select", ",", "array", "$", "params", "=", "null", ",", "$", "sort", "=", "''", ",", "$", "fields", "=", "'*'", ",", "$", "limitfrom", "=", "0", ",", "$", "limitnum", "=", "0...
Get a number of records as an array of objects which match a particular WHERE clause. Return value is like {@link function get_records}. @param string $table The table to query. @param string $select A fragment of SQL to be used in a where clause in the SQL call. @param array $params An array of sql parameters @param...
[ "Get", "a", "number", "of", "records", "as", "an", "array", "of", "objects", "which", "match", "a", "particular", "WHERE", "clause", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1393-L1401
213,014
moodle/moodle
lib/dml/moodle_database.php
moodle_database.get_records_menu
public function get_records_menu($table, array $conditions=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { $menu = array(); if ($records = $this->get_records($table, $conditions, $sort, $fields, $limitfrom, $limitnum)) { foreach ($records as $record) { $record = (ar...
php
public function get_records_menu($table, array $conditions=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { $menu = array(); if ($records = $this->get_records($table, $conditions, $sort, $fields, $limitfrom, $limitnum)) { foreach ($records as $record) { $record = (ar...
[ "public", "function", "get_records_menu", "(", "$", "table", ",", "array", "$", "conditions", "=", "null", ",", "$", "sort", "=", "''", ",", "$", "fields", "=", "'*'", ",", "$", "limitfrom", "=", "0", ",", "$", "limitnum", "=", "0", ")", "{", "$", ...
Get the first two columns from a number of records as an associative array where all the given conditions met. Arguments are like {@link function get_recordset}. If no errors occur the return value is an associative whose keys come from the first field of each record, and whose values are the corresponding second fie...
[ "Get", "the", "first", "two", "columns", "from", "a", "number", "of", "records", "as", "an", "associative", "array", "where", "all", "the", "given", "conditions", "met", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1438-L1449
213,015
moodle/moodle
lib/dml/moodle_database.php
moodle_database.get_records_select_menu
public function get_records_select_menu($table, $select, array $params=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { $menu = array(); if ($records = $this->get_records_select($table, $select, $params, $sort, $fields, $limitfrom, $limitnum)) { foreach ($records as $record) { ...
php
public function get_records_select_menu($table, $select, array $params=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0) { $menu = array(); if ($records = $this->get_records_select($table, $select, $params, $sort, $fields, $limitfrom, $limitnum)) { foreach ($records as $record) { ...
[ "public", "function", "get_records_select_menu", "(", "$", "table", ",", "$", "select", ",", "array", "$", "params", "=", "null", ",", "$", "sort", "=", "''", ",", "$", "fields", "=", "'*'", ",", "$", "limitfrom", "=", "0", ",", "$", "limitnum", "=",...
Get the first two columns from a number of records as an associative array which match a particular WHERE clause. Arguments are like {@link function get_recordset_select}. Return value is like {@link function get_records_menu}. @param string $table The database table to be checked against. @param string $select A fra...
[ "Get", "the", "first", "two", "columns", "from", "a", "number", "of", "records", "as", "an", "associative", "array", "which", "match", "a", "particular", "WHERE", "clause", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1467-L1478
213,016
moodle/moodle
lib/dml/moodle_database.php
moodle_database.get_records_sql_menu
public function get_records_sql_menu($sql, array $params=null, $limitfrom=0, $limitnum=0) { $menu = array(); if ($records = $this->get_records_sql($sql, $params, $limitfrom, $limitnum)) { foreach ($records as $record) { $record = (array)$record; $key = array...
php
public function get_records_sql_menu($sql, array $params=null, $limitfrom=0, $limitnum=0) { $menu = array(); if ($records = $this->get_records_sql($sql, $params, $limitfrom, $limitnum)) { foreach ($records as $record) { $record = (array)$record; $key = array...
[ "public", "function", "get_records_sql_menu", "(", "$", "sql", ",", "array", "$", "params", "=", "null", ",", "$", "limitfrom", "=", "0", ",", "$", "limitnum", "=", "0", ")", "{", "$", "menu", "=", "array", "(", ")", ";", "if", "(", "$", "records",...
Get the first two columns from a number of records as an associative array using a SQL statement. Arguments are like {@link function get_recordset_sql}. Return value is like {@link function get_records_menu}. @param string $sql The SQL string you wish to be executed. @param array $params array of sql parameters @para...
[ "Get", "the", "first", "two", "columns", "from", "a", "number", "of", "records", "as", "an", "associative", "array", "using", "a", "SQL", "statement", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1493-L1504
213,017
moodle/moodle
lib/dml/moodle_database.php
moodle_database.get_record
public function get_record($table, array $conditions, $fields='*', $strictness=IGNORE_MISSING) { list($select, $params) = $this->where_clause($table, $conditions); return $this->get_record_select($table, $select, $params, $fields, $strictness); }
php
public function get_record($table, array $conditions, $fields='*', $strictness=IGNORE_MISSING) { list($select, $params) = $this->where_clause($table, $conditions); return $this->get_record_select($table, $select, $params, $fields, $strictness); }
[ "public", "function", "get_record", "(", "$", "table", ",", "array", "$", "conditions", ",", "$", "fields", "=", "'*'", ",", "$", "strictness", "=", "IGNORE_MISSING", ")", "{", "list", "(", "$", "select", ",", "$", "params", ")", "=", "$", "this", "-...
Get a single database record as an object where all the given conditions met. @param string $table The table to select from. @param array $conditions optional array $fieldname=>requestedvalue with AND in between @param string $fields A comma separated list of fields to be returned from the chosen table. @param int $st...
[ "Get", "a", "single", "database", "record", "as", "an", "object", "where", "all", "the", "given", "conditions", "met", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1520-L1523
213,018
moodle/moodle
lib/dml/moodle_database.php
moodle_database.get_record_select
public function get_record_select($table, $select, array $params=null, $fields='*', $strictness=IGNORE_MISSING) { if ($select) { $select = "WHERE $select"; } try { return $this->get_record_sql("SELECT $fields FROM {" . $table . "} $select", $params, $strictness); ...
php
public function get_record_select($table, $select, array $params=null, $fields='*', $strictness=IGNORE_MISSING) { if ($select) { $select = "WHERE $select"; } try { return $this->get_record_sql("SELECT $fields FROM {" . $table . "} $select", $params, $strictness); ...
[ "public", "function", "get_record_select", "(", "$", "table", ",", "$", "select", ",", "array", "$", "params", "=", "null", ",", "$", "fields", "=", "'*'", ",", "$", "strictness", "=", "IGNORE_MISSING", ")", "{", "if", "(", "$", "select", ")", "{", "...
Get a single database record as an object which match a particular WHERE clause. @param string $table The database table to be checked against. @param string $select A fragment of SQL to be used in a where clause in the SQL call. @param array $params array of sql parameters @param string $fields A comma separated list...
[ "Get", "a", "single", "database", "record", "as", "an", "object", "which", "match", "a", "particular", "WHERE", "clause", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1538-L1548
213,019
moodle/moodle
lib/dml/moodle_database.php
moodle_database.get_field
public function get_field($table, $return, array $conditions, $strictness=IGNORE_MISSING) { list($select, $params) = $this->where_clause($table, $conditions); return $this->get_field_select($table, $return, $select, $params, $strictness); }
php
public function get_field($table, $return, array $conditions, $strictness=IGNORE_MISSING) { list($select, $params) = $this->where_clause($table, $conditions); return $this->get_field_select($table, $return, $select, $params, $strictness); }
[ "public", "function", "get_field", "(", "$", "table", ",", "$", "return", ",", "array", "$", "conditions", ",", "$", "strictness", "=", "IGNORE_MISSING", ")", "{", "list", "(", "$", "select", ",", "$", "params", ")", "=", "$", "this", "->", "where_clau...
Get a single field value from a table record where all the given conditions met. @param string $table the table to query. @param string $return the field to return the value of. @param array $conditions optional array $fieldname=>requestedvalue with AND in between @param int $strictness IGNORE_MISSING means compatible...
[ "Get", "a", "single", "field", "value", "from", "a", "table", "record", "where", "all", "the", "given", "conditions", "met", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1602-L1605
213,020
moodle/moodle
lib/dml/moodle_database.php
moodle_database.get_field_select
public function get_field_select($table, $return, $select, array $params=null, $strictness=IGNORE_MISSING) { if ($select) { $select = "WHERE $select"; } try { return $this->get_field_sql("SELECT $return FROM {" . $table . "} $select", $params, $strictness); } catc...
php
public function get_field_select($table, $return, $select, array $params=null, $strictness=IGNORE_MISSING) { if ($select) { $select = "WHERE $select"; } try { return $this->get_field_sql("SELECT $return FROM {" . $table . "} $select", $params, $strictness); } catc...
[ "public", "function", "get_field_select", "(", "$", "table", ",", "$", "return", ",", "$", "select", ",", "array", "$", "params", "=", "null", ",", "$", "strictness", "=", "IGNORE_MISSING", ")", "{", "if", "(", "$", "select", ")", "{", "$", "select", ...
Get a single field value from a table record which match a particular WHERE clause. @param string $table the table to query. @param string $return the field to return the value of. @param string $select A fragment of SQL to be used in a where clause returning one row with one column @param array $params array of sql p...
[ "Get", "a", "single", "field", "value", "from", "a", "table", "record", "which", "match", "a", "particular", "WHERE", "clause", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1620-L1630
213,021
moodle/moodle
lib/dml/moodle_database.php
moodle_database.get_fieldset_select
public function get_fieldset_select($table, $return, $select, array $params=null) { if ($select) { $select = "WHERE $select"; } return $this->get_fieldset_sql("SELECT $return FROM {" . $table . "} $select", $params); }
php
public function get_fieldset_select($table, $return, $select, array $params=null) { if ($select) { $select = "WHERE $select"; } return $this->get_fieldset_sql("SELECT $return FROM {" . $table . "} $select", $params); }
[ "public", "function", "get_fieldset_select", "(", "$", "table", ",", "$", "return", ",", "$", "select", ",", "array", "$", "params", "=", "null", ")", "{", "if", "(", "$", "select", ")", "{", "$", "select", "=", "\"WHERE $select\"", ";", "}", "return",...
Selects records and return values of chosen field as an array which match a particular WHERE clause. @param string $table the table to query. @param string $return the field we are intered in @param string $select A fragment of SQL to be used in a where clause in the SQL call. @param array $params array of sql paramet...
[ "Selects", "records", "and", "return", "values", "of", "chosen", "field", "as", "an", "array", "which", "match", "a", "particular", "WHERE", "clause", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1662-L1667
213,022
moodle/moodle
lib/dml/moodle_database.php
moodle_database.set_field
public function set_field($table, $newfield, $newvalue, array $conditions=null) { list($select, $params) = $this->where_clause($table, $conditions); return $this->set_field_select($table, $newfield, $newvalue, $select, $params); }
php
public function set_field($table, $newfield, $newvalue, array $conditions=null) { list($select, $params) = $this->where_clause($table, $conditions); return $this->set_field_select($table, $newfield, $newvalue, $select, $params); }
[ "public", "function", "set_field", "(", "$", "table", ",", "$", "newfield", ",", "$", "newvalue", ",", "array", "$", "conditions", "=", "null", ")", "{", "list", "(", "$", "select", ",", "$", "params", ")", "=", "$", "this", "->", "where_clause", "("...
Set a single field in every table record where all the given conditions met. @param string $table The database table to be checked against. @param string $newfield the field to set. @param string $newvalue the value to set the field to. @param array $conditions optional array $fieldname=>requestedvalue with AND in bet...
[ "Set", "a", "single", "field", "in", "every", "table", "record", "where", "all", "the", "given", "conditions", "met", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1791-L1794
213,023
moodle/moodle
lib/dml/moodle_database.php
moodle_database.count_records
public function count_records($table, array $conditions=null) { list($select, $params) = $this->where_clause($table, $conditions); return $this->count_records_select($table, $select, $params); }
php
public function count_records($table, array $conditions=null) { list($select, $params) = $this->where_clause($table, $conditions); return $this->count_records_select($table, $select, $params); }
[ "public", "function", "count_records", "(", "$", "table", ",", "array", "$", "conditions", "=", "null", ")", "{", "list", "(", "$", "select", ",", "$", "params", ")", "=", "$", "this", "->", "where_clause", "(", "$", "table", ",", "$", "conditions", ...
Count the records in a table where all the given conditions met. @param string $table The table to query. @param array $conditions optional array $fieldname=>requestedvalue with AND in between @return int The count of records returned from the specified criteria. @throws dml_exception A DML specific exception is throw...
[ "Count", "the", "records", "in", "a", "table", "where", "all", "the", "given", "conditions", "met", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1818-L1821
213,024
moodle/moodle
lib/dml/moodle_database.php
moodle_database.count_records_select
public function count_records_select($table, $select, array $params=null, $countitem="COUNT('x')") { if ($select) { $select = "WHERE $select"; } return $this->count_records_sql("SELECT $countitem FROM {" . $table . "} $select", $params); }
php
public function count_records_select($table, $select, array $params=null, $countitem="COUNT('x')") { if ($select) { $select = "WHERE $select"; } return $this->count_records_sql("SELECT $countitem FROM {" . $table . "} $select", $params); }
[ "public", "function", "count_records_select", "(", "$", "table", ",", "$", "select", ",", "array", "$", "params", "=", "null", ",", "$", "countitem", "=", "\"COUNT('x')\"", ")", "{", "if", "(", "$", "select", ")", "{", "$", "select", "=", "\"WHERE $selec...
Count the records in a table which match a particular WHERE clause. @param string $table The database table to be checked against. @param string $select A fragment of SQL to be used in a WHERE clause in the SQL call. @param array $params array of sql parameters @param string $countitem The count string to be used in t...
[ "Count", "the", "records", "in", "a", "table", "which", "match", "a", "particular", "WHERE", "clause", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1833-L1838
213,025
moodle/moodle
lib/dml/moodle_database.php
moodle_database.record_exists
public function record_exists($table, array $conditions) { list($select, $params) = $this->where_clause($table, $conditions); return $this->record_exists_select($table, $select, $params); }
php
public function record_exists($table, array $conditions) { list($select, $params) = $this->where_clause($table, $conditions); return $this->record_exists_select($table, $select, $params); }
[ "public", "function", "record_exists", "(", "$", "table", ",", "array", "$", "conditions", ")", "{", "list", "(", "$", "select", ",", "$", "params", ")", "=", "$", "this", "->", "where_clause", "(", "$", "table", ",", "$", "conditions", ")", ";", "re...
Test whether a record exists in a table where all the given conditions met. @param string $table The table to check. @param array $conditions optional array $fieldname=>requestedvalue with AND in between @return bool true if a matching record exists, else false. @throws dml_exception A DML specific exception is thrown...
[ "Test", "whether", "a", "record", "exists", "in", "a", "table", "where", "all", "the", "given", "conditions", "met", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1869-L1872
213,026
moodle/moodle
lib/dml/moodle_database.php
moodle_database.record_exists_select
public function record_exists_select($table, $select, array $params=null) { if ($select) { $select = "WHERE $select"; } return $this->record_exists_sql("SELECT 'x' FROM {" . $table . "} $select", $params); }
php
public function record_exists_select($table, $select, array $params=null) { if ($select) { $select = "WHERE $select"; } return $this->record_exists_sql("SELECT 'x' FROM {" . $table . "} $select", $params); }
[ "public", "function", "record_exists_select", "(", "$", "table", ",", "$", "select", ",", "array", "$", "params", "=", "null", ")", "{", "if", "(", "$", "select", ")", "{", "$", "select", "=", "\"WHERE $select\"", ";", "}", "return", "$", "this", "->",...
Test whether any records exists in a table which match a particular WHERE clause. @param string $table The database table to be checked against. @param string $select A fragment of SQL to be used in a WHERE clause in the SQL call. @param array $params array of sql parameters @return bool true if a matching record exis...
[ "Test", "whether", "any", "records", "exists", "in", "a", "table", "which", "match", "a", "particular", "WHERE", "clause", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1883-L1888
213,027
moodle/moodle
lib/dml/moodle_database.php
moodle_database.record_exists_sql
public function record_exists_sql($sql, array $params=null) { $mrs = $this->get_recordset_sql($sql, $params, 0, 1); $return = $mrs->valid(); $mrs->close(); return $return; }
php
public function record_exists_sql($sql, array $params=null) { $mrs = $this->get_recordset_sql($sql, $params, 0, 1); $return = $mrs->valid(); $mrs->close(); return $return; }
[ "public", "function", "record_exists_sql", "(", "$", "sql", ",", "array", "$", "params", "=", "null", ")", "{", "$", "mrs", "=", "$", "this", "->", "get_recordset_sql", "(", "$", "sql", ",", "$", "params", ",", "0", ",", "1", ")", ";", "$", "return...
Test whether a SQL SELECT statement returns any records. This function returns true if the SQL statement executes without any errors and returns at least one record. @param string $sql The SQL statement to execute. @param array $params array of sql parameters @return bool true if the SQL executes without errors and r...
[ "Test", "whether", "a", "SQL", "SELECT", "statement", "returns", "any", "records", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1901-L1906
213,028
moodle/moodle
lib/dml/moodle_database.php
moodle_database.delete_records
public function delete_records($table, array $conditions=null) { // truncate is drop/create (DDL), not transactional safe, // so we don't use the shortcut within them. MDL-29198 if (is_null($conditions) && empty($this->transactions)) { return $this->execute("TRUNCATE TABLE {".$table....
php
public function delete_records($table, array $conditions=null) { // truncate is drop/create (DDL), not transactional safe, // so we don't use the shortcut within them. MDL-29198 if (is_null($conditions) && empty($this->transactions)) { return $this->execute("TRUNCATE TABLE {".$table....
[ "public", "function", "delete_records", "(", "$", "table", ",", "array", "$", "conditions", "=", "null", ")", "{", "// truncate is drop/create (DDL), not transactional safe,", "// so we don't use the shortcut within them. MDL-29198", "if", "(", "is_null", "(", "$", "conditi...
Delete the records from a table where all the given conditions met. If conditions not specified, table is truncated. @param string $table the table to delete from. @param array $conditions optional array $fieldname=>requestedvalue with AND in between @return bool true. @throws dml_exception A DML specific exception is...
[ "Delete", "the", "records", "from", "a", "table", "where", "all", "the", "given", "conditions", "met", ".", "If", "conditions", "not", "specified", "table", "is", "truncated", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1917-L1925
213,029
moodle/moodle
lib/dml/moodle_database.php
moodle_database.delete_records_list
public function delete_records_list($table, $field, array $values) { list($select, $params) = $this->where_clause_list($field, $values); return $this->delete_records_select($table, $select, $params); }
php
public function delete_records_list($table, $field, array $values) { list($select, $params) = $this->where_clause_list($field, $values); return $this->delete_records_select($table, $select, $params); }
[ "public", "function", "delete_records_list", "(", "$", "table", ",", "$", "field", ",", "array", "$", "values", ")", "{", "list", "(", "$", "select", ",", "$", "params", ")", "=", "$", "this", "->", "where_clause_list", "(", "$", "field", ",", "$", "...
Delete the records from a table where one field match one list of values. @param string $table the table to delete from. @param string $field The field to search @param array $values array of values @return bool true. @throws dml_exception A DML specific exception is thrown for any errors.
[ "Delete", "the", "records", "from", "a", "table", "where", "one", "field", "match", "one", "list", "of", "values", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L1936-L1939
213,030
moodle/moodle
lib/dml/moodle_database.php
moodle_database.sql_like_escape
public function sql_like_escape($text, $escapechar = '\\') { $text = str_replace('_', $escapechar.'_', $text); $text = str_replace('%', $escapechar.'%', $text); return $text; }
php
public function sql_like_escape($text, $escapechar = '\\') { $text = str_replace('_', $escapechar.'_', $text); $text = str_replace('%', $escapechar.'%', $text); return $text; }
[ "public", "function", "sql_like_escape", "(", "$", "text", ",", "$", "escapechar", "=", "'\\\\'", ")", "{", "$", "text", "=", "str_replace", "(", "'_'", ",", "$", "escapechar", ".", "'_'", ",", "$", "text", ")", ";", "$", "text", "=", "str_replace", ...
Escape sql LIKE special characters like '_' or '%'. @param string $text The string containing characters needing escaping. @param string $escapechar The desired escape character, defaults to '\\'. @return string The escaped sql LIKE string.
[ "Escape", "sql", "LIKE", "special", "characters", "like", "_", "or", "%", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L2150-L2154
213,031
moodle/moodle
lib/dml/moodle_database.php
moodle_database.sql_isnotempty
public function sql_isnotempty($tablename, $fieldname, $nullablefield, $textfield) { return ' ( NOT ' . $this->sql_isempty($tablename, $fieldname, $nullablefield, $textfield) . ') '; }
php
public function sql_isnotempty($tablename, $fieldname, $nullablefield, $textfield) { return ' ( NOT ' . $this->sql_isempty($tablename, $fieldname, $nullablefield, $textfield) . ') '; }
[ "public", "function", "sql_isnotempty", "(", "$", "tablename", ",", "$", "fieldname", ",", "$", "nullablefield", ",", "$", "textfield", ")", "{", "return", "' ( NOT '", ".", "$", "this", "->", "sql_isempty", "(", "$", "tablename", ",", "$", "fieldname", ",...
Returns the proper SQL to know if one field is not empty. Note that the function behavior strongly relies on the parameters passed describing the field so, please, be accurate when specifying them. This function should be applied in all the places where conditions of the type: ... AND fieldname != ''; are being us...
[ "Returns", "the", "proper", "SQL", "to", "know", "if", "one", "field", "is", "not", "empty", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L2329-L2331
213,032
moodle/moodle
lib/dml/moodle_database.php
moodle_database.replace_all_text
public function replace_all_text($table, database_column_info $column, $search, $replace) { if (!$this->replace_all_text_supported()) { return; } // NOTE: override this methods if following standard compliant SQL // does not work for your driver. // Enclose th...
php
public function replace_all_text($table, database_column_info $column, $search, $replace) { if (!$this->replace_all_text_supported()) { return; } // NOTE: override this methods if following standard compliant SQL // does not work for your driver. // Enclose th...
[ "public", "function", "replace_all_text", "(", "$", "table", ",", "database_column_info", "$", "column", ",", "$", "search", ",", "$", "replace", ")", "{", "if", "(", "!", "$", "this", "->", "replace_all_text_supported", "(", ")", ")", "{", "return", ";", ...
Replace given text in all rows of column. @since Moodle 2.6.1 @param string $table name of the table @param database_column_info $column @param string $search @param string $replace
[ "Replace", "given", "text", "in", "all", "rows", "of", "column", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L2395-L2425
213,033
moodle/moodle
lib/dml/moodle_database.php
moodle_database.commit_delegated_transaction
public function commit_delegated_transaction(moodle_transaction $transaction) { if ($transaction->is_disposed()) { throw new dml_transaction_exception('Transactions already disposed', $transaction); } // mark as disposed so that it can not be used again $transaction->dispose(...
php
public function commit_delegated_transaction(moodle_transaction $transaction) { if ($transaction->is_disposed()) { throw new dml_transaction_exception('Transactions already disposed', $transaction); } // mark as disposed so that it can not be used again $transaction->dispose(...
[ "public", "function", "commit_delegated_transaction", "(", "moodle_transaction", "$", "transaction", ")", "{", "if", "(", "$", "transaction", "->", "is_disposed", "(", ")", ")", "{", "throw", "new", "dml_transaction_exception", "(", "'Transactions already disposed'", ...
Indicates delegated transaction finished successfully. The real database transaction is committed only if all delegated transactions committed. @param moodle_transaction $transaction The transaction to commit @return void @throws dml_transaction_exception Creates and throws transaction related exceptions.
[ "Indicates", "delegated", "transaction", "finished", "successfully", ".", "The", "real", "database", "transaction", "is", "committed", "only", "if", "all", "delegated", "transactions", "committed", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L2512-L2543
213,034
moodle/moodle
lib/dml/moodle_database.php
moodle_database.rollback_delegated_transaction
public function rollback_delegated_transaction(moodle_transaction $transaction, $e) { if (!($e instanceof Exception) && !($e instanceof Throwable)) { // PHP7 - we catch Throwables in phpunit but can't use that as the type hint in PHP5. $e = new \coding_exception("Must be given an Excepti...
php
public function rollback_delegated_transaction(moodle_transaction $transaction, $e) { if (!($e instanceof Exception) && !($e instanceof Throwable)) { // PHP7 - we catch Throwables in phpunit but can't use that as the type hint in PHP5. $e = new \coding_exception("Must be given an Excepti...
[ "public", "function", "rollback_delegated_transaction", "(", "moodle_transaction", "$", "transaction", ",", "$", "e", ")", "{", "if", "(", "!", "(", "$", "e", "instanceof", "Exception", ")", "&&", "!", "(", "$", "e", "instanceof", "Throwable", ")", ")", "{...
Call when delegated transaction failed, this rolls back all delegated transactions up to the top most level. In many cases you do not need to call this method manually, because all open delegated transactions are rolled back automatically if exceptions not caught. @param moodle_transaction $transaction An instance of...
[ "Call", "when", "delegated", "transaction", "failed", "this", "rolls", "back", "all", "delegated", "transactions", "up", "to", "the", "top", "most", "level", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L2564-L2596
213,035
moodle/moodle
lib/dml/moodle_database.php
moodle_database.force_transaction_rollback
public function force_transaction_rollback() { if ($this->transactions) { try { $this->rollback_transaction(); } catch (dml_exception $e) { // ignore any sql errors here, the connection might be broken } } // now enable transac...
php
public function force_transaction_rollback() { if ($this->transactions) { try { $this->rollback_transaction(); } catch (dml_exception $e) { // ignore any sql errors here, the connection might be broken } } // now enable transac...
[ "public", "function", "force_transaction_rollback", "(", ")", "{", "if", "(", "$", "this", "->", "transactions", ")", "{", "try", "{", "$", "this", "->", "rollback_transaction", "(", ")", ";", "}", "catch", "(", "dml_exception", "$", "e", ")", "{", "// i...
Force rollback of all delegated transaction. Does not throw any exceptions and does not log anything. This method should be used only from default exception handlers and other core code. @return void
[ "Force", "rollback", "of", "all", "delegated", "transaction", ".", "Does", "not", "throw", "any", "exceptions", "and", "does", "not", "log", "anything", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/dml/moodle_database.php#L2614-L2629
213,036
moodle/moodle
mod/data/classes/search/sortedcontentqueue.php
sortedcontentqueue.compare
public function compare($key1 , $key2) { $record1 = $this->contents[$key1]; $record2 = $this->contents[$key2]; // If a content's fieldtype is compulsory in the database than it would have priority than any other noncompulsory content. if ( ($record1->required && $record2->required) || (...
php
public function compare($key1 , $key2) { $record1 = $this->contents[$key1]; $record2 = $this->contents[$key2]; // If a content's fieldtype is compulsory in the database than it would have priority than any other noncompulsory content. if ( ($record1->required && $record2->required) || (...
[ "public", "function", "compare", "(", "$", "key1", ",", "$", "key2", ")", "{", "$", "record1", "=", "$", "this", "->", "contents", "[", "$", "key1", "]", ";", "$", "record2", "=", "$", "this", "->", "contents", "[", "$", "key2", "]", ";", "// If ...
comparator function overriden for sorting the records ...as per 'required' and 'priotirity' field values @param int $key1 @param int $key2 @return bool
[ "comparator", "function", "overriden", "for", "sorting", "the", "records", "...", "as", "per", "required", "and", "priotirity", "field", "values" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/data/classes/search/sortedcontentqueue.php#L61-L79
213,037
moodle/moodle
backup/moodle2/backup_custom_fields.php
encrypted_final_element.set_key
protected function set_key($key) { $bytes = strlen($key); // Get key length in bytes. // Only accept keys with the expected (backup::CIPHERKEYLEN) key length. There are a number of hashing, // random generators to achieve this esasily, like the one shown below to create the default // s...
php
protected function set_key($key) { $bytes = strlen($key); // Get key length in bytes. // Only accept keys with the expected (backup::CIPHERKEYLEN) key length. There are a number of hashing, // random generators to achieve this esasily, like the one shown below to create the default // s...
[ "protected", "function", "set_key", "(", "$", "key", ")", "{", "$", "bytes", "=", "strlen", "(", "$", "key", ")", ";", "// Get key length in bytes.", "// Only accept keys with the expected (backup::CIPHERKEYLEN) key length. There are a number of hashing,", "// random generators...
Set the encryption key manually, overriding default backup_encryptkey config. @param string $key key to be used for encrypting. Required to be 256-bit key. Use a safe generation technique. See self::generate_encryption_random_key() below.
[ "Set", "the", "encryption", "key", "manually", "overriding", "default", "backup_encryptkey", "config", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/backup_custom_fields.php#L145-L157
213,038
moodle/moodle
backup/moodle2/backup_custom_fields.php
encrypted_final_element.set_value
public function set_value($value) { // No openssl available, skip this field completely. if (!function_exists('openssl_encrypt')) { return; } // No hmac available, skip this field completely. if (!function_exists('hash_hmac')) { return; } ...
php
public function set_value($value) { // No openssl available, skip this field completely. if (!function_exists('openssl_encrypt')) { return; } // No hmac available, skip this field completely. if (!function_exists('hash_hmac')) { return; } ...
[ "public", "function", "set_value", "(", "$", "value", ")", "{", "// No openssl available, skip this field completely.", "if", "(", "!", "function_exists", "(", "'openssl_encrypt'", ")", ")", "{", "return", ";", "}", "// No hmac available, skip this field completely.", "if...
Set the value of the field. This method sets the value of the element, encrypted using the specified key for it, defaulting to (and generating) backup_encryptkey config. HMAC is used for integrity. @param string $value plain-text content the will be stored encrypted and encoded.
[ "Set", "the", "value", "of", "the", "field", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/moodle2/backup_custom_fields.php#L167-L213
213,039
moodle/moodle
lib/phpexcel/PHPExcel/Writer/Excel2007/Chart.php
PHPExcel_Writer_Excel2007_Chart.writeBubbles
private function writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet) { if (is_null($plotSeriesValues)) { return; } $objWriter->startElement('c:bubbleSize'); $objWriter->startElement('c:numLit'); $objWriter->startElement('c:formatCode'); ...
php
private function writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet) { if (is_null($plotSeriesValues)) { return; } $objWriter->startElement('c:bubbleSize'); $objWriter->startElement('c:numLit'); $objWriter->startElement('c:formatCode'); ...
[ "private", "function", "writeBubbles", "(", "$", "plotSeriesValues", ",", "$", "objWriter", ",", "PHPExcel_Worksheet", "$", "pSheet", ")", "{", "if", "(", "is_null", "(", "$", "plotSeriesValues", ")", ")", "{", "return", ";", "}", "$", "objWriter", "->", "...
Write Bubble Chart Details @param PHPExcel_Chart_DataSeriesValues $plotSeriesValues @param PHPExcel_Shared_XMLWriter $objWriter XML Writer @throws PHPExcel_Writer_Exception
[ "Write", "Bubble", "Chart", "Details" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/phpexcel/PHPExcel/Writer/Excel2007/Chart.php#L1344-L1381
213,040
moodle/moodle
admin/tool/dataprivacy/classes/data_registry.php
data_registry.var_names_from_context
public static function var_names_from_context($classname, $pluginname = '') { $pluginname = trim($pluginname); if (!empty($pluginname)) { $categoryvar = $classname . '_' . $pluginname . '_category'; $purposevar = $classname . '_' . $pluginname . '_purpose'; } else { ...
php
public static function var_names_from_context($classname, $pluginname = '') { $pluginname = trim($pluginname); if (!empty($pluginname)) { $categoryvar = $classname . '_' . $pluginname . '_category'; $purposevar = $classname . '_' . $pluginname . '_purpose'; } else { ...
[ "public", "static", "function", "var_names_from_context", "(", "$", "classname", ",", "$", "pluginname", "=", "''", ")", "{", "$", "pluginname", "=", "trim", "(", "$", "pluginname", ")", ";", "if", "(", "!", "empty", "(", "$", "pluginname", ")", ")", "...
Returns purpose and category var names from a context class name @param string $classname The context level's class. @param string $pluginname The name of the plugin associated with the context level. @return string[]
[ "Returns", "purpose", "and", "category", "var", "names", "from", "a", "context", "class", "name" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/data_registry.php#L49-L62
213,041
moodle/moodle
admin/tool/dataprivacy/classes/data_registry.php
data_registry.get_defaults
public static function get_defaults($contextlevel, $pluginname = '') { $classname = \context_helper::get_class_for_level($contextlevel); list($purposevar, $categoryvar) = self::var_names_from_context($classname, $pluginname); $purposeid = get_config('tool_dataprivacy', $purposevar); $ca...
php
public static function get_defaults($contextlevel, $pluginname = '') { $classname = \context_helper::get_class_for_level($contextlevel); list($purposevar, $categoryvar) = self::var_names_from_context($classname, $pluginname); $purposeid = get_config('tool_dataprivacy', $purposevar); $ca...
[ "public", "static", "function", "get_defaults", "(", "$", "contextlevel", ",", "$", "pluginname", "=", "''", ")", "{", "$", "classname", "=", "\\", "context_helper", "::", "get_class_for_level", "(", "$", "contextlevel", ")", ";", "list", "(", "$", "purposev...
Returns the default purpose id and category id for the provided context level. The caller code is responsible of checking that $contextlevel is an integer. @param int $contextlevel The context level. @param string $pluginname The name of the plugin associated with the context level. @return int[]|false[]
[ "Returns", "the", "default", "purpose", "id", "and", "category", "id", "for", "the", "provided", "context", "level", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/data_registry.php#L73-L101
213,042
moodle/moodle
admin/tool/dataprivacy/classes/data_registry.php
data_registry.defaults_set
public static function defaults_set() { list($purposeid, $categoryid) = self::get_defaults(CONTEXT_SYSTEM); if (empty($purposeid) || empty($categoryid)) { return false; } return true; }
php
public static function defaults_set() { list($purposeid, $categoryid) = self::get_defaults(CONTEXT_SYSTEM); if (empty($purposeid) || empty($categoryid)) { return false; } return true; }
[ "public", "static", "function", "defaults_set", "(", ")", "{", "list", "(", "$", "purposeid", ",", "$", "categoryid", ")", "=", "self", "::", "get_defaults", "(", "CONTEXT_SYSTEM", ")", ";", "if", "(", "empty", "(", "$", "purposeid", ")", "||", "empty", ...
Are data registry defaults set? At least the system defaults need to be set. @return bool
[ "Are", "data", "registry", "defaults", "set?" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/data_registry.php#L110-L116
213,043
moodle/moodle
admin/tool/dataprivacy/classes/data_registry.php
data_registry.get_site_categories
public static function get_site_categories() { global $DB; if (method_exists('\core_course_category', 'get_all')) { $categories = \core_course_category::get_all(['returnhidden' => true]); } else { // Fallback (to be removed once this gets integrated into master). ...
php
public static function get_site_categories() { global $DB; if (method_exists('\core_course_category', 'get_all')) { $categories = \core_course_category::get_all(['returnhidden' => true]); } else { // Fallback (to be removed once this gets integrated into master). ...
[ "public", "static", "function", "get_site_categories", "(", ")", "{", "global", "$", "DB", ";", "if", "(", "method_exists", "(", "'\\core_course_category'", ",", "'get_all'", ")", ")", "{", "$", "categories", "=", "\\", "core_course_category", "::", "get_all", ...
Returns all site categories that are visible to the current user. @return \core_course_category[]
[ "Returns", "all", "site", "categories", "that", "are", "visible", "to", "the", "current", "user", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/data_registry.php#L123-L140
213,044
moodle/moodle
admin/tool/dataprivacy/classes/data_registry.php
data_registry.get_subject_scope
public static function get_subject_scope(\context $context) { if ($contextcourse = $context->get_course_context(false)) { // Below course level we look at module or block level roles + course-assigned roles. $courseroles = get_roles_used_in_context($contextcourse, false); $r...
php
public static function get_subject_scope(\context $context) { if ($contextcourse = $context->get_course_context(false)) { // Below course level we look at module or block level roles + course-assigned roles. $courseroles = get_roles_used_in_context($contextcourse, false); $r...
[ "public", "static", "function", "get_subject_scope", "(", "\\", "context", "$", "context", ")", "{", "if", "(", "$", "contextcourse", "=", "$", "context", "->", "get_course_context", "(", "false", ")", ")", "{", "// Below course level we look at module or block leve...
Returns the roles assigned to the provided level. Important to note that it returns course-level assigned roles if the provided context level is below course. @param \context $context @return array
[ "Returns", "the", "roles", "assigned", "to", "the", "provided", "level", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/data_registry.php#L151-L169
213,045
moodle/moodle
admin/tool/dataprivacy/classes/data_registry.php
data_registry.get_effective_contextlevel_value
public static function get_effective_contextlevel_value($contextlevel, $element) { if ($element !== 'purpose' && $element !== 'category') { throw new coding_exception('Only \'purpose\' and \'category\' are supported.'); } $fieldname = $element . 'id'; if ($contextlevel != CO...
php
public static function get_effective_contextlevel_value($contextlevel, $element) { if ($element !== 'purpose' && $element !== 'category') { throw new coding_exception('Only \'purpose\' and \'category\' are supported.'); } $fieldname = $element . 'id'; if ($contextlevel != CO...
[ "public", "static", "function", "get_effective_contextlevel_value", "(", "$", "contextlevel", ",", "$", "element", ")", "{", "if", "(", "$", "element", "!==", "'purpose'", "&&", "$", "element", "!==", "'category'", ")", "{", "throw", "new", "coding_exception", ...
Returns the effective value for a context level. Note that this is different from the effective default context level (see get_effective_default_contextlevel_purpose_and_category) as this is returning the value set in the data registry, not in the defaults page. @param int $contextlevel @param string $element 'catego...
[ "Returns", "the", "effective", "value", "for", "a", "context", "level", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/data_registry.php#L279-L299
213,046
moodle/moodle
admin/tool/dataprivacy/classes/data_registry.php
data_registry.get_effective_default_contextlevel_purpose_and_category
public static function get_effective_default_contextlevel_purpose_and_category($contextlevel, $forcedpurposevalue = false, $forcedcategoryvalue = false, $component = '') { // Get the defaults for this context level. list(...
php
public static function get_effective_default_contextlevel_purpose_and_category($contextlevel, $forcedpurposevalue = false, $forcedcategoryvalue = false, $component = '') { // Get the defaults for this context level. list(...
[ "public", "static", "function", "get_effective_default_contextlevel_purpose_and_category", "(", "$", "contextlevel", ",", "$", "forcedpurposevalue", "=", "false", ",", "$", "forcedcategoryvalue", "=", "false", ",", "$", "component", "=", "''", ")", "{", "// Get the de...
Returns the effective default purpose and category for a context level. @param int $contextlevel @param int|bool $forcedpurposevalue Use this value as if this was this context level purpose. @param int|bool $forcedcategoryvalue Use this value as if this was this context level category. @param string $component The nam...
[ "Returns", "the", "effective", "default", "purpose", "and", "category", "for", "a", "context", "level", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/data_registry.php#L310-L337
213,047
moodle/moodle
admin/tool/dataprivacy/classes/data_registry.php
data_registry.get_element_instance
private static function get_element_instance($element, $id) { if ($element !== 'purpose' && $element !== 'category') { throw new coding_exception('No other elements than purpose and category are allowed'); } $classname = '\tool_dataprivacy\\' . $element; return new $classnam...
php
private static function get_element_instance($element, $id) { if ($element !== 'purpose' && $element !== 'category') { throw new coding_exception('No other elements than purpose and category are allowed'); } $classname = '\tool_dataprivacy\\' . $element; return new $classnam...
[ "private", "static", "function", "get_element_instance", "(", "$", "element", ",", "$", "id", ")", "{", "if", "(", "$", "element", "!==", "'purpose'", "&&", "$", "element", "!==", "'category'", ")", "{", "throw", "new", "coding_exception", "(", "'No other el...
Returns an instance of the provided element. @throws \coding_exception @param string $element The element name 'purpose' or 'category' @param int $id The element id @return \core\persistent
[ "Returns", "an", "instance", "of", "the", "provided", "element", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/dataprivacy/classes/data_registry.php#L347-L354
213,048
moodle/moodle
lib/spout/src/Spout/Reader/XLSX/Helper/SharedStringsCaching/FileBasedStrategy.php
FileBasedStrategy.getSharedStringTempFilePath
protected function getSharedStringTempFilePath($sharedStringIndex) { $numTempFile = intval($sharedStringIndex / $this->maxNumStringsPerTempFile); return $this->tempFolder . '/sharedstrings' . $numTempFile; }
php
protected function getSharedStringTempFilePath($sharedStringIndex) { $numTempFile = intval($sharedStringIndex / $this->maxNumStringsPerTempFile); return $this->tempFolder . '/sharedstrings' . $numTempFile; }
[ "protected", "function", "getSharedStringTempFilePath", "(", "$", "sharedStringIndex", ")", "{", "$", "numTempFile", "=", "intval", "(", "$", "sharedStringIndex", "/", "$", "this", "->", "maxNumStringsPerTempFile", ")", ";", "return", "$", "this", "->", "tempFolde...
Returns the path for the temp file that should contain the string for the given index @param int $sharedStringIndex Index of the shared string in the sharedStrings.xml file @return string The temp file path for the given index
[ "Returns", "the", "path", "for", "the", "temp", "file", "that", "should", "contain", "the", "string", "for", "the", "given", "index" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/XLSX/Helper/SharedStringsCaching/FileBasedStrategy.php#L100-L104
213,049
moodle/moodle
lib/spout/src/Spout/Reader/XLSX/Helper/SharedStringsCaching/FileBasedStrategy.php
FileBasedStrategy.getStringAtIndex
public function getStringAtIndex($sharedStringIndex) { $tempFilePath = $this->getSharedStringTempFilePath($sharedStringIndex); $indexInFile = $sharedStringIndex % $this->maxNumStringsPerTempFile; if (!$this->globalFunctionsHelper->file_exists($tempFilePath)) { throw new SharedSt...
php
public function getStringAtIndex($sharedStringIndex) { $tempFilePath = $this->getSharedStringTempFilePath($sharedStringIndex); $indexInFile = $sharedStringIndex % $this->maxNumStringsPerTempFile; if (!$this->globalFunctionsHelper->file_exists($tempFilePath)) { throw new SharedSt...
[ "public", "function", "getStringAtIndex", "(", "$", "sharedStringIndex", ")", "{", "$", "tempFilePath", "=", "$", "this", "->", "getSharedStringTempFilePath", "(", "$", "sharedStringIndex", ")", ";", "$", "indexInFile", "=", "$", "sharedStringIndex", "%", "$", "...
Returns the string located at the given index from the cache. @param int $sharedStringIndex Index of the shared string in the sharedStrings.xml file @return string The shared string at the given index @throws \Box\Spout\Reader\Exception\SharedStringNotFoundException If no shared string found for the given index
[ "Returns", "the", "string", "located", "at", "the", "given", "index", "from", "the", "cache", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Reader/XLSX/Helper/SharedStringsCaching/FileBasedStrategy.php#L128-L158
213,050
moodle/moodle
question/engine/bank.php
question_bank.get_qtype
public static function get_qtype($qtypename, $mustexist = true) { global $CFG; if (isset(self::$questiontypes[$qtypename])) { return self::$questiontypes[$qtypename]; } $file = core_component::get_plugin_directory('qtype', $qtypename) . '/questiontype.php'; if (!is_re...
php
public static function get_qtype($qtypename, $mustexist = true) { global $CFG; if (isset(self::$questiontypes[$qtypename])) { return self::$questiontypes[$qtypename]; } $file = core_component::get_plugin_directory('qtype', $qtypename) . '/questiontype.php'; if (!is_re...
[ "public", "static", "function", "get_qtype", "(", "$", "qtypename", ",", "$", "mustexist", "=", "true", ")", "{", "global", "$", "CFG", ";", "if", "(", "isset", "(", "self", "::", "$", "questiontypes", "[", "$", "qtypename", "]", ")", ")", "{", "retu...
Get the question type class for a particular question type. @param string $qtypename the question type name. For example 'multichoice' or 'shortanswer'. @param bool $mustexist if false, the missing question type is returned when the requested question type is not installed. @return question_type the corresponding quest...
[ "Get", "the", "question", "type", "class", "for", "a", "particular", "question", "type", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/bank.php#L87-L107
213,051
moodle/moodle
question/engine/bank.php
question_bank.sort_qtype_array
public static function sort_qtype_array($qtypes, $config = null) { if (is_null($config)) { $config = self::get_config(); } $sortorder = array(); $otherqtypes = array(); foreach ($qtypes as $name => $localname) { $sortvar = $name . '_sortorder'; ...
php
public static function sort_qtype_array($qtypes, $config = null) { if (is_null($config)) { $config = self::get_config(); } $sortorder = array(); $otherqtypes = array(); foreach ($qtypes as $name => $localname) { $sortvar = $name . '_sortorder'; ...
[ "public", "static", "function", "sort_qtype_array", "(", "$", "qtypes", ",", "$", "config", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "config", ")", ")", "{", "$", "config", "=", "self", "::", "get_config", "(", ")", ";", "}", "$", "so...
Sort an array of question types according to the order the admin set up, and then alphabetically for the rest. @param array qtype->name() => qtype->local_name(). @return array sorted array.
[ "Sort", "an", "array", "of", "question", "types", "according", "to", "the", "order", "the", "admin", "set", "up", "and", "then", "alphabetically", "for", "the", "rest", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/bank.php#L169-L196
213,052
moodle/moodle
question/engine/bank.php
question_bank.get_all_question_types_in_categories
public static function get_all_question_types_in_categories($categories) { global $DB; list($categorysql, $params) = $DB->get_in_or_equal($categories); $sql = "SELECT DISTINCT q.qtype FROM {question} q WHERE q.category $categorysql"; $qtypes = $DB->get_f...
php
public static function get_all_question_types_in_categories($categories) { global $DB; list($categorysql, $params) = $DB->get_in_or_equal($categories); $sql = "SELECT DISTINCT q.qtype FROM {question} q WHERE q.category $categorysql"; $qtypes = $DB->get_f...
[ "public", "static", "function", "get_all_question_types_in_categories", "(", "$", "categories", ")", "{", "global", "$", "DB", ";", "list", "(", "$", "categorysql", ",", "$", "params", ")", "=", "$", "DB", "->", "get_in_or_equal", "(", "$", "categories", ")"...
Return a list of the different question types present in the given categories. @param array $categories a list of category ids @return array the list of question types in the categories @since Moodle 3.1
[ "Return", "a", "list", "of", "the", "different", "question", "types", "present", "in", "the", "given", "categories", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/bank.php#L418-L428
213,053
moodle/moodle
question/engine/bank.php
question_finder.get_questions_from_categories
public function get_questions_from_categories($categoryids, $extraconditions, $extraparams = array()) { global $DB; list($qcsql, $qcparams) = $DB->get_in_or_equal($categoryids, SQL_PARAMS_NAMED, 'qc'); if ($extraconditions) { $extraconditions = ' AND (' . $extraconditio...
php
public function get_questions_from_categories($categoryids, $extraconditions, $extraparams = array()) { global $DB; list($qcsql, $qcparams) = $DB->get_in_or_equal($categoryids, SQL_PARAMS_NAMED, 'qc'); if ($extraconditions) { $extraconditions = ' AND (' . $extraconditio...
[ "public", "function", "get_questions_from_categories", "(", "$", "categoryids", ",", "$", "extraconditions", ",", "$", "extraparams", "=", "array", "(", ")", ")", "{", "global", "$", "DB", ";", "list", "(", "$", "qcsql", ",", "$", "qcparams", ")", "=", "...
Get the ids of all the questions in a list of categories. @param array $categoryids either a categoryid, or a comma-separated list category ids, or an array of them. @param string $extraconditions extra conditions to AND with the rest of the where clause. Must use named parameters. @param array $extraparams any paramet...
[ "Get", "the", "ids", "of", "all", "the", "questions", "in", "a", "list", "of", "categories", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/bank.php#L491-L506
213,054
moodle/moodle
question/engine/bank.php
question_finder.get_questions_from_categories_with_usage_counts
public function get_questions_from_categories_with_usage_counts($categoryids, qubaid_condition $qubaids, $extraconditions = '', $extraparams = array()) { return $this->get_questions_from_categories_and_tags_with_usage_counts( $categoryids, $qubaids, $extraconditions, $extraparams); ...
php
public function get_questions_from_categories_with_usage_counts($categoryids, qubaid_condition $qubaids, $extraconditions = '', $extraparams = array()) { return $this->get_questions_from_categories_and_tags_with_usage_counts( $categoryids, $qubaids, $extraconditions, $extraparams); ...
[ "public", "function", "get_questions_from_categories_with_usage_counts", "(", "$", "categoryids", ",", "qubaid_condition", "$", "qubaids", ",", "$", "extraconditions", "=", "''", ",", "$", "extraparams", "=", "array", "(", ")", ")", "{", "return", "$", "this", "...
Get the ids of all the questions in a list of categories, with the number of times they have already been used in a given set of usages. The result array is returned in order of increasing (count previous uses). @param array $categoryids an array question_category ids. @param qubaid_condition $qubaids which question_...
[ "Get", "the", "ids", "of", "all", "the", "questions", "in", "a", "list", "of", "categories", "with", "the", "number", "of", "times", "they", "have", "already", "been", "used", "in", "a", "given", "set", "of", "usages", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/bank.php#L521-L525
213,055
moodle/moodle
question/engine/bank.php
question_finder.get_questions_from_categories_and_tags_with_usage_counts
public function get_questions_from_categories_and_tags_with_usage_counts($categoryids, qubaid_condition $qubaids, $extraconditions = '', $extraparams = array(), $tagids = array()) { global $DB; list($qcsql, $qcparams) = $DB->get_in_or_equal($categoryids, SQL_PARAMS_NAMED, 'qc'); $s...
php
public function get_questions_from_categories_and_tags_with_usage_counts($categoryids, qubaid_condition $qubaids, $extraconditions = '', $extraparams = array(), $tagids = array()) { global $DB; list($qcsql, $qcparams) = $DB->get_in_or_equal($categoryids, SQL_PARAMS_NAMED, 'qc'); $s...
[ "public", "function", "get_questions_from_categories_and_tags_with_usage_counts", "(", "$", "categoryids", ",", "qubaid_condition", "$", "qubaids", ",", "$", "extraconditions", "=", "''", ",", "$", "extraparams", "=", "array", "(", ")", ",", "$", "tagids", "=", "a...
Get the ids of all the questions in a list of categories that have ALL the provided tags, with the number of times they have already been used in a given set of usages. The result array is returned in order of increasing (count previous uses). @param array $categoryids an array of question_category ids. @param qubaid...
[ "Get", "the", "ids", "of", "all", "the", "questions", "in", "a", "list", "of", "categories", "that", "have", "ALL", "the", "provided", "tags", "with", "the", "number", "of", "times", "they", "have", "already", "been", "used", "in", "a", "given", "set", ...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/engine/bank.php#L541-L588
213,056
moodle/moodle
group/autogroup_form.php
autogroup_form.validation
function validation($data, $files) { global $CFG, $COURSE; $errors = parent::validation($data, $files); if ($data['allocateby'] != 'no') { $source = array(); if ($data['cohortid']) { $source['cohortid'] = $data['cohortid']; } if ($...
php
function validation($data, $files) { global $CFG, $COURSE; $errors = parent::validation($data, $files); if ($data['allocateby'] != 'no') { $source = array(); if ($data['cohortid']) { $source['cohortid'] = $data['cohortid']; } if ($...
[ "function", "validation", "(", "$", "data", ",", "$", "files", ")", "{", "global", "$", "CFG", ",", "$", "COURSE", ";", "$", "errors", "=", "parent", "::", "validation", "(", "$", "data", ",", "$", "files", ")", ";", "if", "(", "$", "data", "[", ...
Performs validation of the form information @param array $data @param array $files @return array $errors An array of $errors
[ "Performs", "validation", "of", "the", "form", "information" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/group/autogroup_form.php#L196-L252
213,057
moodle/moodle
cache/stores/mongodb/MongoDB/GridFS/Bucket.php
Bucket.delete
public function delete($id) { $file = $this->collectionWrapper->findFileById($id); $this->collectionWrapper->deleteFileAndChunksById($id); if ($file === null) { throw FileNotFoundException::byId($id, $this->getFilesNamespace()); } }
php
public function delete($id) { $file = $this->collectionWrapper->findFileById($id); $this->collectionWrapper->deleteFileAndChunksById($id); if ($file === null) { throw FileNotFoundException::byId($id, $this->getFilesNamespace()); } }
[ "public", "function", "delete", "(", "$", "id", ")", "{", "$", "file", "=", "$", "this", "->", "collectionWrapper", "->", "findFileById", "(", "$", "id", ")", ";", "$", "this", "->", "collectionWrapper", "->", "deleteFileAndChunksById", "(", "$", "id", "...
Delete a file from the GridFS bucket. If the files collection document is not found, this method will still attempt to delete orphaned chunks. @param mixed $id File ID @throws FileNotFoundException if no file could be selected @throws DriverRuntimeException for other driver errors (e.g. connection errors)
[ "Delete", "a", "file", "from", "the", "GridFS", "bucket", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/Bucket.php#L174-L182
213,058
moodle/moodle
cache/stores/mongodb/MongoDB/GridFS/Bucket.php
Bucket.downloadToStream
public function downloadToStream($id, $destination) { if ( ! is_resource($destination) || get_resource_type($destination) != "stream") { throw InvalidArgumentException::invalidType('$destination', $destination, 'resource'); } stream_copy_to_stream($this->openDownloadStream($id),...
php
public function downloadToStream($id, $destination) { if ( ! is_resource($destination) || get_resource_type($destination) != "stream") { throw InvalidArgumentException::invalidType('$destination', $destination, 'resource'); } stream_copy_to_stream($this->openDownloadStream($id),...
[ "public", "function", "downloadToStream", "(", "$", "id", ",", "$", "destination", ")", "{", "if", "(", "!", "is_resource", "(", "$", "destination", ")", "||", "get_resource_type", "(", "$", "destination", ")", "!=", "\"stream\"", ")", "{", "throw", "Inval...
Writes the contents of a GridFS file to a writable stream. @param mixed $id File ID @param resource $destination Writable Stream @throws FileNotFoundException if no file could be selected @throws InvalidArgumentException if $destination is not a stream @throws DriverRuntimeException for other driver errors...
[ "Writes", "the", "contents", "of", "a", "GridFS", "file", "to", "a", "writable", "stream", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/Bucket.php#L193-L200
213,059
moodle/moodle
cache/stores/mongodb/MongoDB/GridFS/Bucket.php
Bucket.downloadToStreamByName
public function downloadToStreamByName($filename, $destination, array $options = []) { if ( ! is_resource($destination) || get_resource_type($destination) != "stream") { throw InvalidArgumentException::invalidType('$destination', $destination, 'resource'); } stream_copy_to_strea...
php
public function downloadToStreamByName($filename, $destination, array $options = []) { if ( ! is_resource($destination) || get_resource_type($destination) != "stream") { throw InvalidArgumentException::invalidType('$destination', $destination, 'resource'); } stream_copy_to_strea...
[ "public", "function", "downloadToStreamByName", "(", "$", "filename", ",", "$", "destination", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "is_resource", "(", "$", "destination", ")", "||", "get_resource_type", "(", "$", "destina...
Writes the contents of a GridFS file, which is selected by name and revision, to a writable stream. Supported options: * revision (integer): Which revision (i.e. documents with the same filename and different uploadDate) of the file to retrieve. Defaults to -1 (i.e. the most recent revision). Revision numbers are de...
[ "Writes", "the", "contents", "of", "a", "GridFS", "file", "which", "is", "selected", "by", "name", "and", "revision", "to", "a", "writable", "stream", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/Bucket.php#L228-L235
213,060
moodle/moodle
cache/stores/mongodb/MongoDB/GridFS/Bucket.php
Bucket.getFileIdForStream
public function getFileIdForStream($stream) { $file = $this->getRawFileDocumentForStream($stream); /* Filter the raw document through the specified type map, but override * the root type so we can reliably access the ID. */ $typeMap = ['root' => 'stdClass'] + $this->typeMa...
php
public function getFileIdForStream($stream) { $file = $this->getRawFileDocumentForStream($stream); /* Filter the raw document through the specified type map, but override * the root type so we can reliably access the ID. */ $typeMap = ['root' => 'stdClass'] + $this->typeMa...
[ "public", "function", "getFileIdForStream", "(", "$", "stream", ")", "{", "$", "file", "=", "$", "this", "->", "getRawFileDocumentForStream", "(", "$", "stream", ")", ";", "/* Filter the raw document through the specified type map, but override\n * the root type so we...
Gets the file document's ID of the GridFS file associated with a stream. @param resource $stream GridFS stream @return mixed @throws CorruptFileException if the file "_id" field does not exist @throws InvalidArgumentException if $stream is not a GridFS stream @throws DriverRuntimeException for other driver errors (e.g...
[ "Gets", "the", "file", "document", "s", "ID", "of", "the", "GridFS", "file", "associated", "with", "a", "stream", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/Bucket.php#L347-L362
213,061
moodle/moodle
cache/stores/mongodb/MongoDB/GridFS/Bucket.php
Bucket.openDownloadStream
public function openDownloadStream($id) { $file = $this->collectionWrapper->findFileById($id); if ($file === null) { throw FileNotFoundException::byId($id, $this->getFilesNamespace()); } return $this->openDownloadStreamByFile($file); }
php
public function openDownloadStream($id) { $file = $this->collectionWrapper->findFileById($id); if ($file === null) { throw FileNotFoundException::byId($id, $this->getFilesNamespace()); } return $this->openDownloadStreamByFile($file); }
[ "public", "function", "openDownloadStream", "(", "$", "id", ")", "{", "$", "file", "=", "$", "this", "->", "collectionWrapper", "->", "findFileById", "(", "$", "id", ")", ";", "if", "(", "$", "file", "===", "null", ")", "{", "throw", "FileNotFoundExcepti...
Opens a readable stream for reading a GridFS file. @param mixed $id File ID @return resource @throws FileNotFoundException if no file could be selected @throws DriverRuntimeException for other driver errors (e.g. connection errors)
[ "Opens", "a", "readable", "stream", "for", "reading", "a", "GridFS", "file", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/Bucket.php#L424-L433
213,062
moodle/moodle
cache/stores/mongodb/MongoDB/GridFS/Bucket.php
Bucket.openDownloadStreamByName
public function openDownloadStreamByName($filename, array $options = []) { $options += ['revision' => -1]; $file = $this->collectionWrapper->findFileByFilenameAndRevision($filename, $options['revision']); if ($file === null) { throw FileNotFoundException::byFilenameAndRevision(...
php
public function openDownloadStreamByName($filename, array $options = []) { $options += ['revision' => -1]; $file = $this->collectionWrapper->findFileByFilenameAndRevision($filename, $options['revision']); if ($file === null) { throw FileNotFoundException::byFilenameAndRevision(...
[ "public", "function", "openDownloadStreamByName", "(", "$", "filename", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "[", "'revision'", "=>", "-", "1", "]", ";", "$", "file", "=", "$", "this", "->", "collectionWrapper", ...
Opens a readable stream stream to read a GridFS file, which is selected by name and revision. Supported options: * revision (integer): Which revision (i.e. documents with the same filename and different uploadDate) of the file to retrieve. Defaults to -1 (i.e. the most recent revision). Revision numbers are defined ...
[ "Opens", "a", "readable", "stream", "stream", "to", "read", "a", "GridFS", "file", "which", "is", "selected", "by", "name", "and", "revision", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/Bucket.php#L460-L471
213,063
moodle/moodle
cache/stores/mongodb/MongoDB/GridFS/Bucket.php
Bucket.openUploadStream
public function openUploadStream($filename, array $options = []) { $options += ['chunkSizeBytes' => $this->chunkSizeBytes]; $path = $this->createPathForUpload(); $context = stream_context_create([ self::$streamWrapperProtocol => [ 'collectionWrapper' => $this->co...
php
public function openUploadStream($filename, array $options = []) { $options += ['chunkSizeBytes' => $this->chunkSizeBytes]; $path = $this->createPathForUpload(); $context = stream_context_create([ self::$streamWrapperProtocol => [ 'collectionWrapper' => $this->co...
[ "public", "function", "openUploadStream", "(", "$", "filename", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "[", "'chunkSizeBytes'", "=>", "$", "this", "->", "chunkSizeBytes", "]", ";", "$", "path", "=", "$", "this", "-...
Opens a writable stream for writing a GridFS file. Supported options: * _id (mixed): File document identifier. Defaults to a new ObjectId. * chunkSizeBytes (integer): The chunk size in bytes. Defaults to the bucket's chunk size. * disableMD5 (boolean): When true, no MD5 sum will be generated for the stored file. De...
[ "Opens", "a", "writable", "stream", "for", "writing", "a", "GridFS", "file", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/Bucket.php#L493-L507
213,064
moodle/moodle
cache/stores/mongodb/MongoDB/GridFS/Bucket.php
Bucket.rename
public function rename($id, $newFilename) { $updateResult = $this->collectionWrapper->updateFilenameForId($id, $newFilename); if ($updateResult->getModifiedCount() === 1) { return; } /* If the update resulted in no modification, it's possible that the * file di...
php
public function rename($id, $newFilename) { $updateResult = $this->collectionWrapper->updateFilenameForId($id, $newFilename); if ($updateResult->getModifiedCount() === 1) { return; } /* If the update resulted in no modification, it's possible that the * file di...
[ "public", "function", "rename", "(", "$", "id", ",", "$", "newFilename", ")", "{", "$", "updateResult", "=", "$", "this", "->", "collectionWrapper", "->", "updateFilenameForId", "(", "$", "id", ",", "$", "newFilename", ")", ";", "if", "(", "$", "updateRe...
Renames the GridFS file with the specified ID. @param mixed $id File ID @param string $newFilename New filename @throws FileNotFoundException if no file could be selected @throws DriverRuntimeException for other driver errors (e.g. connection errors)
[ "Renames", "the", "GridFS", "file", "with", "the", "specified", "ID", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/Bucket.php#L517-L537
213,065
moodle/moodle
cache/stores/mongodb/MongoDB/GridFS/Bucket.php
Bucket.uploadFromStream
public function uploadFromStream($filename, $source, array $options = []) { if ( ! is_resource($source) || get_resource_type($source) != "stream") { throw InvalidArgumentException::invalidType('$source', $source, 'resource'); } $destination = $this->openUploadStream($filename, $...
php
public function uploadFromStream($filename, $source, array $options = []) { if ( ! is_resource($source) || get_resource_type($source) != "stream") { throw InvalidArgumentException::invalidType('$source', $source, 'resource'); } $destination = $this->openUploadStream($filename, $...
[ "public", "function", "uploadFromStream", "(", "$", "filename", ",", "$", "source", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "is_resource", "(", "$", "source", ")", "||", "get_resource_type", "(", "$", "source", ")", "!=",...
Writes the contents of a readable stream to a GridFS file. Supported options: * _id (mixed): File document identifier. Defaults to a new ObjectId. * chunkSizeBytes (integer): The chunk size in bytes. Defaults to the bucket's chunk size. * disableMD5 (boolean): When true, no MD5 sum will be generated for the stored ...
[ "Writes", "the", "contents", "of", "a", "readable", "stream", "to", "a", "GridFS", "file", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/Bucket.php#L562-L572
213,066
moodle/moodle
cache/stores/mongodb/MongoDB/GridFS/Bucket.php
Bucket.createPathForFile
private function createPathForFile(stdClass $file) { if ( ! is_object($file->_id) || method_exists($file->_id, '__toString')) { $id = (string) $file->_id; } else { $id = \MongoDB\BSON\toJSON(\MongoDB\BSON\fromPHP(['_id' => $file->_id])); } return sprintf( ...
php
private function createPathForFile(stdClass $file) { if ( ! is_object($file->_id) || method_exists($file->_id, '__toString')) { $id = (string) $file->_id; } else { $id = \MongoDB\BSON\toJSON(\MongoDB\BSON\fromPHP(['_id' => $file->_id])); } return sprintf( ...
[ "private", "function", "createPathForFile", "(", "stdClass", "$", "file", ")", "{", "if", "(", "!", "is_object", "(", "$", "file", "->", "_id", ")", "||", "method_exists", "(", "$", "file", "->", "_id", ",", "'__toString'", ")", ")", "{", "$", "id", ...
Creates a path for an existing GridFS file. @param stdClass $file GridFS file document @return string
[ "Creates", "a", "path", "for", "an", "existing", "GridFS", "file", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/Bucket.php#L580-L595
213,067
moodle/moodle
cache/stores/mongodb/MongoDB/GridFS/Bucket.php
Bucket.createPathForUpload
private function createPathForUpload() { return sprintf( '%s://%s/%s.files', self::$streamWrapperProtocol, urlencode($this->databaseName), urlencode($this->bucketName) ); }
php
private function createPathForUpload() { return sprintf( '%s://%s/%s.files', self::$streamWrapperProtocol, urlencode($this->databaseName), urlencode($this->bucketName) ); }
[ "private", "function", "createPathForUpload", "(", ")", "{", "return", "sprintf", "(", "'%s://%s/%s.files'", ",", "self", "::", "$", "streamWrapperProtocol", ",", "urlencode", "(", "$", "this", "->", "databaseName", ")", ",", "urlencode", "(", "$", "this", "->...
Creates a path for a new GridFS file, which does not yet have an ID. @return string
[ "Creates", "a", "path", "for", "a", "new", "GridFS", "file", "which", "does", "not", "yet", "have", "an", "ID", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/Bucket.php#L602-L610
213,068
moodle/moodle
cache/stores/mongodb/MongoDB/GridFS/Bucket.php
Bucket.openDownloadStreamByFile
private function openDownloadStreamByFile(stdClass $file) { $path = $this->createPathForFile($file); $context = stream_context_create([ self::$streamWrapperProtocol => [ 'collectionWrapper' => $this->collectionWrapper, 'file' => $file, ], ...
php
private function openDownloadStreamByFile(stdClass $file) { $path = $this->createPathForFile($file); $context = stream_context_create([ self::$streamWrapperProtocol => [ 'collectionWrapper' => $this->collectionWrapper, 'file' => $file, ], ...
[ "private", "function", "openDownloadStreamByFile", "(", "stdClass", "$", "file", ")", "{", "$", "path", "=", "$", "this", "->", "createPathForFile", "(", "$", "file", ")", ";", "$", "context", "=", "stream_context_create", "(", "[", "self", "::", "$", "str...
Opens a readable stream for the GridFS file. @param stdClass $file GridFS file document @return resource
[ "Opens", "a", "readable", "stream", "for", "the", "GridFS", "file", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/cache/stores/mongodb/MongoDB/GridFS/Bucket.php#L653-L664
213,069
moodle/moodle
question/classes/statistics/questions/calculated_question_summary.php
calculated_question_summary.get_min_max_of
public function get_min_max_of($attribute) { $getmethod = 'get_min_max_of_' . $attribute; if (method_exists($this, $getmethod)) { return $this->$getmethod(); } else { $min = $max = null; $set = false; // We cannot simply use min or max functions b...
php
public function get_min_max_of($attribute) { $getmethod = 'get_min_max_of_' . $attribute; if (method_exists($this, $getmethod)) { return $this->$getmethod(); } else { $min = $max = null; $set = false; // We cannot simply use min or max functions b...
[ "public", "function", "get_min_max_of", "(", "$", "attribute", ")", "{", "$", "getmethod", "=", "'get_min_max_of_'", ".", "$", "attribute", ";", "if", "(", "method_exists", "(", "$", "this", ",", "$", "getmethod", ")", ")", "{", "return", "$", "this", "-...
Returns the minimum and maximum values of the given attribute in the summarised calculated stats. @param string $attribute The attribute that we are looking for its extremums. @return array An array of [min,max]
[ "Returns", "the", "minimum", "and", "maximum", "values", "of", "the", "given", "attribute", "in", "the", "summarised", "calculated", "stats", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/calculated_question_summary.php#L81-L106
213,070
moodle/moodle
question/classes/statistics/questions/calculated_question_summary.php
calculated_question_summary.get_min_max_of_sd
protected function get_min_max_of_sd() { $min = $max = null; $set = false; foreach ($this->subqstats as $subqstat) { if (isset($subqstat->sd) && $subqstat->maxmark) { $value = $subqstat->sd / $subqstat->maxmark; } else { $value = null; ...
php
protected function get_min_max_of_sd() { $min = $max = null; $set = false; foreach ($this->subqstats as $subqstat) { if (isset($subqstat->sd) && $subqstat->maxmark) { $value = $subqstat->sd / $subqstat->maxmark; } else { $value = null; ...
[ "protected", "function", "get_min_max_of_sd", "(", ")", "{", "$", "min", "=", "$", "max", "=", "null", ";", "$", "set", "=", "false", ";", "foreach", "(", "$", "this", "->", "subqstats", "as", "$", "subqstat", ")", "{", "if", "(", "isset", "(", "$"...
Returns the minimum and maximum values of the standard deviation in the summarised calculated stats. @return array An array of [min,max]
[ "Returns", "the", "minimum", "and", "maximum", "values", "of", "the", "standard", "deviation", "in", "the", "summarised", "calculated", "stats", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/calculated_question_summary.php#L112-L135
213,071
moodle/moodle
question/classes/statistics/questions/calculated_question_summary.php
calculated_question_summary.max
protected function max(float $value1 = null, float $value2 = null) { $temp1 = $value1 ?: 0; $temp2 = $value2 ?: 0; $tempmax = max($temp1, $temp2); if (!$tempmax && $value1 !== 0 && $value2 !== 0) { $max = null; } else { $max = $tempmax; } ...
php
protected function max(float $value1 = null, float $value2 = null) { $temp1 = $value1 ?: 0; $temp2 = $value2 ?: 0; $tempmax = max($temp1, $temp2); if (!$tempmax && $value1 !== 0 && $value2 !== 0) { $max = null; } else { $max = $tempmax; } ...
[ "protected", "function", "max", "(", "float", "$", "value1", "=", "null", ",", "float", "$", "value2", "=", "null", ")", "{", "$", "temp1", "=", "$", "value1", "?", ":", "0", ";", "$", "temp2", "=", "$", "value2", "?", ":", "0", ";", "$", "temp...
Find higher value. A zero value is almost considered equal to zero in comparisons. The only difference is that when being compared to zero, zero is higher than null. @param float|null $value1 @param float|null $value2 @return float|null
[ "Find", "higher", "value", ".", "A", "zero", "value", "is", "almost", "considered", "equal", "to", "zero", "in", "comparisons", ".", "The", "only", "difference", "is", "that", "when", "being", "compared", "to", "zero", "zero", "is", "higher", "than", "null...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/calculated_question_summary.php#L146-L159
213,072
moodle/moodle
question/classes/statistics/questions/calculated_question_summary.php
calculated_question_summary.min
protected function min(float $value1 = null, float $value2 = null) { $temp1 = $value1 ?: 0; $temp2 = $value2 ?: 0; $tempmin = min($temp1, $temp2); if (!$tempmin && $value1 !== 0 && $value2 !== 0) { $min = null; } else { $min = $tempmin; } ...
php
protected function min(float $value1 = null, float $value2 = null) { $temp1 = $value1 ?: 0; $temp2 = $value2 ?: 0; $tempmin = min($temp1, $temp2); if (!$tempmin && $value1 !== 0 && $value2 !== 0) { $min = null; } else { $min = $tempmin; } ...
[ "protected", "function", "min", "(", "float", "$", "value1", "=", "null", ",", "float", "$", "value2", "=", "null", ")", "{", "$", "temp1", "=", "$", "value1", "?", ":", "0", ";", "$", "temp2", "=", "$", "value2", "?", ":", "0", ";", "$", "temp...
Find lower value. A zero value is almost considered equal to zero in comparisons. The only difference is that when being compared to zero, zero is lower than null. @param float|null $value1 @param float|null $value2 @return mixed|null
[ "Find", "lower", "value", ".", "A", "zero", "value", "is", "almost", "considered", "equal", "to", "zero", "in", "comparisons", ".", "The", "only", "difference", "is", "that", "when", "being", "compared", "to", "zero", "zero", "is", "lower", "than", "null",...
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/classes/statistics/questions/calculated_question_summary.php#L170-L183
213,073
moodle/moodle
lib/spout/src/Spout/Writer/XLSX/Helper/SharedStringsHelper.php
SharedStringsHelper.writeString
public function writeString($string) { fwrite($this->sharedStringsFilePointer, '<si><t xml:space="preserve">' . $this->stringsEscaper->escape($string) . '</t></si>'); $this->numSharedStrings++; // Shared string ID is zero-based return ($this->numSharedStrings - 1); }
php
public function writeString($string) { fwrite($this->sharedStringsFilePointer, '<si><t xml:space="preserve">' . $this->stringsEscaper->escape($string) . '</t></si>'); $this->numSharedStrings++; // Shared string ID is zero-based return ($this->numSharedStrings - 1); }
[ "public", "function", "writeString", "(", "$", "string", ")", "{", "fwrite", "(", "$", "this", "->", "sharedStringsFilePointer", ",", "'<si><t xml:space=\"preserve\">'", ".", "$", "this", "->", "stringsEscaper", "->", "escape", "(", "$", "string", ")", ".", "'...
Writes the given string into the sharedStrings.xml file. Starting and ending whitespaces are preserved. @param string $string @return int ID of the written shared string
[ "Writes", "the", "given", "string", "into", "the", "sharedStrings", ".", "xml", "file", ".", "Starting", "and", "ending", "whitespaces", "are", "preserved", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/XLSX/Helper/SharedStringsHelper.php#L75-L82
213,074
moodle/moodle
lib/spout/src/Spout/Writer/XLSX/Helper/SharedStringsHelper.php
SharedStringsHelper.close
public function close() { if (!is_resource($this->sharedStringsFilePointer)) { return; } fwrite($this->sharedStringsFilePointer, '</sst>'); // Replace the default strings count with the actual number of shared strings in the file header $firstPartHeaderLength = ...
php
public function close() { if (!is_resource($this->sharedStringsFilePointer)) { return; } fwrite($this->sharedStringsFilePointer, '</sst>'); // Replace the default strings count with the actual number of shared strings in the file header $firstPartHeaderLength = ...
[ "public", "function", "close", "(", ")", "{", "if", "(", "!", "is_resource", "(", "$", "this", "->", "sharedStringsFilePointer", ")", ")", "{", "return", ";", "}", "fwrite", "(", "$", "this", "->", "sharedStringsFilePointer", ",", "'</sst>'", ")", ";", "...
Finishes writing the data in the sharedStrings.xml file and closes the file. @return void
[ "Finishes", "writing", "the", "data", "in", "the", "sharedStrings", ".", "xml", "file", "and", "closes", "the", "file", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/spout/src/Spout/Writer/XLSX/Helper/SharedStringsHelper.php#L89-L106
213,075
moodle/moodle
lib/classes/lock/lock_config.php
lock_config.get_lock_factory
public static function get_lock_factory($type) { global $CFG, $DB; $lockfactory = null; if (during_initial_install()) { $lockfactory = new \core\lock\installation_lock_factory($type); } else if (isset($CFG->lock_factory) && $CFG->lock_factory != 'auto') { if (!cl...
php
public static function get_lock_factory($type) { global $CFG, $DB; $lockfactory = null; if (during_initial_install()) { $lockfactory = new \core\lock\installation_lock_factory($type); } else if (isset($CFG->lock_factory) && $CFG->lock_factory != 'auto') { if (!cl...
[ "public", "static", "function", "get_lock_factory", "(", "$", "type", ")", "{", "global", "$", "CFG", ",", "$", "DB", ";", "$", "lockfactory", "=", "null", ";", "if", "(", "during_initial_install", "(", ")", ")", "{", "$", "lockfactory", "=", "new", "\...
Get an instance of the currently configured locking subclass. @param string $type - Unique namespace for the locks generated by this factory. e.g. core_cron @return \core\lock\lock_factory @throws \coding_exception
[ "Get", "an", "instance", "of", "the", "currently", "configured", "locking", "subclass", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/lock/lock_config.php#L47-L78
213,076
moodle/moodle
blocks/recentlyaccesseditems/classes/privacy/provider.php
provider.export_recentitems
protected static function export_recentitems(int $userid, \context $context) { global $DB; $sql = "SELECT ra.id, c.fullname, ra.timeaccess, m.name, ra.cmid FROM {block_recentlyaccesseditems} ra JOIN {course} c ON c.id = ra.courseid JOIN {course_modul...
php
protected static function export_recentitems(int $userid, \context $context) { global $DB; $sql = "SELECT ra.id, c.fullname, ra.timeaccess, m.name, ra.cmid FROM {block_recentlyaccesseditems} ra JOIN {course} c ON c.id = ra.courseid JOIN {course_modul...
[ "protected", "static", "function", "export_recentitems", "(", "int", "$", "userid", ",", "\\", "context", "$", "context", ")", "{", "global", "$", "DB", ";", "$", "sql", "=", "\"SELECT ra.id, c.fullname, ra.timeaccess, m.name, ra.cmid\n FROM {block_recent...
Export information about the most recently accessed items. @param int $userid The user ID. @param \context $context The user context.
[ "Export", "information", "about", "the", "most", "recently", "accessed", "items", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/blocks/recentlyaccesseditems/classes/privacy/provider.php#L124-L146
213,077
moodle/moodle
mod/lesson/pagetypes/shortanswer.php
lesson_page_type_shortanswer.create_answers
public function create_answers($properties) { if (isset($properties->enableotheranswers) && $properties->enableotheranswers) { $properties->response_editor = array_values($properties->response_editor); $properties->jumpto = array_values($properties->jumpto); $properties->scor...
php
public function create_answers($properties) { if (isset($properties->enableotheranswers) && $properties->enableotheranswers) { $properties->response_editor = array_values($properties->response_editor); $properties->jumpto = array_values($properties->jumpto); $properties->scor...
[ "public", "function", "create_answers", "(", "$", "properties", ")", "{", "if", "(", "isset", "(", "$", "properties", "->", "enableotheranswers", ")", "&&", "$", "properties", "->", "enableotheranswers", ")", "{", "$", "properties", "->", "response_editor", "=...
Creates answers for this page type. @param object $properties The answer properties.
[ "Creates", "answers", "for", "this", "page", "type", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/pagetypes/shortanswer.php#L80-L90
213,078
moodle/moodle
mod/lesson/pagetypes/shortanswer.php
lesson_page_type_shortanswer.update
public function update($properties, $context = null, $maxbytes = null) { if ($properties->enableotheranswers) { $properties->response_editor = array_values($properties->response_editor); $properties->jumpto = array_values($properties->jumpto); $properties->score = array_value...
php
public function update($properties, $context = null, $maxbytes = null) { if ($properties->enableotheranswers) { $properties->response_editor = array_values($properties->response_editor); $properties->jumpto = array_values($properties->jumpto); $properties->score = array_value...
[ "public", "function", "update", "(", "$", "properties", ",", "$", "context", "=", "null", ",", "$", "maxbytes", "=", "null", ")", "{", "if", "(", "$", "properties", "->", "enableotheranswers", ")", "{", "$", "properties", "->", "response_editor", "=", "a...
Update the answers for this page type. @param object $properties The answer properties. @param context $context The context for this module. @param int $maxbytes The maximum bytes for any uploades.
[ "Update", "the", "answers", "for", "this", "page", "type", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/pagetypes/shortanswer.php#L99-L109
213,079
moodle/moodle
mod/lesson/pagetypes/shortanswer.php
lesson_page_type_shortanswer.update_form_data
public function update_form_data(stdClass $data) : stdClass { $answercount = count($this->get_answers()); // Check for other answer entry. $lastanswer = $data->{'answer_editor[' . ($answercount - 1) . ']'}; if (strpos($lastanswer, LESSON_OTHER_ANSWERS) !== false) { $data->{'a...
php
public function update_form_data(stdClass $data) : stdClass { $answercount = count($this->get_answers()); // Check for other answer entry. $lastanswer = $data->{'answer_editor[' . ($answercount - 1) . ']'}; if (strpos($lastanswer, LESSON_OTHER_ANSWERS) !== false) { $data->{'a...
[ "public", "function", "update_form_data", "(", "stdClass", "$", "data", ")", ":", "stdClass", "{", "$", "answercount", "=", "count", "(", "$", "this", "->", "get_answers", "(", ")", ")", ";", "// Check for other answer entry.", "$", "lastanswer", "=", "$", "...
Make updates to the form data if required. In this case to put the all other answer data into the write section of the form. @param stdClass $data The form data to update. @return stdClass The updated fom data.
[ "Make", "updates", "to", "the", "form", "data", "if", "required", ".", "In", "this", "case", "to", "put", "the", "all", "other", "answer", "data", "into", "the", "write", "section", "of", "the", "form", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/lesson/pagetypes/shortanswer.php#L393-L412
213,080
moodle/moodle
backup/util/dbops/backup_structure_dbops.class.php
backup_structure_dbops.annotate_files
public static function annotate_files($backupid, $contextid, $component, $filearea, $itemid, \core\progress\base $progress = null) { global $DB; $sql = 'SELECT id FROM {files} WHERE contextid = ? AND component = ?'; $params = arra...
php
public static function annotate_files($backupid, $contextid, $component, $filearea, $itemid, \core\progress\base $progress = null) { global $DB; $sql = 'SELECT id FROM {files} WHERE contextid = ? AND component = ?'; $params = arra...
[ "public", "static", "function", "annotate_files", "(", "$", "backupid", ",", "$", "contextid", ",", "$", "component", ",", "$", "filearea", ",", "$", "itemid", ",", "\\", "core", "\\", "progress", "\\", "base", "$", "progress", "=", "null", ")", "{", "...
Adds backup id database record for all files in the given file area. @param string $backupid Backup ID @param int $contextid Context id @param string $component Component @param string $filearea File area @param int $itemid Item id @param \core\progress\base $progress
[ "Adds", "backup", "id", "database", "record", "for", "all", "files", "in", "the", "given", "file", "area", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/dbops/backup_structure_dbops.class.php#L118-L150
213,081
moodle/moodle
backup/util/dbops/backup_structure_dbops.class.php
backup_structure_dbops.move_annotations_to_final
public static function move_annotations_to_final($backupid, $itemname, \core\progress\base $progress) { global $DB; $progress->start_progress('move_annotations_to_final'); $rs = $DB->get_recordset('backup_ids_temp', array('backupid' => $backupid, 'itemname' => $itemname)); $progress->pro...
php
public static function move_annotations_to_final($backupid, $itemname, \core\progress\base $progress) { global $DB; $progress->start_progress('move_annotations_to_final'); $rs = $DB->get_recordset('backup_ids_temp', array('backupid' => $backupid, 'itemname' => $itemname)); $progress->pro...
[ "public", "static", "function", "move_annotations_to_final", "(", "$", "backupid", ",", "$", "itemname", ",", "\\", "core", "\\", "progress", "\\", "base", "$", "progress", ")", "{", "global", "$", "DB", ";", "$", "progress", "->", "start_progress", "(", "...
Moves all the existing 'item' annotations to their final 'itemfinal' ones for a given backup. @param string $backupid Backup ID @param string $itemname Item name @param \core\progress\base $progress Progress tracker
[ "Moves", "all", "the", "existing", "item", "annotations", "to", "their", "final", "itemfinal", "ones", "for", "a", "given", "backup", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/backup/util/dbops/backup_structure_dbops.class.php#L160-L178
213,082
moodle/moodle
lib/classes/task/grade_history_cleanup_task.php
grade_history_cleanup_task.execute
public function execute() { global $CFG, $DB; if (!empty($CFG->gradehistorylifetime)) { $now = time(); $histlifetime = $now - ($CFG->gradehistorylifetime * DAYSECS); $tables = [ 'grade_outcomes_history', 'grade_categories_history', ...
php
public function execute() { global $CFG, $DB; if (!empty($CFG->gradehistorylifetime)) { $now = time(); $histlifetime = $now - ($CFG->gradehistorylifetime * DAYSECS); $tables = [ 'grade_outcomes_history', 'grade_categories_history', ...
[ "public", "function", "execute", "(", ")", "{", "global", "$", "CFG", ",", "$", "DB", ";", "if", "(", "!", "empty", "(", "$", "CFG", "->", "gradehistorylifetime", ")", ")", "{", "$", "now", "=", "time", "(", ")", ";", "$", "histlifetime", "=", "$...
Cleanup history tables.
[ "Cleanup", "history", "tables", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/lib/classes/task/grade_history_cleanup_task.php#L47-L66
213,083
moodle/moodle
user/classes/output/myprofile/category.php
category.sort_nodes
public function sort_nodes() { $tempnodes = array(); $this->validate_after_order(); // First content noes. foreach ($this->nodes as $node) { $after = $node->after; $content = $node->content; if (($after == null && !empty($content)) || $node->name === ...
php
public function sort_nodes() { $tempnodes = array(); $this->validate_after_order(); // First content noes. foreach ($this->nodes as $node) { $after = $node->after; $content = $node->content; if (($after == null && !empty($content)) || $node->name === ...
[ "public", "function", "sort_nodes", "(", ")", "{", "$", "tempnodes", "=", "array", "(", ")", ";", "$", "this", "->", "validate_after_order", "(", ")", ";", "// First content noes.", "foreach", "(", "$", "this", "->", "nodes", "as", "$", "node", ")", "{",...
Sort nodes of the category in the order in which they should be displayed. @see \core_user\output\myprofile\tree::sort_categories() @throws \coding_exception
[ "Sort", "nodes", "of", "the", "category", "in", "the", "order", "in", "which", "they", "should", "be", "displayed", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/output/myprofile/category.php#L108-L137
213,084
moodle/moodle
user/classes/output/myprofile/category.php
category.validate_after_order
protected function validate_after_order() { $nodearray = $this->nodes; foreach ($this->nodes as $node) { $after = $node->after; if (!empty($after)) { if (empty($nodearray[$after])) { throw new \coding_exception('node {$node->name} specified con...
php
protected function validate_after_order() { $nodearray = $this->nodes; foreach ($this->nodes as $node) { $after = $node->after; if (!empty($after)) { if (empty($nodearray[$after])) { throw new \coding_exception('node {$node->name} specified con...
[ "protected", "function", "validate_after_order", "(", ")", "{", "$", "nodearray", "=", "$", "this", "->", "nodes", ";", "foreach", "(", "$", "this", "->", "nodes", "as", "$", "node", ")", "{", "$", "after", "=", "$", "node", "->", "after", ";", "if",...
Verifies that node with content can come after node with content only . Also verifies the same thing for nodes without content. @throws \coding_exception
[ "Verifies", "that", "node", "with", "content", "can", "come", "after", "node", "with", "content", "only", ".", "Also", "verifies", "the", "same", "thing", "for", "nodes", "without", "content", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/output/myprofile/category.php#L144-L164
213,085
moodle/moodle
user/classes/output/myprofile/category.php
category.find_nodes_after
protected function find_nodes_after($node) { $return = array(); $nodearray = $this->nodes; foreach ($nodearray as $nodeelement) { if ($nodeelement->after === $node->name) { // Find all nodes that comes after this node as well. $return = array_merge($re...
php
protected function find_nodes_after($node) { $return = array(); $nodearray = $this->nodes; foreach ($nodearray as $nodeelement) { if ($nodeelement->after === $node->name) { // Find all nodes that comes after this node as well. $return = array_merge($re...
[ "protected", "function", "find_nodes_after", "(", "$", "node", ")", "{", "$", "return", "=", "array", "(", ")", ";", "$", "nodearray", "=", "$", "this", "->", "nodes", ";", "foreach", "(", "$", "nodearray", "as", "$", "nodeelement", ")", "{", "if", "...
Given a node object find all node objects that should appear after it. @param node $node node object @return array
[ "Given", "a", "node", "object", "find", "all", "node", "objects", "that", "should", "appear", "after", "it", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/output/myprofile/category.php#L173-L183
213,086
moodle/moodle
auth/cas/auth.php
auth_plugin_cas.user_login
function user_login ($username, $password) { $this->connectCAS(); return phpCAS::isAuthenticated() && (trim(core_text::strtolower(phpCAS::getUser())) == $username); }
php
function user_login ($username, $password) { $this->connectCAS(); return phpCAS::isAuthenticated() && (trim(core_text::strtolower(phpCAS::getUser())) == $username); }
[ "function", "user_login", "(", "$", "username", ",", "$", "password", ")", "{", "$", "this", "->", "connectCAS", "(", ")", ";", "return", "phpCAS", "::", "isAuthenticated", "(", ")", "&&", "(", "trim", "(", "core_text", "::", "strtolower", "(", "phpCAS",...
Authenticates user against CAS Returns true if the username and password work and false if they are wrong or don't exist. @param string $username The username (with system magic quotes) @param string $password The password (with system magic quotes) @return bool Authentication success or failure.
[ "Authenticates", "user", "against", "CAS", "Returns", "true", "if", "the", "username", "and", "password", "work", "and", "false", "if", "they", "are", "wrong", "or", "don", "t", "exist", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/auth.php#L72-L75
213,087
moodle/moodle
auth/cas/auth.php
auth_plugin_cas.sync_users
function sync_users($do_updates=true) { if (empty($this->config->host_url)) { error_log('[AUTH CAS] '.get_string('noldapserver', 'auth_cas')); return; } parent::sync_users($do_updates); }
php
function sync_users($do_updates=true) { if (empty($this->config->host_url)) { error_log('[AUTH CAS] '.get_string('noldapserver', 'auth_cas')); return; } parent::sync_users($do_updates); }
[ "function", "sync_users", "(", "$", "do_updates", "=", "true", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "config", "->", "host_url", ")", ")", "{", "error_log", "(", "'[AUTH CAS] '", ".", "get_string", "(", "'noldapserver'", ",", "'auth_cas'", ...
Syncronizes users from LDAP server to moodle user table. If no LDAP servers are configured, simply return. Otherwise, call parent class method to do the work. @param bool $do_updates will do pull in data updates from LDAP if relevant @return nothing
[ "Syncronizes", "users", "from", "LDAP", "server", "to", "moodle", "user", "table", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/auth.php#L314-L320
213,088
moodle/moodle
auth/cas/auth.php
auth_plugin_cas.postlogout_hook
public function postlogout_hook($user) { global $CFG; // Only redirect to CAS logout if the user is logged as a CAS user. if (!empty($this->config->logoutcas) && $user->auth == $this->authtype) { $backurl = !empty($this->config->logout_return_url) ? $this->config->logout_return_url :...
php
public function postlogout_hook($user) { global $CFG; // Only redirect to CAS logout if the user is logged as a CAS user. if (!empty($this->config->logoutcas) && $user->auth == $this->authtype) { $backurl = !empty($this->config->logout_return_url) ? $this->config->logout_return_url :...
[ "public", "function", "postlogout_hook", "(", "$", "user", ")", "{", "global", "$", "CFG", ";", "// Only redirect to CAS logout if the user is logged as a CAS user.", "if", "(", "!", "empty", "(", "$", "this", "->", "config", "->", "logoutcas", ")", "&&", "$", "...
Post logout hook. Note: this method replace the prelogout_hook method to avoid redirect to CAS logout before the event userlogout being triggered. @param stdClass $user clone of USER object object before the user session was terminated
[ "Post", "logout", "hook", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/auth/cas/auth.php#L346-L354
213,089
moodle/moodle
admin/tool/log/store/legacy/classes/log/store.php
store.replace_sql_legacy
protected static function replace_sql_legacy($selectwhere, array $params, $sort = '') { // Following mapping is done to make can_delete_course() compatible with legacy store. if ($selectwhere == "userid = :userid AND courseid = :courseid AND eventname = :eventname AND timecreated > :since" and ...
php
protected static function replace_sql_legacy($selectwhere, array $params, $sort = '') { // Following mapping is done to make can_delete_course() compatible with legacy store. if ($selectwhere == "userid = :userid AND courseid = :courseid AND eventname = :eventname AND timecreated > :since" and ...
[ "protected", "static", "function", "replace_sql_legacy", "(", "$", "selectwhere", ",", "array", "$", "params", ",", "$", "sort", "=", "''", ")", "{", "// Following mapping is done to make can_delete_course() compatible with legacy store.", "if", "(", "$", "selectwhere", ...
This method contains mapping required for Moodle core to make legacy store compatible with other sql_reader based queries. @param string $selectwhere Select statment @param array $params params for the sql @param string $sort sort fields @return array returns an array containing the sql predicate, an array of params ...
[ "This", "method", "contains", "mapping", "required", "for", "Moodle", "core", "to", "make", "legacy", "store", "compatible", "with", "other", "sql_reader", "based", "queries", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/admin/tool/log/store/legacy/classes/log/store.php#L67-L92
213,090
moodle/moodle
mod/book/backup/moodle2/restore_book_stepslib.php
restore_book_activity_structure_step.process_book_chapter
protected function process_book_chapter($data) { global $DB; $data = (object)$data; $oldid = $data->id; $data->course = $this->get_courseid(); $data->bookid = $this->get_new_parentid('book'); $newitemid = $DB->insert_record('book_chapters', $data); $this->set_m...
php
protected function process_book_chapter($data) { global $DB; $data = (object)$data; $oldid = $data->id; $data->course = $this->get_courseid(); $data->bookid = $this->get_new_parentid('book'); $newitemid = $DB->insert_record('book_chapters', $data); $this->set_m...
[ "protected", "function", "process_book_chapter", "(", "$", "data", ")", "{", "global", "$", "DB", ";", "$", "data", "=", "(", "object", ")", "$", "data", ";", "$", "oldid", "=", "$", "data", "->", "id", ";", "$", "data", "->", "course", "=", "$", ...
Process chapter tag information @param array $data information
[ "Process", "chapter", "tag", "information" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/book/backup/moodle2/restore_book_stepslib.php#L65-L76
213,091
moodle/moodle
user/classes/output/myprofile/manager.php
manager.build_tree
public static function build_tree($user, $iscurrentuser, $course = null) { global $CFG; $tree = new tree(); // Add core nodes. require_once($CFG->libdir . "/myprofilelib.php"); core_myprofile_navigation($tree, $user, $iscurrentuser, $course); // Core components. ...
php
public static function build_tree($user, $iscurrentuser, $course = null) { global $CFG; $tree = new tree(); // Add core nodes. require_once($CFG->libdir . "/myprofilelib.php"); core_myprofile_navigation($tree, $user, $iscurrentuser, $course); // Core components. ...
[ "public", "static", "function", "build_tree", "(", "$", "user", ",", "$", "iscurrentuser", ",", "$", "course", "=", "null", ")", "{", "global", "$", "CFG", ";", "$", "tree", "=", "new", "tree", "(", ")", ";", "// Add core nodes.", "require_once", "(", ...
Parse all callbacks and builds the tree. @param integer $user ID of the user for which the profile is displayed. @param bool $iscurrentuser true if the profile being viewed is of current user, else false. @param \stdClass $course Course object @return tree Fully build tree to be rendered on my profile page.
[ "Parse", "all", "callbacks", "and", "builds", "the", "tree", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/user/classes/output/myprofile/manager.php#L46-L81
213,092
moodle/moodle
course/switchrole_form.php
switchrole_form.in_alternative_role
protected function in_alternative_role($context) { global $USER, $PAGE; if (!empty($USER->access['rsw']) && is_array($USER->access['rsw'])) { if (!empty($PAGE->context) && !empty($USER->access['rsw'][$PAGE->context->path])) { return $USER->access['rsw'][$PAGE->context->path];...
php
protected function in_alternative_role($context) { global $USER, $PAGE; if (!empty($USER->access['rsw']) && is_array($USER->access['rsw'])) { if (!empty($PAGE->context) && !empty($USER->access['rsw'][$PAGE->context->path])) { return $USER->access['rsw'][$PAGE->context->path];...
[ "protected", "function", "in_alternative_role", "(", "$", "context", ")", "{", "global", "$", "USER", ",", "$", "PAGE", ";", "if", "(", "!", "empty", "(", "$", "USER", "->", "access", "[", "'rsw'", "]", ")", "&&", "is_array", "(", "$", "USER", "->", ...
Determine whether the user is assuming another role This function checks to see if the user is assuming another role by means of role switching. In doing this we compare each RSW key (context path) against the current context path. This ensures that we can provide the switching options against both the course and any ...
[ "Determine", "whether", "the", "user", "is", "assuming", "another", "role" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/switchrole_form.php#L46-L59
213,093
moodle/moodle
course/classes/analytics/indicator/potential_cognitive_depth.php
potential_cognitive_depth.get_cognitive_indicator
protected function get_cognitive_indicator($modname) { $indicators = \core_analytics\manager::get_all_indicators(); foreach ($indicators as $indicator) { if ($indicator instanceof community_of_inquiry_activity && $indicator->get_indicator_type() === community_of_inquiry_a...
php
protected function get_cognitive_indicator($modname) { $indicators = \core_analytics\manager::get_all_indicators(); foreach ($indicators as $indicator) { if ($indicator instanceof community_of_inquiry_activity && $indicator->get_indicator_type() === community_of_inquiry_a...
[ "protected", "function", "get_cognitive_indicator", "(", "$", "modname", ")", "{", "$", "indicators", "=", "\\", "core_analytics", "\\", "manager", "::", "get_all_indicators", "(", ")", ";", "foreach", "(", "$", "indicators", "as", "$", "indicator", ")", "{", ...
Returns the cognitive depth class of this indicator. @param string $modname @return \core_analytics\local\indicator\base|false
[ "Returns", "the", "cognitive", "depth", "class", "of", "this", "indicator", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/course/classes/analytics/indicator/potential_cognitive_depth.php#L125-L135
213,094
moodle/moodle
question/type/ddmarker/shapes.php
qtype_ddmarker_shape.is_only_numbers
protected function is_only_numbers() { $args = func_get_args(); foreach ($args as $arg) { if (0 === preg_match('!^[0-9]+$!', $arg)) { return false; } } return true; }
php
protected function is_only_numbers() { $args = func_get_args(); foreach ($args as $arg) { if (0 === preg_match('!^[0-9]+$!', $arg)) { return false; } } return true; }
[ "protected", "function", "is_only_numbers", "(", ")", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "foreach", "(", "$", "args", "as", "$", "arg", ")", "{", "if", "(", "0", "===", "preg_match", "(", "'!^[0-9]+$!'", ",", "$", "arg", ")", ")",...
Test if all passed parameters consist of only numbers. @return bool True if only numbers
[ "Test", "if", "all", "passed", "parameters", "consist", "of", "only", "numbers", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/ddmarker/shapes.php#L67-L75
213,095
moodle/moodle
question/type/ddmarker/shapes.php
qtype_ddmarker_shape.is_point_in_bounding_box
protected function is_point_in_bounding_box($pointxy, $xleftytop, $xrightybottom) { if ($pointxy[0] < $xleftytop[0]) { return false; } else if ($pointxy[0] > $xrightybottom[0]) { return false; } else if ($pointxy[1] < $xleftytop[1]) { return false; } e...
php
protected function is_point_in_bounding_box($pointxy, $xleftytop, $xrightybottom) { if ($pointxy[0] < $xleftytop[0]) { return false; } else if ($pointxy[0] > $xrightybottom[0]) { return false; } else if ($pointxy[1] < $xleftytop[1]) { return false; } e...
[ "protected", "function", "is_point_in_bounding_box", "(", "$", "pointxy", ",", "$", "xleftytop", ",", "$", "xrightybottom", ")", "{", "if", "(", "$", "pointxy", "[", "0", "]", "<", "$", "xleftytop", "[", "0", "]", ")", "{", "return", "false", ";", "}",...
Checks if the point is within the bounding box made by top left and bottom right @param array $pointxy Array of the point (x, y) @param array $xleftytop Top left point of bounding box @param array $xrightybottom Bottom left point of bounding box @return bool
[ "Checks", "if", "the", "point", "is", "within", "the", "bounding", "box", "made", "by", "top", "left", "and", "bottom", "right" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/ddmarker/shapes.php#L85-L96
213,096
moodle/moodle
question/type/ddmarker/shapes.php
qtype_ddmarker_shape.get_coords_interpreter_error
public function get_coords_interpreter_error() { if ($this->error) { $a = new stdClass(); $a->shape = self::human_readable_name(true); $a->coordsstring = self::human_readable_coords_format(); return get_string('formerror_'.$this->error, 'qtype_ddmarker', $a); ...
php
public function get_coords_interpreter_error() { if ($this->error) { $a = new stdClass(); $a->shape = self::human_readable_name(true); $a->coordsstring = self::human_readable_coords_format(); return get_string('formerror_'.$this->error, 'qtype_ddmarker', $a); ...
[ "public", "function", "get_coords_interpreter_error", "(", ")", "{", "if", "(", "$", "this", "->", "error", ")", "{", "$", "a", "=", "new", "stdClass", "(", ")", ";", "$", "a", "->", "shape", "=", "self", "::", "human_readable_name", "(", "true", ")", ...
Gets any coordinate error @return string|bool String of the error or false if there is no error
[ "Gets", "any", "coordinate", "error" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/ddmarker/shapes.php#L103-L112
213,097
moodle/moodle
question/type/ddmarker/shapes.php
qtype_ddmarker_shape.human_readable_name
public static function human_readable_name($lowercase = false) { $stringid = 'shape_'.self::name(); if ($lowercase) { $stringid .= '_lowercase'; } return get_string($stringid, 'qtype_ddmarker'); }
php
public static function human_readable_name($lowercase = false) { $stringid = 'shape_'.self::name(); if ($lowercase) { $stringid .= '_lowercase'; } return get_string($stringid, 'qtype_ddmarker'); }
[ "public", "static", "function", "human_readable_name", "(", "$", "lowercase", "=", "false", ")", "{", "$", "stringid", "=", "'shape_'", ".", "self", "::", "name", "(", ")", ";", "if", "(", "$", "lowercase", ")", "{", "$", "stringid", ".=", "'_lowercase'"...
Return a human readable name of the shape. @param bool $lowercase True if it should be lowercase. @return string
[ "Return", "a", "human", "readable", "name", "of", "the", "shape", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/ddmarker/shapes.php#L137-L143
213,098
moodle/moodle
question/type/ddmarker/shapes.php
qtype_ddmarker_point.dist
public function dist($other) { return sqrt(pow($this->x - $other->x, 2) + pow($this->y - $other->y, 2)); }
php
public function dist($other) { return sqrt(pow($this->x - $other->x, 2) + pow($this->y - $other->y, 2)); }
[ "public", "function", "dist", "(", "$", "other", ")", "{", "return", "sqrt", "(", "pow", "(", "$", "this", "->", "x", "-", "$", "other", "->", "x", ",", "2", ")", "+", "pow", "(", "$", "this", "->", "y", "-", "$", "other", "->", "y", ",", "...
Return the distance between this point and another
[ "Return", "the", "distance", "between", "this", "point", "and", "another" ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/question/type/ddmarker/shapes.php#L481-L483
213,099
moodle/moodle
mod/workshop/classes/privacy/provider.php
provider.export_user_data
public static function export_user_data(approved_contextlist $contextlist) { global $DB; if (!count($contextlist)) { return; } $user = $contextlist->get_user(); // Export general information about all workshops. foreach ($contextlist->get_contexts() as $con...
php
public static function export_user_data(approved_contextlist $contextlist) { global $DB; if (!count($contextlist)) { return; } $user = $contextlist->get_user(); // Export general information about all workshops. foreach ($contextlist->get_contexts() as $con...
[ "public", "static", "function", "export_user_data", "(", "approved_contextlist", "$", "contextlist", ")", "{", "global", "$", "DB", ";", "if", "(", "!", "count", "(", "$", "contextlist", ")", ")", "{", "return", ";", "}", "$", "user", "=", "$", "contextl...
Export personal data stored in the given contexts. @param approved_contextlist $contextlist List of contexts approved for export.
[ "Export", "personal", "data", "stored", "in", "the", "given", "contexts", "." ]
a411b499b98afc9901c24a9466c7e322946a04aa
https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/workshop/classes/privacy/provider.php#L229-L254