idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
30,600 | public function render_print_book_chapter ( $ chapter , $ chapters , $ book , $ cm ) { global $ OUTPUT ; $ context = context_module :: instance ( $ cm -> id ) ; $ title = book_get_chapter_title ( $ chapter -> id , $ chapters , $ book , $ context ) ; $ chaptervisible = $ chapter -> hidden ? false : true ; $ bookchapter ... | Render the print book chapter . |
30,601 | public static function get_user_badges_parameters ( ) { return new external_function_parameters ( array ( 'userid' => new external_value ( PARAM_INT , 'Badges only for this user id, empty for current user' , VALUE_DEFAULT , 0 ) , 'courseid' => new external_value ( PARAM_INT , 'Filter badges by course id, empty all the ... | Describes the parameters for get_user_badges . |
30,602 | protected function _getCid ( $ mailbox , $ slice ) { return implode ( '|' , array ( 'horde_imap_client' , $ this -> _params [ 'username' ] , $ mailbox , $ this -> _params [ 'hostspec' ] , $ this -> _params [ 'port' ] , $ slice , self :: VERSION ) ) ; } | Create the unique ID used to store the data in the cache . |
30,603 | protected function _loadSlice ( $ mailbox , $ slice ) { $ cache_id = $ this -> _getCid ( $ mailbox , $ slice ) ; if ( ! empty ( $ this -> _loaded [ $ cache_id ] ) ) { return ; } if ( ( $ data = $ this -> _cache -> get ( $ cache_id , 0 ) ) !== false ) { try { $ data = @ unserialize ( $ data ) ; } catch ( Exception $ e )... | Load UIDs from a cache slice . |
30,604 | protected function _loadSliceMap ( $ mailbox , $ uidvalid = null ) { if ( ! isset ( $ this -> _slicemap [ $ mailbox ] ) && ( ( $ data = $ this -> _cache -> get ( $ this -> _getCid ( $ mailbox , 'slicemap' ) , 0 ) ) !== false ) ) { try { if ( ( $ slice = @ unserialize ( $ data ) ) && is_array ( $ slice ) ) { $ this -> _... | Load the slicemap for a given mailbox . The slicemap contains the uidvalidity information the UIDs - > slice lookup table and any metadata that needs to be saved for the mailbox . |
30,605 | protected function _toUpdate ( $ mailbox , $ type , $ data ) { if ( ! isset ( $ this -> _update [ $ mailbox ] ) ) { $ this -> _update [ $ mailbox ] = array ( 'add' => array ( ) , 'slice' => array ( ) ) ; } $ this -> _update [ $ mailbox ] [ $ type ] = ( $ type == 'slicemap' ) ? $ data : array_merge ( $ this -> _update [... | Add update entry for a mailbox . |
30,606 | public function set_attributes ( $ type , $ fields , $ hints = array ( ) ) { $ this -> unique = ! empty ( $ type ) ? true : false ; $ this -> fields = $ fields ; $ this -> hints = $ hints ; } | Set all the attributes of one xmldb_index |
30,607 | public function calculateHash ( $ recursive = false ) { if ( ! $ this -> loaded ) { $ this -> hash = null ; } else { $ key = $ this -> unique . implode ( ', ' , $ this -> fields ) . implode ( ', ' , $ this -> hints ) ; $ this -> hash = md5 ( $ key ) ; } } | This function calculate and set the hash of one xmldb_index |
30,608 | public function xmlOutput ( ) { $ o = '' ; $ o .= ' <INDEX NAME="' . $ this -> name . '"' ; if ( $ this -> unique ) { $ unique = 'true' ; } else { $ unique = 'false' ; } $ o .= ' UNIQUE="' . $ unique . '"' ; $ o .= ' FIELDS="' . implode ( ', ' , $ this -> fields ) . '"' ; if ( $ this -> hints ) { $ o .= ' HINTS=... | This function will output the XML text for one index |
30,609 | public function setFromADOIndex ( $ adoindex ) { $ this -> unique = false ; $ fields = array_flip ( array_change_key_case ( array_flip ( $ adoindex [ 'columns' ] ) ) ) ; $ this -> fields = $ fields ; $ this -> loaded = true ; $ this -> changed = true ; } | This function will set all the attributes of the xmldb_index object based on information passed in one ADOindex |
30,610 | public function getPHP ( ) { $ result = '' ; $ unique = $ this -> getUnique ( ) ; if ( ! empty ( $ unique ) ) { $ result .= 'XMLDB_INDEX_UNIQUE, ' ; } else { $ result .= 'XMLDB_INDEX_NOTUNIQUE, ' ; } $ indexfields = $ this -> getFields ( ) ; if ( ! empty ( $ indexfields ) ) { $ result .= "['" . implode ( "', '" , $ ind... | Returns the PHP code needed to define one xmldb_index |
30,611 | public function validateDefinition ( xmldb_table $ xmldb_table = null ) { if ( ! $ xmldb_table ) { return 'Invalid xmldb_index->validateDefinition() call, $xmldb_table is required.' ; } $ total = 0 ; foreach ( $ this -> getFields ( ) as $ fieldname ) { if ( ! $ field = $ xmldb_table -> getField ( $ fieldname ) ) { cont... | Validates the index restrictions . |
30,612 | public function set_sorting ( $ sort , $ asc = true , $ split = true ) { $ this -> sort = ( bool ) $ sort ; $ this -> sortasc = ( bool ) $ asc ; $ this -> sortsplit = ( bool ) $ split ; } | Sets sorting on this category . |
30,613 | public function get_children ( ) { if ( $ this -> sort && ! $ this -> sorted ) { if ( $ this -> sortsplit ) { $ categories = array ( ) ; $ pages = array ( ) ; foreach ( $ this -> children as $ child ) { if ( $ child instanceof admin_category ) { $ categories [ ] = $ child ; } else { $ pages [ ] = $ child ; } } core_col... | Returns the children associated with this category . |
30,614 | public function purge_children ( $ requirefulltree ) { $ this -> children = array ( ) ; $ this -> fulltree = ( $ requirefulltree || $ this -> fulltree ) ; $ this -> loaded = false ; while ( $ this -> category_cache ) { array_pop ( $ this -> category_cache ) ; } $ this -> category_cache = array ( ) ; } | Empties children array and sets loaded to false |
30,615 | private function parse_name ( $ name ) { $ bits = explode ( '/' , $ name ) ; $ name = array_pop ( $ bits ) ; $ plugin = '' ; if ( $ bits ) { $ plugin = array_pop ( $ bits ) ; if ( $ plugin === 'moodle' ) { $ plugin = '' ; } } return 's_' . $ plugin . '_' . $ name ; } | Convert the setting name into the form field name . |
30,616 | public static function prepare_for_javascript ( $ dependencies ) { $ result = [ ] ; foreach ( $ dependencies as $ d ) { if ( ! isset ( $ result [ $ d -> dependenton ] ) ) { $ result [ $ d -> dependenton ] = [ ] ; } if ( ! isset ( $ result [ $ d -> dependenton ] [ $ d -> condition ] ) ) { $ result [ $ d -> dependenton ]... | Gather together all the dependencies in a format suitable for initialising javascript |
30,617 | public function search ( $ query ) { $ found = array ( ) ; foreach ( $ this -> settings as $ setting ) { if ( $ setting -> is_related ( $ query ) ) { $ found [ ] = $ setting ; } } if ( $ found ) { $ result = new stdClass ( ) ; $ result -> page = $ this ; $ result -> settings = $ found ; return array ( $ this -> name =>... | Search string in settings page . |
30,618 | public function add ( $ setting ) { if ( ! ( $ setting instanceof admin_setting ) ) { debugging ( 'error - not a setting instance' ) ; return false ; } $ name = $ setting -> name ; if ( $ setting -> plugin ) { $ name = $ setting -> plugin . $ name ; } $ this -> settings -> { $ name } = $ setting ; return true ; } | adds an admin_setting to this admin_settingpage |
30,619 | public function hide_if ( $ settingname , $ dependenton , $ condition = 'notchecked' , $ value = '1' ) { $ this -> dependencies [ ] = new admin_settingdependency ( $ settingname , $ dependenton , $ condition , $ value ) ; $ dependenton = str_replace ( '/' , ' | ' , $ dependenton ) ; $ findname = str_replace ( '/' , '' ... | Hide the named setting if the specified condition is matched . |
30,620 | public function show_save ( ) { foreach ( $ this -> settings as $ setting ) { if ( empty ( $ setting -> nosave ) ) { return true ; } } return false ; } | Show we display Save button at the page bottom? |
30,621 | protected function set_flag_options ( $ enabled , $ default , $ shortname , $ displayname ) { if ( empty ( $ this -> flags [ $ shortname ] ) ) { $ this -> flags [ $ shortname ] = new admin_setting_flag ( $ enabled , $ default , $ shortname , $ displayname ) ; } else { $ this -> flags [ $ shortname ] -> set_options ( $ ... | Generic function to add a flag to this admin setting . |
30,622 | public function get_setting_flag_value ( admin_setting_flag $ flag ) { $ value = $ this -> config_read ( $ this -> name . '_' . $ flag -> get_shortname ( ) ) ; if ( ! isset ( $ value ) ) { $ value = $ flag -> get_default ( ) ; } return ! empty ( $ value ) ; } | Get the currently saved value for a setting flag |
30,623 | public function get_setting_flag_defaults ( & $ defaults ) { foreach ( $ this -> flags as $ flag ) { if ( $ flag -> is_enabled ( ) && $ flag -> get_default ( ) ) { $ defaults [ ] = $ flag -> get_displayname ( ) ; } } } | Get the list of defaults for the flags on this setting . |
30,624 | public function output_setting_flags ( ) { $ output = '' ; foreach ( $ this -> flags as $ flag ) { if ( $ flag -> is_enabled ( ) ) { $ output .= $ flag -> output_setting_flag ( $ this ) ; } } if ( ! empty ( $ output ) ) { return html_writer :: tag ( 'span' , $ output , array ( 'class' => 'adminsettingsflags' ) ) ; } re... | Output the input fields for the advanced and locked flags on this setting . |
30,625 | public function write_setting_flags ( $ data ) { $ result = true ; foreach ( $ this -> flags as $ flag ) { $ result = $ result && $ flag -> write_setting_flag ( $ this , $ data ) ; } return $ result ; } | Write the values of the flags for this admin setting . |
30,626 | public function config_read ( $ name ) { global $ CFG ; if ( ! empty ( $ this -> plugin ) ) { $ value = get_config ( $ this -> plugin , $ name ) ; return $ value === false ? NULL : $ value ; } else { if ( isset ( $ CFG -> $ name ) ) { return $ CFG -> $ name ; } else { return NULL ; } } } | Returns the config if possible |
30,627 | public function config_write ( $ name , $ value ) { global $ DB , $ USER , $ CFG ; if ( $ this -> nosave ) { return true ; } $ oldvalue = get_config ( $ this -> plugin , $ name ) ; $ oldvalue = ( $ oldvalue === false ) ? null : $ oldvalue ; $ value = is_null ( $ value ) ? null : ( string ) $ value ; if ( $ oldvalue ===... | Used to set a config pair and log change |
30,628 | public function get_defaultsetting ( ) { $ adminroot = admin_get_root ( false , false ) ; if ( ! empty ( $ adminroot -> custom_defaults ) ) { $ plugin = is_null ( $ this -> plugin ) ? 'moodle' : $ this -> plugin ; if ( isset ( $ adminroot -> custom_defaults [ $ plugin ] ) ) { if ( array_key_exists ( $ this -> name , $ ... | Returns default setting if exists |
30,629 | public function post_write_settings ( $ original ) { if ( serialize ( $ original ) === serialize ( $ this -> get_setting ( ) ) ) { return false ; } $ callbackfunction = $ this -> updatedcallback ; if ( ! empty ( $ callbackfunction ) and is_callable ( $ callbackfunction ) ) { $ callbackfunction ( $ this -> get_full_name... | Execute postupdatecallback if necessary . |
30,630 | public function output_setting_flag ( admin_setting $ setting ) { global $ OUTPUT ; $ value = $ setting -> get_setting_flag_value ( $ this ) ; $ context = new stdClass ( ) ; $ context -> id = $ setting -> get_id ( ) . '_' . $ this -> get_shortname ( ) ; $ context -> name = $ setting -> get_full_name ( ) . '_' . $ this ... | Output the checkbox for this setting flag . Should only be called if the flag is enabled . |
30,631 | public function get_force_ltr ( ) { $ forceltr = parent :: get_force_ltr ( ) ; if ( $ forceltr === null ) { return ! is_rtl_compatible ( $ this -> paramtype ) ; } return $ forceltr ; } | Get whether this should be displayed in LTR mode . |
30,632 | public function output_html ( $ data , $ query = '' ) { global $ OUTPUT ; $ default = $ this -> get_defaultsetting ( ) ; $ context = ( object ) [ 'size' => $ this -> size , 'id' => $ this -> get_id ( ) , 'name' => $ this -> get_full_name ( ) , 'value' => $ data , 'forceltr' => $ this -> get_force_ltr ( ) , ] ; $ elemen... | Return an XHTML string for the setting |
30,633 | public function output_html ( $ data , $ query = '' ) { global $ OUTPUT ; $ context = ( object ) [ 'id' => $ this -> get_id ( ) , 'name' => $ this -> get_full_name ( ) ] ; $ element = $ OUTPUT -> render_from_template ( 'core_admin/setting_configempty' , $ context ) ; return format_admin_setting ( $ this , $ this -> vis... | Returns an XHTML string for the hidden field |
30,634 | public function write_setting ( $ data ) { global $ CFG ; if ( ! empty ( $ CFG -> preventexecpath ) ) { if ( $ this -> get_setting ( ) === null ) { $ data = $ this -> get_defaultsetting ( ) ; if ( $ data === null ) { $ data = '' ; } } else { return '' ; } } return parent :: write_setting ( $ data ) ; } | Checks if execpatch has been disabled in config . php |
30,635 | public function output_html ( $ data , $ query = '' ) { global $ CFG , $ OUTPUT ; $ default = $ this -> get_defaultsetting ( ) ; require_once ( "$CFG->libdir/filelib.php" ) ; $ context = ( object ) [ 'id' => $ this -> get_id ( ) , 'name' => $ this -> get_full_name ( ) , 'size' => $ this -> size , 'value' => $ data , 's... | Returns an XHTML field |
30,636 | public function write_setting ( $ data ) { if ( ( string ) $ data === $ this -> yes ) { $ data = $ this -> yes ; } else { $ data = $ this -> no ; } return ( $ this -> config_write ( $ this -> name , $ data ) ? '' : get_string ( 'errorsetting' , 'admin' ) ) ; } | Sets the value for the setting |
30,637 | public function output_html ( $ data , $ query = '' ) { global $ OUTPUT ; $ context = ( object ) [ 'id' => $ this -> get_id ( ) , 'name' => $ this -> get_full_name ( ) , 'no' => $ this -> no , 'value' => $ this -> yes , 'checked' => ( string ) $ data === $ this -> yes , ] ; $ default = $ this -> get_defaultsetting ( ) ... | Returns an XHTML checkbox field |
30,638 | public function get_setting ( ) { $ result = $ this -> config_read ( $ this -> name ) ; if ( is_null ( $ result ) ) { return NULL ; } if ( ! $ this -> load_choices ( ) ) { return NULL ; } $ result = str_pad ( $ result , count ( $ this -> choices ) , '0' ) ; $ result = preg_split ( '//' , $ result , - 1 , PREG_SPLIT_NO_... | Returns the setting if set |
30,639 | public function output_html ( $ data , $ query = '' ) { global $ OUTPUT ; if ( ! $ this -> load_choices ( ) or empty ( $ this -> choices ) ) { return '' ; } $ default = $ this -> get_defaultsetting ( ) ; if ( is_null ( $ default ) ) { $ default = array ( ) ; } if ( is_null ( $ data ) ) { $ data = array ( ) ; } $ contex... | Returns XHTML multi - select field |
30,640 | public function get_setting ( ) { $ result1 = $ this -> config_read ( $ this -> name ) ; $ result2 = $ this -> config_read ( $ this -> name2 ) ; if ( is_null ( $ result1 ) or is_null ( $ result2 ) ) { return NULL ; } return array ( 'h' => $ result1 , 'm' => $ result2 ) ; } | Get the selected time |
30,641 | public function output_html ( $ data , $ query = '' ) { global $ OUTPUT ; $ default = $ this -> get_defaultsetting ( ) ; if ( is_array ( $ default ) ) { $ defaultinfo = $ default [ 'h' ] . ':' . $ default [ 'm' ] ; } else { $ defaultinfo = NULL ; } $ context = ( object ) [ 'id' => $ this -> get_id ( ) , 'name' => $ thi... | Returns XHTML time select fields |
30,642 | protected static function get_duration_text ( $ seconds ) { if ( empty ( $ seconds ) ) { return get_string ( 'none' ) ; } $ data = self :: parse_seconds ( $ seconds ) ; switch ( $ data [ 'u' ] ) { case ( 60 * 60 * 24 * 7 ) : return get_string ( 'numweeks' , '' , $ data [ 'v' ] ) ; case ( 60 * 60 * 24 ) : return get_str... | Converts seconds to some more user friendly string . |
30,643 | protected static function parse_seconds ( $ seconds ) { foreach ( self :: get_units ( ) as $ unit => $ unused ) { if ( $ seconds % $ unit === 0 ) { return array ( 'v' => ( int ) ( $ seconds / $ unit ) , 'u' => $ unit ) ; } } return array ( 'v' => ( int ) $ seconds , 'u' => 1 ) ; } | Finds suitable units for given duration . |
30,644 | public function get_setting ( ) { $ seconds = $ this -> config_read ( $ this -> name ) ; if ( is_null ( $ seconds ) ) { return null ; } return self :: parse_seconds ( $ seconds ) ; } | Get the selected duration as array . |
30,645 | public function write_setting ( $ data ) { if ( ! is_array ( $ data ) ) { return '' ; } $ seconds = ( int ) ( $ data [ 'v' ] * $ data [ 'u' ] ) ; if ( $ seconds < 0 ) { return get_string ( 'errorsetting' , 'admin' ) ; } $ result = $ this -> config_write ( $ this -> name , $ seconds ) ; return ( $ result ? '' : get_stri... | Store the duration as seconds . |
30,646 | public function output_html ( $ data , $ query = '' ) { global $ OUTPUT ; $ default = $ this -> get_defaultsetting ( ) ; if ( is_number ( $ default ) ) { $ defaultinfo = self :: get_duration_text ( $ default ) ; } else if ( is_array ( $ default ) ) { $ defaultinfo = self :: get_duration_text ( $ default [ 'v' ] * $ def... | Returns duration text + select fields . |
30,647 | public function validate ( $ data ) { if ( ! empty ( $ data ) ) { $ lines = explode ( "\n" , $ data ) ; } else { return true ; } $ result = true ; $ badips = array ( ) ; foreach ( $ lines as $ line ) { $ tokens = explode ( '#' , $ line ) ; $ ip = trim ( $ tokens [ 0 ] ) ; if ( empty ( $ ip ) ) { continue ; } if ( preg_... | Validate the contents of the textarea as IP addresses |
30,648 | protected function ace_decode ( $ data ) { $ entries = explode ( "\n" , $ data ) ; foreach ( $ entries as $ key => $ entry ) { $ entry = trim ( $ entry ) ; if ( strpos ( $ entry , 'xn--' ) !== false ) { $ entries [ $ key ] = idn_to_utf8 ( $ entry , IDNA_NONTRANSITIONAL_TO_ASCII , INTL_IDNA_VARIANT_UTS46 ) ; } } return ... | Decode any ascii - encoded domain names back to their utf - 8 representation for display . |
30,649 | public function get_setting ( ) { $ data = $ this -> config_read ( $ this -> name ) ; if ( function_exists ( 'idn_to_utf8' ) && ! is_null ( $ data ) ) { $ data = $ this -> ace_decode ( $ data ) ; } return $ data ; } | Override providing utf8 - decoding for ascii - encoded IDN strings . |
30,650 | public function validate ( $ data ) { if ( empty ( $ data ) ) { return true ; } $ ports = explode ( "\n" , $ data ) ; $ badentries = [ ] ; foreach ( $ ports as $ port ) { $ port = trim ( $ port ) ; if ( empty ( $ port ) ) { return get_string ( 'validateemptylineerror' , 'admin' ) ; } if ( strval ( intval ( $ port ) ) !... | Validate the contents of the textarea as port numbers . Used to validate a new line separated list of ports collected from a textarea control . |
30,651 | function load_choices ( ) { if ( is_array ( $ this -> choices ) ) { return true ; } list ( $ sort , $ sortparams ) = users_order_by_sql ( 'u' ) ; if ( ! empty ( $ sortparams ) ) { throw new coding_exception ( 'users_order_by_sql returned some query parameters. ' . 'This is unexpected, and a problem because there is no ... | Load all of the uses who have the capability into choice array |
30,652 | public function get_defaultsetting ( ) { $ this -> load_choices ( ) ; $ defaultsetting = parent :: get_defaultsetting ( ) ; if ( empty ( $ defaultsetting ) ) { return array ( '$@NONE@$' ) ; } else if ( array_key_exists ( $ defaultsetting , $ this -> choices ) ) { return $ defaultsetting ; } else { return '' ; } } | Returns the default setting for class |
30,653 | public function get_setting ( ) { $ result = parent :: get_setting ( ) ; if ( $ result === null ) { return null ; } if ( empty ( $ result ) ) { $ result = array ( '$@NONE@$' ) ; } return $ result ; } | Returns the current setting |
30,654 | public function load_choices ( ) { if ( is_array ( $ this -> choices ) ) { return true ; } $ this -> choices = array ( FRONTPAGENEWS => get_string ( 'frontpagenews' ) , FRONTPAGEALLCOURSELIST => get_string ( 'frontpagecourselist' ) , FRONTPAGEENROLLEDCOURSELIST => get_string ( 'frontpageenrolledcourselist' ) , FRONTPAG... | Loads the choices available |
30,655 | public function write_setting ( $ data ) { if ( ! is_array ( $ data ) ) { return '' ; } $ this -> load_choices ( ) ; $ save = array ( ) ; foreach ( $ data as $ datum ) { if ( $ datum == 'none' or ! array_key_exists ( $ datum , $ this -> choices ) ) { continue ; } $ save [ $ datum ] = $ datum ; } return ( $ this -> conf... | Save the selected options |
30,656 | public function output_html ( $ data , $ query = '' ) { global $ OUTPUT ; $ this -> load_choices ( ) ; $ currentsetting = array ( ) ; foreach ( $ data as $ key ) { if ( $ key != 'none' and array_key_exists ( $ key , $ this -> choices ) ) { $ currentsetting [ ] = $ key ; } } $ context = ( object ) [ 'id' => $ this -> ge... | Return XHTML select field and wrapping div |
30,657 | public function get_setting ( ) { $ site = course_get_format ( get_site ( ) ) -> get_course ( ) ; return $ site -> { $ this -> name } != '' ? $ site -> { $ this -> name } : NULL ; } | Return the current setting |
30,658 | public function validate ( $ data ) { global $ DB , $ SITE ; $ cleaned = clean_param ( $ data , PARAM_TEXT ) ; if ( $ cleaned === '' ) { return get_string ( 'required' ) ; } if ( $ this -> name === 'shortname' && $ DB -> record_exists_sql ( 'SELECT id from {course} WHERE shortname = ? AND id <> ?' , array ( $ data , $ ... | Validate the selected data |
30,659 | protected function process_form_data ( array $ form ) { $ count = count ( $ form ) ; if ( $ count % 5 ) { return false ; } $ emoticons = array ( ) ; for ( $ i = 0 ; $ i < $ count / 5 ; $ i ++ ) { $ emoticon = new stdClass ( ) ; $ emoticon -> text = clean_param ( trim ( $ form [ 'text' . $ i ] ) , PARAM_NOTAGS ) ; $ emo... | Converts the data from admin settings form into an array of emoticon objects |
30,660 | public function get_setting ( ) { $ result = $ this -> config_read ( $ this -> name ) ; if ( is_null ( $ result ) ) { return NULL ; } if ( $ result === '' ) { return array ( ) ; } $ settings = array ( ) ; for ( $ i = 0 ; $ i < 7 ; $ i ++ ) { if ( $ result & ( 1 << $ i ) ) { $ settings [ ] = $ i ; } } return $ settings ... | Gets the current settings as an array |
30,661 | public function write_setting ( $ data ) { if ( ! is_array ( $ data ) ) { return '' ; } unset ( $ data [ 'xxxxx' ] ) ; $ result = 0 ; foreach ( $ data as $ index ) { $ result |= 1 << $ index ; } return ( $ this -> config_write ( $ this -> name , $ result ) ? '' : get_string ( 'errorsetting' , 'admin' ) ) ; } | Save the new settings |
30,662 | public function output_html ( $ data , $ query = '' ) { global $ OUTPUT ; $ days = array ( 'sunday' , 'monday' , 'tuesday' , 'wednesday' , 'thursday' , 'friday' , 'saturday' ) ; $ context = ( object ) [ 'name' => $ this -> get_full_name ( ) , 'id' => $ this -> get_id ( ) , 'days' => array_map ( function ( $ index ) use... | Return XHTML to display the control |
30,663 | public function load_choices ( ) { global $ CFG , $ DB ; if ( during_initial_install ( ) ) { return false ; } if ( is_array ( $ this -> choices ) ) { return true ; } if ( $ roles = get_all_roles ( ) ) { $ this -> choices = role_fix_names ( $ roles , null , ROLENAME_ORIGINAL , true ) ; return true ; } else { return fals... | Load roles as choices |
30,664 | public function get_defaultsetting ( ) { global $ CFG ; if ( during_initial_install ( ) ) { return null ; } $ result = array ( ) ; foreach ( $ this -> types as $ archetype ) { if ( $ caproles = get_archetype_roles ( $ archetype ) ) { foreach ( $ caproles as $ caprole ) { $ result [ $ caprole -> id ] = 1 ; } } } return ... | Return the default setting for this control |
30,665 | function write_setting ( $ data ) { $ previous = $ this -> get_setting ( ) ; if ( $ previous === null ) { if ( $ data ) { $ this -> regrade_all ( ) ; } } else { if ( $ data != $ previous ) { $ this -> regrade_all ( ) ; } } return ( $ this -> config_write ( $ this -> name , $ data ) ? '' : get_string ( 'errorsetting' , ... | Saves the new settings |
30,666 | function write_setting ( $ data ) { global $ CFG ; $ previous = $ this -> get_setting ( ) ; $ result = parent :: write_setting ( $ data ) ; if ( empty ( $ result ) && $ previous != $ data ) { require_once ( $ CFG -> libdir . '/gradelib.php' ) ; grade_force_site_regrading ( ) ; } return $ result ; } | Saves the new setting . |
30,667 | public function load_choices ( ) { if ( is_array ( $ this -> choices ) ) { return true ; } $ this -> choices = array ( ) ; if ( $ plugins = core_component :: get_plugin_list ( 'gradeexport' ) ) { foreach ( $ plugins as $ plugin => $ unused ) { $ this -> choices [ $ plugin ] = get_string ( 'pluginname' , 'gradeexport_' ... | Load the available choices for the multicheckbox |
30,668 | public function output_html ( $ data , $ query = '' ) { global $ OUTPUT ; $ value = $ data [ 'value' ] ; $ default = $ this -> get_defaultsetting ( ) ; if ( ! is_null ( $ default ) ) { $ defaultinfo = array ( ) ; if ( isset ( $ this -> choices [ $ default [ 'value' ] ] ) ) { $ defaultinfo [ ] = $ this -> choices [ $ de... | Return XHTML to display the field and wrapping div |
30,669 | public function load_choices ( ) { if ( is_array ( $ this -> choices ) ) { return true ; } $ this -> choices = array ( ) ; global $ CFG ; require_once ( $ CFG -> libdir . '/gradelib.php' ) ; foreach ( core_component :: get_plugin_list ( 'gradereport' ) as $ plugin => $ plugindir ) { if ( file_exists ( $ plugindir . '/l... | Loads an array of choices for the configselect control |
30,670 | public function load_choices ( ) { global $ CFG ; $ this -> choices = array ( ) ; foreach ( core_component :: get_plugin_list ( 'gradereport' ) as $ plugin => $ plugindir ) { if ( file_exists ( $ plugindir . '/lib.php' ) ) { require_once ( $ plugindir . '/lib.php' ) ; if ( class_exists ( 'gradereport_' . $ plugin ) ) {... | Loads an array of choices for the configselect control . |
30,671 | public function load_choices ( ) { global $ CFG ; if ( is_array ( $ this -> choices ) ) { return true ; } $ this -> choices = array ( ) ; $ this -> choices [ '' ] = get_string ( 'disable' ) ; $ authsenabled = get_enabled_auth_plugins ( true ) ; foreach ( $ authsenabled as $ auth ) { $ authplugin = get_auth_plugin ( $ a... | Loads the possible choices for the array |
30,672 | public function search ( $ query ) { global $ CFG , $ DB ; if ( $ result = parent :: search ( $ query ) ) { return $ result ; } $ found = false ; if ( $ modules = $ DB -> get_records ( 'modules' ) ) { foreach ( $ modules as $ module ) { if ( ! file_exists ( "$CFG->dirroot/mod/$module->name/lib.php" ) ) { continue ; } i... | Try to find the specified module |
30,673 | public function search ( $ query ) { global $ CFG , $ DB ; if ( $ result = parent :: search ( $ query ) ) { return $ result ; } $ found = false ; if ( $ blocks = $ DB -> get_records ( 'block' ) ) { foreach ( $ blocks as $ block ) { if ( ! file_exists ( "$CFG->dirroot/blocks/$block->name/" ) ) { continue ; } if ( strpos... | Search for a specific block |
30,674 | public function search ( $ query ) { global $ CFG , $ DB ; if ( $ result = parent :: search ( $ query ) ) { return $ result ; } $ found = false ; if ( $ processors = get_message_processors ( ) ) { foreach ( $ processors as $ processor ) { if ( ! $ processor -> available ) { continue ; } if ( strpos ( $ processor -> nam... | Search for a specific message processor |
30,675 | public function search ( $ query ) { global $ CFG ; if ( $ result = parent :: search ( $ query ) ) { return $ result ; } $ found = false ; require_once ( $ CFG -> dirroot . '/question/engine/lib.php' ) ; foreach ( core_component :: get_plugin_list ( 'qbehaviour' ) as $ behaviour => $ notused ) { if ( strpos ( core_text... | Search question behaviours for the specified string |
30,676 | public function search ( $ query ) { global $ CFG ; if ( $ result = parent :: search ( $ query ) ) { return $ result ; } $ found = false ; require_once ( $ CFG -> dirroot . '/question/engine/bank.php' ) ; foreach ( question_bank :: get_all_qtypes ( ) as $ qtype ) { if ( strpos ( core_text :: strtolower ( $ qtype -> loc... | Search question types for the specified string |
30,677 | public function is_related ( $ query ) { if ( parent :: is_related ( $ query ) ) { return true ; } $ authsavailable = core_component :: get_plugin_list ( 'auth' ) ; foreach ( $ authsavailable as $ auth => $ dir ) { if ( strpos ( $ auth , $ query ) !== false ) { return true ; } $ authplugin = get_auth_plugin ( $ auth ) ... | Search to find if Query is related to auth plugin |
30,678 | public function is_related ( $ query ) { if ( parent :: is_related ( $ query ) ) { return true ; } $ formats = core_plugin_manager :: instance ( ) -> get_plugins_of_type ( 'format' ) ; foreach ( $ formats as $ format ) { if ( strpos ( $ format -> component , $ query ) !== false || strpos ( core_text :: strtolower ( $ f... | Search to find if Query is related to format plugin |
30,679 | public function search ( $ query ) { global $ CFG ; if ( $ result = parent :: search ( $ query ) ) { return $ result ; } $ found = false ; $ filternames = filter_get_all_installed ( ) ; foreach ( $ filternames as $ path => $ strfiltername ) { if ( strpos ( core_text :: strtolower ( $ strfiltername ) , $ query ) !== fal... | Searches all installed filters for specified filter |
30,680 | public function output_html ( $ data , $ query = '' ) { global $ CFG , $ OUTPUT , $ DB , $ PAGE ; $ context = ( object ) [ 'manageurl' => new moodle_url ( $ this -> get_manage_url ( ) , [ 'type' => $ this -> get_plugin_type ( ) , 'sesskey' => sesskey ( ) , ] ) , 'infocolumnname' => $ this -> get_info_column_name ( ) , ... | Builds the HTML to display the control . |
30,681 | protected function get_sorted_plugins ( ) { $ pluginmanager = core_plugin_manager :: instance ( ) ; $ plugins = $ pluginmanager -> get_plugins_of_type ( 'media' ) ; $ enabledplugins = $ pluginmanager -> get_enabled_plugins ( 'media' ) ; \ core_collator :: asort_objects_by_method ( $ plugins , 'get_rank' , \ core_collat... | Sort plugins so enabled plugins are displayed first and all others are displayed in the end sorted by rank . |
30,682 | public function output_html ( $ data , $ query = '' ) { global $ OUTPUT ; $ html = parent :: output_html ( $ data , $ query ) ; if ( ( string ) $ data === $ this -> yes ) { $ notifications = tool_mobile \ api :: get_potential_config_issues ( ) ; foreach ( $ notifications as $ notification ) { $ message = get_string ( $... | Builds XHTML to display the control . The main purpose of this overloading is to display a warning when https is not supported by the server |
30,683 | public function get_setting ( ) { global $ CFG ; $ result = $ this -> config_read ( $ this -> name ) ; if ( is_null ( $ result ) ) { return null ; } if ( empty ( $ CFG -> defaultuserroleid ) || empty ( $ CFG -> enablewebservices ) ) { return 0 ; } require_once ( $ CFG -> dirroot . '/webservice/lib.php' ) ; $ webservice... | Retrieves the current setting using the objects name |
30,684 | public function write_setting ( $ data ) { $ data = $ this -> validate ( $ data ) ; if ( $ data === false ) { return get_string ( 'validateerror' , 'admin' ) ; } return ( $ this -> config_write ( $ this -> name , $ data ) ? '' : get_string ( 'errorsetting' , 'admin' ) ) ; } | Saves the setting |
30,685 | public function output_html ( $ data , $ query = '' ) { global $ PAGE , $ OUTPUT ; $ icon = new pix_icon ( 'i/loading' , get_string ( 'loading' , 'admin' ) , 'moodle' , [ 'class' => 'loadingicon' ] ) ; $ context = ( object ) [ 'id' => $ this -> get_id ( ) , 'name' => $ this -> get_full_name ( ) , 'value' => $ data , 'i... | Generates the HTML for the setting |
30,686 | protected function get_options ( ) { global $ CFG ; require_once ( "$CFG->libdir/filelib.php" ) ; require_once ( "$CFG->dirroot/repository/lib.php" ) ; $ defaults = array ( 'mainfile' => '' , 'subdirs' => 0 , 'maxbytes' => - 1 , 'maxfiles' => 1 , 'accepted_types' => '*' , 'return_types' => FILE_INTERNAL , 'areamaxbytes... | Applies defaults and returns all options . |
30,687 | protected function prepare_form_data ( $ regexes ) { $ regexes = json_decode ( $ regexes ) ; $ form = array ( ) ; $ i = 0 ; foreach ( $ regexes as $ value => $ regex ) { $ expressionname = 'expression' . $ i ; $ valuename = 'value' . $ i ; $ form [ $ expressionname ] = $ regex ; $ form [ $ valuename ] = $ value ; $ i +... | Converts the string of regexes |
30,688 | protected function process_form_data ( array $ form ) { $ count = count ( $ form ) ; if ( $ count % 2 ) { return false ; } $ regexes = array ( ) ; for ( $ i = 0 ; $ i < $ count / 2 ; $ i ++ ) { $ expressionname = "expression" . $ i ; $ valuename = "value" . $ i ; $ expression = trim ( $ form [ 'expression' . $ i ] ) ; ... | Converts the data from admin settings form into a string of regexes |
30,689 | public function load_choices ( ) { if ( is_array ( $ this -> choices ) ) { return true ; } $ this -> choices = array ( ) ; global $ CFG , $ DB ; $ records = $ DB -> get_records ( 'modules' , array ( 'visible' => 1 ) , 'name' ) ; foreach ( $ records as $ record ) { if ( file_exists ( "$CFG->dirroot/mod/$record->name/lib... | Loads an array of current module choices |
30,690 | public function output_html ( $ data , $ query = '' ) { global $ OUTPUT ; $ o = '' ; if ( ! extension_loaded ( $ this -> extension ) ) { $ warning = $ OUTPUT -> pix_icon ( 'i/warning' , '' , '' , array ( 'role' => 'presentation' ) ) . ' ' . $ this -> description ; $ o .= format_admin_setting ( $ this , $ this -> visibl... | Outputs the html for this setting . |
30,691 | public function validate ( $ data ) { if ( empty ( $ data ) ) { return true ; } $ scss = new core_scss ( ) ; try { $ scss -> compile ( $ data ) ; } catch ( Leafo \ ScssPhp \ Exception \ ParserException $ e ) { return get_string ( 'scssinvalid' , 'admin' , $ e -> getMessage ( ) ) ; } catch ( Leafo \ ScssPhp \ Exception ... | Validate the contents of the SCSS to ensure its parsable . Does not attempt to detect undefined scss variables . |
30,692 | public function output_html ( $ data , $ query = '' ) { global $ OUTPUT , $ PAGE ; $ default = $ this -> get_defaultsetting ( ) ; $ context = ( object ) [ 'id' => $ this -> get_id ( ) , 'name' => $ this -> get_full_name ( ) , 'value' => $ data , 'descriptions' => $ this -> util -> describe_file_types ( $ data ) , ] ; $... | Return an HTML string for the setting element . |
30,693 | public function validate ( $ data ) { if ( empty ( $ data ) ) { return true ; } try { \ core_auth \ digital_consent :: parse_age_digital_consent_map ( $ data ) ; } catch ( \ moodle_exception $ e ) { return get_string ( 'invalidagedigitalconsent' , 'admin' , $ e -> getMessage ( ) ) ; } return true ; } | Validate the content and format of the age of digital consent map to ensure it is parsable . |
30,694 | function OffsetDate ( $ dayFraction , $ date = false ) { if ( ! $ date ) { $ date = $ this -> sysDate ; } $ fraction = $ dayFraction * 24 * 3600 ; return $ date . ' + INTERVAL ' . $ fraction . ' SECOND' ; } | dayFraction is a day in floating point |
30,695 | function SelectLimit ( $ sql , $ nrows = - 1 , $ offset = - 1 , $ inputarr = false , $ secs = 0 ) { $ offsetStr = ( $ offset >= 0 ) ? "$offset," : '' ; if ( $ nrows < 0 ) { $ nrows = '18446744073709551615' ; } if ( $ secs ) { $ rs = $ this -> CacheExecute ( $ secs , $ sql . " LIMIT $offsetStr$nrows" , $ inputarr ) ; } ... | parameters use PostgreSQL convention not MySQL |
30,696 | function _fetch ( $ ignore_fields = false ) { $ this -> fields = array ( ) ; $ fields = @ sqlite_fetch_array ( $ this -> _queryID , $ this -> fetchMode ) ; if ( is_array ( $ fields ) ) foreach ( $ fields as $ n => $ v ) { if ( ( $ p = strpos ( $ n , "." ) ) !== false ) $ n = substr ( $ n , $ p + 1 ) ; $ this -> fields ... | Modified to strip table names from returned fields |
30,697 | public function check_if_active ( $ strength = URL_MATCH_EXACT ) { global $ FULLME , $ PAGE ; if ( self :: $ fullmeurl == null ) { if ( $ PAGE -> has_set_url ( ) ) { self :: override_active_url ( new moodle_url ( $ PAGE -> url ) ) ; } else { self :: override_active_url ( new moodle_url ( $ FULLME ) ) ; } } if ( $ this ... | Checks if this node is the active node . |
30,698 | public function has_siblings ( ) { if ( empty ( $ this -> parent ) || empty ( $ this -> parent -> children ) ) { return false ; } if ( $ this -> parent -> children instanceof navigation_node_collection ) { $ count = $ this -> parent -> children -> count ( ) ; } else { $ count = count ( $ this -> parent -> children ) ; ... | True if this nav node has siblings in the tree . |
30,699 | public function get_siblings ( ) { $ siblings = false ; if ( $ this -> has_siblings ( ) ) { $ siblings = [ ] ; foreach ( $ this -> parent -> children as $ child ) { if ( $ child -> display ) { $ siblings [ ] = $ child ; } } } return $ siblings ; } | Get a list of sibling navigation nodes at the same level as this one . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.