idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
34,300 | function MetaType ( $ t , $ len = - 1 , $ fieldobj = false ) { if ( is_object ( $ t ) ) { $ fieldobj = $ t ; $ t = $ fieldobj -> type ; $ len = $ fieldobj -> max_length ; } $ is_serial = is_object ( $ fieldobj ) && $ fieldobj -> primary_key && $ fieldobj -> auto_increment ; $ len = - 1 ; switch ( strtoupper ( $ t ) ) {... | needs column - definition! |
34,301 | protected function populateRequest ( CAS_Request_RequestInterface $ request ) { if ( empty ( $ this -> _contentType ) && ! empty ( $ this -> _body ) ) { throw new CAS_ProxiedService_Exception ( "If you pass a POST body, you must specify a content type via " . get_class ( $ this ) . '->setContentType($contentType).' ) ;... | Add any other parts of the request needed by concrete classes |
34,302 | protected function add_button_before ( array & $ params , $ row , $ button , $ before = '' , $ alwaysadd = true ) { if ( $ button !== '|' && $ this -> find_button ( $ params , $ button ) ) { return true ; } $ row = $ this -> fix_row ( $ params , $ row ) ; $ field = 'theme_advanced_buttons' . $ row ; $ old = $ params [ ... | Adds a button to the editor . |
34,303 | protected function find_button ( array & $ params , $ button ) { foreach ( $ params as $ key => $ value ) { if ( preg_match ( '/^theme_advanced_buttons(\d+)$/' , $ key , $ matches ) && strpos ( ',' . $ value . ',' , ',' . $ button . ',' ) !== false ) { return ( int ) $ matches [ 1 ] ; } } return false ; } | Tests if button is already present . |
34,304 | private function fix_row ( array & $ params , $ row ) { if ( $ row <= 1 ) { return 1 ; } else if ( isset ( $ params [ 'theme_advanced_buttons' . $ row ] ) ) { return $ row ; } else { return $ this -> count_button_rows ( $ params ) ; } } | Checks the row value is valid fix if necessary . |
34,305 | protected function add_js_plugin ( & $ params , $ pluginname = '' , $ jsfile = 'editor_plugin.js' ) { global $ CFG ; if ( $ pluginname === '' ) { $ pluginname = $ this -> plugin ; } $ params [ 'plugins' ] .= ',-' . $ pluginname ; if ( ! isset ( $ params [ 'moodle_init_plugins' ] ) ) { $ params [ 'moodle_init_plugins' ]... | Adds a JavaScript plugin into TinyMCE . Note that adding a plugin does not by itself add a button ; you must do both . |
34,306 | protected function get_version ( ) { global $ CFG ; $ plugin = new stdClass ; require ( $ CFG -> dirroot . '/lib/editor/tinymce/plugins/' . $ this -> plugin . '/version.php' ) ; return $ plugin -> version ; } | Obtains version number from version . php for this plugin . |
34,307 | public static function all_update_init_params ( array & $ params , context $ context , array $ options = null ) { global $ CFG ; $ plugins = core_component :: get_plugin_list ( 'tinymce' ) ; $ disabled = array ( ) ; if ( $ params [ 'moodle_config' ] -> disabledsubplugins ) { foreach ( explode ( ',' , $ params [ 'moodle... | Calls all available plugins to adjust the TinyMCE init parameters . |
34,308 | public static function get ( $ plugin ) { $ dir = core_component :: get_component_directory ( 'tinymce_' . $ plugin ) ; require_once ( $ dir . '/lib.php' ) ; $ classname = 'tinymce_' . $ plugin ; return new $ classname ( $ plugin ) ; } | Gets a named plugin object . Will cause fatal error if plugin doesn t exist . |
34,309 | public static function compare_plugins ( editor_tinymce_plugin $ a , editor_tinymce_plugin $ b ) { $ order = $ a -> get_sort_order ( ) - $ b -> get_sort_order ( ) ; if ( $ order != 0 ) { return $ order ; } return strcmp ( $ a -> plugin , $ b -> plugin ) ; } | Compares two plugins . |
34,310 | public static function get_request_type_string ( $ requesttype ) { $ types = self :: get_request_types ( ) ; if ( ! isset ( $ types [ $ requesttype ] ) ) { throw new moodle_exception ( 'errorinvalidrequesttype' , 'tool_dataprivacy' ) ; } return $ types [ $ requesttype ] ; } | Retrieves the human - readable text value of a data request type . |
34,311 | public static function get_shortened_request_type_string ( $ requesttype ) { $ types = self :: get_request_types_short ( ) ; if ( ! isset ( $ types [ $ requesttype ] ) ) { throw new moodle_exception ( 'errorinvalidrequesttype' , 'tool_dataprivacy' ) ; } return $ types [ $ requesttype ] ; } | Retrieves the human - readable shortened text value of a data request type . |
34,312 | public static function get_request_types ( ) { return [ api :: DATAREQUEST_TYPE_EXPORT => get_string ( 'requesttypeexport' , 'tool_dataprivacy' ) , api :: DATAREQUEST_TYPE_DELETE => get_string ( 'requesttypedelete' , 'tool_dataprivacy' ) , api :: DATAREQUEST_TYPE_OTHERS => get_string ( 'requesttypeothers' , 'tool_datap... | Returns the key value - pairs of request type code and their string value . |
34,313 | public static function get_request_types_short ( ) { return [ api :: DATAREQUEST_TYPE_EXPORT => get_string ( 'requesttypeexportshort' , 'tool_dataprivacy' ) , api :: DATAREQUEST_TYPE_DELETE => get_string ( 'requesttypedeleteshort' , 'tool_dataprivacy' ) , api :: DATAREQUEST_TYPE_OTHERS => get_string ( 'requesttypeother... | Returns the key value - pairs of request type code and their shortened string value . |
34,314 | public static function get_request_status_string ( $ status ) { $ statuses = self :: get_request_statuses ( ) ; if ( ! isset ( $ statuses [ $ status ] ) ) { throw new moodle_exception ( 'errorinvalidrequeststatus' , 'tool_dataprivacy' ) ; } return $ statuses [ $ status ] ; } | Retrieves the human - readable value of a data request status . |
34,315 | public static function get_request_statuses ( ) { return [ api :: DATAREQUEST_STATUS_PENDING => get_string ( 'statuspending' , 'tool_dataprivacy' ) , api :: DATAREQUEST_STATUS_AWAITING_APPROVAL => get_string ( 'statusawaitingapproval' , 'tool_dataprivacy' ) , api :: DATAREQUEST_STATUS_APPROVED => get_string ( 'statusap... | Returns the key value - pairs of request status code and string value . |
34,316 | public static function get_request_creation_method_string ( $ creation ) { $ creationmethods = self :: get_request_creation_methods ( ) ; if ( ! isset ( $ creationmethods [ $ creation ] ) ) { throw new moodle_exception ( 'errorinvalidrequestcreationmethod' , 'tool_dataprivacy' ) ; } return $ creationmethods [ $ creatio... | Retrieves the human - readable value of a data request creation method . |
34,317 | public static function get_children_of_user ( $ userid ) { global $ DB ; $ allusernames = get_all_user_name_fields ( true , 'u' ) ; $ sql = "SELECT u.id, $allusernames FROM {role_assignments} ra, {context} c, {user} u WHERE ra.userid = :userid AND ra.contextid = c.... | Get the users that a user can make data request for . |
34,318 | public static function get_request_filter_options ( ) { $ filters = [ self :: FILTER_TYPE => ( object ) [ 'name' => get_string ( 'requesttype' , 'tool_dataprivacy' ) , 'options' => self :: get_request_types_short ( ) ] , self :: FILTER_STATUS => ( object ) [ 'name' => get_string ( 'requeststatus' , 'tool_dataprivacy' )... | Get options for the data requests filter . |
34,319 | protected function define_assignment_subplugin_structure ( ) { return false ; $ subplugin = $ this -> get_subplugin_element ( null , '/assignment/assignmenttype' , 'offline' ) ; $ assassoff = new backup_nested_element ( $ this -> get_recommended_name ( ) ) ; $ config = new backup_nested_element ( 'config' , null , arra... | Returns the subplugin information to attach at assignment element |
34,320 | protected function define_submission_subplugin_structure ( ) { return false ; $ subplugin = $ this -> get_subplugin_element ( null , '/assignment/assignmenttype' , 'offline' ) ; $ asssuboff = new backup_nested_element ( $ this -> get_recommended_name ( ) ) ; $ config = new backup_nested_element ( 'submission_config' , ... | Returns the subplugin information to attach at submission element |
34,321 | public function html ( ) { global $ OUTPUT ; $ context = ( object ) [ 'id' => $ this -> name , 'name' => $ this -> name , 'value' => $ this -> value , 'disabled' => $ this -> isdisabled , ] ; $ context -> label = '' ; if ( preg_match ( "/^feedback/" , $ this -> name ) ) { $ context -> label = get_string ( 'feedbackfor'... | Render the html for this field . |
34,322 | public static function create_cohorts ( $ cohorts ) { global $ CFG , $ DB ; require_once ( "$CFG->dirroot/cohort/lib.php" ) ; $ params = self :: validate_parameters ( self :: create_cohorts_parameters ( ) , array ( 'cohorts' => $ cohorts ) ) ; $ availablethemes = cohort_get_list_of_themes ( ) ; $ transaction = $ DB -> ... | Create one or more cohorts |
34,323 | public static function get_cohorts ( $ cohortids = array ( ) ) { global $ DB , $ CFG ; $ params = self :: validate_parameters ( self :: get_cohorts_parameters ( ) , array ( 'cohortids' => $ cohortids ) ) ; if ( empty ( $ cohortids ) ) { $ cohorts = $ DB -> get_records ( 'cohort' ) ; } else { $ cohorts = $ DB -> get_rec... | Get cohorts definition specified by ids |
34,324 | public static function search_cohorts ( $ query , $ context , $ includes = 'parents' , $ limitfrom = 0 , $ limitnum = 25 ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/cohort/lib.php' ) ; $ params = self :: validate_parameters ( self :: search_cohorts_parameters ( ) , array ( 'query' => $ query , 'context' => $... | Search cohorts . |
34,325 | public static function delete_cohort_members ( $ members ) { global $ CFG , $ DB ; require_once ( "$CFG->dirroot/cohort/lib.php" ) ; $ params = self :: validate_parameters ( self :: delete_cohort_members_parameters ( ) , array ( 'members' => $ members ) ) ; $ transaction = $ DB -> start_delegated_transaction ( ) ; fore... | Delete cohort members |
34,326 | public static function get_cohort_members ( $ cohortids ) { global $ DB ; $ params = self :: validate_parameters ( self :: get_cohort_members_parameters ( ) , array ( 'cohortids' => $ cohortids ) ) ; $ members = array ( ) ; foreach ( $ params [ 'cohortids' ] as $ cohortid ) { $ cohort = $ DB -> get_record ( 'cohort' , ... | Return all members for a cohort |
34,327 | public function has_summary ( ) { if ( isset ( $ this -> record -> hassummary ) ) { return ! empty ( $ this -> record -> hassummary ) ; } if ( ! isset ( $ this -> record -> summary ) ) { $ this -> __get ( 'summary' ) ; } return ! empty ( $ this -> record -> summary ) ; } | Indicates if the course has non - empty summary field |
34,328 | public function has_course_contacts ( ) { if ( ! isset ( $ this -> record -> managers ) ) { $ courses = array ( $ this -> id => & $ this -> record ) ; core_course_category :: preload_course_contacts ( $ courses ) ; } return ! empty ( $ this -> record -> managers ) ; } | Indicates if the course have course contacts to display |
34,329 | public function get_custom_fields ( ) : array { if ( ! isset ( $ this -> record -> customfields ) ) { $ this -> record -> customfields = \ core_course \ customfield \ course_handler :: create ( ) -> get_instance_data ( $ this -> id ) ; } return $ this -> record -> customfields ; } | Returns custom fields data for this course |
34,330 | public function has_course_overviewfiles ( ) { global $ CFG ; if ( empty ( $ CFG -> courseoverviewfileslimit ) ) { return false ; } $ fs = get_file_storage ( ) ; $ context = context_course :: instance ( $ this -> id ) ; return ! $ fs -> is_area_empty ( $ context -> id , 'course' , 'overviewfiles' ) ; } | Checks if course has any associated overview files |
34,331 | public function get_course_overviewfiles ( ) { global $ CFG ; if ( empty ( $ CFG -> courseoverviewfileslimit ) ) { return array ( ) ; } require_once ( $ CFG -> libdir . '/filestorage/file_storage.php' ) ; require_once ( $ CFG -> dirroot . '/course/lib.php' ) ; $ fs = get_file_storage ( ) ; $ context = context_course ::... | Returns all course overview files |
34,332 | public function getIterator ( ) { $ ret = array ( 'id' => $ this -> record -> id ) ; foreach ( $ this -> record as $ property => $ value ) { $ ret [ $ property ] = $ value ; } return new ArrayIterator ( $ ret ) ; } | Create an iterator because magic vars can t be seen by foreach . Exclude context fields |
34,333 | public function can_access ( ) { if ( $ this -> canaccess === null ) { $ this -> canaccess = can_access_course ( $ this -> record ) ; } return $ this -> canaccess ; } | Returns true if the current user can access this course . |
34,334 | public function getBytesOffsetToSkipBOM ( $ filePointer , $ encoding ) { $ byteOffsetToSkipBom = 0 ; if ( $ this -> hasBOM ( $ filePointer , $ encoding ) ) { $ bomUsed = $ this -> supportedEncodingsWithBom [ $ encoding ] ; $ byteOffsetToSkipBom = strlen ( $ bomUsed ) ; } return $ byteOffsetToSkipBom ; } | Returns the number of bytes to use as offset in order to skip the BOM . |
34,335 | protected function hasBOM ( $ filePointer , $ encoding ) { $ hasBOM = false ; $ this -> globalFunctionsHelper -> rewind ( $ filePointer ) ; if ( array_key_exists ( $ encoding , $ this -> supportedEncodingsWithBom ) ) { $ potentialBom = $ this -> supportedEncodingsWithBom [ $ encoding ] ; $ numBytesInBom = strlen ( $ po... | Returns whether the file identified by the given pointer has a BOM . |
34,336 | protected function attemptConversion ( $ string , $ sourceEncoding , $ targetEncoding ) { if ( $ sourceEncoding === $ targetEncoding ) { return $ string ; } $ convertedString = null ; if ( $ this -> canUseIconv ( ) ) { $ convertedString = $ this -> globalFunctionsHelper -> iconv ( $ string , $ sourceEncoding , $ target... | Attempts to convert the given string to the given encoding . Depending on what is installed on the server we will try to iconv or mbstring . |
34,337 | public function load_data ( ) { global $ DB , $ USER ; if ( ! $ this -> cm = get_coursemodule_from_id ( 'data' , $ this -> id ) ) { throw new portfolio_caller_exception ( 'invalidid' , 'data' ) ; } if ( ! $ this -> data = $ DB -> get_record ( 'data' , array ( 'id' => $ this -> cm -> instance ) ) ) { throw new portfolio... | load up the data needed for the export |
34,338 | public function get_sha1 ( ) { if ( $ this -> exporter -> get ( 'format' ) instanceof portfolio_format_file && $ this -> singlefile ) { return $ this -> get_sha1_file ( ) ; } $ str = '' ; foreach ( $ this -> records as $ record ) { foreach ( $ record as $ data ) { if ( is_array ( $ data ) || is_object ( $ data ) ) { $ ... | Calculate the shal1 of this export Dependent on the export format . |
34,339 | public function check_permissions ( ) { if ( $ this -> recordid ) { if ( data_isowner ( $ this -> recordid ) ) { return has_capability ( 'mod/data:exportownentry' , context_module :: instance ( $ this -> cm -> id ) ) ; } return has_capability ( 'mod/data:exportentry' , context_module :: instance ( $ this -> cm -> id ) ... | Verify the user can still export this entry |
34,340 | private function exportentry ( $ record ) { $ patterns = array ( ) ; $ replacement = array ( ) ; $ files = array ( ) ; $ format = $ this -> get ( 'exporter' ) -> get ( 'format' ) ; foreach ( $ this -> fields as $ field ) { $ patterns [ ] = '[[' . $ field -> field -> name . ']]' ; if ( is_callable ( array ( $ field , 'g... | Prepare a single entry for export replacing all the content etc |
34,341 | protected static function export_user_data_lti_submissions ( approved_contextlist $ contextlist ) { global $ DB ; $ cmids = array_reduce ( $ contextlist -> get_contexts ( ) , function ( $ carry , $ context ) { if ( $ context -> contextlevel == CONTEXT_MODULE ) { $ carry [ ] = $ context -> instanceid ; } return $ carry ... | Export personal data for the given approved_contextlist related to LTI submissions . |
34,342 | protected static function export_user_data_lti_types ( approved_contextlist $ contextlist ) { global $ DB ; $ courseids = array_reduce ( $ contextlist -> get_contexts ( ) , function ( $ carry , $ context ) { if ( $ context -> contextlevel == CONTEXT_COURSE ) { $ carry [ ] = $ context -> instanceid ; } return $ carry ; ... | Export personal data for the given approved_contextlist related to LTI types . |
34,343 | protected static function export_user_data_lti_tool_proxies ( approved_contextlist $ contextlist ) { global $ DB ; $ systemcontexts = array_filter ( $ contextlist -> get_contexts ( ) , function ( $ context ) { return $ context -> contextlevel == CONTEXT_SYSTEM ; } ) ; if ( empty ( $ systemcontexts ) ) { return ; } $ us... | Export personal data for the given approved_contextlist related to LTI tool proxies . |
34,344 | public function export_for_template ( \ renderer_base $ output ) { $ components = [ ] ; foreach ( $ this -> models as $ componentname => $ modelslist ) { $ component = [ 'name' => $ this -> component_name ( $ componentname ) , 'component' => $ componentname , 'models' => [ ] , ] ; foreach ( $ modelslist as $ definition... | Export the list of models to be rendered . |
34,345 | protected function component_name ( string $ component ) : string { if ( $ component === 'core' || strpos ( $ component , 'core_' ) ) { return get_string ( 'componentcore' , 'tool_analytics' ) ; } else { return get_string ( 'pluginname' , $ component ) ; } } | Return a human readable name for the given frankenstyle component . |
34,346 | public static function create ( int $ id , \ stdClass $ record = null , field_controller $ field = null ) : data_controller { global $ DB ; if ( $ id && $ record ) { debugging ( 'Too many parameters, either id need to be specified or a record, but not both.' , DEBUG_DEVELOPER ) ; } if ( $ id ) { $ record = $ DB -> get_... | Creates an instance of data_controller |
34,347 | protected function is_empty ( $ value ) : bool { if ( $ this -> datafield ( ) === 'value' || $ this -> datafield ( ) === 'charvalue' || $ this -> datafield ( ) === 'shortcharvalue' ) { return '' . $ value === '' ; } return empty ( $ value ) ; } | Checks if the value is empty |
34,348 | protected function is_unique ( $ value ) : bool { global $ DB ; $ datafield = $ this -> datafield ( ) ; $ where = "fieldid = ? AND {$datafield} = ?" ; $ params = [ $ this -> get_field ( ) -> get ( 'id' ) , $ value ] ; if ( $ this -> get ( 'id' ) ) { $ where .= ' AND id <> ?' ; $ params [ ] = $ this -> get ( 'id' ) ; } ... | Checks if the value is unique |
34,349 | public function display ( ) : string { global $ PAGE ; $ output = $ PAGE -> get_renderer ( 'core_customfield' ) ; return $ output -> render ( new field_data ( $ this ) ) ; } | Used by handlers to display data on various places . |
34,350 | public function get_context ( ) : \ context { if ( $ this -> get ( 'contextid' ) ) { return \ context :: instance_by_id ( $ this -> get ( 'contextid' ) ) ; } else if ( $ this -> get ( 'instanceid' ) ) { return $ this -> get_field ( ) -> get_handler ( ) -> get_instance_context ( $ this -> get ( 'instanceid' ) ) ; } else... | Return the context of the field |
34,351 | public function export_value ( ) { $ value = $ this -> get_value ( ) ; if ( $ this -> is_empty ( $ value ) ) { return null ; } if ( $ this -> datafield ( ) === 'intvalue' ) { return ( int ) $ value ; } else if ( $ this -> datafield ( ) === 'decvalue' ) { return ( float ) $ value ; } else if ( $ this -> datafield ( ) ==... | Returns value in a human - readable format or default value if data record is not present |
34,352 | public static function is_user_visible ( $ cmorid , $ userid = 0 , $ checkcourse = true ) { global $ USER , $ DB , $ CFG ; if ( ! $ userid ) { $ userid = $ USER -> id ; } if ( ( $ cmorid instanceof \ cm_info ) && $ cmorid -> get_modinfo ( ) -> userid == $ userid ) { return $ cmorid -> uservisible ; } if ( is_object ( $... | Checks if an activity is visible to the given user . |
34,353 | public function set_callback_options ( $ class , array $ argarray , $ component ) { global $ CFG ; require_once ( $ CFG -> libdir . '/portfolio/caller.php' ) ; portfolio_include_callback_file ( $ component , $ class ) ; $ test = new $ class ( $ argarray ) ; unset ( $ test ) ; $ this -> callbackcomponent = $ component ;... | Function to set the callback options |
34,354 | public function set_format_by_file ( stored_file $ file , $ extraformats = null ) { $ this -> file = $ file ; $ fileformat = portfolio_format_from_mimetype ( $ file -> get_mimetype ( ) ) ; if ( is_string ( $ extraformats ) ) { $ extraformats = array ( $ extraformats ) ; } else if ( ! is_array ( $ extraformats ) ) { $ e... | If we already know we have exactly one file bypass set_formats and just pass the file so we can detect the formats by mimetype . |
34,355 | private function is_renderable ( ) { global $ CFG ; if ( empty ( $ CFG -> enableportfolios ) ) { return false ; } if ( defined ( 'PORTFOLIO_INTERNAL' ) ) { return false ; } if ( empty ( $ this -> instances ) || count ( $ this -> instances ) == 0 ) { return false ; } return true ; } | Perform some internal checks . These are not errors just situations where it s not appropriate to add the button |
34,356 | public function start ( ) { if ( $ this -> running === true ) { throw new xml_writer_exception ( 'xml_writer_already_started' ) ; } if ( $ this -> running === false ) { throw new xml_writer_exception ( 'xml_writer_already_stopped' ) ; } $ this -> output -> start ( ) ; if ( ! is_null ( $ this -> prologue ) ) { $ this ->... | Initializes the XML writer preparing it to accept instructions also invoking the underlying |
34,357 | public function stop ( ) { if ( is_null ( $ this -> running ) ) { throw new xml_writer_exception ( 'xml_writer_not_started' ) ; } if ( $ this -> running === false ) { throw new xml_writer_exception ( 'xml_writer_already_stopped' ) ; } if ( $ this -> level > 0 ) { throw new xml_writer_exception ( 'xml_writer_open_tags_r... | Finishes the XML writer not accepting instructions any more also invoking the underlying |
34,358 | public function end_tag ( $ tag ) { if ( $ this -> level == 0 ) { throw new xml_writer_exception ( 'xml_writer_end_tag_no_match' ) ; } $ pre = $ this -> lastwastext ? '' : "\n" . str_repeat ( ' ' , ( $ this -> level - 1 ) * 2 ) ; $ tag = $ this -> casefolding ? strtoupper ( $ tag ) : $ tag ; $ lastopentag = array_pop (... | Outputs one XML end tag |
34,359 | protected function text_content ( $ content ) { if ( ! is_null ( $ this -> contenttransformer ) ) { $ content = $ this -> contenttransformer -> process ( $ content ) ; } return is_null ( $ content ) ? null : $ this -> xml_safe_text_content ( $ content ) ; } | Returns text contents processed by the corresponding |
34,360 | public static function create_from_section ( $ section ) { $ event = self :: create ( [ 'context' => \ context_course :: instance ( $ section -> course ) , 'objectid' => $ section -> id , 'other' => [ 'sectionnum' => $ section -> section ] ] ) ; $ event -> add_record_snapshot ( 'course_sections' , $ section ) ; return ... | Creates event from the section object |
34,361 | protected function get_packer_for_read_operation ( $ archivefile ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/lib/filestorage/tgz_packer.php' ) ; if ( tgz_packer :: is_tgz_file ( $ archivefile ) ) { return get_file_packer ( 'application/x-gzip' ) ; } else { return get_file_packer ( 'application/zip' ) ; } } | Selects appropriate packer for existing archive depending on file contents . |
34,362 | private function HasMatches ( $ extend , $ haystackSelectorPath ) { if ( ! $ extend -> selector -> cacheable ) { return true ; } $ first_el = $ extend -> selector -> _oelements [ 0 ] ; foreach ( $ haystackSelectorPath as $ hackstackSelector ) { if ( ! $ hackstackSelector -> cacheable ) { return true ; } if ( in_array (... | Reduces Bootstrap 3 . 1 compile time from ~6 . 5s to ~5 . 6s |
34,363 | public function getSheets ( ) { $ this -> throwIfBookIsNotAvailable ( ) ; $ externalSheets = [ ] ; $ worksheets = $ this -> getWorkbook ( ) -> getWorksheets ( ) ; foreach ( $ worksheets as $ worksheet ) { $ externalSheets [ ] = $ worksheet -> getExternalSheet ( ) ; } return $ externalSheets ; } | Returns all the workbook s sheets |
34,364 | protected function get_course_filter_selector ( renderer_base $ output ) { $ langstr = get_string ( 'dayviewfor' , 'calendar' ) ; return $ output -> course_filter_selector ( $ this -> url , $ langstr , $ this -> calendar -> course -> id ) ; } | Get the course filter selector . |
34,365 | protected function get_previous_day_data ( ) { $ type = $ this -> related [ 'type' ] ; $ time = $ type -> get_prev_day ( $ this -> calendar -> time ) ; return $ type -> timestamp_to_date_array ( $ time ) ; } | Get the previous day timestamp . |
34,366 | protected function get_next_day_data ( ) { $ type = $ this -> related [ 'type' ] ; $ time = $ type -> get_next_day ( $ this -> calendar -> time ) ; return $ type -> timestamp_to_date_array ( $ time ) ; } | Get the next day timestamp . |
34,367 | protected function process_block_rule ( $ name , $ block ) { $ this -> rulestack [ ] = array ( 'callback' => method_exists ( $ this , $ name . "_block_rule" ) ? $ name . "_block_rule" : null , 'rule' => $ block ) ; $ this -> string = preg_replace_callback ( $ block [ 'expression' ] , array ( $ this , 'block_callback' )... | Block processing function & callbacks |
34,368 | protected final function rules ( & $ text , $ rules = null ) { if ( $ rules === null ) { $ rules = array ( 'except' => array ( ) ) ; } else if ( is_array ( $ rules ) && count ( $ rules ) > 1 ) { $ rules = array ( 'only' => $ rules ) ; } if ( isset ( $ rules [ 'only' ] ) && is_array ( $ rules [ 'only' ] ) ) { $ rules = ... | Rules processing function & callback |
34,369 | private function initialize_nowiki_index ( ) { $ token = "\Q" . $ this -> nowikitoken . "\E" ; $ this -> string = preg_replace_callback ( "/" . $ token . "\d+" . $ token . "/" , array ( $ this , "initialize_nowiki_index_callback" ) , $ this -> string ) ; } | Special nowiki parser index |
34,370 | public function include_after_restore ( $ restoreid , $ courseid , \ base_logger $ logger , $ name , \ base_task $ task ) { return ! $ this -> groupid || $ task -> get_setting_value ( 'groups' ) ; } | Include this condition only if we are including groups in restore or if it s a generic same activity one . |
34,371 | public function trans_format ( $ name ) { $ name = trim ( $ name ) ; if ( $ name == 'moodle_auto_format' ) { return FORMAT_MOODLE ; } else if ( $ name == 'html' ) { return FORMAT_HTML ; } else if ( $ name == 'plain_text' ) { return FORMAT_PLAIN ; } else if ( $ name == 'wiki_like' ) { return FORMAT_WIKI ; } else if ( $ ... | Translate human readable format name into internal Moodle code number Note the reverse function is called get_format . |
34,372 | public function getpath ( $ xml , $ path , $ default , $ istext = false , $ error = '' ) { foreach ( $ path as $ index ) { if ( ! isset ( $ xml [ $ index ] ) ) { if ( ! empty ( $ error ) ) { $ this -> error ( $ error ) ; return false ; } else { return $ default ; } } $ xml = $ xml [ $ index ] ; } if ( $ istext ) { if (... | return the value of a node given a path to the node if it doesn t exist return the default value |
34,373 | public function import_answer ( $ answer , $ withanswerfiles = false , $ defaultformat = 'html' ) { $ ans = new stdClass ( ) ; if ( $ withanswerfiles ) { $ ans -> answer = $ this -> import_text_with_files ( $ answer , array ( ) , '' , $ defaultformat ) ; } else { $ ans -> answer = array ( ) ; $ ans -> answer [ 'text' ]... | Import the common parts of a single answer |
34,374 | public function import_combined_feedback ( $ qo , $ questionxml , $ withshownumpartscorrect = false ) { $ fields = array ( 'correctfeedback' , 'partiallycorrectfeedback' , 'incorrectfeedback' ) ; foreach ( $ fields as $ field ) { $ qo -> $ field = $ this -> import_text_with_files ( $ questionxml , array ( '#' , $ field... | Import the common overall feedback fields . |
34,375 | public function import_hint ( $ hintxml , $ defaultformat ) { $ hint = new stdClass ( ) ; if ( array_key_exists ( 'hintcontent' , $ hintxml [ '#' ] ) ) { $ hint -> hint = $ this -> import_text_with_files ( $ hintxml , array ( '#' , 'hintcontent' , 0 ) , '' , $ defaultformat ) ; $ hint -> shownumcorrect = $ this -> getp... | Import a question hint |
34,376 | public function import_hints ( $ qo , $ questionxml , $ withparts = false , $ withoptions = false , $ defaultformat = 'html' ) { if ( ! isset ( $ questionxml [ '#' ] [ 'hint' ] ) ) { return ; } foreach ( $ questionxml [ '#' ] [ 'hint' ] as $ hintxml ) { $ hint = $ this -> import_hint ( $ hintxml , $ defaultformat ) ; $... | Import all the question hints |
34,377 | public function import_question_tags ( $ qo , $ questionxml ) { global $ CFG ; if ( core_tag_tag :: is_enabled ( 'core_question' , 'question' ) ) { $ qo -> tags = [ ] ; if ( ! empty ( $ questionxml [ '#' ] [ 'tags' ] [ 0 ] [ '#' ] [ 'tag' ] ) ) { foreach ( $ questionxml [ '#' ] [ 'tags' ] [ 0 ] [ '#' ] [ 'tag' ] as $ t... | Import all the question tags |
34,378 | public function import_files ( $ xml ) { $ files = array ( ) ; foreach ( $ xml as $ file ) { $ data = new stdClass ( ) ; $ data -> content = $ file [ '#' ] ; $ data -> encoding = $ file [ '@' ] [ 'encoding' ] ; $ data -> name = $ file [ '@' ] [ 'name' ] ; $ files [ ] = $ data ; } return $ files ; } | Import files from a node in the XML . |
34,379 | public function import_multichoice ( $ question ) { $ qo = $ this -> import_headers ( $ question ) ; $ qo -> qtype = 'multichoice' ; $ single = $ this -> getpath ( $ question , array ( '#' , 'single' , 0 , '#' ) , 'true' ) ; $ qo -> single = $ this -> trans_single ( $ single ) ; $ shuffleanswers = $ this -> getpath ( $... | import multiple choice question |
34,380 | public function import_shortanswer ( $ question ) { $ qo = $ this -> import_headers ( $ question ) ; $ qo -> qtype = 'shortanswer' ; $ qo -> usecase = $ this -> getpath ( $ question , array ( '#' , 'usecase' , 0 , '#' ) , $ qo -> usecase ) ; $ answers = $ question [ '#' ] [ 'answer' ] ; $ acount = 0 ; foreach ( $ answe... | Import short answer type question |
34,381 | public function import_description ( $ question ) { $ qo = $ this -> import_headers ( $ question ) ; $ qo -> qtype = 'description' ; $ qo -> defaultmark = 0 ; $ qo -> length = 0 ; return $ qo ; } | Import description type question |
34,382 | public function import_match ( $ question ) { $ qo = $ this -> import_headers ( $ question ) ; $ qo -> qtype = 'match' ; $ qo -> shuffleanswers = $ this -> trans_single ( $ this -> getpath ( $ question , array ( '#' , 'shuffleanswers' , 0 , '#' ) , 1 ) ) ; $ qo -> subquestions = array ( ) ; $ qo -> subanswers = array (... | Import matching type question |
34,383 | public function import_essay ( $ question ) { $ qo = $ this -> import_headers ( $ question ) ; $ qo -> qtype = 'essay' ; $ qo -> responseformat = $ this -> getpath ( $ question , array ( '#' , 'responseformat' , 0 , '#' ) , 'editor' ) ; $ qo -> responsefieldlines = $ this -> getpath ( $ question , array ( '#' , 'respon... | Import essay type question |
34,384 | public function xml_escape ( $ string ) { if ( ! empty ( $ string ) && htmlspecialchars ( $ string ) != $ string ) { $ string = str_replace ( ']]>' , ']]]]><![CDATA[>' , $ string ) ; return "<![CDATA[{$string}]]>" ; } else { return $ string ; } } | Take a string and wrap it in a CDATA secion if that is required to make the output XML valid . |
34,385 | public function write_files ( $ files ) { if ( empty ( $ files ) ) { return '' ; } $ string = '' ; foreach ( $ files as $ file ) { if ( $ file -> is_directory ( ) ) { continue ; } $ string .= '<file name="' . $ file -> get_filename ( ) . '" path="' . $ file -> get_filepath ( ) . '" encoding="base64">' ; $ string .= bas... | Generte the XML to represent some files . |
34,386 | public function write_hints ( $ question ) { if ( empty ( $ question -> hints ) ) { return '' ; } $ output = '' ; foreach ( $ question -> hints as $ hint ) { $ output .= $ this -> write_hint ( $ hint , $ question -> contextid ) ; } return $ output ; } | Write out the hints . |
34,387 | public function write_combined_feedback ( $ questionoptions , $ questionid , $ contextid ) { $ fs = get_file_storage ( ) ; $ output = '' ; $ fields = array ( 'correctfeedback' , 'partiallycorrectfeedback' , 'incorrectfeedback' ) ; foreach ( $ fields as $ field ) { $ formatfield = $ field . 'format' ; $ files = $ fs -> ... | Output the combined feedback fields . |
34,388 | public static function enrol_users ( $ enrolments ) { global $ DB , $ CFG ; require_once ( $ CFG -> libdir . '/enrollib.php' ) ; $ params = self :: validate_parameters ( self :: enrol_users_parameters ( ) , array ( 'enrolments' => $ enrolments ) ) ; $ transaction = $ DB -> start_delegated_transaction ( ) ; $ enrol = en... | Enrolment of users . |
34,389 | public static function unenrol_users ( $ enrolments ) { global $ CFG , $ DB ; $ params = self :: validate_parameters ( self :: unenrol_users_parameters ( ) , array ( 'enrolments' => $ enrolments ) ) ; require_once ( $ CFG -> libdir . '/enrollib.php' ) ; $ transaction = $ DB -> start_delegated_transaction ( ) ; $ enrol ... | Unenrolment of users . |
34,390 | function definition_after_data ( ) { $ mform = $ this -> _form ; $ columns = $ this -> _customdata [ 'columns' ] ; foreach ( $ columns as $ column ) { if ( $ mform -> elementExists ( $ column ) ) { $ mform -> removeElement ( $ column ) ; } } if ( ! in_array ( 'password' , $ columns ) ) { if ( $ mform -> elementExists (... | Form tweaks that depend on current data . |
34,391 | function validation ( $ data , $ files ) { $ errors = parent :: validation ( $ data , $ files ) ; $ columns = $ this -> _customdata [ 'columns' ] ; $ optype = $ data [ 'uutype' ] ; $ updatetype = $ data [ 'uuupdatetype' ] ; if ( ! in_array ( 'password' , $ columns ) ) { switch ( $ optype ) { case UU_USER_UPDATE : if ( ... | Server side validation . |
34,392 | function get_data ( ) { $ data = parent :: get_data ( ) ; if ( $ data !== null and isset ( $ data -> description ) ) { $ data -> descriptionformat = $ data -> description [ 'format' ] ; $ data -> description = $ data -> description [ 'text' ] ; } return $ data ; } | Used to reformat the data from the editor component |
34,393 | public static function prepareVariableForJavascript ( $ string , $ asObject ) { if ( $ asObject ) { $ string = str_replace ( array ( '"' , '/' , '<' , "\n" , "\r" ) , array ( '\"' , '\/' , '\<' , '<br />' , '' ) , $ string ) ; } else { $ string = str_replace ( array ( '"' , '/' , '<' , "\n" , "\r" ) , array ( '\"' , '\... | Replaces special characters for the usage inside javascript |
34,394 | public static function convertVariableToString ( $ variable ) { $ string = '' ; if ( is_array ( $ variable ) ) { $ string = self :: viewArray ( $ variable ) ; } elseif ( is_object ( $ variable ) ) { $ string = '<strong>|Object:<pre>' ; $ string .= print_r ( $ variable , TRUE ) ; $ string .= '</pre>|</strong>' ; } elsei... | Converts a variable to a string |
34,395 | public static function debugInPopUpWindow ( $ debugVariable , $ header = 'Debug' , $ group = 'Debug' ) { $ debugString = self :: prepareVariableForJavascript ( self :: convertVariableToString ( $ debugVariable ) , is_object ( $ debugVariable ) ) ; $ script = ' (function debug() { var debugMessage = "' . $ debugStr... | Opens a debug message inside a popup window |
34,396 | public static function debugTrail ( ) { $ trail = debug_backtrace ( ) ; $ trail = array_reverse ( $ trail ) ; array_pop ( $ trail ) ; $ path = array ( ) ; foreach ( $ trail as $ dat ) { $ pathFragment = $ dat [ 'class' ] . $ dat [ 'type' ] . $ dat [ 'function' ] ; if ( in_array ( $ dat [ 'function' ] , array ( 'require... | Displays the path of the function call stack in a string using debug_backtrace |
34,397 | public static function debugRows ( $ rows , $ header = '' , $ returnHTML = FALSE ) { if ( is_array ( $ rows ) ) { $ firstEl = reset ( $ rows ) ; if ( is_array ( $ firstEl ) ) { $ headerColumns = array_keys ( $ firstEl ) ; $ tRows = array ( ) ; $ tRows [ ] = '<tr><td colspan="' . count ( $ headerColumns ) . '" style="ba... | Displays an array as rows in a table . Useful to debug output like an array of database records . |
34,398 | public function get_taxonomy ( $ level ) { $ taxonomies = $ this -> get_taxonomies ( ) ; if ( empty ( $ taxonomies [ $ level ] ) ) { $ constant = self :: TAXONOMY_COMPETENCY ; } else { $ constant = $ taxonomies [ $ level ] ; } return $ constant ; } | Get the constant name for a level . |
34,399 | protected function get_taxonomies ( ) { $ taxonomies = explode ( ',' , $ this -> raw_get ( 'taxonomies' ) ) ; array_unshift ( $ taxonomies , null ) ; unset ( $ taxonomies [ 0 ] ) ; foreach ( $ taxonomies as $ i => $ taxonomy ) { if ( empty ( $ taxonomy ) ) { $ taxonomies [ $ i ] = self :: TAXONOMY_COMPETENCY ; } } retu... | Return the taxonomy constants indexed by level . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.