idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
27,400
public function definition ( ) { $ mform = $ this -> _form ; $ mform -> addElement ( 'text' , 'name' , get_string ( 'discussionname' , 'forum' ) , array ( 'size' => '60' , 'maxlength' => '255' ) ) ; $ mform -> setType ( 'name' , PARAM_TEXT ) ; $ mform -> addRule ( 'name' , null , 'required' , null , 'client' ) ; $ mfor...
Form constructor .
27,401
public static function get_upcoming_content ( $ events , $ linkhref = null , $ showcourselink = false ) { debugging ( 'get_upcoming_content() is deprecated. ' . 'Please see block_calendar_upcoming::get_content() for the correct API usage.' , DEBUG_DEVELOPER ) ; $ content = '' ; $ lines = count ( $ events ) ; if ( ! $ l...
Get the upcoming event block content .
27,402
public function remove ( $ obs ) { $ old = $ this -> _filter ; $ this -> setIteratorFilter ( self :: HIDE_GROUPS | self :: BASE_ELEMENTS ) ; foreach ( $ this -> _normalize ( $ obs ) as $ val ) { $ remove = array ( ) ; foreach ( $ this as $ key => $ val2 ) { if ( $ val2 -> match ( $ val ) ) { $ remove [ ] = $ key ; } } ...
Remove addresses from the container . This method ignores Group objects .
27,403
public function unique ( ) { $ exist = $ remove = array ( ) ; $ old = $ this -> _filter ; $ this -> setIteratorFilter ( self :: HIDE_GROUPS | self :: BASE_ELEMENTS ) ; foreach ( $ this as $ key => $ val ) { $ bare = $ val -> bare_address ; if ( isset ( $ exist [ $ bare ] ) ) { if ( ( $ exist [ $ bare ] == - 1 ) || is_n...
Removes duplicate addresses from list . This method ignores Group objects .
27,404
public function groupCount ( ) { $ ret = 0 ; foreach ( $ this -> _data as $ val ) { if ( $ val instanceof Horde_Mail_Rfc822_Group ) { ++ $ ret ; } } return $ ret ; }
Group count .
27,405
public function setIteratorFilter ( $ mask = 0 , $ filter = null ) { $ this -> _filter = array ( ) ; if ( $ mask ) { $ this -> _filter [ 'mask' ] = $ mask ; } if ( ! is_null ( $ filter ) ) { $ rfc822 = new Horde_Mail_Rfc822 ( ) ; $ this -> _filter [ 'filter' ] = $ rfc822 -> parseAddressList ( $ filter ) ; } }
Set the Iterator filter .
27,406
public function contains ( $ address ) { $ ob = new Horde_Mail_Rfc822_Address ( $ address ) ; foreach ( $ this -> raw_addresses as $ val ) { if ( $ val -> match ( $ ob ) ) { return true ; } } return false ; }
Does this list contain the given e - mail address?
27,407
protected function _normalize ( $ obs ) { $ add = array ( ) ; if ( ! ( $ obs instanceof Horde_Mail_Rfc822_List ) && ! is_array ( $ obs ) ) { $ obs = array ( $ obs ) ; } foreach ( $ obs as $ val ) { if ( is_string ( $ val ) ) { $ rfc822 = new Horde_Mail_Rfc822 ( ) ; $ val = $ rfc822 -> parseAddressList ( $ val ) ; } if ...
Normalize objects to add to list .
27,408
public static function LOOKUP ( $ lookup_value , $ lookup_vector , $ result_vector = null ) { $ lookup_value = PHPExcel_Calculation_Functions :: flattenSingleValue ( $ lookup_value ) ; if ( ! is_array ( $ lookup_vector ) ) { return PHPExcel_Calculation_Functions :: NA ( ) ; } $ lookupRows = count ( $ lookup_vector ) ; ...
LOOKUP The LOOKUP function searches for value either from a one - row or one - column range or from an array .
27,409
public function next_user ( ) { if ( ! $ this -> users_rs ) { return false ; } if ( ! $ this -> users_rs -> valid ( ) ) { if ( $ current = $ this -> _pop ( ) ) { } return false ; } else { $ user = $ this -> users_rs -> current ( ) ; $ this -> users_rs -> next ( ) ; } $ grade_records = array ( ) ; while ( true ) { if ( ...
Returns information about the next user
27,410
public function close ( ) { if ( $ this -> users_rs ) { $ this -> users_rs -> close ( ) ; $ this -> users_rs = null ; } if ( $ this -> grades_rs ) { $ this -> grades_rs -> close ( ) ; $ this -> grades_rs = null ; } $ this -> gradestack = array ( ) ; }
Close the iterator do not forget to call this function
27,411
public function require_active_enrolment ( $ onlyactive = true ) { if ( ! empty ( $ this -> users_rs ) ) { debugging ( 'Calling require_active_enrolment() has no effect unless you call init() again' , DEBUG_DEVELOPER ) ; } $ this -> onlyactive = $ onlyactive ; }
Should all enrolled users be exported or just those with an active enrolment?
27,412
public function allow_user_custom_fields ( $ allow = true ) { if ( $ allow ) { $ this -> allowusercustomfields = true ; } else { $ this -> allowusercustomfields = false ; } }
Allow custom fields to be included
27,413
private function _pop ( ) { global $ DB ; if ( empty ( $ this -> gradestack ) ) { if ( empty ( $ this -> grades_rs ) || ! $ this -> grades_rs -> valid ( ) ) { return null ; } $ current = $ this -> grades_rs -> current ( ) ; $ this -> grades_rs -> next ( ) ; return $ current ; } else { return array_pop ( $ this -> grade...
Remove a grade_grade instance from the grade stack
27,414
public function get_options ( ) { if ( empty ( $ this -> type ) ) { return array ( ) ; } $ params = array ( ) ; if ( ! empty ( $ this -> plugin ) ) { $ params [ 'plugin' ] = $ this -> plugin ; } if ( ! empty ( $ this -> courseid ) ) { $ params [ 'id' ] = $ this -> courseid ; } if ( ! empty ( $ this -> userid ) ) { $ pa...
Returns return parameters as options array suitable for buttons .
27,415
public function get_return_url ( $ default , $ extras = null ) { global $ CFG ; if ( empty ( $ this -> type ) or empty ( $ this -> plugin ) ) { return $ default ; } $ url = $ CFG -> wwwroot . '/grade/' . $ this -> type . '/' . $ this -> plugin . '/index.php' ; $ glue = '?' ; if ( ! empty ( $ this -> courseid ) ) { $ ur...
Returns return url
27,416
public function get_form_fields ( ) { if ( empty ( $ this -> type ) ) { return '' ; } $ result = '<input type="hidden" name="gpr_type" value="' . $ this -> type . '" />' ; if ( ! empty ( $ this -> plugin ) ) { $ result .= '<input type="hidden" name="gpr_plugin" value="' . $ this -> plugin . '" />' ; } if ( ! empty ( $ ...
Returns string with hidden return tracking form elements .
27,417
public function add_mform_elements ( & $ mform ) { if ( empty ( $ this -> type ) ) { return ; } $ mform -> addElement ( 'hidden' , 'gpr_type' , $ this -> type ) ; $ mform -> setType ( 'gpr_type' , PARAM_SAFEDIR ) ; if ( ! empty ( $ this -> plugin ) ) { $ mform -> addElement ( 'hidden' , 'gpr_plugin' , $ this -> plugin ...
Add hidden elements into mform
27,418
public function add_url_params ( moodle_url $ url ) { if ( empty ( $ this -> type ) ) { return $ url ; } $ url -> param ( 'gpr_type' , $ this -> type ) ; if ( ! empty ( $ this -> plugin ) ) { $ url -> param ( 'gpr_plugin' , $ this -> plugin ) ; } if ( ! empty ( $ this -> courseid ) ) { $ url -> param ( 'gpr_courseid' ,...
Add return tracking params into url
27,419
public static function get_users_json ( $ resource , $ context , $ contextid , $ tool , $ role , $ limitfrom , $ limitnum , $ lti , $ info ) { $ withcapability = '' ; $ exclude = array ( ) ; if ( ! empty ( $ role ) ) { if ( ( strpos ( $ role , 'http://' ) !== 0 ) && ( strpos ( $ role , 'https://' ) !== 0 ) ) { $ role =...
Get the JSON for members .
27,420
private static function is_allowed_field_set ( $ toolconfig , $ instanceconfig , $ fields ) { $ isallowedstate = [ ] ; foreach ( $ fields as $ key => $ field ) { $ allowed = self :: ALWAYS_INCLUDE_FIELD == $ toolconfig -> { $ field } ; if ( ! $ allowed ) { if ( self :: DELEGATE_TO_INSTRUCTOR == $ toolconfig -> { $ fiel...
Determines whether a user attribute may be used as part of LTI membership
27,421
function _prepareTemplate ( $ name , $ label , $ required , $ error ) { if ( is_array ( $ label ) ) { $ nameLabel = array_shift ( $ label ) ; } else { $ nameLabel = $ label ; } if ( isset ( $ this -> _templates [ $ name ] ) ) { $ html = str_replace ( '{label}' , $ nameLabel , $ this -> _templates [ $ name ] ) ; } else ...
Helper method for renderElement
27,422
function startGroup ( & $ group , $ required , $ error ) { $ name = $ group -> getName ( ) ; $ this -> _groupTemplate = $ this -> _prepareTemplate ( $ name , $ group -> getLabel ( ) , $ required , $ error ) ; $ this -> _groupElementTemplate = empty ( $ this -> _groupTemplates [ $ name ] ) ? '' : $ this -> _groupTemplat...
Called when visiting a group before processing any group elements
27,423
function finishGroup ( & $ group ) { $ separator = $ group -> _separator ; if ( is_array ( $ separator ) ) { $ count = count ( $ separator ) ; $ html = '' ; for ( $ i = 0 ; $ i < count ( $ this -> _groupElements ) ; $ i ++ ) { $ html .= ( 0 == $ i ? '' : $ separator [ ( $ i - 1 ) % $ count ] ) . $ this -> _groupElement...
Called when visiting a group after processing all group elements
27,424
function setElementTemplate ( $ html , $ element = null ) { if ( is_null ( $ element ) ) { $ this -> _elementTemplate = $ html ; } else { $ this -> _templates [ $ element ] = $ html ; } }
Sets element template
27,425
protected function shared ( $ path1 , $ path2 ) { $ path1 = $ path1 ? explode ( '/' , $ path1 ) : array ( ) ; $ path2 = $ path2 ? explode ( '/' , $ path2 ) : array ( ) ; $ shared = array ( ) ; foreach ( $ path1 as $ i => $ chunk ) { if ( isset ( $ path2 [ $ i ] ) && $ path1 [ $ i ] == $ path2 [ $ i ] ) { $ shared [ ] =...
Figure out the shared path of 2 locations .
27,426
protected function dirname ( $ path ) { if ( is_file ( $ path ) ) { return dirname ( $ path ) ; } if ( is_dir ( $ path ) ) { return rtrim ( $ path , '/' ) ; } if ( mb_substr ( $ path , - 1 ) === '/' ) { return rtrim ( $ path , '/' ) ; } if ( preg_match ( '/.*\..*$/' , basename ( $ path ) ) !== 0 ) { return dirname ( $ ...
Attempt to get the directory name from a path .
27,427
public function query ( $ charset , $ cached = false ) { $ charset = Horde_String :: upper ( $ charset ) ; if ( isset ( $ this -> _charsets [ $ charset ] ) ) { return $ this -> _charsets [ $ charset ] ; } elseif ( $ cached ) { return null ; } if ( ! $ this -> _baseob ) { throw new RuntimeException ( 'Base object needs ...
Query the validity of a charset .
27,428
public function setValid ( $ charset , $ valid = true ) { $ charset = Horde_String :: upper ( $ charset ) ; $ valid = ( bool ) $ valid ; if ( ! isset ( $ this -> _charsets [ $ charset ] ) || ( $ this -> _charsets [ $ charset ] !== $ valid ) ) { $ this -> _charsets [ $ charset ] = $ valid ; $ this -> notify ( ) ; } }
Set the validity of a given charset .
27,429
protected function new_redis ( $ server , $ prefix = '' , $ password = '' ) { $ redis = new Redis ( ) ; $ port = null ; if ( strpos ( $ server , ':' ) ) { $ serverconf = explode ( ':' , $ server ) ; $ server = $ serverconf [ 0 ] ; $ port = $ serverconf [ 1 ] ; } if ( $ redis -> connect ( $ server , $ port ) ) { if ( ! ...
Create a new Redis instance and connect to the server .
27,430
protected function ping ( Redis $ redis ) { try { if ( $ redis -> ping ( ) === false ) { return false ; } } catch ( Exception $ e ) { return false ; } return true ; }
See if we can ping Redis server
27,431
public function initialise ( cache_definition $ definition ) { $ this -> definition = $ definition ; $ this -> hash = $ definition -> generate_definition_hash ( ) ; return true ; }
Initialize the store .
27,432
public function set ( $ key , $ value ) { return ( $ this -> redis -> hSet ( $ this -> hash , $ key , $ value ) !== false ) ; }
Set the value of a key .
27,433
public function set_many ( array $ keyvaluearray ) { $ pairs = [ ] ; foreach ( $ keyvaluearray as $ pair ) { $ pairs [ $ pair [ 'key' ] ] = $ pair [ 'value' ] ; } if ( $ this -> redis -> hMSet ( $ this -> hash , $ pairs ) ) { return count ( $ pairs ) ; } return 0 ; }
Set the values of many keys .
27,434
public function delete_many ( array $ keys ) { array_unshift ( $ keys , $ this -> hash ) ; return call_user_func_array ( array ( $ this -> redis , 'hDel' ) , $ keys ) ; }
Delete many keys .
27,435
public function has_any ( array $ keys ) { foreach ( $ keys as $ key ) { if ( $ this -> has ( $ key ) ) { return true ; } } return false ; }
Determines if the store has any of the keys in a list .
27,436
public function has_all ( array $ keys ) { foreach ( $ keys as $ key ) { if ( ! $ this -> has ( $ key ) ) { return false ; } } return true ; }
Determines if the store has all of the keys in a list .
27,437
public function check_lock_state ( $ key , $ ownerid ) { $ result = $ this -> redis -> get ( $ key ) ; if ( $ result === $ ownerid ) { return true ; } if ( $ result === false ) { return null ; } return false ; }
Checks a lock with a given name and owner information .
27,438
public function release_lock ( $ key , $ ownerid ) { if ( $ this -> check_lock_state ( $ key , $ ownerid ) ) { return ( $ this -> redis -> del ( $ key ) !== false ) ; } return false ; }
Releases a given lock if the owner information matches .
27,439
public static function config_get_configuration_array ( $ data ) { return array ( 'server' => $ data -> server , 'prefix' => $ data -> prefix , 'password' => $ data -> password , 'serializer' => $ data -> serializer ) ; }
Creates a configuration array from given add instance form data .
27,440
public static function config_set_edit_form_data ( moodleform $ editform , array $ config ) { $ data = array ( ) ; $ data [ 'server' ] = $ config [ 'server' ] ; $ data [ 'prefix' ] = ! empty ( $ config [ 'prefix' ] ) ? $ config [ 'prefix' ] : '' ; $ data [ 'password' ] = ! empty ( $ config [ 'password' ] ) ? $ config [...
Sets form data from a configuration array .
27,441
public function getRules ( $ mRule = null ) { if ( $ mRule instanceof Rule ) { $ mRule = $ mRule -> getRule ( ) ; } $ aResult = array ( ) ; foreach ( $ this -> aRules as $ sName => $ aRules ) { if ( ! $ mRule || $ sName === $ mRule || ( strrpos ( $ mRule , '-' ) === strlen ( $ mRule ) - strlen ( '-' ) && ( strpos ( $ s...
Returns all rules matching the given rule name
27,442
public function setRules ( array $ aRules ) { $ this -> aRules = array ( ) ; foreach ( $ aRules as $ rule ) { $ this -> addRule ( $ rule ) ; } }
Override all the rules of this set .
27,443
public function removeRule ( $ mRule ) { if ( $ mRule instanceof Rule ) { $ sRule = $ mRule -> getRule ( ) ; if ( ! isset ( $ this -> aRules [ $ sRule ] ) ) { return ; } foreach ( $ this -> aRules [ $ sRule ] as $ iKey => $ oRule ) { if ( $ oRule === $ mRule ) { unset ( $ this -> aRules [ $ sRule ] [ $ iKey ] ) ; } } }...
Remove a rule from this RuleSet . This accepts all the possible values that
27,444
protected static function get_database_and_table ( ) { $ manager = get_log_manager ( ) ; $ store = new \ logstore_database \ log \ store ( $ manager ) ; $ db = $ store -> get_extdb ( ) ; return $ db ? [ $ db , $ store -> get_config_value ( 'dbtable' ) ] : [ null , null ] ; }
Get the database object .
27,445
public static function get_competencies_by_userevidenceid ( $ userevidenceid ) { global $ DB ; $ sql = "SELECT c.* FROM {" . self :: TABLE . "} uec JOIN {" . competency :: TABLE . "} c ON uec.userevidenceid = ? AND uec.competencyid = c.id ...
Get competencies by user evidence ID .
27,446
public static function get_user_competencies_by_userevidenceid ( $ userevidenceid ) { global $ DB ; $ sql = "SELECT uc.* FROM {" . user_competency :: TABLE . "} uc JOIN {" . self :: TABLE . "} uec ON uc.competencyid = uec.competencyid JOIN {" . user_...
Get user competencies by user evidence ID .
27,447
public static function delete_by_competencyids ( $ competencyids ) { global $ DB ; if ( empty ( $ competencyids ) ) { return true ; } list ( $ insql , $ params ) = $ DB -> get_in_or_equal ( $ competencyids ) ; return $ DB -> delete_records_select ( self :: TABLE , "competencyid $insql" , $ params ) ; }
Delete evidences using competencies .
27,448
public static function get_item_ratings_parameters ( ) { return new external_function_parameters ( array ( 'contextlevel' => new external_value ( PARAM_ALPHA , 'context level: course, module, user, etc...' ) , 'instanceid' => new external_value ( PARAM_INT , 'the instance id of item associated with the context level' )...
Returns description of get_item_ratings parameters .
27,449
public static function get_item_ratings_returns ( ) { return new external_single_structure ( array ( 'ratings' => new external_multiple_structure ( new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'rating id' ) , 'userid' => new external_value ( PARAM_INT , 'user id' ) , 'userpictureurl'...
Returns description of get_item_ratings result values .
27,450
public static function add_rating_parameters ( ) { return new external_function_parameters ( array ( 'contextlevel' => new external_value ( PARAM_ALPHA , 'context level: course, module, user, etc...' ) , 'instanceid' => new external_value ( PARAM_INT , 'the instance id of item associated with the context level' ) , 'co...
Returns description of add_rating parameters .
27,451
public static function add_rating ( $ contextlevel , $ instanceid , $ component , $ ratingarea , $ itemid , $ scaleid , $ rating , $ rateduserid , $ aggregation = RATING_AGGREGATE_NONE ) { $ warnings = array ( ) ; $ params = array ( 'contextlevel' => $ contextlevel , 'instanceid' => $ instanceid , 'component' => $ comp...
Adds a rating to an item
27,452
public static function add_rating_returns ( ) { return new external_single_structure ( array ( 'success' => new external_value ( PARAM_BOOL , 'Whether the rate was successfully created' ) , 'aggregate' => new external_value ( PARAM_TEXT , 'New aggregate' , VALUE_OPTIONAL ) , 'count' => new external_value ( PARAM_INT , ...
Returns description of add_rating result values .
27,453
protected function init ( ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/mod/feedback/lib.php' ) ; $ this -> data [ 'objecttable' ] = 'feedback_completed' ; $ this -> data [ 'crud' ] = 'c' ; $ this -> data [ 'edulevel' ] = self :: LEVEL_PARTICIPATING ; }
Set basic properties for the event .
27,454
public static function create_from_record ( $ completed , $ cm ) { $ event = self :: create ( array ( 'relateduserid' => $ completed -> userid , 'objectid' => $ completed -> id , 'context' => \ context_module :: instance ( $ cm -> id ) , 'anonymous' => ( $ completed -> anonymous_response == FEEDBACK_ANONYMOUS_YES ) , '...
Creates an instance from the record from db table feedback_completed
27,455
public function get_url ( ) { if ( $ this -> anonymous ) { return new \ moodle_url ( '/mod/feedback/show_entries.php' , array ( 'id' => $ this -> other [ 'cmid' ] , 'showcompleted' => $ this -> objectid ) ) ; } else { return new \ moodle_url ( '/mod/feedback/show_entries.php' , array ( 'id' => $ this -> other [ 'cmid' ...
Returns relevant URL based on the anonymous mode of the response .
27,456
public function can_view ( $ userorid = null ) { global $ USER ; debugging ( 'can_view() method is deprecated, use anonymous flag instead if necessary.' , DEBUG_DEVELOPER ) ; if ( empty ( $ userorid ) ) { $ userorid = $ USER ; } if ( $ this -> anonymous ) { return is_siteadmin ( $ userorid ) ; } else { return has_capab...
Define whether a user can view the event or not . Make sure no one except admin can see details of an anonymous response .
27,457
public function notify_message ( $ message ) { $ n = new \ core \ output \ notification ( $ message , \ core \ output \ notification :: NOTIFY_INFO ) ; return $ this -> render ( $ n ) ; }
Output a nofication .
27,458
public function notify_problem ( $ message ) { $ n = new \ core \ output \ notification ( $ message , \ core \ output \ notification :: NOTIFY_ERROR ) ; return $ this -> render ( $ n ) ; }
Output an error notification .
27,459
public function notify_success ( $ message ) { $ n = new \ core \ output \ notification ( $ message , \ core \ output \ notification :: NOTIFY_SUCCESS ) ; return $ this -> render ( $ n ) ; }
Output a success notification .
27,460
public static function export_user_preferences ( int $ userid ) { $ preference = get_user_preferences ( 'filemanager_recentviewmode' ) ; if ( $ preference !== null ) { switch ( $ preference ) { case 1 : $ value = get_string ( 'displayasicons' , 'core_repository' ) ; break ; case 2 : $ value = get_string ( 'displayastre...
Export all user preferences for the subsystem .
27,461
public function process_submission ( ) { global $ DB ; $ DB -> delete_records ( $ this -> tablename ) ; foreach ( $ this -> roles as $ fromroleid => $ notused ) { foreach ( $ this -> roles as $ targetroleid => $ alsonotused ) { if ( optional_param ( 's_' . $ fromroleid . '_' . $ targetroleid , false , PARAM_BOOL ) ) { ...
Update the data with the new settings submitted by the user .
27,462
public function load_current_settings ( ) { global $ DB ; $ this -> allowed = array ( ) ; foreach ( $ this -> roles as $ role ) { $ this -> allowed [ $ role -> id ] = array_combine ( array_keys ( $ this -> roles ) , array_fill ( 0 , count ( $ this -> roles ) , false ) ) ; } $ rs = $ DB -> get_recordset ( $ this -> tabl...
Load the current allows from the database .
27,463
public function get_table ( ) { $ table = new html_table ( ) ; $ table -> tablealign = 'center' ; $ table -> cellpadding = 5 ; $ table -> cellspacing = 0 ; $ table -> width = '90%' ; $ table -> align = array ( 'left' ) ; $ table -> rotateheaders = true ; $ table -> head = array ( '&#xa0;' ) ; $ table -> colclasses = ar...
Returns structure that can be passed to print_table containing one cell for each checkbox .
27,464
public function write_setting ( $ data ) { $ data = explode ( ';' , $ data ) ; $ data = array_map ( function ( $ x ) { return core_text :: strtolower ( trim ( $ x ) ) ; } , $ data ) ; $ data = implode ( ';' , array_unique ( $ data ) ) ; return parent :: write_setting ( $ data ) ; }
We need to remove duplicates on save to prevent issues in other areas of Moodle .
27,465
protected function render_add_button ( $ courseid ) { global $ CFG ; $ button = \ html_writer :: tag ( 'button' , get_string ( 'addrule' , 'tool_monitor' ) , [ 'class' => 'btn btn-primary' ] ) ; $ addurl = new \ moodle_url ( $ CFG -> wwwroot . '/admin/tool/monitor/edit.php' , array ( 'courseid' => $ courseid ) ) ; retu...
Html to add a button for adding a new rule .
27,466
public function render_subscriptions_link ( $ manageurl ) { echo \ html_writer :: start_div ( ) ; $ a = \ html_writer :: link ( $ manageurl , get_string ( 'managesubscriptions' , 'tool_monitor' ) ) ; $ link = \ html_writer :: tag ( 'span' , get_string ( 'managesubscriptionslink' , 'tool_monitor' , $ a ) ) ; echo $ link...
Html to add a link to go to the subscription page .
27,467
public function can_subscribe_to_forum ( stdClass $ user ) : bool { if ( $ this -> forum -> get_type ( ) == 'single' ) { return false ; } return ! is_guest ( $ this -> get_context ( ) , $ user ) && subscriptions :: is_subscribable ( $ this -> get_forum_record ( ) ) ; }
Can the user subscribe to this forum?
27,468
public function can_create_discussions ( stdClass $ user , int $ groupid = null ) : bool { if ( isguestuser ( $ user ) or ! isloggedin ( ) ) { return false ; } if ( $ this -> forum -> is_cutoff_date_reached ( ) ) { if ( ! has_capability ( 'mod/forum:canoverridecutoff' , $ this -> get_context ( ) ) ) { return false ; } ...
Can the user create discussions in this forum?
27,469
public function can_access_group ( stdClass $ user , int $ groupid ) : bool { if ( $ this -> can_access_all_groups ( $ user ) ) { return true ; } return groups_is_member ( $ groupid , $ user -> id ) ; }
Can the user access the given group?
27,470
public function can_pin_discussions ( stdClass $ user ) : bool { return $ this -> forum -> get_type ( ) !== 'single' && has_capability ( 'mod/forum:pindiscussions' , $ this -> get_context ( ) , $ user ) ; }
Can the user pin discussions in this forum?
27,471
public function can_split_discussions ( stdClass $ user ) : bool { $ forum = $ this -> get_forum ( ) ; return $ forum -> get_type ( ) !== 'single' && has_capability ( 'mod/forum:splitdiscussions' , $ this -> get_context ( ) , $ user ) ; }
Can the user split discussions in this forum?
27,472
public function must_post_before_viewing_discussion ( stdClass $ user , discussion_entity $ discussion ) : bool { $ forum = $ this -> get_forum ( ) ; if ( $ forum -> get_type ( ) === 'qanda' ) { return ! has_capability ( 'mod/forum:viewqandawithoutposting' , $ this -> get_context ( ) , $ user ) && ! forum_user_has_post...
Is the user required to post in the discussion before they can view it?
27,473
public function can_post_in_discussion ( stdClass $ user , discussion_entity $ discussion ) : bool { $ forum = $ this -> get_forum ( ) ; $ forumrecord = $ this -> get_forum_record ( ) ; $ discussionrecord = $ this -> get_discussion_record ( $ discussion ) ; $ context = $ this -> get_context ( ) ; $ coursemodule = $ for...
Can the user post in this discussion?
27,474
public function can_favourite_discussion ( stdClass $ user ) : bool { $ context = $ this -> get_context ( ) ; return has_capability ( 'mod/forum:cantogglefavourite' , $ context , $ user ) ; }
Can the user favourite the discussion
27,475
public function can_view_discussion ( stdClass $ user , discussion_entity $ discussion ) : bool { $ forumrecord = $ this -> get_forum_record ( ) ; $ discussionrecord = $ this -> get_discussion_record ( $ discussion ) ; $ context = $ this -> get_context ( ) ; return forum_user_can_see_discussion ( $ forumrecord , $ disc...
Can the user view the content of a discussion?
27,476
public function can_view_post ( stdClass $ user , discussion_entity $ discussion , post_entity $ post ) : bool { if ( ! $ this -> can_view_post_shell ( $ user , $ post ) ) { return false ; } $ forum = $ this -> get_forum ( ) ; $ forumrecord = $ this -> get_forum_record ( ) ; $ discussionrecord = $ this -> get_discussio...
Can the user view the content of the post in this discussion?
27,477
public function can_view_post_shell ( stdClass $ user , post_entity $ post ) : bool { if ( ! $ post -> is_private_reply ( ) ) { return true ; } if ( $ post -> is_private_reply_intended_for_user ( $ user ) ) { return true ; } return $ this -> can_view_any_private_reply ( $ user ) ; }
Can the user view the post at all? In some situations the user can view the shell of a post without being able to view its content .
27,478
public function can_edit_post ( stdClass $ user , discussion_entity $ discussion , post_entity $ post ) : bool { global $ CFG ; $ context = $ this -> get_context ( ) ; $ ownpost = $ post -> is_owned_by_user ( $ user ) ; $ ineditingtime = $ post -> get_age ( ) < $ CFG -> maxeditingtime ; switch ( $ this -> forum -> get_...
Can the user edit the post in this discussion?
27,479
public function can_delete_post ( stdClass $ user , discussion_entity $ discussion , post_entity $ post ) : bool { global $ CFG ; $ forum = $ this -> get_forum ( ) ; if ( $ forum -> get_type ( ) == 'single' && $ discussion -> is_first_post ( $ post ) ) { return false ; } else { $ context = $ this -> get_context ( ) ; $...
Can the user delete the post in this discussion?
27,480
public function can_split_post ( stdClass $ user , discussion_entity $ discussion , post_entity $ post ) : bool { if ( $ post -> is_private_reply ( ) ) { return false ; } return $ this -> can_split_discussions ( $ user ) && $ post -> has_parent ( ) ; }
Can the user split the post in this discussion?
27,481
public function can_reply_to_post ( stdClass $ user , discussion_entity $ discussion , post_entity $ post ) : bool { if ( $ post -> is_private_reply ( ) ) { return false ; } return $ this -> can_post_in_discussion ( $ user , $ discussion ) ; }
Can the user reply to the post in this discussion?
27,482
public function can_reply_privately_to_post ( stdClass $ user , post_entity $ post ) : bool { if ( $ post -> is_private_reply ( ) ) { return false ; } return has_capability ( 'mod/forum:postprivatereply' , $ this -> get_context ( ) , $ user ) ; }
Can the user reply privately to the specified post?
27,483
public function can_view_participants ( stdClass $ user , discussion_entity $ discussion ) : bool { return course_can_view_participants ( $ this -> get_context ( ) ) && ! $ this -> must_post_before_viewing_discussion ( $ user , $ discussion ) ; }
Can the user view the participants of this discussion?
27,484
protected function gradebook_calculation_freeze ( ) { global $ CFG ; $ gradebookcalculationsfreeze = get_config ( 'core' , 'gradebook_calculations_freeze_' . $ this -> get_courseid ( ) ) ; preg_match ( '/(\d{8})/' , $ this -> get_task ( ) -> get_info ( ) -> moodle_release , $ matches ) ; $ backupbuild = ( int ) $ match...
Freeze gradebook calculation if needed .
27,485
protected function check_minmaxtouse ( ) { global $ CFG , $ DB ; require_once ( $ CFG -> libdir . '/gradelib.php' ) ; $ userinfo = $ this -> task -> get_setting_value ( 'users' ) ; $ settingname = 'minmaxtouse' ; $ courseid = $ this -> get_courseid ( ) ; $ minmaxtouse = $ DB -> get_field ( 'grade_settings' , 'value' , ...
Checks what should happen with the course grade setting minmaxtouse .
27,486
protected function rewrite_step_backup_file_for_legacy_freeze ( $ filepath ) { $ foundnode = false ; $ newfile = make_request_directory ( true ) . DIRECTORY_SEPARATOR . 'file.xml' ; $ fr = fopen ( $ filepath , 'r' ) ; $ fw = fopen ( $ newfile , 'w' ) ; if ( $ fr && $ fw ) { while ( ( $ line = fgets ( $ fr , 4096 ) ) !=...
Rewrite step definition to handle the legacy freeze attribute .
27,487
public function process_customfield ( $ data ) { $ handler = core_course \ customfield \ course_handler :: create ( ) ; $ handler -> restore_instance_data_from_backup ( $ this -> task , $ data ) ; }
Process custom fields
27,488
public function process_enrolment ( $ data ) { global $ DB ; if ( ! isset ( $ this -> plugins ) ) { $ this -> plugins = enrol_get_plugins ( true ) ; } $ data = ( object ) $ data ; if ( $ enrolid = $ this -> get_new_parentid ( 'enrol' ) ) { $ oldinstancestatus = ENROL_INSTANCE_ENABLED ; $ oldenrolid = $ this -> get_old_...
Create user enrolments .
27,489
public function process_endorsement ( $ data ) { global $ DB ; $ data = ( object ) $ data ; $ params = [ 'badgeid' => $ this -> get_new_parentid ( 'badge' ) , 'issuername' => $ data -> issuername , 'issuerurl' => $ data -> issuerurl , 'issueremail' => $ data -> issueremail , 'claimid' => $ data -> claimid , 'claimcomme...
Create an endorsement for a badge .
27,490
public function process_alignment ( $ data ) { global $ DB ; $ data = ( object ) $ data ; $ params = array ( 'badgeid' => $ this -> get_new_parentid ( 'badge' ) , 'targetname' => $ data -> targetname , 'targeturl' => $ data -> targeturl , 'targetdescription' => $ data -> targetdescription , 'targetframework' => $ data ...
Link to an alignment for a badge .
27,491
public function process_course_completion_criteria ( $ data ) { global $ DB ; $ data = ( object ) $ data ; $ data -> course = $ this -> get_courseid ( ) ; $ data -> timeend = $ this -> apply_date_offset ( $ data -> timeend ) ; if ( isset ( $ data -> role ) && $ data -> role != '' ) { if ( ! empty ( $ data -> roleshortn...
Process course completion criteria
27,492
public function process_course_completion_crit_compl ( $ data ) { global $ DB ; $ data = ( object ) $ data ; $ data -> criteriaid = $ this -> get_mappingid ( 'course_completion_criteria' , $ data -> criteriaid ) ; $ data -> course = $ this -> get_courseid ( ) ; $ data -> userid = $ this -> get_mappingid ( 'user' , $ da...
Processes course compltion criteria complete records
27,493
public function process_course_completions ( $ data ) { global $ DB ; $ data = ( object ) $ data ; $ data -> course = $ this -> get_courseid ( ) ; $ data -> userid = $ this -> get_mappingid ( 'user' , $ data -> userid ) ; if ( ! empty ( $ data -> userid ) ) { $ params = array ( 'userid' => $ data -> userid , 'course' =...
Process course completions
27,494
public function process_course_completion_aggr_methd ( $ data ) { global $ DB ; $ data = ( object ) $ data ; $ data -> course = $ this -> get_courseid ( ) ; if ( ! $ DB -> record_exists ( 'course_completion_aggr_methd' , array ( 'course' => $ data -> course , 'criteriatype' => $ data -> criteriatype ) ) ) { $ params = ...
Process course completion aggregate methods
27,495
protected function define_structure ( ) { $ paths = array ( ) ; $ logstore = new restore_path_element ( 'logstore' , '/logstores/logstore' ) ; $ paths [ ] = $ logstore ; $ this -> add_subplugin_structure ( 'logstore' , $ logstore , 'tool' , 'log' ) ; return array ( $ logstore ) ; }
Return the elements to be processed on restore of logstores .
27,496
public function process_course_competency_settings ( $ data ) { global $ DB ; $ data = ( object ) $ data ; $ target = $ this -> get_task ( ) -> get_target ( ) ; if ( $ target == backup :: TARGET_CURRENT_ADDING || $ target == backup :: TARGET_EXISTING_ADDING ) { return ; } $ courseid = $ this -> task -> get_courseid ( )...
Process a course competency settings .
27,497
public function process_course_competency ( $ data ) { $ data = ( object ) $ data ; $ framework = \ core_competency \ competency_framework :: get_record ( array ( 'idnumber' => $ data -> frameworkidnumber ) ) ; if ( ! $ framework ) { return ; } $ competency = \ core_competency \ competency :: get_record ( array ( 'idnu...
Process a course competency .
27,498
public function process_user_competency_course ( $ data ) { global $ USER , $ DB ; $ data = ( object ) $ data ; $ data -> competencyid = $ this -> get_mappingid ( \ core_competency \ competency :: TABLE , $ data -> competencyid ) ; if ( ! $ data -> competencyid ) { return ; } else if ( $ data -> grade === null ) { retu...
Process the user competency course .
27,499
public function process_course_module_competency ( $ data ) { $ data = ( object ) $ data ; $ framework = \ core_competency \ competency_framework :: get_record ( array ( 'idnumber' => $ data -> frameworkidnumber ) ) ; if ( ! $ framework ) { return ; } $ competency = \ core_competency \ competency :: get_record ( array ...
Process a course module competency .