idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
27,500 | protected function define_structure ( ) { $ paths = array ( ) ; $ userinfo = $ this -> get_setting_value ( 'userinfo' ) ; $ area = new restore_path_element ( 'grading_area' , '/areas/area' ) ; $ paths [ ] = $ area ; $ this -> add_plugin_structure ( 'local' , $ area ) ; $ definition = new restore_path_element ( 'grading... | Declares paths in the grading . xml file we are interested in |
27,501 | protected function process_grading_area ( $ data ) { global $ DB ; $ task = $ this -> get_task ( ) ; $ data = ( object ) $ data ; $ oldid = $ data -> id ; $ data -> component = 'mod_' . $ task -> get_modulename ( ) ; $ data -> contextid = $ task -> get_contextid ( ) ; $ newid = $ DB -> insert_record ( 'grading_areas' ,... | Processes one grading area element |
27,502 | protected function process_grading_definition ( $ data ) { global $ DB ; $ task = $ this -> get_task ( ) ; $ data = ( object ) $ data ; $ oldid = $ data -> id ; $ data -> areaid = $ this -> get_new_parentid ( 'grading_area' ) ; $ data -> copiedfromid = null ; $ data -> timecreated = time ( ) ; $ data -> usercreated = $... | Processes one grading definition element |
27,503 | protected function process_grading_instance ( $ data ) { global $ DB ; $ data = ( object ) $ data ; $ newformid = $ this -> get_new_parentid ( 'grading_definition' ) ; $ sql = "SELECT ga.areaname FROM {grading_definitions} gd JOIN {grading_areas} ga ON gd.areaid = ga.id ... | Processes one grading form instance element |
27,504 | protected function process_grade_letter ( $ data ) { global $ DB ; $ data [ 'contextid' ] = $ this -> task -> get_contextid ( ) ; $ gradeletter = ( object ) $ data ; unset ( $ data [ 'id' ] ) ; if ( ! $ DB -> record_exists ( 'grade_letters' , $ data ) ) { $ newitemid = $ DB -> insert_record ( 'grade_letters' , $ gradel... | process activity grade_letters . Note that while these are possible because grade_letters are contextid based in practice only course context letters can be defined . So we keep here this method knowing it won t be executed ever . gradebook restore will restore course letters . |
27,505 | protected function after_restore ( ) { global $ DB ; $ contextid = $ this -> task -> get_contextid ( ) ; $ instanceid = $ this -> task -> get_activityid ( ) ; $ olditemid = $ this -> task -> get_old_activityid ( ) ; $ DB -> set_field ( 'tag_instance' , 'itemid' , $ instanceid , array ( 'contextid' => $ contextid , 'ite... | This method will be executed after the rest of the restore has been processed . |
27,506 | protected function process_activity ( $ data ) { $ data = ( object ) $ data ; $ this -> task -> set_old_contextid ( $ data -> contextid ) ; $ this -> set_mapping ( 'context' , $ data -> contextid , $ this -> task -> get_contextid ( ) ) ; $ this -> task -> set_old_activityid ( $ data -> id ) ; } | Process the activity path informing the task about various ids needed later |
27,507 | protected function define_execution ( ) { global $ DB ; $ progress = $ this -> task -> get_progress ( ) ; $ progress -> start_progress ( $ this -> get_name ( ) , \ core \ progress \ base :: INDETERMINATE ) ; $ catqtypes = $ DB -> get_recordset_sql ( "SELECT DISTINCT bi.parentitemid AS categoryid, q.qtype as qtype ... | Preform the restore_create_question_files step . |
27,508 | private function send_common_files ( $ oldctxid , $ newctxid , $ progress ) { restore_dbops :: send_files_to_pool ( $ this -> get_basepath ( ) , $ this -> get_restoreid ( ) , 'question' , 'questiontext' , $ oldctxid , $ this -> task -> get_userid ( ) , 'question_created' , null , $ newctxid , true , $ progress ) ; rest... | Send the common question files to a new context . |
27,509 | private function send_qtype_files ( $ qtype , $ oldctxid , $ newctxid , $ progress ) { if ( ! isset ( $ this -> qtypecomponentscache [ $ qtype ] ) ) { $ this -> qtypecomponentscache [ $ qtype ] = backup_qtype_plugin :: get_components_and_fileareas ( $ qtype ) ; } $ components = $ this -> qtypecomponentscache [ $ qtype ... | Send the question type specific files to a new context . |
27,510 | private function choose_repository ( stdClass $ info ) { global $ DB , $ CFG ; require_once ( $ CFG -> dirroot . '/repository/lib.php' ) ; if ( $ this -> task -> is_samesite ( ) ) { if ( array_key_exists ( $ info -> oldfile -> repositoryid , $ this -> cachereposbyid ) ) { return $ this -> cachereposbyid [ $ info -> old... | Choose the repository instance that should handle the alias . |
27,511 | private function notify_success ( stdClass $ info ) { $ filedesc = $ this -> describe_alias ( $ info ) ; $ this -> log ( 'successfully restored alias' , backup :: LOG_DEBUG , $ filedesc , 1 ) ; } | Let the user know that the given alias was successfully restored |
27,512 | private function notify_failure ( stdClass $ info , $ reason = '' ) { $ filedesc = $ this -> describe_alias ( $ info ) ; if ( $ reason ) { $ reason = ' (' . $ reason . ')' ; } $ this -> log ( 'unable to restore alias' . $ reason , backup :: LOG_WARNING , $ filedesc , 1 ) ; $ this -> add_result_item ( 'file_aliases_rest... | Let the user know that the given alias can t be restored |
27,513 | private function describe_alias ( stdClass $ info ) { $ filedesc = $ this -> expected_alias_location ( $ info -> newfile ) ; if ( ! is_null ( $ info -> oldfile -> source ) ) { $ filedesc .= ' (' . $ info -> oldfile -> source . ')' ; } return $ filedesc ; } | Return a human readable description of the alias file |
27,514 | private function expected_alias_location ( $ filerecord ) { $ filedesc = '/' . $ filerecord -> contextid . '/' . $ filerecord -> component . '/' . $ filerecord -> filearea ; if ( ! is_null ( $ filerecord -> itemid ) ) { $ filedesc .= '/' . $ filerecord -> itemid ; } $ filedesc .= $ filerecord -> filepath . $ filerecord... | Return the expected location of a file |
27,515 | private function add_result_item ( $ name , $ value ) { $ results = $ this -> task -> get_results ( ) ; if ( isset ( $ results [ $ name ] ) ) { if ( ! is_array ( $ results [ $ name ] ) ) { throw new coding_exception ( 'Unable to append a result item into a non-array structure.' ) ; } $ current = $ results [ $ name ] ; ... | Append a value to the given resultset |
27,516 | public function questions_recode_response_data ( $ qtype , $ newquestionid , $ sequencenumber , array $ response ) { $ qtyperestorer = $ this -> get_qtype_restorer ( $ qtype ) ; if ( $ qtyperestorer ) { $ response = $ qtyperestorer -> recode_response ( $ newquestionid , $ sequencenumber , $ response ) ; } return $ resp... | Recode the respones data for a particular step of an attempt at at particular question . |
27,517 | protected function get_qtype_restorer ( $ qtype ) { static $ qtypeplugins = array ( ) ; if ( ! isset ( $ qtypeplugins [ $ qtype ] ) ) { $ classname = 'restore_qtype_' . $ qtype . '_plugin' ; if ( class_exists ( $ classname ) ) { $ qtypeplugins [ $ qtype ] = new $ classname ( 'qtype' , $ qtype , $ this ) ; } else { $ qt... | Get the restore_qtype_plugin subclass for a specific question type . |
27,518 | protected function recode_legacy_response_data ( $ question , $ qsession , $ qstates ) { $ qsession -> questionid = $ question -> id ; foreach ( $ qstates as & $ state ) { $ state -> question = $ question -> id ; $ state -> answer = $ this -> restore_recode_legacy_answer ( $ state , $ question -> qtype ) ; } return arr... | Recode any ids in the response data |
27,519 | public function restore_recode_legacy_answer ( $ state , $ qtype ) { $ restorer = $ this -> get_qtype_restorer ( $ qtype ) ; if ( $ restorer ) { return $ restorer -> recode_legacy_state_answer ( $ state ) ; } else { return $ state -> answer ; } } | Recode the legacy answer field . |
27,520 | protected function process_completion_defaults ( $ data ) { global $ DB ; $ data = ( array ) $ data ; $ oldid = $ data [ 'id' ] ; unset ( $ data [ 'id' ] ) ; if ( ! $ mod = $ DB -> get_record ( 'modules' , [ 'name' => $ data [ 'modulename' ] ] ) ) { return ; } unset ( $ data [ 'modulename' ] ) ; $ newid = $ DB -> get_f... | Processor for path element completion_defaults |
27,521 | protected function define_execution ( ) { $ context = \ context_course :: instance ( $ this -> task -> get_courseid ( ) ) ; \ core_search \ manager :: request_index ( $ context ) ; } | When this step is executed we add the course context to the queue for reindexing . |
27,522 | protected function define_execution ( ) { $ context = \ context :: instance_by_id ( $ this -> task -> get_contextid ( ) ) ; \ core_search \ manager :: request_index ( $ context ) ; } | When this step is executed we add the activity context to the queue for reindexing . |
27,523 | protected function define_execution ( ) { if ( ! empty ( $ this -> task -> get_blockid ( ) ) ) { $ context = \ context_block :: instance ( $ this -> task -> get_blockid ( ) ) ; \ core_search \ manager :: request_index ( $ context ) ; } } | When this step is executed we add the block context to the queue for reindexing . |
27,524 | protected static function flush_store ( ) { $ ids = array_keys ( self :: $ staticstore ) ; unset ( self :: $ staticstore ) ; self :: $ staticstore = array ( ) ; foreach ( $ ids as $ id ) { self :: $ staticstore [ $ id ] = array ( ) ; } } | Flushes all of the values from all stores . |
27,525 | public function has_all ( array $ keys ) { foreach ( $ keys as $ key ) { if ( ! is_array ( $ key ) ) { $ key = array ( 'key' => $ key ) ; } $ key = $ key [ 'key' ] ; if ( ! isset ( $ this -> store [ $ key ] ) ) { return false ; } } return true ; } | Returns true if the store contains records for all of the given keys . |
27,526 | protected function reduce_for_maxsize ( ) { $ diff = $ this -> storecount - $ this -> maxsize ; if ( $ diff < 1 ) { return 0 ; } $ diff += floor ( $ this -> maxsize / 10 ) ; $ this -> store = array_slice ( $ this -> store , $ diff , null , true ) ; $ this -> storecount -= $ diff ; return $ diff ; } | Reduces the size of the array if maxsize has been hit . |
27,527 | public function get_legacy_logdata ( ) { $ user = $ this -> get_record_snapshot ( 'user' , $ this -> relateduserid ) ; $ fullname = fullname ( $ user ) ; $ info = $ this -> grade -> grade_item -> itemname . ': ' . $ fullname ; $ url = '/report/grader/index.php?id=' . $ this -> courseid ; return array ( $ this -> course... | Return legacy log info . |
27,528 | public function get_run ( $ run_id , $ type , & $ run_desc ) { global $ DB ; $ rec = $ DB -> get_record ( 'profiling' , array ( 'runid' => $ run_id ) , '*' , MUST_EXIST ) ; $ this -> runid = $ rec -> runid ; $ this -> url = $ rec -> url ; $ this -> totalexecutiontime = $ rec -> totalexecutiontime ; $ this -> totalcputi... | Given one runid and one type return the run data and some extra info in run_desc from DB |
27,529 | public function save_run ( $ xhprof_data , $ type , $ run_id = null ) { global $ DB , $ CFG ; if ( is_null ( $ this -> url ) ) { xhprof_error ( "Warning: You must use the prepare_run() method before saving it" ) ; } $ this -> runid = is_null ( $ run_id ) ? md5 ( $ this -> url . '-' . uniqid ( ) ) : $ run_id ; $ this ->... | Given some run data one type and optionally one runid store the information in DB |
27,530 | protected function col_url ( $ row ) { global $ OUTPUT ; $ scripturl = new moodle_url ( '/admin/tool/profiling/index.php' , array ( 'script' => $ row -> url , 'listurl' => $ row -> url ) ) ; $ scriptaction = $ OUTPUT -> action_link ( $ scripturl , $ row -> url ) ; if ( $ this -> listurlmode ) { $ detailsaction = '' ; }... | Format URL so it points to last run for that url |
27,531 | protected function col_timecreated ( $ row ) { global $ OUTPUT ; $ fdate = userdate ( $ row -> timecreated , '%d %b %Y, %H:%M' ) ; $ url = new moodle_url ( '/admin/tool/profiling/index.php' , array ( 'runid' => $ row -> runid , 'listurl' => $ row -> url ) ) ; return $ OUTPUT -> action_link ( $ url , $ fdate ) ; } | Format profiling date human and pointing to run |
27,532 | public function get_document ( $ record , $ options = array ( ) ) { try { $ context = \ context_course :: instance ( $ record -> id ) ; } catch ( \ moodle_exception $ ex ) { debugging ( 'Error retrieving ' . $ this -> areaid . ' ' . $ record -> id . ' document, not all required data is available: ' . $ ex -> getMessage... | Returns the document associated with this course . |
27,533 | public function setConditionalStyles ( $ pValue = null ) { if ( is_array ( $ pValue ) ) { $ this -> getActiveSheet ( ) -> setConditionalStyles ( $ this -> getSelectedCells ( ) , $ pValue ) ; } return $ this ; } | Set Conditional Styles . Only used on supervisor . |
27,534 | protected function calculate_context ( ) { global $ USER , $ DB ; $ context = null ; if ( isset ( $ this -> properties -> categoryid ) && $ this -> properties -> categoryid > 0 ) { $ context = \ context_coursecat :: instance ( $ this -> properties -> categoryid ) ; } else if ( isset ( $ this -> properties -> courseid )... | Calculate the context value needed for an event . |
27,535 | protected function get_context ( ) { if ( ! isset ( $ this -> properties -> context ) ) { $ this -> properties -> context = $ this -> calculate_context ( ) ; } return $ this -> properties -> context ; } | Returns the context for this event . The context is calculated the first time is is requested and then stored in a member variable to be returned each subsequent time . |
27,536 | public function count_repeats ( ) { global $ DB ; if ( ! empty ( $ this -> properties -> repeatid ) ) { $ this -> properties -> eventrepeats = $ DB -> count_records ( 'event' , array ( 'repeatid' => $ this -> properties -> repeatid ) ) ; $ this -> properties -> eventrepeats -- ; } return $ this -> properties -> eventre... | Return the number of repeat events there are in this events series . |
27,537 | public function properties ( $ prepareeditor = false ) { global $ DB ; $ properties = clone ( $ this -> properties ) ; $ properties -> description = clean_text ( $ properties -> description , $ properties -> format ) ; if ( $ prepareeditor ) { if ( ! empty ( $ properties -> id ) ) { if ( $ properties -> eventtype === '... | Fetch all event properties . |
27,538 | public function toggle_visibility ( $ force = null ) { global $ DB ; if ( empty ( $ this -> properties -> visible ) ) { $ this -> properties -> visible = 1 ; } if ( $ force === true || ( $ force !== false && $ this -> properties -> visible == 0 ) ) { $ this -> properties -> visible = 1 ; } else { $ this -> properties -... | Toggles the visibility of an event |
27,539 | public static function load ( $ param ) { global $ DB ; if ( is_object ( $ param ) ) { $ event = new calendar_event ( $ param ) ; } else { $ event = $ DB -> get_record ( 'event' , array ( 'id' => ( int ) $ param ) , '*' , MUST_EXIST ) ; $ event = new calendar_event ( $ event ) ; } return $ event ; } | Returns an event object when provided with an event id . |
27,540 | public static function create ( $ properties , $ checkcapability = true ) { if ( is_array ( $ properties ) ) { $ properties = ( object ) $ properties ; } if ( ! is_object ( $ properties ) ) { throw new \ coding_exception ( 'When creating an event properties should be either an object or an assoc array' ) ; } $ event = ... | Creates a new event and returns an event object . |
27,541 | public function format_external_text ( ) { if ( $ this -> editorcontext === null ) { $ this -> editorcontext = $ this -> get_context ( ) ; if ( ! calendar_is_valid_eventtype ( $ this -> properties -> eventtype ) ) { return external_format_text ( $ this -> properties -> description , $ this -> properties -> format , $ t... | Format the text using the external API . |
27,542 | public static function create ( $ time , int $ courseid , int $ categoryid = null ) : calendar_information { $ calendar = new static ( 0 , 0 , 0 , $ time ) ; if ( $ courseid != SITEID && ! empty ( $ courseid ) ) { $ course = get_course ( $ courseid ) ; $ calendar -> context = context_course :: instance ( $ course -> id... | Creates and set up a instance . |
27,543 | public function set_time ( $ time = null ) { if ( empty ( $ time ) ) { $ this -> time = time ( ) ; } else { $ this -> time = $ time ; } return $ this ; } | Set the time period of this instance . |
27,544 | public function prepare_for_view ( stdClass $ course , array $ coursestoload , $ ignorefilters = false ) { debugging ( 'The prepare_for_view() function has been deprecated. Please update your code to use set_sources()' , DEBUG_DEVELOPER ) ; $ this -> set_sources ( $ course , $ coursestoload ) ; } | Initialize calendar information |
27,545 | public function set_sources ( stdClass $ course , array $ courses , stdClass $ category = null ) { global $ USER ; $ this -> course = $ course ; $ this -> courseid = $ course -> id ; list ( $ courseids , $ group , $ user ) = calendar_set_filters ( $ courses ) ; $ this -> courses = $ courseids ; $ this -> groups = $ gro... | Set the sources for events within the calendar . |
27,546 | public function checkdate ( $ defaultonow = true ) { if ( ! checkdate ( $ this -> month , $ this -> day , $ this -> year ) ) { if ( $ defaultonow ) { $ now = usergetdate ( time ( ) ) ; $ this -> day = intval ( $ now [ 'mday' ] ) ; $ this -> month = intval ( $ now [ 'mon' ] ) ; $ this -> year = intval ( $ now [ 'year' ]... | Ensures the date for the calendar is correct and either sets it to now or throws a moodle_exception if not |
27,547 | public function add_sidecalendar_blocks ( core_calendar_renderer $ renderer , $ showfilters = false , $ view = null ) { if ( $ showfilters ) { $ filters = new block_contents ( ) ; $ filters -> content = $ renderer -> event_filter ( ) ; $ filters -> footer = '' ; $ filters -> title = get_string ( 'eventskey' , 'calendar... | Adds the pretend blocks for the calendar |
27,548 | public function write ( PHPExcel $ pPHPExcel = null ) { if ( ! $ pPHPExcel ) { $ pPHPExcel = $ this -> getParentWriter ( ) -> getPHPExcel ( ) ; } $ objWriter = null ; if ( $ this -> getParentWriter ( ) -> getUseDiskCaching ( ) ) { $ objWriter = new PHPExcel_Shared_XMLWriter ( PHPExcel_Shared_XMLWriter :: STORAGE_DISK ,... | Write meta . xml to XML format |
27,549 | function init ( ) { $ this -> blockname = get_class ( $ this ) ; $ this -> title = get_string ( 'pluginname' , $ this -> blockname ) ; } | Set the initial properties for the block |
27,550 | public function find_users ( $ search ) { global $ DB ; $ whereconditions = array ( ) ; list ( $ wherecondition , $ params ) = $ this -> search_sql ( $ search , 'u' ) ; if ( $ wherecondition ) { $ whereconditions [ ] = $ wherecondition ; } $ existingids = array ( ) ; foreach ( $ this -> existingrecipients as $ group ) ... | Finds all potential badge recipients |
27,551 | public function find_users ( $ search ) { global $ DB ; list ( $ wherecondition , $ params ) = $ this -> search_sql ( $ search , 'u' ) ; $ params [ 'badgeid' ] = $ this -> badgeid ; $ params [ 'issuerrole' ] = $ this -> issuerrole ; list ( $ esql , $ eparams ) = get_enrolled_sql ( $ this -> context , 'moodle/badges:ear... | Finds all users who already have been awarded a badge by current role |
27,552 | public static function toPHPDateFormat ( $ excelDateFormat ) { $ dateFormat = preg_replace ( '/^(?:\[\$[^\]]+?\])?([^;]*).*/' , '$1' , $ excelDateFormat ) ; $ dateFormatParts = explode ( '"' , $ dateFormat ) ; foreach ( $ dateFormatParts as $ partIndex => $ dateFormatPart ) { if ( $ partIndex % 2 === 1 ) { continue ; }... | Converts the given Excel date format to a format understandable by the PHP date function . |
27,553 | private static function get_block_structure ( ) { return new external_single_structure ( array ( 'instanceid' => new external_value ( PARAM_INT , 'Block instance id.' ) , 'name' => new external_value ( PARAM_PLUGIN , 'Block name.' ) , 'region' => new external_value ( PARAM_ALPHANUMEXT , 'Block region.' ) , 'positionid'... | Returns a block structure . |
27,554 | public static function get_course_blocks ( $ courseid , $ returncontents = false ) { global $ PAGE ; $ warnings = array ( ) ; $ params = self :: validate_parameters ( self :: get_course_blocks_parameters ( ) , [ 'courseid' => $ courseid , 'returncontents' => $ returncontents ] ) ; $ course = get_course ( $ params [ 'co... | Returns blocks information for a course . |
27,555 | public static function get_dashboard_blocks ( $ userid = 0 , $ returncontents = false ) { global $ CFG , $ USER , $ PAGE ; require_once ( $ CFG -> dirroot . '/my/lib.php' ) ; $ warnings = array ( ) ; $ params = self :: validate_parameters ( self :: get_dashboard_blocks_parameters ( ) , [ 'userid' => $ userid , 'returnc... | Returns blocks information for the given user dashboard . |
27,556 | protected function is_tagging_enabled ( ) { if ( ! empty ( $ this -> tagsoptions [ 'itemtype' ] ) && ! empty ( $ this -> tagsoptions [ 'component' ] ) ) { $ enabled = core_tag_tag :: is_enabled ( $ this -> tagsoptions [ 'component' ] , $ this -> tagsoptions [ 'itemtype' ] ) ; if ( $ enabled === false ) { return false ;... | Checks if tagging is enabled for this itemtype |
27,557 | protected function get_tag_collection ( ) { if ( empty ( $ this -> tagsoptions [ 'tagcollid' ] ) && ( empty ( $ this -> tagsoptions [ 'itemtype' ] ) || empty ( $ this -> tagsoptions [ 'component' ] ) ) ) { debugging ( 'You need to specify \'itemtype\' and \'component\' of the tagged ' . 'area in the tags form element o... | Finds the tag collection to use for standard tag selector |
27,558 | protected function load_standard_tags ( ) { global $ CFG , $ DB ; if ( ! $ this -> is_tagging_enabled ( ) ) { return array ( ) ; } $ namefield = empty ( $ CFG -> keeptagnamecase ) ? 'name' : 'rawname' ; $ tags = $ DB -> get_records_menu ( 'tag' , array ( 'isstandard' => 1 , 'tagcollid' => $ this -> get_tag_collection (... | Internal function to load standard tags |
27,559 | public function get_users ( $ sort , $ direction = 'ASC' , $ page = 0 , $ perpage = 25 ) { global $ DB ; if ( $ direction !== 'ASC' ) { $ direction = 'DESC' ; } $ key = md5 ( "$sort-$direction-$page-$perpage" ) ; if ( ! array_key_exists ( $ key , $ this -> users ) ) { list ( $ instancessql , $ params , $ filter ) = $ t... | Gets all of the users enrolled in this course . |
27,560 | public function get_other_users ( $ sort , $ direction = 'ASC' , $ page = 0 , $ perpage = 25 ) { global $ DB ; if ( $ direction !== 'ASC' ) { $ direction = 'DESC' ; } $ key = md5 ( "$sort-$direction-$page-$perpage" ) ; if ( ! array_key_exists ( $ key , $ this -> otherusers ) ) { list ( $ ctxcondition , $ params ) = $ D... | Gets and array of other users . |
27,561 | public function get_potential_users ( $ enrolid , $ search = '' , $ searchanywhere = false , $ page = 0 , $ perpage = 25 , $ addedenrollment = 0 , $ returnexactcount = false ) { global $ DB ; list ( $ ufields , $ params , $ wherecondition ) = $ this -> get_basic_search_conditions ( $ search , $ searchanywhere ) ; $ fie... | Gets an array of the users that can be enrolled in this course . |
27,562 | public function search_other_users ( $ search = '' , $ searchanywhere = false , $ page = 0 , $ perpage = 25 , $ returnexactcount = false ) { global $ DB , $ CFG ; list ( $ ufields , $ params , $ wherecondition ) = $ this -> get_basic_search_conditions ( $ search , $ searchanywhere ) ; $ fields = 'SELECT ' . $ ufields ;... | Searches other users and returns paginated results |
27,563 | protected function get_instance_sql ( ) { global $ DB ; if ( $ this -> _instancessql === null ) { $ instances = $ this -> get_enrolment_instances ( ) ; $ filter = $ this -> get_enrolment_filter ( ) ; if ( $ filter && array_key_exists ( $ filter , $ instances ) ) { $ sql = " = :ifilter" ; $ params = array ( 'ifilter' =>... | Gets an array containing some SQL to user for when selecting params for that SQL and the filter that was used in constructing the sql . |
27,564 | public function get_enrolment_instances ( $ onlyenabled = false ) { if ( $ this -> _instances === null ) { $ this -> _instances = enrol_get_instances ( $ this -> course -> id , $ onlyenabled ) ; } return $ this -> _instances ; } | Returns all of the enrolment instances for this course . |
27,565 | public function get_enrolment_instance_names ( $ onlyenabled = false ) { if ( $ this -> _inames === null ) { $ instances = $ this -> get_enrolment_instances ( $ onlyenabled ) ; $ plugins = $ this -> get_enrolment_plugins ( false ) ; foreach ( $ instances as $ key => $ instance ) { if ( ! isset ( $ plugins [ $ instance ... | Returns the names for all of the enrolment instances for this course . |
27,566 | public function get_enrolment_plugins ( $ onlyenabled = true ) { if ( $ this -> _plugins === null ) { $ this -> _plugins = enrol_get_plugins ( true ) ; } if ( $ onlyenabled ) { return $ this -> _plugins ; } if ( $ this -> _allplugins === null ) { $ this -> _allplugins = $ this -> _plugins ; foreach ( enrol_get_plugins ... | Gets all of the enrolment plugins that are available for this course . |
27,567 | public function get_assignable_roles ( $ otherusers = false ) { if ( $ this -> _assignableroles === null ) { $ this -> _assignableroles = get_assignable_roles ( $ this -> context , ROLENAME_ALIAS , false ) ; } if ( $ otherusers ) { if ( ! is_array ( $ this -> _assignablerolesothers ) ) { $ this -> _assignablerolesother... | Gets all of the assignable roles for this course . |
27,568 | public function get_assignable_roles_for_json ( $ otherusers = false ) { $ rolesarray = array ( ) ; $ assignable = $ this -> get_assignable_roles ( $ otherusers ) ; foreach ( $ assignable as $ id => $ role ) { $ rolesarray [ ] = array ( 'id' => $ id , 'name' => $ role ) ; } return $ rolesarray ; } | Gets all of the assignable roles for this course wrapped in an array to ensure role sort order is not lost during json deserialisation . |
27,569 | public function get_all_groups ( ) { if ( $ this -> _groups === null ) { $ this -> _groups = groups_get_all_groups ( $ this -> course -> id ) ; foreach ( $ this -> _groups as $ gid => $ group ) { $ this -> _groups [ $ gid ] -> name = format_string ( $ group -> name ) ; } } return $ this -> _groups ; } | Gets all of the groups for this course . |
27,570 | public function unenrol_user ( $ ue ) { global $ DB ; list ( $ instance , $ plugin ) = $ this -> get_user_enrolment_components ( $ ue ) ; if ( $ instance && $ plugin && $ plugin -> allow_unenrol_user ( $ instance , $ ue ) && has_capability ( "enrol/$instance->enrol:unenrol" , $ this -> context ) ) { $ plugin -> unenrol... | Unenrols a user from the course given the users ue entry |
27,571 | public function get_user_enrolment_components ( $ userenrolment ) { global $ DB ; if ( is_numeric ( $ userenrolment ) ) { $ userenrolment = $ DB -> get_record ( 'user_enrolments' , array ( 'id' => ( int ) $ userenrolment ) ) ; } $ instances = $ this -> get_enrolment_instances ( ) ; $ plugins = $ this -> get_enrolment_p... | Given a user enrolment record this method returns the plugin and enrolment instance that relate to it . |
27,572 | public function unassign_role_from_user ( $ userid , $ roleid ) { global $ DB ; if ( ! is_siteadmin ( ) and ! array_key_exists ( $ roleid , $ this -> get_assignable_roles ( ) ) ) { if ( defined ( 'AJAX_SCRIPT' ) ) { throw new moodle_exception ( 'invalidrole' ) ; } return false ; } $ user = $ DB -> get_record ( 'user' ,... | Removes an assigned role from a user . |
27,573 | public function add_user_to_group ( $ user , $ groupid ) { require_capability ( 'moodle/course:managegroups' , $ this -> context ) ; $ group = $ this -> get_group ( $ groupid ) ; if ( ! $ group ) { return false ; } return groups_add_member ( $ group -> id , $ user -> id ) ; } | Adds a user to a group |
27,574 | public function remove_user_from_group ( $ user , $ groupid ) { global $ DB ; require_capability ( 'moodle/course:managegroups' , $ this -> context ) ; $ group = $ this -> get_group ( $ groupid ) ; if ( ! groups_remove_member_allowed ( $ group , $ user ) ) { return false ; } if ( ! $ group ) { return false ; } return g... | Removes a user from a group |
27,575 | public function get_group ( $ groupid ) { $ groups = $ this -> get_all_groups ( ) ; if ( ! array_key_exists ( $ groupid , $ groups ) ) { return false ; } return $ groups [ $ groupid ] ; } | Gets the requested group |
27,576 | public function edit_enrolment ( $ userenrolment , $ data ) { list ( $ instance , $ plugin ) = $ this -> get_user_enrolment_components ( $ userenrolment ) ; if ( $ instance && $ plugin && $ plugin -> allow_manage ( $ instance ) && has_capability ( "enrol/$instance->enrol:manage" , $ this -> context ) ) { if ( ! isset (... | Edits an enrolment |
27,577 | public function get_user_roles ( $ userid ) { $ roles = array ( ) ; $ ras = get_user_roles ( $ this -> context , $ userid , true , 'c.contextlevel DESC, r.sortorder ASC' ) ; $ plugins = $ this -> get_enrolment_plugins ( false ) ; foreach ( $ ras as $ ra ) { if ( $ ra -> contextid != $ this -> context -> id ) { if ( ! a... | Gets the roles assigned to this user that are applicable for this course . |
27,578 | public function get_user_enrolments ( $ userid ) { global $ DB ; list ( $ instancessql , $ params , $ filter ) = $ this -> get_instance_sql ( ) ; $ params [ 'userid' ] = $ userid ; $ userenrolments = $ DB -> get_records_select ( 'user_enrolments' , "enrolid $instancessql AND userid = :userid" , $ params ) ; $ instances... | Gets the enrolments this user has in the course - including all suspended plugins and instances . |
27,579 | public function get_url_params ( ) { $ args = array ( 'id' => $ this -> course -> id ) ; if ( ! empty ( $ this -> instancefilter ) ) { $ args [ 'ifilter' ] = $ this -> instancefilter ; } if ( ! empty ( $ this -> rolefilter ) ) { $ args [ 'role' ] = $ this -> rolefilter ; } if ( $ this -> searchfilter !== '' ) { $ args ... | Retursn an array of params that would go into the URL to return to this exact page . |
27,580 | public function get_other_users_for_display ( core_enrol_renderer $ renderer , moodle_url $ pageurl , $ sort , $ direction , $ page , $ perpage ) { $ userroles = $ this -> get_other_users ( $ sort , $ direction , $ page , $ perpage ) ; $ roles = $ this -> get_all_roles ( ) ; $ plugins = $ this -> get_enrolment_plugins ... | Gets an array of other users in this course ready for display . |
27,581 | private function prepare_user_for_display ( $ user , $ extrafields , $ now ) { $ details = array ( 'userid' => $ user -> id , 'courseid' => $ this -> get_course ( ) -> id , 'picture' => new user_picture ( $ user ) , 'userfullnamedisplay' => fullname ( $ user , has_capability ( 'moodle/site:viewfullnames' , $ this -> ge... | Prepare a user record for display |
27,582 | public function get_filtered_enrolment_plugin ( ) { $ instances = $ this -> get_enrolment_instances ( ) ; $ plugins = $ this -> get_enrolment_plugins ( false ) ; if ( empty ( $ this -> instancefilter ) || ! array_key_exists ( $ this -> instancefilter , $ instances ) ) { return false ; } $ instance = $ instances [ $ thi... | Returns the enrolment plugin that the course manager was being filtered to . |
27,583 | public function get_users_enrolments ( array $ userids ) { global $ DB ; $ instances = $ this -> get_enrolment_instances ( ) ; $ plugins = $ this -> get_enrolment_plugins ( false ) ; if ( ! empty ( $ this -> instancefilter ) ) { $ instancesql = ' = :instanceid' ; $ instanceparams = array ( 'instanceid' => $ this -> ins... | Returns and array of users + enrolment details . |
27,584 | public function require_yui_module ( $ modules , $ function , array $ arguments = null , $ galleryversion = null , $ ondomready = false ) { if ( $ galleryversion != null ) { debugging ( 'The galleryversion parameter to yui_module has been deprecated since Moodle 2.3.' , DEBUG_DEVELOPER ) ; } $ js = new stdClass ; $ js ... | Adds a YUI module call that will be added to the page when the button is used . |
27,585 | public function require_js_init_call ( $ function , array $ extraarguments = null , $ ondomready = false , array $ module = null ) { $ js = new stdClass ; $ js -> function = $ function ; $ js -> extraarguments = $ extraarguments ; $ js -> ondomready = $ ondomready ; $ js -> module = $ module ; $ this -> jsinitcalls [ ]... | Adds a JS initialisation call to the page when the button is used . |
27,586 | public function strings_for_js ( $ identifiers , $ component = 'moodle' , $ a = null ) { $ string = new stdClass ; $ string -> identifiers = ( array ) $ identifiers ; $ string -> component = $ component ; $ string -> a = $ a ; $ this -> jsstrings [ ] = $ string ; } | Requires strings for JS that will be loaded when the button is used . |
27,587 | public function initialise_js ( moodle_page $ page ) { foreach ( $ this -> jsyuimodules as $ js ) { $ page -> requires -> yui_module ( $ js -> modules , $ js -> function , $ js -> arguments , null , $ js -> ondomready ) ; } foreach ( $ this -> jsinitcalls as $ js ) { $ page -> requires -> js_init_call ( $ js -> functio... | Initialises the JS that is required by this button |
27,588 | public function need_confirm_regrading ( $ controller ) { $ data = $ this -> get_data ( ) ; if ( isset ( $ data -> rubric [ 'regrade' ] ) ) { return false ; } if ( ! isset ( $ data -> saverubric ) || ! $ data -> saverubric ) { return false ; } if ( ! $ controller -> has_active_instances ( ) ) { return false ; } $ chang... | Check if there are changes in the rubric and it is needed to ask user whether to mark the current grades for re - grading . User may confirm re - grading and continue return to editing or cancel the changes |
27,589 | public function block_community_add_course ( $ course , $ userid ) { global $ DB ; $ community = $ this -> block_community_get_course ( $ course -> url , $ userid ) ; if ( empty ( $ community ) ) { $ community = new stdClass ( ) ; $ community -> userid = $ userid ; $ community -> coursename = $ course -> name ; $ commu... | Add a community course |
27,590 | protected function manipulateRuleValues ( array $ rules ) { $ finalrules = [ ] ; foreach ( $ rules as $ rule ) { $ property = $ rule -> getRule ( ) ; $ value = $ rule -> getValue ( ) ; if ( $ property === 'position' && $ value === 'sticky' ) { $ newrule = clone $ rule ; $ newrule -> setValue ( '-webkit-sticky' ) ; $ fi... | Manipulate an array of rules to adapt their values . |
27,591 | protected function processBlock ( $ block ) { foreach ( $ block -> getContents ( ) as $ node ) { if ( $ node instanceof AtRule ) { $ name = $ node -> atRuleName ( ) ; if ( isset ( self :: $ atrules [ $ name ] ) ) { foreach ( self :: $ atrules [ $ name ] as $ prefix ) { $ newname = $ prefix . $ name ; $ newnode = clone ... | Process block . |
27,592 | protected function processDeclaration ( $ node , $ parent ) { $ rules = [ ] ; foreach ( $ node -> getRules ( ) as $ key => $ rule ) { $ name = $ rule -> getRule ( ) ; $ seen [ $ name ] = true ; if ( ! isset ( self :: $ rules [ $ name ] ) ) { $ rules [ ] = $ rule ; continue ; } foreach ( self :: $ rules [ $ name ] as $ ... | Process declaration . |
27,593 | protected function render_enrol_user_button ( enrol_user_button $ button ) { $ attributes = array ( 'type' => 'submit' , 'value' => $ button -> label , 'disabled' => $ button -> disabled ? 'disabled' : null , 'title' => $ button -> tooltip , 'class' => 'btn btn-secondary my-1' ) ; if ( $ button -> actions ) { $ id = ht... | Renderers the enrol_user_button . |
27,594 | protected function render_course_enrolment_other_users_table ( course_enrolment_other_users_table $ table ) { $ table -> initialise_javascript ( ) ; $ content = '' ; $ searchbutton = $ table -> get_user_search_button ( ) ; if ( $ searchbutton ) { $ content .= $ this -> output -> render ( $ searchbutton ) ; } $ content ... | Renders a course enrolment table |
27,595 | public function user_roles_and_actions ( $ userid , $ roles , $ assignableroles , $ canassign , $ pageurl ) { $ rolesoutput = '' ; foreach ( $ roles as $ roleid => $ role ) { if ( $ canassign and ( is_siteadmin ( ) or isset ( $ assignableroles [ $ roleid ] ) ) and ! $ role [ 'unchangeable' ] ) { $ strunassign = get_str... | Generates HTML to display the users roles and any available actions |
27,596 | public function user_groups_and_actions ( $ userid , $ groups , $ allgroups , $ canmanagegroups , $ pageurl ) { $ groupicon = $ this -> output -> pix_icon ( 'i/group' , get_string ( 'addgroup' , 'group' ) ) ; $ groupoutput = '' ; foreach ( $ groups as $ groupid => $ name ) { if ( $ canmanagegroups and groups_remove_mem... | Generates the HTML to view the users groups and available group actions |
27,597 | public function user_enrolments_and_actions ( $ enrolments ) { $ output = '' ; foreach ( $ enrolments as $ ue ) { $ enrolmentoutput = $ ue [ 'text' ] . ' ' . $ ue [ 'period' ] ; if ( $ ue [ 'dimmed' ] ) { $ enrolmentoutput = html_writer :: tag ( 'span' , $ enrolmentoutput , array ( 'class' => 'dimmed_text' ) ) ; } else... | Generates the HTML for the given enrolments + available actions |
27,598 | protected function render_user_enrolment_action ( user_enrolment_action $ icon ) { return html_writer :: link ( $ icon -> get_url ( ) , $ this -> output -> render ( $ icon -> get_icon ( ) ) , $ icon -> get_attributes ( ) ) ; } | Renders a user enrolment action |
27,599 | public function set_fields ( $ fields , $ output ) { $ this -> fields = $ fields ; $ this -> head = array ( ) ; $ this -> colclasses = array ( ) ; $ this -> align = array ( ) ; $ url = $ this -> manager -> get_moodlepage ( ) -> url ; if ( ! empty ( $ this -> bulkoperations ) ) { $ this -> head [ ] = '' ; $ this -> colc... | Sets the fields for this table . These get added to the tables head as well . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.