idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
30,300 | public function explain ( Explainable $ explainable , array $ options = [ ] ) { if ( ! isset ( $ options [ 'readPreference' ] ) ) { $ options [ 'readPreference' ] = $ this -> readPreference ; } if ( ! isset ( $ options [ 'typeMap' ] ) ) { $ options [ 'typeMap' ] = $ this -> typeMap ; } $ server = $ this -> manager -> s... | Explains explainable commands . |
30,301 | public function find ( $ filter = [ ] , array $ options = [ ] ) { if ( ! isset ( $ options [ 'readPreference' ] ) ) { $ options [ 'readPreference' ] = $ this -> readPreference ; } $ server = $ this -> manager -> selectServer ( $ options [ 'readPreference' ] ) ; if ( ! isset ( $ options [ 'readConcern' ] ) && \ MongoDB ... | Finds documents matching the query . |
30,302 | public function findOneAndReplace ( $ filter , $ replacement , array $ options = [ ] ) { $ server = $ this -> manager -> selectServer ( new ReadPreference ( ReadPreference :: RP_PRIMARY ) ) ; if ( ! isset ( $ options [ 'writeConcern' ] ) && \ MongoDB \ server_supports_feature ( $ server , self :: $ wireVersionForFindAn... | Finds a single document and replaces it returning either the original or the replaced document . |
30,303 | public function listIndexes ( array $ options = [ ] ) { $ operation = new ListIndexes ( $ this -> databaseName , $ this -> collectionName , $ options ) ; $ server = $ this -> manager -> selectServer ( new ReadPreference ( ReadPreference :: RP_PRIMARY ) ) ; return $ operation -> execute ( $ server ) ; } | Returns information for all indexes for the collection . |
30,304 | public function replaceOne ( $ filter , $ replacement , array $ options = [ ] ) { if ( ! isset ( $ options [ 'writeConcern' ] ) ) { $ options [ 'writeConcern' ] = $ this -> writeConcern ; } $ operation = new ReplaceOne ( $ this -> databaseName , $ this -> collectionName , $ filter , $ replacement , $ options ) ; $ serv... | Replaces at most one document matching the filter . |
30,305 | public function updateMany ( $ filter , $ update , array $ options = [ ] ) { if ( ! isset ( $ options [ 'writeConcern' ] ) ) { $ options [ 'writeConcern' ] = $ this -> writeConcern ; } $ operation = new UpdateMany ( $ this -> databaseName , $ this -> collectionName , $ filter , $ update , $ options ) ; $ server = $ thi... | Updates all documents matching the filter . |
30,306 | public function initialize ( ) { $ this -> id = null ; $ this -> recordId = null ; $ this -> toolProxy = null ; $ this -> created = null ; $ this -> updated = null ; } | Initialise the tool proxy . |
30,307 | private function load ( $ id ) { $ this -> initialize ( ) ; $ this -> id = $ id ; $ ok = $ this -> dataConnector -> loadToolProxy ( $ this ) ; if ( ! $ ok ) { $ this -> enabled = $ autoEnable ; } return $ ok ; } | Load the tool proxy from the database . |
30,308 | public static function get_supported_features ( array $ configuration = array ( ) ) { $ supports = self :: SUPPORTS_DATA_GUARANTEE + self :: DEREFERENCES_OBJECTS ; if ( array_key_exists ( 'extendedmode' , $ configuration ) && $ configuration [ 'extendedmode' ] ) { $ supports += self :: SUPPORTS_MULTIPLE_IDENTIFIERS ; }... | Returns the supported features . |
30,309 | public function initialise ( cache_definition $ definition ) { if ( $ this -> is_initialised ( ) ) { throw new coding_exception ( 'This mongodb instance has already been initialised.' ) ; } $ this -> database = $ this -> connection -> selectDatabase ( $ this -> databasename ) ; $ this -> definitionhash = 'm' . $ defini... | Initialises the store instance for use . |
30,310 | public static function config_get_configuration_array ( $ data ) { $ return = array ( 'server' => $ data -> server , 'database' => $ data -> database , 'extendedmode' => ( ! empty ( $ data -> extendedmode ) ) ) ; if ( ! empty ( $ data -> username ) ) { $ return [ 'username' ] = $ data -> username ; } if ( ! empty ( $ d... | Takes the object from the add instance store and creates a configuration array that can be used to initialise an instance . |
30,311 | protected function get_either_description ( $ not , $ standalone ) { $ direction = $ this -> get_logical_direction ( $ not ) ; $ midnight = self :: is_midnight ( $ this -> time ) ; $ midnighttag = $ midnight ? '_date' : '' ; $ satag = $ standalone ? 'short_' : 'full_' ; switch ( $ direction ) { case self :: DIRECTION_F... | Shows the description using the different lang strings for the standalone version or the full one . |
30,312 | protected function show_time ( $ time , $ dateonly , $ until = false ) { $ daybefore = false ; if ( $ until && $ dateonly ) { $ daybefore = true ; $ time = strtotime ( '-1 day' , $ time ) ; } return userdate ( $ time , get_string ( $ dateonly ? 'strftimedate' : 'strftimedatetime' , 'langconfig' ) ) ; } | Shows a time either as a date or a full date and time according to user s timezone . |
30,313 | public static function update_all_dates ( $ courseid , $ timeshift ) { global $ DB ; $ modinfo = get_fast_modinfo ( $ courseid ) ; $ anychanged = false ; foreach ( $ modinfo -> cms as $ cm ) { if ( ! $ cm -> availability ) { continue ; } $ info = new \ core_availability \ info_module ( $ cm ) ; $ tree = $ info -> get_a... | Changes all date restrictions on a course by the specified shift amount . Used by the course reset feature . |
30,314 | public function query ( $ siteUrl , Google_Service_Webmasters_SearchAnalyticsQueryRequest $ postBody , $ optParams = array ( ) ) { $ params = array ( 'siteUrl' => $ siteUrl , 'postBody' => $ postBody ) ; $ params = array_merge ( $ params , $ optParams ) ; return $ this -> call ( 'query' , array ( $ params ) , "Google_S... | Query your data with filters and parameters that you define . Returns zero or more rows grouped by the row keys that you define . You must define a date range of one or more days . |
30,315 | public function col_picture ( $ attempt ) { global $ OUTPUT ; $ user = new stdClass ( ) ; $ additionalfields = explode ( ',' , user_picture :: fields ( ) ) ; $ user = username_load_fields_from_object ( $ user , $ attempt , null , $ additionalfields ) ; $ user -> id = $ attempt -> userid ; return $ OUTPUT -> user_pictur... | Generate the display of the user s picture column . |
30,316 | public function col_fullname ( $ attempt ) { $ html = parent :: col_fullname ( $ attempt ) ; if ( $ this -> is_downloading ( ) || empty ( $ attempt -> attempt ) ) { return $ html ; } return $ html . html_writer :: empty_tag ( 'br' ) . html_writer :: link ( new moodle_url ( '/mod/quiz/review.php' , array ( 'attempt' => ... | Generate the display of the user s full name column . |
30,317 | public function col_timefinish ( $ attempt ) { if ( $ attempt -> attempt && $ attempt -> timefinish ) { return userdate ( $ attempt -> timefinish , $ this -> strtimeformat ) ; } else { return '-' ; } } | Generate the display of the finish time column . |
30,318 | public function col_feedbacktext ( $ attempt ) { if ( $ attempt -> state != quiz_attempt :: FINISHED ) { return '-' ; } $ feedback = quiz_report_feedback_for_grade ( quiz_rescale_grade ( $ attempt -> sumgrades , $ this -> quiz , false ) , $ this -> quiz -> id , $ this -> context ) ; if ( $ this -> is_downloading ( ) ) ... | Generate the display of the feedback column . |
30,319 | public function make_review_link ( $ data , $ attempt , $ slot ) { global $ OUTPUT ; $ flag = '' ; if ( $ this -> is_flagged ( $ attempt -> usageid , $ slot ) ) { $ flag = $ OUTPUT -> pix_icon ( 'i/flagged' , get_string ( 'flagged' , 'question' ) , 'moodle' , array ( 'class' => 'questionflag' ) ) ; } $ feedbackimg = ''... | Make a link to review an individual question in a popup window . |
30,320 | public function base_sql ( \ core \ dml \ sql_join $ allowedstudentsjoins ) { global $ DB ; $ fields = 'DISTINCT ' . $ DB -> sql_concat ( 'u.id' , "'#'" , 'COALESCE(quiza.attempt, 0)' ) . ' AS uniqueid,' ; if ( $ this -> qmsubselect ) { $ fields .= "\n(CASE WHEN $this->qmsubselect THEN 1 ELSE 0 END) AS gradedattempt," ... | Contruct all the parts of the main database query . |
30,321 | protected function get_qubaids_condition ( ) { if ( is_null ( $ this -> rawdata ) ) { throw new coding_exception ( 'Cannot call get_qubaids_condition until the main data has been loaded.' ) ; } if ( $ this -> is_downloading ( ) ) { return new qubaid_join ( "( SELECT DISTINCT quiza.uniqueid ... | Get an appropriate qubaid_condition for loading more data about the attempts we are displaying . |
30,322 | protected static function get_and_export_user_preference ( int $ userid , string $ userpreference , $ transform = false ) { $ prefvalue = get_user_preferences ( $ userpreference , null , $ userid ) ; if ( $ prefvalue !== null ) { if ( $ transform ) { $ transformedvalue = transform :: yesno ( $ prefvalue ) ; } else { $ ... | Get and export a user preference . |
30,323 | private function createCommandDocument ( ) { $ cmd = [ 'find' => $ this -> collectionName , 'filter' => ( object ) $ this -> filter ] ; $ options = $ this -> createQueryOptions ( ) ; if ( empty ( $ options ) ) { return $ cmd ; } unset ( $ options [ 'maxAwaitTimeMS' ] ) ; $ modifierFallback = [ [ 'allowPartialResults' ,... | Construct a command document for Find |
30,324 | private function createQueryOptions ( ) { $ options = [ ] ; if ( isset ( $ this -> options [ 'cursorType' ] ) ) { if ( $ this -> options [ 'cursorType' ] === self :: TAILABLE ) { $ options [ 'tailable' ] = true ; } if ( $ this -> options [ 'cursorType' ] === self :: TAILABLE_AWAIT ) { $ options [ 'tailable' ] = true ; ... | Create options for the find query . |
30,325 | public function enrol_user ( stdClass $ instance , $ userid , $ roleid = null , $ timestart = 0 , $ timeend = 0 , $ status = null , $ recovergrades = null ) { return ; } | Enrol a user using a given enrolment instance . |
30,326 | public function try_guestaccess ( stdClass $ instance ) { global $ USER , $ CFG ; $ allow = false ; if ( $ instance -> password === '' ) { $ allow = true ; } else if ( isset ( $ USER -> enrol_guest_passwords [ $ instance -> id ] ) ) { if ( $ USER -> enrol_guest_passwords [ $ instance -> id ] === $ instance -> password ... | Attempt to automatically gain temporary guest access to course calling code has to make sure the plugin and instance are active . |
30,327 | protected function openWriter ( ) { $ tempFolder = ( $ this -> tempFolder ) ? : sys_get_temp_dir ( ) ; $ this -> book = new Workbook ( $ tempFolder , $ this -> shouldCreateNewSheetsAutomatically , $ this -> defaultRowStyle ) ; $ this -> book -> addNewSheetAndMakeItCurrent ( ) ; } | Configures the write and sets the current sheet pointer to a new sheet . |
30,328 | protected function addRowToWriter ( array $ dataRow , $ style ) { $ this -> throwIfBookIsNotAvailable ( ) ; $ this -> book -> addRowToCurrentWorksheet ( $ dataRow , $ style ) ; } | Adds data to the currently opened writer . If shouldCreateNewSheetsAutomatically option is set to true it will handle pagination with the creation of new worksheets if one worksheet has reached its maximum capicity . |
30,329 | public function save ( ) { $ ok = $ this -> dataConnector -> saveToolConsumer ( $ this ) ; if ( $ ok ) { $ this -> settingsChanged = false ; } return $ ok ; } | Save the tool consumer to the database . |
30,330 | public function setToolSettings ( $ settings = array ( ) ) { $ url = $ this -> getSetting ( 'custom_system_setting_url' ) ; $ service = new Service \ ToolSettings ( $ this , $ url ) ; $ response = $ service -> set ( $ settings ) ; return $ response ; } | Perform a Tool Settings service request . |
30,331 | public static function addSignature ( $ endpoint , $ consumerKey , $ consumerSecret , $ data , $ method = 'POST' , $ type = null ) { $ params = array ( ) ; if ( is_array ( $ data ) ) { $ params = $ data ; } $ queryParams = array ( ) ; $ queryString = parse_url ( $ endpoint , PHP_URL_QUERY ) ; if ( ! is_null ( $ querySt... | Add the OAuth signature to an array of message parameters or to a header string . |
30,332 | public function doServiceRequest ( $ service , $ method , $ format , $ data ) { $ header = ToolConsumer :: addSignature ( $ service -> endpoint , $ this -> getKey ( ) , $ this -> secret , $ data , $ method , $ format ) ; $ http = new HTTPMessage ( $ service -> endpoint , $ method , $ data , $ header ) ; if ( $ http -> ... | Perform a service request |
30,333 | public static function fromRecordId ( $ id , $ dataConnector ) { $ toolConsumer = new ToolConsumer ( null , $ dataConnector ) ; $ toolConsumer -> initialize ( ) ; $ toolConsumer -> setRecordId ( $ id ) ; if ( ! $ dataConnector -> loadToolConsumer ( $ toolConsumer ) ) { $ toolConsumer -> initialize ( ) ; } return $ tool... | Load the tool consumer from the database by its record ID . |
30,334 | public function load ( $ name ) { if ( ! isset ( $ this -> templates [ $ name ] ) ) { throw new Mustache_Exception_UnknownTemplateException ( $ name ) ; } return $ this -> templates [ $ name ] ; } | Load a Template . |
30,335 | public function get_value ( ) { $ this -> label = $ this -> grade -> grade_item -> itemname ; $ val = $ this -> grade -> finalgrade ; if ( $ this -> grade -> grade_item -> scaleid ) { return $ val ? ( int ) $ val : - 1 ; } else { return $ val ? format_float ( $ val , $ this -> grade -> grade_item -> get_decimals ( ) ) ... | Get the value for this input . |
30,336 | public function determine_format ( ) { if ( $ this -> grade -> grade_item -> load_scale ( ) ) { $ scale = $ this -> grade -> grade_item -> load_scale ( ) ; $ options = array ( - 1 => get_string ( 'nograde' ) ) ; foreach ( $ scale -> scale_items as $ i => $ name ) { $ options [ $ i + 1 ] = $ name ; } return new dropdown... | Create the element for this column . |
30,337 | public function set ( $ value ) { global $ DB ; $ userid = $ this -> grade -> userid ; $ gradeitem = $ this -> grade -> grade_item ; $ feedback = false ; $ feedbackformat = false ; if ( $ gradeitem -> gradetype == GRADE_TYPE_SCALE ) { if ( $ value == - 1 ) { $ finalgrade = null ; } else { $ finalgrade = $ value ; } } e... | Save the altered value for this field . |
30,338 | protected function add_unit_options ( $ mform ) { $ mform -> addElement ( 'header' , 'unithandling' , get_string ( 'unithandling' , 'qtype_numerical' ) ) ; $ unitoptions = array ( qtype_numerical :: UNITNONE => get_string ( 'onlynumerical' , 'qtype_numerical' ) , qtype_numerical :: UNITOPTIONAL => get_string ( 'manynum... | Add the unit handling options to the form . |
30,339 | protected function add_unit_fields ( $ mform ) { $ mform -> addElement ( 'header' , 'unithdr' , get_string ( 'units' , 'qtype_numerical' ) , '' ) ; $ unitfields = array ( $ mform -> createElement ( 'group' , 'units' , get_string ( 'unitx' , 'qtype_numerical' ) , $ this -> unit_group ( $ mform ) , null , false ) ) ; $ r... | Add the input areas for each unit . |
30,340 | protected function unit_group ( $ mform ) { $ grouparray = array ( ) ; $ grouparray [ ] = $ mform -> createElement ( 'text' , 'unit' , get_string ( 'unit' , 'qtype_numerical' ) , array ( 'size' => 10 ) ) ; $ grouparray [ ] = $ mform -> createElement ( 'float' , 'multiplier' , get_string ( 'multiplier' , 'qtype_numerica... | Get the form fields needed to edit one unit . |
30,341 | public function add_item ( cc_i_item & $ item ) { if ( is_null ( $ this -> itemlist ) ) { $ this -> itemlist = array ( ) ; } $ this -> itemlist [ $ item -> identifier ] = $ item ; } | Add one Item into the Organization |
30,342 | public function add_new_item ( $ title = '' ) { $ nitem = new cc_item ( ) ; $ nitem -> title = $ title ; $ this -> add_item ( $ nitem ) ; return $ nitem ; } | Add new Item into the Organization |
30,343 | public function add_child_item ( cc_i_item & $ item ) { if ( is_null ( $ this -> childitems ) ) { $ this -> childitems = array ( ) ; } $ this -> childitems [ $ item -> identifier ] = $ item ; } | Add one Child Item |
30,344 | public function add_new_child_item ( $ title = '' ) { $ sc = new cc_item ( ) ; $ sc -> title = $ title ; $ this -> add_child_item ( $ sc ) ; return $ sc ; } | Add new child Item |
30,345 | public function delete ( $ source = null ) { global $ DB ; if ( ! empty ( $ this -> standard ) ) { $ eventcontext = context_system :: instance ( ) ; } else { if ( ! empty ( $ this -> courseid ) ) { $ eventcontext = context_course :: instance ( $ this -> courseid ) ; } else { $ eventcontext = context_system :: instance ... | Deletes this scale from the database . |
30,346 | public function get_name ( ) { $ context = empty ( $ this -> courseid ) ? context_system :: instance ( ) : context_course :: instance ( $ this -> courseid ) ; return format_string ( $ this -> name , false , [ 'context' => $ context ] ) ; } | Returns the most descriptive field for this object . This is a standard method used when we do not know the exact type of an object . |
30,347 | public function is_used ( ) { global $ DB ; global $ CFG ; $ params = array ( $ this -> id ) ; $ sql = "SELECT COUNT(id) FROM {grade_items} WHERE scaleid = ? AND outcomeid IS NULL" ; if ( $ DB -> count_records_sql ( $ sql , $ params ) ) { return true ; } $ sql = "SELECT COUNT(id) FROM {grade_outcomes} WHERE scaleid = ?... | Returns if scale used anywhere - activities grade items outcomes etc . |
30,348 | public function get_description ( ) { global $ CFG ; require_once ( $ CFG -> libdir . '/filelib.php' ) ; $ systemcontext = context_system :: instance ( ) ; $ options = new stdClass ; $ options -> noclean = true ; $ description = file_rewrite_pluginfile_urls ( $ this -> description , 'pluginfile.php' , $ systemcontext -... | Returns the formatted grade description with URLs converted |
30,349 | public function available_courses ( ) { global $ CFG , $ DB ; require_once ( $ CFG -> libdir . '/filelib.php' ) ; if ( ! $ client = get_mnet_remote_client ( ) ) { die ( 'Callable via XML-RPC only' ) ; } $ sql = "SELECT c.id AS remoteid, c.fullname, c.shortname, c.idnumber, c.summary, c.summaryformat, ... | Returns list of courses that we offer to the caller for remote enrolment of their users |
30,350 | public function enrol_user ( array $ userdata , $ courseid ) { global $ CFG , $ DB ; require_once ( __DIR__ . '/lib.php' ) ; if ( ! $ client = get_mnet_remote_client ( ) ) { die ( 'Callable via XML-RPC only' ) ; } if ( empty ( $ userdata [ 'username' ] ) ) { throw new mnet_server_exception ( 5021 , 'emptyusername' , 'e... | Enrol remote user to our course |
30,351 | public function unenrol_user ( $ username , $ courseid ) { global $ CFG , $ DB ; if ( ! $ client = get_mnet_remote_client ( ) ) { die ( 'Callable via XML-RPC only' ) ; } $ user = $ DB -> get_record ( 'user' , array ( 'username' => $ username , 'mnethostid' => $ client -> id ) ) ; if ( $ user === false ) { throw new mne... | Unenrol remote user from our course |
30,352 | public function course_enrolments ( $ courseid , $ roles = null ) { global $ DB , $ CFG ; if ( ! $ client = get_mnet_remote_client ( ) ) { die ( 'Callable via XML-RPC only' ) ; } $ sql = "SELECT u.username, r.shortname, r.name, e.enrol, ue.timemodified FROM {user_enrolments} ue JOIN {u... | Returns a list of users from the client server who are enrolled in our course |
30,353 | public function increment_count ( $ try = 0 ) { $ this -> totalcount ++ ; if ( $ try != 0 ) { if ( $ try > analyser :: MAX_TRY_COUNTED ) { $ try = analyser :: MAX_TRY_COUNTED ; } if ( ! isset ( $ this -> trycount [ $ try ] ) ) { $ this -> trycount [ $ try ] = 0 ; } $ this -> trycount [ $ try ] ++ ; } } | Used to count the occurrences of response sub parts . |
30,354 | public function set_count ( $ try , $ count ) { $ this -> totalcount = $ this -> totalcount + $ count ; $ this -> trycount [ $ try ] = $ count ; } | Used to set the count of occurrences of response sub parts when loading count from cache . |
30,355 | public function data_for_question_response_table ( $ partid , $ modelresponse ) { $ rowdata = new \ stdClass ( ) ; $ rowdata -> part = $ partid ; $ rowdata -> responseclass = $ modelresponse ; $ rowdata -> response = $ this -> response ; $ rowdata -> fraction = $ this -> fraction ; $ rowdata -> totalcount = $ this -> t... | Returns an object with a property for each column of the question response analysis table . |
30,356 | public static function get_edit_step_link ( $ tourid , $ stepid = null , $ targettype = null ) { $ link = new \ moodle_url ( '/admin/tool/usertours/configure.php' ) ; if ( $ stepid ) { $ link -> param ( 'action' , manager :: ACTION_EDITSTEP ) ; $ link -> param ( 'id' , $ stepid ) ; } else { $ link -> param ( 'action' ,... | Get the link to edit the step . |
30,357 | public static function get_move_tour_link ( $ tourid , $ direction = self :: MOVE_DOWN ) { $ link = new \ moodle_url ( '/admin/tool/usertours/configure.php' ) ; $ link -> param ( 'action' , manager :: ACTION_MOVETOUR ) ; $ link -> param ( 'id' , $ tourid ) ; $ link -> param ( 'direction' , $ direction ) ; $ link -> par... | Get the link to move the tour . |
30,358 | public static function get_move_step_link ( $ stepid , $ direction = self :: MOVE_DOWN ) { $ link = new \ moodle_url ( '/admin/tool/usertours/configure.php' ) ; $ link -> param ( 'action' , manager :: ACTION_MOVESTEP ) ; $ link -> param ( 'id' , $ stepid ) ; $ link -> param ( 'direction' , $ direction ) ; $ link -> par... | Get the link to move the step . |
30,359 | public static function get_new_step_link ( $ tourid , $ targettype = null ) { $ link = new \ moodle_url ( '/admin/tool/usertours/configure.php' ) ; $ link -> param ( 'action' , manager :: ACTION_NEWSTEP ) ; $ link -> param ( 'tourid' , $ tourid ) ; $ link -> param ( 'targettype' , $ targettype ) ; return $ link ; } | Get the link ot create a new step . |
30,360 | public static function get_edit_tour_link ( $ tourid = null ) { $ link = new \ moodle_url ( '/admin/tool/usertours/configure.php' ) ; if ( $ tourid ) { $ link -> param ( 'action' , manager :: ACTION_EDITTOUR ) ; $ link -> param ( 'id' , $ tourid ) ; } else { $ link -> param ( 'action' , manager :: ACTION_NEWTOUR ) ; } ... | Get the link used to edit the tour . |
30,361 | public static function format_icon_link ( $ url , $ icon , $ alt , $ iconcomponent = 'moodle' , $ options = array ( ) ) { global $ OUTPUT ; return $ OUTPUT -> action_icon ( $ url , new \ pix_icon ( $ icon , $ alt , $ iconcomponent , [ 'title' => $ alt , ] ) , null , $ options ) ; } | Get a filler icon for display in the actions column of a table . |
30,362 | public static function render_tourname_inplace_editable ( tour $ tour ) { return new \ core \ output \ inplace_editable ( 'tool_usertours' , 'tourname' , $ tour -> get_id ( ) , true , \ html_writer :: link ( $ tour -> get_view_link ( ) , $ tour -> get_name ( ) ) , $ tour -> get_name ( ) ) ; } | Render the inplace editable used to edit the tour name . |
30,363 | public static function render_tourdescription_inplace_editable ( tour $ tour ) { return new \ core \ output \ inplace_editable ( 'tool_usertours' , 'tourdescription' , $ tour -> get_id ( ) , true , $ tour -> get_description ( ) , $ tour -> get_description ( ) ) ; } | Render the inplace editable used to edit the tour description . |
30,364 | public static function render_tourenabled_inplace_editable ( tour $ tour ) { global $ OUTPUT ; if ( $ tour -> is_enabled ( ) ) { $ icon = 't/hide' ; $ alt = get_string ( 'disable' ) ; $ value = 1 ; } else { $ icon = 't/show' ; $ alt = get_string ( 'enable' ) ; $ value = 0 ; } $ editable = new \ core \ output \ inplace_... | Render the inplace editable used to edit the tour enable state . |
30,365 | public static function render_stepname_inplace_editable ( step $ step ) { $ title = format_text ( step :: get_string_from_input ( $ step -> get_title ( ) ) , FORMAT_HTML ) ; return new \ core \ output \ inplace_editable ( 'tool_usertours' , 'stepname' , $ step -> get_id ( ) , true , \ html_writer :: link ( $ step -> ge... | Render the inplace editable used to edit the step name . |
30,366 | public static function get_tours ( ) { global $ DB ; $ tours = $ DB -> get_records ( 'tool_usertours_tours' , array ( ) , 'sortorder ASC' ) ; $ return = [ ] ; foreach ( $ tours as $ tour ) { $ return [ $ tour -> id ] = tour :: load_from_record ( $ tour ) ; } return $ return ; } | Get all of the tours . |
30,367 | public static function get_tour_from_sortorder ( $ sortorder ) { global $ DB ; $ tour = $ DB -> get_record ( 'tool_usertours_tours' , array ( 'sortorder' => $ sortorder ) ) ; return tour :: load_from_record ( $ tour ) ; } | Fetch the tour with the specified sortorder . |
30,368 | public static function reset_tour_sortorder ( ) { global $ DB ; $ tours = $ DB -> get_records ( 'tool_usertours_tours' , null , 'sortorder ASC, pathmatch DESC' , 'id, sortorder' ) ; $ index = 0 ; foreach ( $ tours as $ tour ) { if ( $ tour -> sortorder != $ index ) { $ DB -> set_field ( 'tool_usertours_tours' , 'sortor... | Reset the sortorder for all tours . |
30,369 | public static function get_steps ( $ tourid ) { $ steps = cache :: get_stepdata ( $ tourid ) ; $ return = [ ] ; foreach ( $ steps as $ step ) { $ return [ $ step -> id ] = step :: load_from_record ( $ step ) ; } return $ return ; } | Get all of the steps in the tour . |
30,370 | public static function get_step_from_sortorder ( $ tourid , $ sortorder ) { global $ DB ; $ step = $ DB -> get_record ( 'tool_usertours_steps' , array ( 'tourid' => $ tourid , 'sortorder' => $ sortorder ) ) ; return step :: load_from_record ( $ step ) ; } | Fetch the step with the specified sortorder . |
30,371 | public static function bootstrap ( ) { global $ PAGE ; if ( ! isloggedin ( ) || isguestuser ( ) ) { return ; } if ( in_array ( $ PAGE -> pagelayout , [ 'maintenance' , 'print' , 'redirect' ] ) ) { return ; } if ( self :: $ bootstrapped ) { return ; } self :: $ bootstrapped = true ; if ( $ tour = manager :: get_current_... | Handle addition of the tour into the current page . |
30,372 | public static function get_all_filters ( ) { $ filters = \ core_component :: get_component_classes_in_namespace ( 'tool_usertours' , 'local\filter' ) ; $ filters = array_keys ( $ filters ) ; $ filters = array_filter ( $ filters , function ( $ filterclass ) { $ rc = new \ ReflectionClass ( $ filterclass ) ; return $ rc ... | Get a list of all possible filters . |
30,373 | public function execute ( ) { global $ DB ; $ userid = $ this -> get_custom_data ( ) -> userid ; $ hasbeenmigrated = get_user_preferences ( 'core_message_migrate_data' , false , $ userid ) ; if ( ! $ hasbeenmigrated ) { $ updatepreference = true ; $ sql = "SELECT DISTINCT(useridfrom) FROM {message}... | Run the migration task . |
30,374 | private function migrate_data ( $ userid , $ otheruserid ) { global $ DB ; if ( $ userid == $ otheruserid ) { $ conversation = \ core_message \ api :: get_self_conversation ( $ userid ) ; if ( empty ( $ conversation ) ) { $ conversation = \ core_message \ api :: create_conversation ( \ core_message \ api :: MESSAGE_CON... | Helper function to deal with migrating the data . |
30,375 | private function migrate_notification ( $ notification , $ isread ) { global $ DB ; $ tabledata = new \ stdClass ( ) ; $ tabledata -> useridfrom = $ notification -> useridfrom ; $ tabledata -> useridto = $ notification -> useridto ; $ tabledata -> subject = $ notification -> subject ; $ tabledata -> fullmessage = $ not... | Helper function to deal with migrating an individual notification . |
30,376 | private function migrate_message ( $ conversationid , $ message ) { global $ DB ; $ tabledata = new \ stdClass ( ) ; $ tabledata -> useridfrom = $ message -> useridfrom ; $ tabledata -> conversationid = $ conversationid ; $ tabledata -> subject = $ message -> subject ; $ tabledata -> fullmessage = $ message -> fullmess... | Helper function to deal with migrating an individual message . |
30,377 | public static function queue_task ( $ userid ) { $ task = new \ core_message \ task \ migrate_message_data ( ) ; $ task -> set_custom_data ( [ 'userid' => $ userid ] ) ; \ core \ task \ manager :: queue_adhoc_task ( $ task , true ) ; } | Queues the task . |
30,378 | protected static function define_other_properties ( ) { return [ 'currentversion' => [ 'type' => policy_version_exporter :: read_properties_definition ( ) , 'null' => NULL_ALLOWED , ] , 'draftversions' => [ 'type' => policy_version_exporter :: read_properties_definition ( ) , 'multiple' => true , ] , 'archivedversions'... | Return the list of additional generated dynamically from the given properties . |
30,379 | protected function get_mapping ( $ itemname , $ itemid ) { if ( ! $ this -> restoreid ) { throw new restore_decode_rule_exception ( 'decode_rule_restoreid_not_set' ) ; } if ( ! $ found = restore_dbops :: get_backup_ids_record ( $ this -> restoreid , $ itemname , $ itemid ) ) { return false ; } return $ found -> newitem... | Looks for mapping values in backup_ids table simple wrapper over get_backup_ids_record |
30,380 | protected function validate_params ( $ linkname , $ urltemplate , $ mappings ) { if ( empty ( $ linkname ) || preg_match ( '/[^A-Z0-9]/' , $ linkname ) ) { throw new restore_decode_rule_exception ( 'decode_rule_incorrect_name' , $ linkname ) ; } if ( empty ( $ urltemplate ) || substr ( $ urltemplate , 0 , 1 ) != '/' ) ... | Perform all the validations and checks on the rule attributes |
30,381 | protected function get_calculated_regexp ( ) { $ regexp = '/\$@' . $ this -> linkname ; foreach ( $ this -> mappings as $ key => $ value ) { $ regexp .= '\*(\d+)' ; } $ regexp .= '@\$/' ; return $ regexp ; } | based on rule definition build the regular expression to execute on decode |
30,382 | protected static function flush_store ( ) { $ ids = array_keys ( self :: $ sessionstore ) ; unset ( self :: $ sessionstore ) ; self :: $ sessionstore = array ( ) ; foreach ( $ ids as $ id ) { self :: $ sessionstore [ $ id ] = array ( ) ; } } | Flushes the store of all data . |
30,383 | public function has_any ( array $ keys ) { $ maxtime = 0 ; if ( $ this -> ttl != 0 ) { $ maxtime = cache :: now ( ) - $ this -> ttl ; } foreach ( $ keys as $ key ) { if ( isset ( $ this -> store [ $ key ] ) && ( $ this -> ttl == 0 || $ this -> store [ $ key ] [ 1 ] >= $ maxtime ) ) { return true ; } } return false ; } | Returns true if the store contains records for any of the given keys . |
30,384 | protected function check_ttl ( ) { if ( $ this -> ttl === 0 ) { return 0 ; } $ maxtime = cache :: now ( ) - $ this -> ttl ; $ count = 0 ; for ( $ value = reset ( $ this -> store ) ; $ value !== false ; $ value = next ( $ this -> store ) ) { if ( $ value [ 1 ] >= $ maxtime ) { break ; } $ count ++ ; } if ( $ count ) { $... | Removes expired elements . |
30,385 | public function get_null_provider_reason ( string $ component ) : string { if ( $ this -> component_implements ( $ component , null_provider :: class ) ) { $ reason = $ this -> handled_component_class_callback ( $ component , null_provider :: class , 'get_reason' , [ ] ) ; return empty ( $ reason ) ? 'privacy:reason' :... | Retrieve the reason for implementing the null provider interface . |
30,386 | public static function is_empty_subsystem ( $ component ) { if ( strpos ( $ component , 'core_' ) === 0 ) { if ( null === \ core_component :: get_subsystem_directory ( substr ( $ component , 5 ) ) ) { return true ; } } return false ; } | Return whether this is an empty subsystem - that is a subsystem without a directory . |
30,387 | public function get_metadata_for_components ( ) : array { $ metadata = [ ] ; foreach ( $ this -> get_component_list ( ) as $ component ) { $ componentmetadata = $ this -> handled_component_class_callback ( $ component , metadata_provider :: class , 'get_metadata' , [ new collection ( $ component ) ] ) ; if ( $ componen... | Get the privacy metadata for all components . |
30,388 | public function get_contexts_for_userid ( int $ userid ) : contextlist_collection { $ progress = static :: get_log_tracer ( ) ; $ components = $ this -> get_component_list ( ) ; $ a = ( object ) [ 'total' => count ( $ components ) , 'progress' => 0 , 'component' => '' , 'datetime' => userdate ( time ( ) ) , ] ; $ clcol... | Gets a collection of resultset objects for all components . |
30,389 | public function get_users_in_context ( \ context $ context ) : \ core_privacy \ local \ request \ userlist_collection { $ progress = static :: get_log_tracer ( ) ; $ components = $ this -> get_component_list ( ) ; $ a = ( object ) [ 'total' => count ( $ components ) , 'progress' => 0 , 'component' => '' , 'datetime' =>... | Gets a collection of users for all components in the specified context . |
30,390 | public function export_user_data ( contextlist_collection $ contextlistcollection ) { $ progress = static :: get_log_tracer ( ) ; $ a = ( object ) [ 'total' => count ( $ contextlistcollection ) , 'progress' => 0 , 'component' => '' , 'datetime' => userdate ( time ( ) ) , ] ; $ progress -> output ( get_string ( 'trace:e... | Export all user data for the specified approved_contextlist items . |
30,391 | public function delete_data_for_user ( contextlist_collection $ contextlistcollection ) { $ progress = static :: get_log_tracer ( ) ; $ a = ( object ) [ 'total' => count ( $ contextlistcollection ) , 'progress' => 0 , 'component' => '' , 'datetime' => userdate ( time ( ) ) , ] ; $ progress -> output ( get_string ( 'tra... | Delete all user data for approved contexts lists provided in the collection . |
30,392 | public function delete_data_for_users_in_context ( \ core_privacy \ local \ request \ userlist_collection $ collection ) { $ progress = static :: get_log_tracer ( ) ; $ a = ( object ) [ 'contextid' => $ collection -> get_context ( ) -> id , 'total' => count ( $ collection ) , 'progress' => 0 , 'component' => '' , 'date... | Delete all user data for all specified users in a context . |
30,393 | public function delete_data_for_all_users_in_context ( \ context $ context ) { $ progress = static :: get_log_tracer ( ) ; $ components = $ this -> get_component_list ( ) ; $ a = ( object ) [ 'total' => count ( $ components ) , 'progress' => 0 , 'component' => '' , 'datetime' => userdate ( time ( ) ) , ] ; $ progress -... | Delete all use data which matches the specified deletion criteria . |
30,394 | public static function plugintype_class_callback ( string $ plugintype , string $ interface , string $ methodname , array $ params ) { $ components = \ core_component :: get_plugin_list ( $ plugintype ) ; foreach ( array_keys ( $ components ) as $ component ) { static :: component_class_callback ( "{$plugintype}_{$comp... | Call the named method with the specified params on any plugintype implementing the relevant interface . |
30,395 | protected function component_class_callback_failed ( \ Throwable $ e , string $ component , string $ interface , string $ methodname , array $ params ) { if ( $ this -> observer ) { call_user_func_array ( [ $ this -> observer , 'handle_component_failure' ] , func_get_args ( ) ) ; } } | Notifies the observer of any failure . |
30,396 | public function prediction_actions ( \ core_analytics \ prediction $ prediction , $ includedetailsaction = false , $ isinsightuser = false ) { global $ PAGE ; $ predictionid = $ prediction -> get_prediction_data ( ) -> id ; $ PAGE -> requires -> js_call_amd ( 'report_insights/actions' , 'init' , array ( $ predictionid ... | Suggested actions for a user . |
30,397 | private function get_view_details_text ( ) { if ( $ this -> based_on_assumptions ( ) ) { $ analyserclass = $ this -> get_analyser_class ( ) ; if ( $ analyserclass :: one_sample_per_analysable ( ) ) { $ detailstext = get_string ( 'viewinsightdetails' , 'analytics' ) ; } else { $ detailstext = get_string ( 'viewdetails' ... | Returns the view details link text . |
30,398 | public function generate_insight_notifications ( $ modelid , $ samplecontexts , array $ predictions = [ ] ) { $ insightsgenerator = new \ core_analytics \ insights_generator ( $ modelid , $ this ) ; $ insightsgenerator -> generate ( $ samplecontexts , $ predictions ) ; } | Generates insights notifications |
30,399 | public function get_insights_users ( \ context $ context ) { if ( $ context -> contextlevel === CONTEXT_USER ) { $ users = [ $ context -> instanceid => \ core_user :: get_user ( $ context -> instanceid ) ] ; } else if ( $ context -> contextlevel >= CONTEXT_COURSE ) { $ users = get_enrolled_users ( $ context , 'moodle/a... | Returns the list of users that will receive insights notifications . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.