idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
27,700
private function store_links ( & $ file , $ hub , $ self ) { if ( isset ( $ file -> headers [ 'link' ] [ 'hub' ] ) || ( isset ( $ file -> headers [ 'link' ] ) && preg_match ( '/rel=hub/' , $ file -> headers [ 'link' ] ) ) ) { return ; } if ( $ hub ) { if ( isset ( $ file -> headers [ 'link' ] ) ) { if ( $ file -> heade...
Store PubSubHubbub links as headers
27,701
public function get_path ( ) { $ path = $ this -> template ; $ toolproxy = $ this -> get_service ( ) -> get_tool_proxy ( ) ; if ( ! empty ( $ toolproxy ) ) { $ path = str_replace ( '{tool_proxy_id}' , $ toolproxy -> guid , $ path ) ; } return $ path ; }
Get the path for this resource .
27,702
public function getString ( $ type = self :: RFC_4314 ) { $ acl = strval ( $ this ) ; if ( $ type == self :: RFC_2086 ) { foreach ( $ this -> _virtual as $ key => $ val ) { $ acl = str_replace ( $ val , '' , $ acl , $ count ) ; if ( $ count ) { $ acl .= $ key ; } } } return $ acl ; }
Returns the raw string to use in IMAP server calls .
27,703
protected function get_grouping_id ( \ core_availability \ info $ info ) { if ( $ this -> activitygrouping ) { $ groupingid = $ info -> get_course_module ( ) -> groupingid ; if ( ! $ groupingid ) { throw new \ coding_exception ( 'Not supposed to be able to turn on activitygrouping when no grouping' ) ; } return $ group...
Gets the actual grouping id for the condition . This is either a specified id or a special flag indicating that we use the one for the current cm .
27,704
public function _createElements ( ) { $ this -> _generateId ( ) ; $ this -> setElements ( [ $ this -> createFormElement ( 'text' , 'filetypes' , $ this -> getLabel ( ) , [ 'id' => $ this -> getAttribute ( 'id' ) , ] ) , $ this -> createFormElement ( 'static' , 'browser' , null , '<span data-filetypesbrowser="' . $ this...
Assemble the elements of the form control .
27,705
public function exportValue ( & $ submitted , $ assoc = false ) { $ value = '' ; $ filetypeselement = null ; foreach ( $ this -> _elements as $ key => $ element ) { if ( $ element -> _attributes [ 'name' ] === 'filetypes' ) { $ filetypeselement = $ this -> _elements [ $ key ] ; } } if ( $ filetypeselement ) { $ formval...
Return the selected file types .
27,706
public function validateSubmitValue ( $ value ) { if ( ! $ this -> allowall ) { $ normalized = $ this -> util -> normalize_file_types ( $ value [ 'filetypes' ] ) ; if ( empty ( $ normalized ) || $ normalized == [ '*' ] ) { return get_string ( 'filetypesnotall' , 'core_form' ) ; } } if ( ! $ this -> allowunknown ) { $ u...
Check that the submitted list contains only known and allowed file types .
27,707
protected function get_mustache ( ) { global $ CFG ; if ( $ this -> mustache === null ) { require_once ( "{$CFG->libdir}/filelib.php" ) ; $ themename = $ this -> page -> theme -> name ; $ themerev = theme_get_revision ( ) ; $ cachedir = make_localcache_directory ( "mustache/$themerev/$themename" ) ; $ mustachecachedirs...
Return an instance of the mustache class .
27,708
public function render_from_template ( $ templatename , $ context ) { static $ templatecache = array ( ) ; $ mustache = $ this -> get_mustache ( ) ; try { $ uniqidhelper = $ mustache -> getHelper ( 'uniqid' ) ; } catch ( Mustache_Exception_UnknownHelperException $ e ) { $ uniqidhelper = null ; } $ mustache -> addHelper...
Renders a template by name with the given context .
27,709
public function render ( renderable $ widget ) { $ classparts = explode ( '\\' , get_class ( $ widget ) ) ; $ classname = array_pop ( $ classparts ) ; $ classname = preg_replace ( '/_renderable$/' , '' , $ classname ) ; $ rendermethod = 'render_' . $ classname ; if ( method_exists ( $ this , $ rendermethod ) ) { return...
Returns rendered widget .
27,710
public function add_action_handler ( component_action $ action , $ id = null ) { if ( ! $ id ) { $ id = html_writer :: random_id ( $ action -> event ) ; } $ this -> page -> requires -> event_handler ( "#$id" , $ action -> event , $ action -> jsfunction , $ action -> jsfunctionargs ) ; return $ id ; }
Adds a JS action for the element with the provided id .
27,711
public function get_logo_url ( $ maxwidth = null , $ maxheight = 200 ) { global $ CFG ; $ logo = get_config ( 'core_admin' , 'logo' ) ; if ( empty ( $ logo ) ) { return false ; } $ filepath = ( ( int ) $ maxwidth . 'x' . ( int ) $ maxheight ) . '/' ; return moodle_url :: make_pluginfile_url ( context_system :: instance...
Return the site s logo URL if any .
27,712
public function should_display_main_logo ( $ headinglevel = 1 ) { global $ PAGE ; $ logo = $ this -> get_logo_url ( ) ; if ( $ headinglevel == 1 && ! empty ( $ logo ) ) { if ( $ PAGE -> pagelayout == 'frontpage' || $ PAGE -> pagelayout == 'login' ) { return true ; } } return false ; }
Whether we should display the main logo .
27,713
public function render ( renderable $ widget ) { $ classname = get_class ( $ widget ) ; $ classname = preg_replace ( '/^.*\\\/' , '' , $ classname ) ; $ deprecatedmethod = 'render_' . $ classname ; $ classname = preg_replace ( '/_renderable$/' , '' , $ classname ) ; $ rendermethod = 'render_' . $ classname ; if ( metho...
Renders the provided widget and returns the HTML to display it .
27,714
public function doctype ( ) { if ( $ this -> page -> theme -> doctype === 'html5' ) { $ this -> contenttype = 'text/html; charset=utf-8' ; return "<!DOCTYPE html>\n" ; } else if ( $ this -> page -> theme -> doctype === 'xhtml5' ) { $ this -> contenttype = 'application/xhtml+xml; charset=utf-8' ; return "<!DOCTYPE html>...
Get the DOCTYPE declaration that should be used with this page . Designed to be called in theme layout . php files .
27,715
public function maintenance_warning ( ) { global $ CFG ; $ output = '' ; if ( isset ( $ CFG -> maintenance_later ) and $ CFG -> maintenance_later > time ( ) ) { $ timeleft = $ CFG -> maintenance_later - time ( ) ; $ errorclass = ( $ timeleft < 30 ) ? 'alert-error alert-danger' : 'alert-warning' ; $ output .= $ this -> ...
Scheduled maintenance warning message .
27,716
public function activity_navigation ( ) { $ context = $ this -> page -> context ; if ( ( $ this -> page -> pagelayout !== 'incourse' && $ this -> page -> pagelayout !== 'frametop' ) || $ context -> contextlevel != CONTEXT_MODULE ) { return '' ; } if ( $ this -> page -> cm -> is_stealth ( ) ) { return '' ; } $ course = ...
Returns standard navigation between activities in a course .
27,717
public function home_link ( ) { global $ CFG , $ SITE ; if ( $ this -> page -> pagetype == 'site-index' ) { return '<div class="sitelink">' . '<a title="Moodle" href="http://moodle.org/">' . '<img src="' . $ this -> image_url ( 'moodlelogo' ) . '" alt="' . get_string ( 'moodlelogo' ) . '" /></a></div>' ; } else if ( ! ...
Return the back link that normally appears in the footer .
27,718
public function redirect_message ( $ encodedurl , $ message , $ delay , $ debugdisableredirect , $ messagetype = \ core \ output \ notification :: NOTIFY_INFO ) { global $ CFG ; $ url = str_replace ( '&amp;' , '&' , $ encodedurl ) ; switch ( $ this -> page -> state ) { case moodle_page :: STATE_BEFORE_HEADER : if ( ! $...
Redirects the user by any means possible given the current state
27,719
protected function render_page_layout ( $ layoutfile ) { global $ CFG , $ SITE , $ USER ; $ OUTPUT = $ this ; $ PAGE = $ this -> page ; $ COURSE = $ this -> page -> course ; ob_start ( ) ; include ( $ layoutfile ) ; $ rendered = ob_get_contents ( ) ; ob_end_clean ( ) ; return $ rendered ; }
Renders and outputs the page layout file .
27,720
public function footer ( ) { global $ CFG , $ DB , $ PAGE ; $ pluginswithfunction = get_plugins_with_function ( 'before_footer' , 'lib.php' ) ; foreach ( $ pluginswithfunction as $ plugins ) { foreach ( $ plugins as $ function ) { $ function ( ) ; } } $ output = $ this -> container_end_all ( true ) ; $ footer = $ this ...
Outputs the page s footer
27,721
public function lang_menu ( ) { global $ CFG ; if ( empty ( $ CFG -> langmenu ) ) { return '' ; } if ( $ this -> page -> course != SITEID and ! empty ( $ this -> page -> course -> lang ) ) { return '' ; } $ currlang = current_language ( ) ; $ langs = get_string_manager ( ) -> get_list_of_translations ( ) ; if ( count (...
Returns lang menu or this method also checks forcing of languages in courses .
27,722
public function block_controls ( $ actions , $ blockid = null ) { global $ CFG ; if ( empty ( $ actions ) ) { return '' ; } $ menu = new action_menu ( $ actions ) ; if ( $ blockid !== null ) { $ menu -> set_owner_selector ( '#' . $ blockid ) ; } $ menu -> set_constraint ( '.block-region' ) ; $ menu -> attributes [ 'cla...
Output the row of editing icons for a block as defined by the controls array .
27,723
public function print_textarea ( $ name , $ id , $ value , $ rows , $ cols ) { global $ OUTPUT ; editors_head_setup ( ) ; $ editor = editors_get_preferred_editor ( FORMAT_HTML ) ; $ editor -> set_text ( $ value ) ; $ editor -> use_editor ( $ id , [ ] ) ; $ context = [ 'id' => $ id , 'name' => $ name , 'value' => $ valu...
Returns the HTML for a basic textarea field .
27,724
public function render_action_menu ( action_menu $ menu ) { foreach ( $ menu -> get_secondary_actions ( ) as $ action ) { if ( $ action instanceof \ action_menu_link && $ action -> has_class ( 'icon' ) ) { $ action -> attributes [ 'class' ] = preg_replace ( '/(^|\s+)icon(\s+|$)/i' , '' , $ action -> attributes [ 'class...
Renders an action menu component .
27,725
public function block ( block_contents $ bc , $ region ) { $ bc = clone ( $ bc ) ; if ( empty ( $ bc -> blockinstanceid ) || ! strip_tags ( $ bc -> title ) ) { $ bc -> collapsible = block_contents :: NOT_HIDEABLE ; } $ id = ! empty ( $ bc -> attributes [ 'id' ] ) ? $ bc -> attributes [ 'id' ] : uniqid ( 'block-' ) ; $ ...
Prints a nice side block with an optional header .
27,726
public function list_block_contents ( $ icons , $ items ) { $ row = 0 ; $ lis = array ( ) ; foreach ( $ items as $ key => $ string ) { $ item = html_writer :: start_tag ( 'li' , array ( 'class' => 'r' . $ row ) ) ; if ( ! empty ( $ icons [ $ key ] ) ) { $ item .= html_writer :: tag ( 'div' , $ icons [ $ key ] , array (...
Render the contents of a block_list .
27,727
public function blocks_for_region ( $ region ) { $ blockcontents = $ this -> page -> blocks -> get_content_for_region ( $ region , $ this ) ; $ blocks = $ this -> page -> blocks -> get_blocks_for_region ( $ region ) ; $ lastblock = null ; $ zones = array ( ) ; foreach ( $ blocks as $ block ) { $ zones [ ] = $ block -> ...
Output all the blocks in a particular region .
27,728
public function block_move_target ( $ target , $ zones , $ previous , $ region ) { if ( $ previous == null ) { if ( empty ( $ zones ) ) { $ regions = $ this -> page -> theme -> get_all_block_regions ( ) ; $ position = get_string ( 'moveblockinregion' , 'block' , $ regions [ $ region ] ) ; } else { $ position = get_stri...
Output a place where the block that is currently being moved can be dropped .
27,729
public function action_link ( $ url , $ text , component_action $ action = null , array $ attributes = null , $ icon = null ) { if ( ! ( $ url instanceof moodle_url ) ) { $ url = new moodle_url ( $ url ) ; } $ link = new action_link ( $ url , $ text , $ action , $ attributes , $ icon ) ; return $ this -> render ( $ lin...
Renders a special html link with attached action
27,730
public function single_button ( $ url , $ label , $ method = 'post' , array $ options = null ) { if ( ! ( $ url instanceof moodle_url ) ) { $ url = new moodle_url ( $ url ) ; } $ button = new single_button ( $ url , $ label , $ method ) ; foreach ( ( array ) $ options as $ key => $ value ) { if ( array_key_exists ( $ k...
Returns a form with a single button .
27,731
public function single_select ( $ url , $ name , array $ options , $ selected = '' , $ nothing = array ( '' => 'choosedots' ) , $ formid = null , $ attributes = array ( ) ) { if ( ! ( $ url instanceof moodle_url ) ) { $ url = new moodle_url ( $ url ) ; } $ select = new single_select ( $ url , $ name , $ options , $ sel...
Returns a form with a single select widget .
27,732
public function download_dataformat_selector ( $ label , $ base , $ name = 'dataformat' , $ params = array ( ) ) { $ formats = core_plugin_manager :: instance ( ) -> get_plugins_of_type ( 'dataformat' ) ; $ options = array ( ) ; foreach ( $ formats as $ format ) { if ( $ format -> is_enabled ( ) ) { $ options [ ] = arr...
Returns a dataformat selection and download form
27,733
public function url_select ( array $ urls , $ selected , $ nothing = array ( '' => 'choosedots' ) , $ formid = null ) { $ select = new url_select ( $ urls , $ selected , $ nothing , $ formid ) ; return $ this -> render ( $ select ) ; }
Returns a form with a url select widget .
27,734
public function doc_link ( $ path , $ text = '' , $ forcepopup = false ) { global $ CFG ; $ icon = $ this -> pix_icon ( 'docs' , '' , 'moodle' , array ( 'class' => 'iconhelp icon-pre' , 'role' => 'presentation' ) ) ; $ url = new moodle_url ( get_docs_url ( $ path ) ) ; $ attributes = array ( 'href' => $ url ) ; if ( ! ...
Returns a string containing a link to the user documentation . Also contains an icon by default . Shown to teachers and admin only .
27,735
public function image_icon ( $ pix , $ alt , $ component = 'moodle' , array $ attributes = null ) { $ icon = new image_icon ( $ pix , $ alt , $ component , $ attributes ) ; return $ this -> render ( $ icon ) ; }
Return HTML for an image_icon .
27,736
protected function render_pix_emoticon ( pix_emoticon $ emoticon ) { $ system = \ core \ output \ icon_system :: instance ( \ core \ output \ icon_system :: STANDARD ) ; return $ system -> render_pix_icon ( $ this , $ emoticon ) ; }
Return HTML to display an emoticon icon .
27,737
public function help_icon ( $ identifier , $ component = 'moodle' , $ linktext = '' ) { $ icon = new help_icon ( $ identifier , $ component ) ; $ icon -> diag_strings ( ) ; if ( $ linktext === true ) { $ icon -> linktext = get_string ( $ icon -> identifier , $ icon -> component ) ; } else if ( ! empty ( $ linktext ) ) ...
Returns HTML to display a help icon .
27,738
protected function render_help_icon ( help_icon $ helpicon ) { $ context = $ helpicon -> export_for_template ( $ this ) ; return $ this -> render_from_template ( 'core/help_icon' , $ context ) ; }
Implementation of user image rendering .
27,739
public function help_icon_scale ( $ courseid , stdClass $ scale ) { global $ CFG ; $ title = get_string ( 'helpprefix2' , '' , $ scale -> name ) . ' (' . get_string ( 'newwindow' ) . ')' ; $ icon = $ this -> pix_icon ( 'help' , get_string ( 'scales' ) , 'moodle' , array ( 'class' => 'iconhelp' ) ) ; $ scaleid = abs ( $...
Returns HTML to display a scale help icon .
27,740
public function spacer ( array $ attributes = null , $ br = false ) { $ attributes = ( array ) $ attributes ; if ( empty ( $ attributes [ 'width' ] ) ) { $ attributes [ 'width' ] = 1 ; } if ( empty ( $ attributes [ 'height' ] ) ) { $ attributes [ 'height' ] = 1 ; } $ attributes [ 'class' ] = 'spacer' ; $ output = $ thi...
Creates and returns a spacer image with optional line break .
27,741
public function user_picture ( stdClass $ user , array $ options = null ) { $ userpicture = new user_picture ( $ user ) ; foreach ( ( array ) $ options as $ key => $ value ) { if ( array_key_exists ( $ key , $ userpicture ) ) { $ userpicture -> $ key = $ value ; } } return $ this -> render ( $ userpicture ) ; }
Returns HTML to display the specified user s avatar .
27,742
public function htmllize_file_tree ( $ dir ) { if ( empty ( $ dir [ 'subdirs' ] ) and empty ( $ dir [ 'files' ] ) ) { return '' ; } $ result = '<ul>' ; foreach ( $ dir [ 'subdirs' ] as $ subdir ) { $ result .= '<li>' . s ( $ subdir [ 'dirname' ] ) . ' ' . $ this -> htmllize_file_tree ( $ subdir ) . '</li>' ; } foreach ...
Internal implementation of file tree viewer items rendering .
27,743
public function render_file_picker ( file_picker $ fp ) { global $ CFG , $ OUTPUT , $ USER ; $ options = $ fp -> options ; $ client_id = $ options -> client_id ; $ strsaved = get_string ( 'filesaved' , 'repository' ) ; $ straddfile = get_string ( 'openpicker' , 'repository' ) ; $ strloading = get_string ( 'loading' , '...
Internal implementation of file picker rendering .
27,744
public function close_window_button ( $ text = '' ) { if ( empty ( $ text ) ) { $ text = get_string ( 'closewindow' ) ; } $ button = new single_button ( new moodle_url ( '#' ) , $ text , 'get' ) ; $ button -> add_action ( new component_action ( 'click' , 'close_window' ) ) ; return $ this -> container ( $ this -> rende...
Returns HTML to display a simple button to close a window
27,745
public function continue_button ( $ url ) { if ( ! ( $ url instanceof moodle_url ) ) { $ url = new moodle_url ( $ url ) ; } $ button = new single_button ( $ url , get_string ( 'continue' ) , 'get' , true ) ; $ button -> class = 'continuebutton' ; return $ this -> render ( $ button ) ; }
Returns HTML to display a continue button that goes to a particular URL .
27,746
protected function render_paging_bar ( paging_bar $ pagingbar ) { $ pagingbar -> maxdisplay = 10 ; return $ this -> render_from_template ( 'core/paging_bar' , $ pagingbar -> export_for_template ( $ this ) ) ; }
Returns HTML to display the paging bar .
27,747
public function heading ( $ text , $ level = 2 , $ classes = null , $ id = null ) { $ level = ( integer ) $ level ; if ( $ level < 1 or $ level > 6 ) { throw new coding_exception ( 'Heading level must be an integer between 1 and 6.' ) ; } return html_writer :: tag ( 'h' . $ level , $ text , array ( 'id' => $ id , 'clas...
Outputs a heading
27,748
public function box ( $ contents , $ classes = 'generalbox' , $ id = null , $ attributes = array ( ) ) { return $ this -> box_start ( $ classes , $ id , $ attributes ) . $ contents . $ this -> box_end ( ) ; }
Outputs a box .
27,749
public function box_start ( $ classes = 'generalbox' , $ id = null , $ attributes = array ( ) ) { $ this -> opencontainers -> push ( 'box' , html_writer :: end_tag ( 'div' ) ) ; $ attributes [ 'id' ] = $ id ; $ attributes [ 'class' ] = 'box py-3 ' . renderer_base :: prepare_classes ( $ classes ) ; return html_writer ::...
Outputs the opening section of a box .
27,750
public function container ( $ contents , $ classes = null , $ id = null ) { return $ this -> container_start ( $ classes , $ id ) . $ contents . $ this -> container_end ( ) ; }
Outputs a container .
27,751
public function container_start ( $ classes = null , $ id = null ) { $ this -> opencontainers -> push ( 'container' , html_writer :: end_tag ( 'div' ) ) ; return html_writer :: start_tag ( 'div' , array ( 'id' => $ id , 'class' => renderer_base :: prepare_classes ( $ classes ) ) ) ; }
Outputs the opening section of a container .
27,752
public function tree_block_contents ( $ items , $ attrs = array ( ) ) { if ( empty ( $ items ) ) { return '' ; } $ lis = array ( ) ; foreach ( $ items as $ item ) { $ content = $ item -> content ( $ this ) ; $ liclasses = array ( $ item -> get_css_type ( ) ) ; if ( ! $ item -> forceopen || ( ! $ item -> forceopen && $ ...
Make nested HTML lists out of the items
27,753
public function search_box ( $ id = false ) { global $ CFG ; if ( empty ( $ CFG -> enableglobalsearch ) || ! has_capability ( 'moodle/search:query' , context_system :: instance ( ) ) ) { return '' ; } if ( $ id == false ) { $ id = uniqid ( ) ; } else { $ id = clean_param ( $ id , PARAM_ALPHANUMEXT ) ; } $ this -> page ...
Returns a search box .
27,754
public function navbar_plugin_output ( ) { $ output = '' ; foreach ( \ core_component :: get_core_subsystems ( ) as $ name => $ path ) { if ( $ path ) { $ output .= component_callback ( $ name , 'render_navbar_output' , [ $ this ] , '' ) ; } } if ( $ pluginsfunction = get_plugins_with_function ( 'render_navbar_output' ...
Allow plugins to provide some content to be rendered in the navbar . The plugin must define a PLUGIN_render_navbar_output function that returns the HTML they wish to add to the navbar .
27,755
protected function render_breadcrumb_navigation_node ( breadcrumb_navigation_node $ item ) { if ( $ item -> action instanceof moodle_url ) { $ content = $ item -> get_content ( ) ; $ title = $ item -> get_title ( ) ; $ attributes = array ( ) ; $ attributes [ 'itemprop' ] = 'url' ; if ( $ title !== '' ) { $ attributes [...
Renders a breadcrumb navigation node object .
27,756
protected function render_navigation_node ( navigation_node $ item ) { $ content = $ item -> get_content ( ) ; $ title = $ item -> get_title ( ) ; if ( $ item -> icon instanceof renderable && ! $ item -> hideicon ) { $ icon = $ this -> render ( $ item -> icon ) ; $ content = $ icon . $ content ; } if ( $ item -> helpbu...
Renders a navigation node object .
27,757
public function custom_menu ( $ custommenuitems = '' ) { global $ CFG ; if ( empty ( $ custommenuitems ) && ! empty ( $ CFG -> custommenuitems ) ) { $ custommenuitems = $ CFG -> custommenuitems ; } $ custommenu = new custom_menu ( $ custommenuitems , current_language ( ) ) ; return $ this -> render_custom_menu ( $ cust...
Returns the custom menu if one has been set
27,758
public function custom_menu_flat ( ) { global $ CFG ; $ custommenuitems = '' ; if ( empty ( $ custommenuitems ) && ! empty ( $ CFG -> custommenuitems ) ) { $ custommenuitems = $ CFG -> custommenuitems ; } $ custommenu = new custom_menu ( $ custommenuitems , current_language ( ) ) ; $ langs = get_string_manager ( ) -> g...
We want to show the custom menus as a list of links in the footer on small screens . Just return the menu object exported so we can render it differently .
27,759
protected function render_custom_menu_item ( custom_menu_item $ menunode ) { static $ submenucount = 0 ; if ( $ menunode -> has_children ( ) ) { $ submenucount ++ ; $ content = html_writer :: start_tag ( 'li' ) ; if ( $ menunode -> get_url ( ) !== null ) { $ url = $ menunode -> get_url ( ) ; } else { $ url = '#cm_subme...
Renders a custom menu node as part of a submenu
27,760
protected function theme_switch_links ( ) { $ actualdevice = core_useragent :: get_device_type ( ) ; $ currentdevice = $ this -> page -> devicetypeinuse ; $ switched = ( $ actualdevice != $ currentdevice ) ; if ( ! $ switched && $ currentdevice == 'default' && $ actualdevice == 'default' ) { return '' ; } if ( $ switch...
Renders theme links for switching between default and other themes .
27,761
public function blocks ( $ region , $ classes = array ( ) , $ tag = 'aside' ) { $ displayregion = $ this -> page -> apply_theme_region_manipulations ( $ region ) ; $ classes = ( array ) $ classes ; $ classes [ ] = 'block-region' ; $ attributes = array ( 'id' => 'block-region-' . preg_replace ( '#[^a-zA-Z0-9_\-]+#' , '-...
Get the HTML for blocks in the given region .
27,762
public function custom_block_region ( $ regionname ) { if ( $ this -> page -> theme -> get_block_render_method ( ) === 'blocks' ) { return $ this -> blocks ( $ regionname ) ; } else { return $ this -> blocks_for_region ( $ regionname ) ; } }
Renders a custom block region .
27,763
public function body_attributes ( $ additionalclasses = array ( ) ) { if ( ! is_array ( $ additionalclasses ) ) { $ additionalclasses = explode ( ' ' , $ additionalclasses ) ; } return ' id="' . $ this -> body_id ( ) . '" class="' . $ this -> body_css_classes ( $ additionalclasses ) . '"' ; }
Returns HTML attributes to use within the body tag . This includes an ID and classes .
27,764
public function page_doc_link ( $ text = null ) { if ( $ text === null ) { $ text = get_string ( 'moodledocslink' ) ; } $ path = page_get_doc_link_path ( $ this -> page ) ; if ( ! $ path ) { return '' ; } return $ this -> doc_link ( $ path , $ text ) ; }
Returns the Moodle docs link to use for this page .
27,765
public function render_preferences_group ( preferences_group $ renderable ) { $ html = '' ; $ html .= html_writer :: start_tag ( 'div' , array ( 'class' => 'col-sm-4 preferences-group' ) ) ; $ html .= $ this -> heading ( $ renderable -> title , 3 ) ; $ html .= html_writer :: start_tag ( 'ul' ) ; foreach ( $ renderable ...
Renders preferences group .
27,766
public function render_skip_links ( $ links ) { $ context = [ 'links' => [ ] ] ; foreach ( $ links as $ url => $ text ) { $ context [ 'links' ] [ ] = [ 'url' => $ url , 'text' => $ text ] ; } return $ this -> render_from_template ( 'core/skip_links' , $ context ) ; }
Renders the skip links for the page .
27,767
protected function render_context_header ( context_header $ contextheader ) { $ showheader = empty ( $ this -> page -> layout_options [ 'nocontextheader' ] ) ; if ( ! $ showheader ) { return '' ; } $ html = html_writer :: start_div ( 'page-context-header' ) ; if ( isset ( $ contextheader -> imagedata ) ) { $ html .= ht...
Renders the header bar .
27,768
public function full_header ( ) { global $ PAGE ; $ header = new stdClass ( ) ; $ header -> settingsmenu = $ this -> context_header_settings_menu ( ) ; $ header -> contextheader = $ this -> context_header ( ) ; $ header -> hasnavbar = empty ( $ PAGE -> layout_options [ 'nonavbar' ] ) ; $ header -> navbar = $ this -> na...
Wrapper for header elements .
27,769
protected function build_action_menu_from_navigation ( action_menu $ menu , navigation_node $ node , $ indent = false , $ onlytopleafnodes = false ) { $ skipped = false ; foreach ( $ node -> children as $ menuitem ) { if ( $ menuitem -> display ) { if ( $ onlytopleafnodes && $ menuitem -> children -> count ( ) ) { $ sk...
Take a node in the nav tree and make an action menu out of it . The links are injected in the action menu .
27,770
public function region_main_settings_menu ( ) { $ context = $ this -> page -> context ; $ menu = new action_menu ( ) ; if ( $ context -> contextlevel == CONTEXT_MODULE ) { $ this -> page -> navigation -> initialise ( ) ; $ node = $ this -> page -> navigation -> find_active_node ( ) ; $ buildmenu = false ; if ( $ this -...
This is an optional menu that can be added to a layout by a theme . It contains the menu for the most specific thing from the settings block . E . g . Module administration .
27,771
public function tag_list ( $ tags , $ label = null , $ classes = '' , $ limit = 10 , $ pagecontext = null ) { $ list = new \ core_tag \ output \ taglist ( $ tags , $ label , $ classes , $ limit , $ pagecontext ) ; return $ this -> render_from_template ( 'core_tag/taglist' , $ list -> export_for_template ( $ this ) ) ; ...
Displays the list of tags associated with an entry
27,772
public function render_inplace_editable ( \ core \ output \ inplace_editable $ element ) { return $ this -> render_from_template ( 'core/inplace_editable' , $ element -> export_for_template ( $ this ) ) ; }
Renders element for inline editing of any value
27,773
public function mform_element ( $ element , $ required , $ advanced , $ error , $ ingroup ) { $ templatename = 'core_form/element-' . $ element -> getType ( ) ; if ( $ ingroup ) { $ templatename .= "-inline" ; } try { core \ output \ mustache_template_finder :: get_template_filepath ( $ templatename ) ; if ( $ element ...
Renders an mform element from a template .
27,774
public function render_login_signup_form ( $ form ) { global $ SITE ; $ context = $ form -> export_for_template ( $ this ) ; $ url = $ this -> get_logo_url ( ) ; if ( $ url ) { $ url = $ url -> out ( false ) ; } $ context [ 'logourl' ] = $ url ; $ context [ 'sitename' ] = format_string ( $ SITE -> fullname , true , [ '...
Render the login signup form into a nice template for the theme .
27,775
public function render_progress_bar ( progress_bar $ bar ) { global $ PAGE ; $ data = $ bar -> export_for_template ( $ this ) ; return $ this -> render_from_template ( 'core/progress_bar' , $ data ) ; }
Renders a progress bar .
27,776
public function heading ( $ text , $ level = 2 , $ classes = 'main' , $ id = null ) { $ text .= "\n" ; switch ( $ level ) { case 1 : return '=>' . $ text ; case 2 : return ' . $ text ; default : return $ text ; } }
Returns a template fragment representing a Heading .
27,777
public function header ( ) { if ( ! empty ( $ _FILES ) ) { @ header ( 'Content-type: text/plain; charset=utf-8' ) ; if ( ! core_useragent :: supports_json_contenttype ( ) ) { @ header ( 'X-Content-Type-Options: nosniff' ) ; } } else if ( ! core_useragent :: supports_json_contenttype ( ) ) { @ header ( 'Content-type: te...
Prepares the start of an AJAX output .
27,778
public function confirm ( $ message , $ continue , $ cancel ) { if ( $ continue instanceof single_button ) { $ continue -> primary = true ; } else if ( is_string ( $ continue ) ) { $ continue = new single_button ( new moodle_url ( $ continue ) , get_string ( 'continue' ) , 'post' , true ) ; } else if ( $ continue insta...
Overridden confirm message for upgrades .
27,779
private function Format ( $ args ) { $ message = array ( ) ; if ( $ args ) { foreach ( $ args as $ a ) { $ argValue = '' ; if ( $ a [ 'name' ] ) { $ argValue .= $ a [ 'name' ] . ':' ; } if ( is_object ( $ a [ 'value' ] ) ) { $ argValue .= $ a [ 'value' ] -> toCSS ( ) ; } else { $ argValue .= '???' ; } $ message [ ] = $...
Format the args for use in exception messages
27,780
private function IsRecursive ( $ env , $ mixin ) { foreach ( $ env -> frames as $ recur_frame ) { if ( ! ( $ mixin instanceof Less_Tree_Mixin_Definition ) ) { if ( $ mixin === $ recur_frame ) { return true ; } if ( isset ( $ recur_frame -> originalRuleset ) && $ mixin -> ruleset_id === $ recur_frame -> originalRuleset ...
Are we in a recursive mixin call?
27,781
public function add_contextlist ( contextlist_base $ contextlist ) { $ component = $ contextlist -> get_component ( ) ; if ( empty ( $ component ) ) { throw new \ moodle_exception ( "The contextlist must have a component set" ) ; } if ( isset ( $ this -> contextlists [ $ component ] ) ) { throw new \ moodle_exception (...
Add a contextlist to this collection .
27,782
public function get_contextlist_for_component ( string $ component ) { if ( isset ( $ this -> contextlists [ $ component ] ) ) { return $ this -> contextlists [ $ component ] ; } return null ; }
Get the contextlist for the specified component .
27,783
public function writeRelationships ( PHPExcel $ pPHPExcel = null ) { $ objWriter = null ; if ( $ this -> getParentWriter ( ) -> getUseDiskCaching ( ) ) { $ objWriter = new PHPExcel_Shared_XMLWriter ( PHPExcel_Shared_XMLWriter :: STORAGE_DISK , $ this -> getParentWriter ( ) -> getDiskCachingDirectory ( ) ) ; } else { $ ...
Write relationships to XML format
27,784
public function writeDrawingRelationships ( PHPExcel_Worksheet $ pWorksheet = null , & $ chartRef , $ includeCharts = false ) { $ objWriter = null ; if ( $ this -> getParentWriter ( ) -> getUseDiskCaching ( ) ) { $ objWriter = new PHPExcel_Shared_XMLWriter ( PHPExcel_Shared_XMLWriter :: STORAGE_DISK , $ this -> getPare...
Write drawing relationships to XML format
27,785
protected function add_field ( \ stdClass $ data ) { foreach ( $ data -> fields as $ field ) { $ this -> _form -> addElement ( $ field ) ; } if ( ! empty ( $ data -> helps ) ) { foreach ( $ data -> helps as $ fieldname => $ helpdata ) { $ help = array_merge ( [ $ fieldname ] , $ helpdata ) ; call_user_func_array ( [ $ ...
Add a fieldset to the current form .
27,786
public function filter_data_for_persistent ( $ data ) { $ data = parent :: filter_data_for_persistent ( $ data ) ; $ classname = static :: $ persistentclass ; $ properties = $ classname :: properties_definition ( ) ; $ data = ( object ) array_filter ( ( array ) $ data , function ( $ value , $ key ) use ( $ properties )...
Converts fields .
27,787
protected function get_lawful_base_field ( string $ prefix = '' ) : \ stdClass { $ fieldname = "{$prefix}lawfulbases" ; $ data = ( object ) [ 'fields' => [ ] , ] ; $ bases = [ ] ; foreach ( \ tool_dataprivacy \ purpose :: GDPR_ART_6_1_ITEMS as $ article ) { $ key = 'gdpr_art_6_1_' . $ article ; $ bases [ $ key ] = get_...
Get the mform field for lawful bases .
27,788
protected function get_retention_period_fields ( string $ prefix = '' ) : \ stdClass { $ prefix = "{$prefix}retentionperiod" ; $ data = ( object ) [ 'fields' => [ ] , 'types' => [ ] , ] ; $ number = $ this -> _form -> createElement ( 'text' , "{$prefix}number" , null , [ 'size' => 8 ] ) ; $ data -> types [ "{$prefix}nu...
Get the retention period fields .
27,789
protected function get_protected_field ( string $ prefix = '' ) : \ stdClass { $ fieldname = "{$prefix}protected" ; return ( object ) [ 'fields' => [ $ this -> _form -> createElement ( 'advcheckbox' , $ fieldname , get_string ( 'protected' , 'tool_dataprivacy' ) , get_string ( 'protectedlabel' , 'tool_dataprivacy' ) ) ...
Get the mform field for the protected flag .
27,790
protected static function convert_fields ( \ stdClass $ data ) { $ data = parent :: convert_fields ( $ data ) ; if ( ! empty ( $ data -> lawfulbases ) && is_array ( $ data -> lawfulbases ) ) { $ data -> lawfulbases = implode ( ',' , $ data -> lawfulbases ) ; } if ( ! empty ( $ data -> sensitivedatareasons ) && is_array...
Converts data to data suitable for storage .
27,791
protected function convert_existing_data_to_values ( \ stdClass $ data ) : \ stdClass { $ data -> lawfulbases = explode ( ',' , $ data -> lawfulbases ) ; if ( ! empty ( $ data -> sensitivedatareasons ) ) { $ data -> sensitivedatareasons = explode ( ',' , $ data -> sensitivedatareasons ) ; } $ strlen = strlen ( $ data -...
Normalise any values stored in existing data .
27,792
public function get_role_overrides_from_data ( \ stdClass $ data ) { $ overrides = [ ] ; if ( ! empty ( $ data -> overrides ) ) { $ searchkey = 'roleoverride_' ; for ( $ i = 0 ; $ i < $ data -> overrides ; $ i ++ ) { $ overridedata = ( object ) [ ] ; foreach ( ( array ) $ data as $ fieldname => $ value ) { if ( strpos ...
Fetch the role override data from the list of submitted data .
27,793
protected function extra_validation ( $ data , $ files , array & $ errors ) { $ overrides = $ this -> get_role_overrides_from_data ( $ data ) ; $ seenroleids = [ ] ; foreach ( $ overrides as $ id => $ override ) { $ override -> purposeid = 0 ; $ persistent = new \ tool_dataprivacy \ purpose_override ( $ override -> id ...
Define extra validation mechanims .
27,794
protected function render_insights_list ( renderable $ renderable ) { $ data = $ renderable -> export_for_template ( $ this ) ; return parent :: render_from_template ( 'report_insights/insights_list' , $ data ) ; }
Renders the list of insights
27,795
protected function render_insight ( renderable $ renderable ) { $ data = $ renderable -> export_for_template ( $ this ) ; return parent :: render_from_template ( 'report_insights/insight_details' , $ data ) ; }
Renders an insight
27,796
public function render_model_disabled ( $ insightinfo ) { global $ OUTPUT , $ PAGE ; $ PAGE -> set_title ( $ insightinfo -> contextname ) ; $ PAGE -> set_heading ( $ insightinfo -> contextname ) ; $ output = $ OUTPUT -> header ( ) ; $ output .= $ OUTPUT -> notification ( get_string ( 'disabledmodel' , 'report_insights'...
Model disabled info .
27,797
public function render_no_insights ( \ context $ context ) { global $ OUTPUT , $ PAGE ; $ PAGE -> set_title ( $ context -> get_context_name ( ) ) ; $ PAGE -> set_heading ( $ context -> get_context_name ( ) ) ; $ output = $ OUTPUT -> header ( ) ; $ output .= $ OUTPUT -> notification ( get_string ( 'noinsights' , 'analyt...
Model without insights info .
27,798
public function load_component_strings ( $ component , $ lang , $ disablecache = false , $ disablelocal = false ) { global $ CFG ; list ( $ plugintype , $ pluginname ) = core_component :: normalize_component ( $ component ) ; if ( $ plugintype === 'core' and is_null ( $ pluginname ) ) { $ component = 'core' ; } else { ...
Load all strings for one component
27,799
protected function load_deprecated_strings ( ) { global $ CFG ; if ( $ this -> cacheddeprecated !== null ) { return $ this -> cacheddeprecated ; } $ this -> cacheddeprecated = array ( ) ; $ content = '' ; $ filename = $ CFG -> dirroot . '/lang/en/deprecated.txt' ; if ( file_exists ( $ filename ) ) { $ content .= file_g...
Parses all deprecated . txt in all plugins lang locations and returns the list of deprecated strings .