idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
30,100 | public static function get_lti_tools ( $ params = array ( ) , $ limitfrom = 0 , $ limitnum = 0 ) { global $ DB ; $ sql = "SELECT elt.*, e.name, e.courseid, e.status, e.enrolstartdate, e.enrolenddate, e.enrolperiod FROM {enrol_lti_tools} elt JOIN {enrol} e ON elt.enro... | Returns the LTI tools requested . |
30,101 | public static function count_lti_tools ( $ params = array ( ) ) { global $ DB ; $ sql = "SELECT COUNT(*) FROM {enrol_lti_tools} elt JOIN {enrol} e ON elt.enrolid = e.id" ; if ( $ params ) { $ where = "WHERE" ; foreach ( $ params as $ colname => $ value ) { $ sql .= "... | Returns the number of LTI tools . |
30,102 | public static function get_description ( $ tool ) { global $ DB ; $ description = '' ; $ context = \ context :: instance_by_id ( $ tool -> contextid ) ; if ( $ context -> contextlevel == CONTEXT_COURSE ) { $ course = $ DB -> get_record ( 'course' , array ( 'id' => $ context -> instanceid ) ) ; $ description = $ course ... | Returns a description of the course or module that this lti instance points to . |
30,103 | public static function get_cartridge_url ( $ tool ) { global $ CFG ; $ url = null ; $ id = $ tool -> id ; $ token = self :: generate_cartridge_token ( $ tool -> id ) ; if ( $ CFG -> slasharguments ) { $ url = new \ moodle_url ( '/enrol/lti/cartridge.php/' . $ id . '/' . $ token . '/cartridge.xml' ) ; } else { $ url = n... | Returns the url to the cartridge representing the tool . |
30,104 | public static function get_proxy_url ( $ tool ) { global $ CFG ; $ url = null ; $ id = $ tool -> id ; $ token = self :: generate_proxy_token ( $ tool -> id ) ; if ( $ CFG -> slasharguments ) { $ url = new \ moodle_url ( '/enrol/lti/proxy.php/' . $ id . '/' . $ token . '/' ) ; } else { $ url = new \ moodle_url ( '/enrol... | Returns the url to the tool proxy registration url . |
30,105 | protected static function get_cartridge_parameters ( $ toolid ) { global $ PAGE , $ SITE ; $ PAGE -> set_context ( \ context_system :: instance ( ) ) ; $ tool = self :: get_lti_tool ( $ toolid ) ; $ title = self :: get_name ( $ tool ) ; $ launchurl = self :: get_launch_url ( $ toolid ) ; $ launchurl = $ launchurl -> ou... | Returns the parameters of the cartridge as an associative array of partial xpath . |
30,106 | protected static function set_xpath ( $ xpath , $ parameters , $ prefix = '' ) { foreach ( $ parameters as $ key => $ value ) { if ( is_array ( $ value ) ) { self :: set_xpath ( $ xpath , $ value , $ prefix . $ key ) ; } else { $ result = @ $ xpath -> query ( $ prefix . $ key ) ; if ( $ result ) { $ node = $ result -> ... | Traverses a recursive associative array setting the properties of the corresponding xpath element . |
30,107 | public static function create_cartridge ( $ toolid ) { $ cartridge = new \ DOMDocument ( ) ; $ cartridge -> load ( realpath ( __DIR__ . '/../xml/imslticc.xml' ) ) ; $ xpath = new \ DOMXpath ( $ cartridge ) ; $ xpath -> registerNamespace ( 'cc' , 'http://www.imsglobal.org/xsd/imslticc_v1p0' ) ; $ parameters = self :: ge... | Create an IMS cartridge for the tool . |
30,108 | protected function convertToUseRealPath ( $ filePath ) { $ realFilePath = $ filePath ; if ( $ this -> isZipStream ( $ filePath ) ) { if ( preg_match ( '/zip:\/\/(.*)#(.*)/' , $ filePath , $ matches ) ) { $ documentPath = $ matches [ 1 ] ; $ documentInsideZipPath = $ matches [ 2 ] ; $ realFilePath = 'zip://' . realpath ... | Updates the given file path to use a real path . This is to avoid issues on some Windows setup . |
30,109 | public static function clean_ruledata_form ( $ mformdata ) { global $ USER ; $ rule = new \ stdClass ( ) ; if ( ! empty ( $ mformdata -> ruleid ) ) { $ rule -> id = $ mformdata -> ruleid ; } $ rule -> userid = empty ( $ mformdata -> userid ) ? $ USER -> id : $ mformdata -> userid ; $ rule -> courseid = $ mformdata -> c... | Clean data submitted by mform . |
30,110 | public static function delete_rule ( $ ruleid , $ coursecontext = null ) { global $ DB ; subscription_manager :: remove_all_subscriptions_for_rule ( $ ruleid , $ coursecontext ) ; $ rule = $ DB -> get_record ( 'tool_monitor_rules' , array ( 'id' => $ ruleid ) ) ; $ success = $ DB -> delete_records ( 'tool_monitor_rules... | Delete a rule and associated subscriptions by rule id . |
30,111 | public static function get_rule ( $ ruleorid ) { global $ DB ; if ( ! is_object ( $ ruleorid ) ) { $ rule = $ DB -> get_record ( 'tool_monitor_rules' , array ( 'id' => $ ruleorid ) , '*' , MUST_EXIST ) ; } else { $ rule = $ ruleorid ; } return new rule ( $ rule ) ; } | Get an instance of rule class . |
30,112 | public static function update_rule ( $ ruledata ) { global $ DB ; if ( ! self :: get_rule ( $ ruledata -> id ) ) { throw new \ coding_exception ( 'Invalid rule ID.' ) ; } $ ruledata -> timemodified = time ( ) ; $ success = $ DB -> update_record ( 'tool_monitor_rules' , $ ruledata ) ; if ( $ success ) { if ( ! isset ( $... | Update rule data . |
30,113 | public static function get_rules_by_courseid ( $ courseid , $ limitfrom = 0 , $ limitto = 0 , $ includesite = true ) { global $ DB ; $ select = 'courseid = ?' ; $ params = array ( ) ; $ params [ ] = $ courseid ; if ( $ includesite ) { $ select .= ' OR courseid = ?' ; $ params [ ] = 0 ; } $ orderby = 'courseid DESC, nam... | Get rules by course id . |
30,114 | protected function get_indexing_restrictions ( ) { global $ DB ; $ stupidobject = ( object ) [ ] ; $ zero = '0' ; $ stupidobject -> { $ zero } = false ; return [ $ DB -> sql_compare_text ( 'bi.configdata' ) . " != ? AND " . $ DB -> sql_compare_text ( 'bi.configdata' ) . " != ? AND " . $ DB -> sql_compare_text ( 'bi.con... | Returns restrictions on which block_instances rows to return . By default excludes rows that have empty configdata . |
30,115 | public function get_document_recordset ( $ modifiedfrom = 0 , \ context $ context = null ) { global $ DB ; list ( $ contextjoin , $ contextparams ) = $ this -> get_context_restriction_sql ( $ context , 'bi' ) ; list ( $ restrictions , $ restrictionparams ) = $ this -> get_indexing_restrictions ( ) ; if ( $ restrictions... | Gets recordset of all blocks of this type modified since given time within the given context . |
30,116 | public function check_access ( $ id ) { $ instance = $ this -> get_block_instance ( $ id , IGNORE_MISSING ) ; if ( ! $ instance ) { return manager :: ACCESS_DELETED ; } if ( ! $ instance -> courseid || ! self :: is_supported_page_type_at_course_context ( $ instance -> pagetypepattern ) ) { return manager :: ACCESS_DELE... | Checks access for a document in this search area . |
30,117 | protected function get_block_instance ( $ id , $ strictness = MUST_EXIST ) { global $ DB ; $ cache = \ cache :: make_from_params ( \ cache_store :: MODE_REQUEST , 'core_search' , self :: CACHE_INSTANCES , [ ] , [ 'simplekeys' => true ] ) ; $ id = ( int ) $ id ; $ instance = $ cache -> get ( $ id ) ; if ( ! $ instance )... | Gets a block instance with given id . |
30,118 | public function setStartColor ( PHPExcel_Style_Color $ pValue = null ) { $ color = $ pValue -> getIsSupervisor ( ) ? $ pValue -> getSharedComponent ( ) : $ pValue ; if ( $ this -> isSupervisor ) { $ styleArray = $ this -> getStartColor ( ) -> getStyleArray ( array ( 'argb' => $ color -> getARGB ( ) ) ) ; $ this -> getA... | Set Start Color |
30,119 | public static function instance ( $ fast = false ) { global $ CFG ; if ( static :: $ instance !== null ) { return static :: $ instance ; } if ( empty ( $ CFG -> searchengine ) ) { throw new \ core_search \ engine_exception ( 'enginenotselected' , 'search' ) ; } if ( ! $ engine = static :: search_engine_instance ( ) ) {... | Returns an initialised \ core_search instance . |
30,120 | public static function get_search_area ( $ areaid ) { if ( ! empty ( static :: $ allsearchareas [ $ areaid ] ) ) { return static :: $ allsearchareas [ $ areaid ] ; } $ classname = static :: get_area_classname ( $ areaid ) ; if ( class_exists ( $ classname ) && static :: is_search_area ( $ classname ) ) { return new $ c... | Returns a new area search indexer instance . |
30,121 | public static function get_search_areas_list ( $ enabled = false ) { if ( static :: $ allsearchareas !== null ) { if ( ! $ enabled ) { return static :: $ allsearchareas ; } else { return static :: $ enabledsearchareas ; } } static :: $ allsearchareas = array ( ) ; static :: $ enabledsearchareas = array ( ) ; $ searchcl... | Return the list of available search areas . |
30,122 | public static function get_search_area_category_by_name ( $ name ) { if ( key_exists ( $ name , self :: get_search_area_categories ( ) ) ) { return self :: get_search_area_categories ( ) [ $ name ] ; } else { return self :: get_search_area_categories ( ) [ self :: get_default_area_category_name ( ) ] ; } } | Return search area category instance by category name . |
30,123 | public static function get_search_area_categories ( ) { if ( ! isset ( static :: $ searchareacategories ) ) { $ categories = self :: get_core_search_area_categories ( ) ; $ areacategories = [ ] ; foreach ( self :: get_search_areas_list ( ) as $ searcharea ) { foreach ( $ searcharea -> get_category_names ( ) as $ catego... | Return a list of existing search area categories . |
30,124 | protected static function get_core_search_area_categories ( ) { $ categories = [ ] ; $ categories [ self :: SEARCH_AREA_CATEGORY_ALL ] = new area_category ( self :: SEARCH_AREA_CATEGORY_ALL , get_string ( 'core-all' , 'search' ) , 0 , self :: get_search_areas_list ( true ) ) ; $ categories [ self :: SEARCH_AREA_CATEGOR... | Get list of core search area categories . |
30,125 | protected static function get_additional_search_area_categories ( ) { $ additionalcategories = [ ] ; if ( $ pluginsfunction = get_plugins_with_function ( 'search_area_categories' ) ) { foreach ( $ pluginsfunction as $ plugintype => $ plugins ) { foreach ( $ plugins as $ pluginfunction ) { $ plugincategories = $ pluginf... | Gets a list of additional search area categories . |
30,126 | public static function clear_static ( ) { static :: $ enabledsearchareas = null ; static :: $ allsearchareas = null ; static :: $ instance = null ; static :: $ searchareacategories = null ; base_block :: clear_static ( ) ; engine :: clear_users_cache ( ) ; } | Clears all static caches . |
30,127 | public static function parse_areaid ( $ areaid ) { $ parts = self :: extract_areaid_parts ( $ areaid ) ; if ( empty ( $ parts [ 1 ] ) ) { throw new \ coding_exception ( 'Trying to parse invalid search area id ' . $ areaid ) ; } $ component = $ parts [ 0 ] ; $ area = $ parts [ 1 ] ; if ( strpos ( $ component , 'core' ) ... | Parse a search area id and get plugin name and config name prefix from it . |
30,128 | public function paged_search ( \ stdClass $ formdata , $ pagenum ) { $ out = new \ stdClass ( ) ; if ( self :: is_search_area_categories_enabled ( ) && ! empty ( $ formdata -> cat ) ) { $ cat = self :: get_search_area_category_by_name ( $ formdata -> cat ) ; if ( empty ( $ formdata -> areaids ) ) { $ formdata -> areaid... | Returns requested page of documents plus additional information for paging . |
30,129 | public function search ( \ stdClass $ formdata , $ limit = 0 ) { if ( defined ( 'BEHAT_SITE_RUNNING' ) ) { $ fakeresult = get_config ( 'core_search' , 'behat_fakeresult' ) ; if ( $ fakeresult ) { unset_config ( 'core_search' , 'behat_fakeresult' ) ; $ details = json_decode ( $ fakeresult ) ; if ( $ formdata -> q !== $ ... | Returns documents from the engine based on the data provided . |
30,130 | protected function build_limitcourseids ( \ stdClass $ formdata ) { $ limitcourseids = false ; if ( ! empty ( $ formdata -> mycoursesonly ) ) { $ limitcourseids = array_keys ( $ this -> get_my_courses ( false ) ) ; } if ( ! empty ( $ formdata -> courseids ) ) { if ( empty ( $ limitcourseids ) ) { $ limitcourseids = $ f... | Build a list of course ids to limit the search based on submitted form data . |
30,131 | public function reset_config ( $ areaid = false ) { if ( ! empty ( $ areaid ) ) { $ searchareas = array ( ) ; if ( ! $ searchareas [ $ areaid ] = static :: get_search_area ( $ areaid ) ) { throw new \ moodle_exception ( 'errorareanotavailable' , 'search' , '' , $ areaid ) ; } } else { $ searchareas = static :: get_sear... | Resets areas config . |
30,132 | public function delete_index ( $ areaid = false ) { if ( ! empty ( $ areaid ) ) { $ this -> engine -> delete ( $ areaid ) ; $ this -> reset_config ( $ areaid ) ; } else { $ this -> engine -> delete ( ) ; $ this -> reset_config ( ) ; } } | Deletes an area s documents or all areas documents . |
30,133 | public function get_areas_config ( $ searchareas ) { $ vars = array ( 'indexingstart' , 'indexingend' , 'lastindexrun' , 'docsignored' , 'docsprocessed' , 'recordsprocessed' , 'partial' ) ; $ configsettings = [ ] ; foreach ( $ searchareas as $ searcharea ) { $ areaid = $ searcharea -> get_area_id ( ) ; $ configsettings... | Returns search areas configuration . |
30,134 | public static function trigger_search_results_viewed ( $ other ) { $ event = \ core \ event \ search_results_viewed :: create ( [ 'context' => \ context_system :: instance ( ) , 'other' => $ other ] ) ; $ event -> trigger ( ) ; return $ event ; } | Triggers search_results_viewed event |
30,135 | public static function request_index ( \ context $ context , $ areaid = '' , $ priority = self :: INDEX_PRIORITY_NORMAL ) { global $ DB ; list ( $ contextsql , $ contextparams ) = $ DB -> get_in_or_equal ( $ context -> get_parent_context_ids ( true ) ) ; $ existing = $ DB -> get_records_select ( 'search_index_requests'... | Requests that a specific context is indexed by the scheduled task . The context will be added to a queue which is processed by the task . |
30,136 | public function get_index_requests_info ( ) { global $ DB ; $ result = new \ stdClass ( ) ; $ result -> total = $ DB -> count_records ( 'search_index_requests' ) ; $ result -> topten = $ DB -> get_records ( 'search_index_requests' , null , 'indexpriority DESC, timerequested, contextid, searcharea' , 'id, contextid, tim... | Gets information about the request queue in the form of a plain object suitable for passing to a template for rendering . |
30,137 | public static function get_default_area_category_name ( ) { $ default = get_config ( 'core' , 'searchdefaultcategory' ) ; if ( empty ( $ default ) ) { $ default = self :: SEARCH_AREA_CATEGORY_ALL ; } if ( $ default == self :: SEARCH_AREA_CATEGORY_ALL && self :: should_hide_all_results_category ( ) ) { $ default = self ... | Returns default search area category name . |
30,138 | protected function get_all_courses ( $ limitcourseids ) { global $ DB ; if ( $ limitcourseids ) { list ( $ coursesql , $ courseparams ) = $ DB -> get_in_or_equal ( $ limitcourseids ) ; $ coursesql = 'id ' . $ coursesql ; } else { $ coursesql = '' ; $ courseparams = [ ] ; } return $ DB -> get_records_select ( 'course' ,... | Get a list of all courses limited by ids if required . |
30,139 | public static function clean_up_non_existing_area ( $ areaid ) { global $ DB ; if ( ! empty ( self :: get_search_area ( $ areaid ) ) ) { throw new \ coding_exception ( "Area $areaid exists. Please use appropriate search area class to manipulate the data." ) ; } $ parts = self :: parse_areaid ( $ areaid ) ; $ plugin = $... | Cleans up non existing search area . |
30,140 | protected function define_settings ( ) { $ settingprefix = 'section_' . $ this -> info -> sectionid . '_' ; $ settingname = $ settingprefix . 'included' ; $ section_included = new restore_section_included_setting ( $ settingname , base_setting :: IS_BOOLEAN , true ) ; if ( is_number ( $ this -> info -> title ) ) { $ la... | Define the common setting that any restore section will have |
30,141 | public function get_data ( ) { global $ CFG ; $ data = parent :: get_data ( ) ; if ( $ data && $ this -> _customdata [ 'multipledisplaytypes' ] ) { if ( count ( array_filter ( $ data -> display ) ) == 0 ) { if ( $ CFG -> grade_export_displaytype == GRADE_DISPLAY_TYPE_LETTER ) { $ data -> display [ 'letter' ] = GRADE_DI... | Overrides the mform get_data method . |
30,142 | public function render_html_page ( exported_html_page $ page ) { $ data = $ page -> export_for_template ( $ this ) ; return parent :: render_from_template ( 'core_privacy/htmlpage' , $ data ) ; } | Render the html page . |
30,143 | static protected function build_activity_plan ( $ controller , $ id ) { $ plan = $ controller -> get_plan ( ) ; try { $ plan -> add_task ( backup_factory :: get_backup_activity_task ( $ controller -> get_format ( ) , $ id ) ) ; $ blockids = backup_plan_dbops :: get_blockids_from_moduleid ( $ id ) ; foreach ( $ blockids... | Build one 1 - activity backup |
30,144 | static protected function build_section_plan ( $ controller , $ id ) { $ plan = $ controller -> get_plan ( ) ; $ plan -> add_task ( backup_factory :: get_backup_section_task ( $ controller -> get_format ( ) , $ id ) ) ; $ coursemodules = backup_plan_dbops :: get_modules_from_sectionid ( $ id ) ; foreach ( $ coursemodul... | Build one 1 - section backup |
30,145 | static protected function build_course_plan ( $ controller , $ id ) { $ plan = $ controller -> get_plan ( ) ; $ plan -> add_task ( backup_factory :: get_backup_course_task ( $ controller -> get_format ( ) , $ id ) ) ; $ sections = backup_plan_dbops :: get_sections_from_courseid ( $ id ) ; foreach ( $ sections as $ sect... | Build one 1 - course backup |
30,146 | public function set_type_toggle ( $ options = null ) { if ( $ options === null ) { $ options = array ( 0 , 1 ) ; } $ options = array_values ( $ options ) ; $ idx = array_search ( $ this -> value , $ options , true ) ; if ( $ idx === false ) { throw new \ coding_exception ( 'Specified value must be one of the toggle opt... | Sets the element type to be a toggle |
30,147 | public function set_type_select ( $ options ) { if ( ! array_key_exists ( $ this -> value , $ options ) ) { throw new \ coding_exception ( 'Options for select element must contain an option for the specified value' ) ; } if ( count ( $ options ) < 2 ) { $ this -> editable = false ; } $ this -> type = 'select' ; $ paire... | Sets the element type to be a dropdown |
30,148 | public function set_type_autocomplete ( $ options , $ attributes ) { $ this -> type = 'autocomplete' ; $ pairedoptions = [ ] ; foreach ( $ options as $ key => $ value ) { $ pairedoptions [ ] = [ 'key' => $ key , 'value' => $ value , ] ; } $ this -> options = json_encode ( [ 'options' => $ pairedoptions , 'attributes' =... | Sets the element type to be an autocomplete field |
30,149 | protected function support_views ( ) { foreach ( $ this -> get_module_names ( ) as $ modname => $ modfullname ) { if ( ! plugin_supports ( 'mod' , $ modname , FEATURE_COMPLETION_TRACKS_VIEWS , false ) ) { return false ; } } return true ; } | Returns true if all selected modules support tracking view . |
30,150 | protected function support_grades ( ) { foreach ( $ this -> get_module_names ( ) as $ modname => $ modfullname ) { if ( ! plugin_supports ( 'mod' , $ modname , FEATURE_GRADE_HAS_GRADE , false ) ) { return false ; } } return true ; } | Returns true if all selected modules support grading . |
30,151 | protected function add_custom_completion_rules ( ) { $ modnames = array_keys ( $ this -> get_module_names ( ) ) ; if ( count ( $ modnames ) != 1 || ! plugin_supports ( 'mod' , $ modnames [ 0 ] , FEATURE_COMPLETION_HAS_RULES , false ) ) { return [ ] ; } try { $ moduleform = $ this -> get_module_form ( ) ; $ moduleform -... | If all selected modules are of the same module type adds custom completion rules from this module type |
30,152 | public function headerText ( array $ opts = array ( ) ) { $ id = isset ( $ opts [ 'id' ] ) ? $ opts [ 'id' ] : 0 ; $ this -> _data [ Horde_Imap_Client :: FETCH_HEADERTEXT ] [ $ id ] = $ opts ; } | Return header text . |
30,153 | public function bodyText ( array $ opts = array ( ) ) { $ id = isset ( $ opts [ 'id' ] ) ? $ opts [ 'id' ] : 0 ; $ this -> _data [ Horde_Imap_Client :: FETCH_BODYTEXT ] [ $ id ] = $ opts ; } | Return body text . |
30,154 | public function headers ( $ label , $ search , array $ opts = array ( ) ) { $ this -> _data [ Horde_Imap_Client :: FETCH_HEADERS ] [ $ label ] = array_merge ( $ opts , array ( 'headers' => array_map ( 'strval' , $ search ) ) ) ; } | Returns RFC 2822 header text that matches a search string . |
30,155 | public function remove ( $ criteria , $ key ) { if ( isset ( $ this -> _data [ $ criteria ] ) && is_array ( $ this -> _data [ $ criteria ] ) ) { unset ( $ this -> _data [ $ criteria ] [ $ key ] ) ; if ( empty ( $ this -> _data [ $ criteria ] ) ) { unset ( $ this -> _data [ $ criteria ] ) ; } } } | Remove an entry under a given criteria . |
30,156 | protected function configuration_definition ( ) { global $ CFG ; $ form = $ this -> _form ; $ form -> addElement ( 'text' , 'prefix' , get_string ( 'prefix' , 'cachestore_apcu' ) , array ( 'maxlength' => 5 , 'size' => 5 ) ) ; $ form -> addHelpButton ( 'prefix' , 'prefix' , 'cachestore_apcu' ) ; $ form -> setType ( 'pre... | Add the desired form elements . |
30,157 | public function configuration_validation ( $ data , $ files , array $ errors ) { if ( empty ( $ errors [ 'prefix' ] ) ) { $ factory = cache_factory :: instance ( ) ; $ config = $ factory -> create_config_instance ( ) ; foreach ( $ config -> get_all_stores ( ) as $ store ) { if ( $ store [ 'plugin' ] === 'apcu' ) { if (... | Validates the configuration data . |
30,158 | private function render_toolbar_button ( $ icon , $ tool , $ accesskey = null , $ disabled = false ) { $ alttext = new stdClass ( ) ; $ alttext -> tool = get_string ( $ tool , 'assignfeedback_editpdf' ) ; if ( ! empty ( $ accesskey ) ) { $ alttext -> shortcut = '(Alt/Shift-Alt/Ctrl-Option + ' . $ accesskey . ')' ; } el... | Render a single colour button . |
30,159 | public static function create_from_record ( $ feedback , $ cm , $ course ) { $ event = self :: create ( array ( 'objectid' => $ feedback -> id , 'context' => \ context_module :: instance ( $ cm -> id ) , 'anonymous' => ( $ feedback -> anonymous == FEEDBACK_ANONYMOUS_YES ) , 'other' => array ( 'anonymous' => $ feedback ... | Creates an instance from feedback record |
30,160 | public function render_stepsdefinitions ( $ stepsdefinitions , $ form ) { global $ CFG ; require_once ( $ CFG -> libdir . '/behat/classes/behat_selectors.php' ) ; $ html = $ this -> generic_info ( ) ; ob_start ( ) ; $ form -> display ( ) ; $ html .= ob_get_contents ( ) ; ob_end_clean ( ) ; if ( empty ( $ stepsdefinitio... | Renders the list of available steps according to the submitted filters . |
30,161 | public function render_error ( $ msg ) { $ html = $ this -> generic_info ( ) ; $ a = new stdClass ( ) ; $ a -> errormsg = $ msg ; $ a -> behatcommand = behat_command :: get_behat_command ( ) ; $ a -> behatinit = 'php admin' . DIRECTORY_SEPARATOR . 'tool' . DIRECTORY_SEPARATOR . 'behat' . DIRECTORY_SEPARATOR . 'cli' . D... | Renders an error message adding the generic info about the tool purpose and setup . |
30,162 | protected function generic_info ( ) { $ title = get_string ( 'pluginname' , 'tool_behat' ) ; $ html = $ this -> output -> header ( ) ; $ html .= $ this -> output -> heading ( $ title ) ; $ installurl = behat_command :: DOCS_URL ; $ installlink = html_writer :: tag ( 'a' , $ installurl , array ( 'href' => $ installurl ,... | Generic info about the tool . |
30,163 | public function find_users ( $ search ) { global $ DB ; list ( $ wherecondition , $ params ) = $ this -> search_sql ( $ search , 'u' ) ; $ params [ 'forumid' ] = $ this -> forumid ; list ( $ esql , $ eparams ) = get_enrolled_sql ( $ this -> context , '' , $ this -> currentgroup , true ) ; $ fields = $ this -> required_... | Finds all subscribed users |
30,164 | public static function get_behat_dir ( $ runprocess = 0 ) { global $ CFG ; if ( ! isset ( $ CFG -> behat_dataroot ) ) { return "" ; } if ( ! empty ( $ runprocess ) && isset ( $ CFG -> behat_parallel_run [ $ runprocess - 1 ] [ 'behat_dataroot' ] ) ) { $ behatdir = $ CFG -> behat_parallel_run [ $ runprocess - 1 ] [ 'beha... | Ensures the behat dir exists in moodledata |
30,165 | public final static function get_behat_command ( $ custombyterm = false , $ parallerun = false , $ absolutepath = false ) { $ separator = DIRECTORY_SEPARATOR ; $ exec = 'behat' ; if ( $ custombyterm && testing_is_cygwin ( ) ) { $ separator = '/' ; if ( ! testing_is_mingw ( ) ) { $ exec = 'behat.bat' ; } } if ( $ absolu... | Returns the executable path |
30,166 | public final static function run ( $ options = '' ) { global $ CFG ; $ currentcwd = getcwd ( ) ; chdir ( $ CFG -> dirroot ) ; exec ( self :: get_behat_command ( ) . ' ' . $ options , $ output , $ code ) ; chdir ( $ currentcwd ) ; return array ( $ output , $ code ) ; } | Runs behat command with provided options |
30,167 | public static function behat_setup_problem ( ) { global $ CFG ; if ( ! self :: are_behat_dependencies_installed ( ) ) { self :: output_msg ( get_string ( 'errorcomposer' , 'tool_behat' ) ) ; return TESTING_EXITCODE_COMPOSER ; } list ( $ output , $ code ) = self :: run ( ' --help' ) ; if ( $ code != 0 ) { self :: output... | Checks if behat is set up and working |
30,168 | protected static function output_msg ( $ msg ) { global $ CFG , $ PAGE ; if ( ! CLI_SCRIPT ) { $ renderer = $ PAGE -> get_renderer ( 'tool_behat' ) ; echo $ renderer -> render_error ( $ msg ) ; exit ( 1 ) ; } else { $ clibehaterrorstr = "Ensure you set \$CFG->behat_* vars in config.php " . "and you ran admin/tool/behat... | Outputs a message . |
30,169 | protected function send_response ( ) { try { if ( $ this -> function -> returns_desc != null ) { $ validatedvalues = external_api :: clean_returnvalue ( $ this -> function -> returns_desc , $ this -> returns ) ; } else { $ validatedvalues = null ; } } catch ( Exception $ ex ) { $ exception = $ ex ; } if ( ! empty ( $ e... | Send the result of function call to the WS client formatted as XML document . |
30,170 | protected static function xmlize_result ( $ returns , $ desc ) { if ( $ desc === null ) { return '' ; } else if ( $ desc instanceof external_value ) { if ( is_bool ( $ returns ) ) { $ returns = ( int ) $ returns ; } if ( is_null ( $ returns ) ) { return '<VALUE null="null"/>' . "\n" ; } else { return '<VALUE>' . htmlsp... | Internal implementation - recursive function producing XML markup . |
30,171 | public function escapeStream ( ) { if ( $ this -> literal ( ) ) { throw new Horde_Imap_Client_Data_Format_Exception ( 'String requires literal to output.' ) ; } rewind ( $ this -> _data -> stream ) ; $ stream = new Horde_Stream_Temp ( ) ; $ stream -> add ( $ this -> _data , true ) ; stream_filter_register ( 'horde_imap... | Return the escaped string as a stream . |
30,172 | public function forceLiteral ( ) { $ this -> _filter = $ this -> _filterParams ( ) ; $ this -> _filter -> literal = true ; $ this -> _filter -> quoted = false ; } | Force item to be output as a literal . |
30,173 | public function forceBinary ( ) { $ this -> _filter = $ this -> _filterParams ( ) ; $ this -> _filter -> binary = true ; $ this -> _filter -> literal = true ; $ this -> _filter -> quoted = false ; } | Force item to be output as a binary literal . |
30,174 | public function get_forum_exporter ( stdClass $ user , forum_entity $ forum , ? int $ currentgroup ) : forum_exporter { return new forum_exporter ( $ forum , [ 'legacydatamapperfactory' => $ this -> legacydatamapperfactory , 'capabilitymanager' => $ this -> managerfactory -> get_capability_manager ( $ forum ) , 'urlfac... | Construct a new forum exporter for the specified user and forum . |
30,175 | public function get_discussion_exporter ( stdClass $ user , forum_entity $ forum , discussion_entity $ discussion , array $ groupsbyid = [ ] , array $ favouriteids = [ ] ) : discussion_exporter { return new discussion_exporter ( $ discussion , [ 'context' => $ forum -> get_context ( ) , 'forum' => $ forum , 'capability... | Construct a new discussion exporter for the specified user and forum discussion . |
30,176 | public function get_discussion_summaries_exporter ( stdClass $ user , forum_entity $ forum , array $ discussions , array $ groupsbyid = [ ] , array $ groupsbyauthorid = [ ] , array $ discussionreplycount = [ ] , array $ discussionunreadcount = [ ] , array $ latestpostids = [ ] , array $ postauthorcontextids = [ ] , arr... | Construct a new discussion summaries exporter for the specified user and set of discussions . |
30,177 | public function get_posts_exporter ( stdClass $ user , forum_entity $ forum , discussion_entity $ discussion , array $ posts , array $ authorsbyid = [ ] , array $ authorcontextids = [ ] , array $ attachmentsbypostid = [ ] , array $ groupsbyauthorid = [ ] , post_read_receipt_collection_entity $ readreceiptcollection = n... | Construct a new post exporter for the specified user and set of post . |
30,178 | public function to_legacy_objects ( array $ forums ) : array { return array_map ( function ( forum_entity $ forum ) { return ( object ) [ 'id' => $ forum -> get_id ( ) , 'course' => $ forum -> get_course_id ( ) , 'type' => $ forum -> get_type ( ) , 'name' => $ forum -> get_name ( ) , 'intro' => $ forum -> get_intro ( )... | Convert a list of forum entities into stdClasses . |
30,179 | public function validation ( $ data , $ files ) { $ errors = parent :: validation ( $ data , $ files ) ; if ( isset ( $ data [ 'clustered' ] ) && ( $ data [ 'clustered' ] == 1 ) ) { if ( ! isset ( $ data [ 'setservers' ] ) ) { $ errors [ 'setservers' ] = get_string ( 'required' ) ; } else { $ trimmed = trim ( $ data [ ... | Perform minimal validation on the settings form . |
30,180 | protected function definition_draggable_items ( $ mform , $ itemrepeatsatstart ) { $ mform -> addElement ( 'header' , 'draggableitemheader' , get_string ( 'draggableitems' , 'qtype_ddimageortext' ) ) ; $ mform -> addElement ( 'advcheckbox' , 'shuffleanswers' , ' ' , get_string ( 'shuffleimages' , 'qtype_' . $ this -> q... | Drag items . |
30,181 | protected function drop_zone ( $ mform , $ imagerepeats ) { $ dropzoneitem = array ( ) ; $ grouparray = array ( ) ; $ grouparray [ ] = $ mform -> createElement ( 'text' , 'xleft' , get_string ( 'xleft' , 'qtype_ddimageortext' ) , array ( 'size' => 5 , 'class' => 'tweakcss' ) ) ; $ grouparray [ ] = $ mform -> createElem... | Drop zones . |
30,182 | private function connect ( ) { if ( $ this -> connection ) { return ; } if ( class_exists ( "Memcached" ) ) { $ this -> mc = new Memcached ( ) ; $ this -> mc -> addServer ( $ this -> host , $ this -> port ) ; $ this -> connection = true ; } else { $ this -> connection = memcache_pconnect ( $ this -> host , $ this -> po... | Lazy initialiser for memcache connection . Uses pconnect for to take advantage of the persistence pool where possible . |
30,183 | public static function instance ( $ user , ? \ context $ context = null ) { $ userid = $ user ; if ( ! is_scalar ( $ userid ) ) { $ userid = $ user -> id ; } if ( self :: $ cachedid === $ userid ) { return self :: $ cachedinstance ; } $ cachedinstance = new \ core_analytics \ user ( $ user , $ context ) ; self :: $ cac... | Returns an analytics user instance . |
30,184 | protected function load ( ) { if ( empty ( $ this -> user -> email ) ) { $ this -> user = \ core_user :: get_user ( $ this -> user -> id ) ; } $ this -> usercontext = $ this -> get_context ( ) ; $ this -> now = time ( ) ; $ this -> loaded = true ; } | Loads the analytics user object . |
30,185 | function init_plugin ( $ authtype ) { $ this -> pluginconfig = 'auth_' . $ authtype ; $ this -> config = get_config ( $ this -> pluginconfig ) ; if ( empty ( $ this -> config -> ldapencoding ) ) { $ this -> config -> ldapencoding = 'utf-8' ; } if ( empty ( $ this -> config -> user_type ) ) { $ this -> config -> user_ty... | Init plugin config from database settings depending on the plugin auth type . |
30,186 | function user_exists ( $ username ) { $ extusername = core_text :: convert ( $ username , 'utf-8' , $ this -> config -> ldapencoding ) ; $ users = $ this -> ldap_get_userlist ( '(' . $ this -> config -> user_attribute . '=' . ldap_filter_addslashes ( $ extusername ) . ')' ) ; return count ( $ users ) ; } | Checks if user exists on LDAP |
30,187 | function user_signup ( $ user , $ notify = true ) { global $ CFG , $ DB , $ PAGE , $ OUTPUT ; require_once ( $ CFG -> dirroot . '/user/profile/lib.php' ) ; require_once ( $ CFG -> dirroot . '/user/lib.php' ) ; if ( $ this -> user_exists ( $ user -> username ) ) { print_error ( 'auth_ldap_user_exists' , 'auth_ldap' ) ; ... | Sign up a new user ready for confirmation . Password is passed in plaintext . |
30,188 | function password_expire ( $ username ) { $ result = 0 ; $ extusername = core_text :: convert ( $ username , 'utf-8' , $ this -> config -> ldapencoding ) ; $ ldapconnection = $ this -> ldap_connect ( ) ; $ user_dn = $ this -> ldap_find_userdn ( $ ldapconnection , $ extusername ) ; $ search_attribs = array ( $ this -> c... | Return number of days to user password expires |
30,189 | function ldap_bulk_insert ( $ username ) { global $ DB , $ CFG ; $ username = core_text :: strtolower ( $ username ) ; $ DB -> insert_record_raw ( 'tmp_extuser' , array ( 'username' => $ username , 'mnethostid' => $ CFG -> mnet_localhost_id ) , false , true ) ; echo '.' ; } | Bulk insert in SQL s temp table |
30,190 | private function is_role ( $ username , $ role ) { if ( empty ( $ this -> config -> { $ role [ 'settingname' ] } ) or empty ( $ this -> config -> memberattribute ) ) { return null ; } $ extusername = core_text :: convert ( $ username , 'utf-8' , $ this -> config -> ldapencoding ) ; $ ldapconnection = $ this -> ldap_con... | Check if user has LDAP group membership . |
30,191 | function ldap_expirationtime2unix ( $ time , $ ldapconnection , $ user_dn ) { $ result = false ; switch ( $ this -> config -> user_type ) { case 'edir' : $ yr = substr ( $ time , 0 , 4 ) ; $ mo = substr ( $ time , 4 , 2 ) ; $ dt = substr ( $ time , 6 , 2 ) ; $ hr = substr ( $ time , 8 , 2 ) ; $ min = substr ( $ time , ... | Take expirationtime and return it as unix timestamp in seconds |
30,192 | function ldap_unix2expirationtime ( $ time ) { $ result = false ; switch ( $ this -> config -> user_type ) { case 'edir' : $ result = date ( 'YmdHis' , $ time ) . 'Z' ; break ; case 'rfc2307' : case 'rfc2307bis' : $ result = $ time ; break ; default : print_error ( 'auth_ldap_usertypeundefined2' , 'auth_ldap' ) ; } ret... | Takes unix timestamp and returns it formated for storing in LDAP |
30,193 | function ldap_attributes ( ) { $ moodleattributes = array ( ) ; $ customfields = $ this -> get_custom_user_profile_fields ( ) ; if ( ! empty ( $ customfields ) && ! empty ( $ this -> userfields ) ) { $ userfields = array_merge ( $ this -> userfields , $ customfields ) ; } else { $ userfields = $ this -> userfields ; } ... | Returns user attribute mappings between moodle and LDAP |
30,194 | function ldap_get_userlist ( $ filter = '*' ) { $ fresult = array ( ) ; $ ldapconnection = $ this -> ldap_connect ( ) ; if ( $ filter == '*' ) { $ filter = '(&(' . $ this -> config -> user_attribute . '=*)' . $ this -> config -> objectclass . ')' ; } $ contexts = explode ( ';' , $ this -> config -> contexts ) ; if ( ! ... | Returns all usernames from LDAP |
30,195 | function change_password_url ( ) { if ( empty ( $ this -> config -> stdchangepassword ) ) { if ( ! empty ( $ this -> config -> changepasswordurl ) ) { return new moodle_url ( $ this -> config -> changepasswordurl ) ; } else { return null ; } } else { return null ; } } | Returns the URL for changing the user s password or empty if the default can be used . |
30,196 | function loginpage_hook ( ) { global $ CFG , $ SESSION ; if ( ( $ _SERVER [ 'REQUEST_METHOD' ] === 'GET' || ( $ _SERVER [ 'REQUEST_METHOD' ] === 'POST' && ( get_local_referer ( ) != strip_querystring ( qualified_me ( ) ) ) ) ) && ! empty ( $ this -> config -> ntlmsso_enabled ) && ! empty ( $ this -> config -> ntlmsso_s... | Will get called before the login page is shownr . Ff NTLM SSO is enabled and the user is in the right network we ll redirect to the magic NTLM page for SSO ... |
30,197 | function ntlmsso_magic ( $ sesskey ) { if ( isset ( $ _SERVER [ 'REMOTE_USER' ] ) && ! empty ( $ _SERVER [ 'REMOTE_USER' ] ) ) { $ username = core_text :: convert ( $ _SERVER [ 'REMOTE_USER' ] , 'iso-8859-1' , 'utf-8' ) ; switch ( $ this -> config -> ntlmsso_type ) { case 'ntlm' : $ username = $ this -> get_ntlm_remote... | To be called from a page running under NTLM s Integrated Windows Authentication . |
30,198 | function sync_roles ( $ user ) { global $ DB ; $ roles = get_ldap_assignable_role_names ( 2 ) ; foreach ( $ roles as $ role ) { $ isrole = $ this -> is_role ( $ user -> username , $ role ) ; if ( $ isrole === null ) { continue ; } $ systemcontext = context_system :: instance ( ) ; if ( $ isrole ) { role_assign ( $ role... | Sync roles for this user . |
30,199 | function ldap_get_ad_pwdexpire ( $ pwdlastset , $ ldapconn , $ user_dn ) { global $ CFG ; if ( ! function_exists ( 'bcsub' ) ) { error_log ( $ this -> errorlogtag . get_string ( 'needbcmath' , 'auth_ldap' ) ) ; return 0 ; } $ sr = ldap_read ( $ ldapconn , $ user_dn , '(objectClass=*)' , array ( 'userAccountControl' ) )... | Get password expiration time for a given user from Active Directory |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.