idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
34,400 | protected function set_taxonomies ( $ taxonomies ) { if ( is_array ( $ taxonomies ) ) { $ taxonomies = implode ( ',' , $ taxonomies ) ; } $ this -> raw_set ( 'taxonomies' , $ taxonomies ) ; } | Convenience method to set taxonomies from an array or string . |
34,401 | protected function validate_scaleid ( $ value ) { global $ DB ; if ( ! $ DB -> record_exists_select ( 'scale' , 'id = :id' , array ( 'id' => $ value ) ) ) { return new lang_string ( 'invalidscaleid' , 'error' ) ; } if ( $ this -> get ( 'id' ) ) { if ( $ this -> beforeupdate -> get ( 'scaleid' ) != $ value ) { if ( $ th... | Validate the scale ID . |
34,402 | protected function validate_scaleconfiguration ( $ value ) { $ scaledefaultselected = false ; $ proficientselected = false ; $ scaleconfigurations = json_decode ( $ value ) ; if ( is_array ( $ scaleconfigurations ) ) { $ scaleinfo = array_shift ( $ scaleconfigurations ) ; if ( empty ( $ scaleinfo ) || ! isset ( $ scale... | Validate the scale configuration . |
34,403 | protected function validate_taxonomies ( $ value ) { $ terms = explode ( ',' , $ value ) ; foreach ( $ terms as $ term ) { if ( ! empty ( $ term ) && ! array_key_exists ( $ term , self :: get_taxonomies_list ( ) ) ) { return new lang_string ( 'invalidtaxonomy' , 'core_competency' , $ term ) ; } } return true ; } | Validate taxonomies . |
34,404 | public static function get_default_grade_from_scale_configuration ( $ config ) { $ config = json_decode ( $ config ) ; if ( ! is_array ( $ config ) ) { throw new coding_exception ( 'Unexpected scale configuration.' ) ; } array_shift ( $ config ) ; foreach ( $ config as $ part ) { if ( $ part -> scaledefault ) { return ... | Extract the default grade from a scale configuration . |
34,405 | public static function get_proficiency_of_grade_from_scale_configuration ( $ config , $ grade ) { $ config = json_decode ( $ config ) ; if ( ! is_array ( $ config ) ) { throw new coding_exception ( 'Unexpected scale configuration.' ) ; } array_shift ( $ config ) ; foreach ( $ config as $ part ) { if ( $ part -> id == $... | Extract the proficiency of a grade from a scale configuration . |
34,406 | public static function get_taxonomies_list ( ) { static $ list = null ; if ( $ list === null ) { $ list = array ( self :: TAXONOMY_BEHAVIOUR => new lang_string ( 'taxonomy_' . self :: TAXONOMY_BEHAVIOUR , 'core_competency' ) , self :: TAXONOMY_COMPETENCY => new lang_string ( 'taxonomy_' . self :: TAXONOMY_COMPETENCY , ... | Get the list of all taxonomies . |
34,407 | public static function get_unused_idnumber ( $ idnumber ) { global $ DB ; $ currentidnumber = $ idnumber ; $ counter = 0 ; while ( $ DB -> record_exists_select ( static :: TABLE , 'idnumber = ?' , array ( $ currentidnumber ) ) ) { $ suffixidnumber = '_' . ++ $ counter ; $ currentidnumber = substr ( $ idnumber , 0 , 100... | Get a uniq idnumber . |
34,408 | protected static function delete_stats ( int $ courseid , int $ userid = null ) { global $ DB ; $ params = ( isset ( $ userid ) ) ? [ 'courseid' => $ courseid , 'userid' => $ userid ] : [ 'courseid' => $ courseid ] ; $ DB -> delete_records ( 'stats_user_daily' , $ params ) ; $ DB -> delete_records ( 'stats_user_weekly'... | Deletes stats for a given course . |
34,409 | protected function correct_choices ( array $ right ) { if ( count ( $ right ) == 1 ) { return get_string ( 'correctansweris' , 'qtype_multichoice' , implode ( ', ' , $ right ) ) ; } else if ( count ( $ right ) > 1 ) { return get_string ( 'correctanswersare' , 'qtype_multichoice' , implode ( ', ' , $ right ) ) ; } else ... | Function returns string based on number of correct answers |
34,410 | public function add_stored_file ( $ file ) { if ( is_numeric ( $ file ) ) { $ this -> files [ $ file ] = $ file ; } else { $ this -> files [ $ file -> get_id ( ) ] = $ file ; } } | Add a stored file to the document . |
34,411 | public function get_files ( ) { foreach ( $ this -> files as $ id => $ listfile ) { if ( is_numeric ( $ listfile ) ) { $ fs = get_file_storage ( ) ; if ( $ file = $ fs -> get_file_by_id ( $ id ) ) { $ this -> files [ $ id ] = $ file ; } else { unset ( $ this -> files [ $ id ] ) ; } } } return $ this -> files ; } | Returns the array of attached files . |
34,412 | public function is_set ( $ field ) { return ( isset ( $ this -> data [ $ field ] ) || isset ( $ this -> extradata [ $ field ] ) ) ; } | Checks if a field is set . |
34,413 | public function set_data_from_engine ( $ docdata ) { $ fields = static :: $ requiredfields + static :: $ optionalfields + static :: $ enginefields ; foreach ( $ fields as $ fieldname => $ field ) { if ( isset ( $ docdata [ $ fieldname ] ) ) { if ( $ field [ 'type' ] === 'tdate' ) { $ this -> set ( $ fieldname , static ... | Fills the document with data coming from the search engine . |
34,414 | public function export_for_engine ( ) { $ this -> apply_defaults ( ) ; $ data = $ this -> data ; foreach ( static :: $ requiredfields as $ fieldname => $ field ) { if ( ! isset ( $ data [ $ fieldname ] ) ) { throw new \ coding_exception ( 'Missing "' . $ fieldname . '" field in document with id "' . $ this -> data [ 'i... | Returns the document ready to submit to the search engine . |
34,415 | public function config_form_validation ( array $ data , $ files = array ( ) ) : array { $ errors = array ( ) ; if ( ! empty ( $ data [ 'configdata' ] [ 'mindate' ] ) && ! empty ( $ data [ 'configdata' ] [ 'maxdate' ] ) && $ data [ 'configdata' ] [ 'mindate' ] > $ data [ 'configdata' ] [ 'maxdate' ] ) { $ errors [ 'conf... | Validate the data from the config form . |
34,416 | public function config_form_definition ( \ MoodleQuickForm $ mform ) { $ config = $ this -> get ( 'configdata' ) ; $ mform -> addElement ( 'header' , 'header_specificsettings' , get_string ( 'specificsettings' , 'customfield_date' ) ) ; $ mform -> setExpanded ( 'header_specificsettings' , true ) ; $ mform -> addElement... | Add fields for editing a date field . |
34,417 | public function get_discussion_renderer ( forum_entity $ forum , discussion_entity $ discussion , int $ displaymode ) : discussion_renderer { $ capabilitymanager = $ this -> managerfactory -> get_capability_manager ( $ forum ) ; $ ratingmanager = $ this -> managerfactory -> get_rating_manager ( ) ; $ rendererbase = $ t... | Create a discussion renderer for the given forum and discussion . |
34,418 | public function get_posts_search_results_renderer ( array $ searchterms ) : posts_renderer { $ urlfactory = $ this -> urlfactory ; return new posts_renderer ( $ this -> rendererbase , $ this -> builderfactory -> get_exported_posts_builder ( ) , 'mod_forum/forum_posts_with_context_links' , function ( $ exportedposts , $... | Create a posts renderer to render posts in the forum search results . |
34,419 | public function get_discussion_list_renderer ( forum_entity $ forum ) : discussion_list_renderer { $ capabilitymanager = $ this -> managerfactory -> get_capability_manager ( $ forum ) ; $ rendererbase = $ this -> rendererbase ; $ notifications = [ ] ; switch ( $ forum -> get_type ( ) ) { case 'news' : if ( SITEID == $ ... | Create a standard type discussion list renderer . |
34,420 | private function get_detailed_discussion_list_renderer ( forum_entity $ forum , string $ template ) : discussion_list_renderer { $ capabilitymanager = $ this -> managerfactory -> get_capability_manager ( $ forum ) ; $ rendererbase = $ this -> rendererbase ; $ notifications = [ ] ; return new discussion_list_renderer ( ... | Create a discussion list renderer which shows more information about the first post . |
34,421 | public function get_single_discussion_list_renderer ( forum_entity $ forum , discussion_entity $ discussion , bool $ hasmultiplediscussions , int $ displaymode ) : discussion_renderer { $ capabilitymanager = $ this -> managerfactory -> get_capability_manager ( $ forum ) ; $ ratingmanager = $ this -> managerfactory -> g... | Create a single type discussion list renderer . |
34,422 | protected function get_filepicker_node ( $ filepickerelement ) { $ exception = new ExpectationException ( '"' . $ filepickerelement . '" filepicker can not be found' , $ this -> getSession ( ) ) ; if ( empty ( $ filepickerelement ) ) { $ filepickercontainer = $ this -> find ( 'xpath' , "//*[@data-fieldtype=\"filemanage... | Gets the NodeElement for filepicker of filemanager moodleform element . |
34,423 | protected function open_element_contextual_menu ( $ name , $ filemanagerelement = false ) { $ containernode = false ; $ exceptionmsg = '"' . $ name . '" element can not be found' ; if ( $ filemanagerelement ) { $ containernode = $ this -> get_filepicker_node ( $ filemanagerelement ) ; $ exceptionmsg = 'The "' . $ filem... | Opens the contextual menu of a folder or a file . |
34,424 | protected function open_add_file_window ( $ filemanagernode , $ repositoryname ) { $ exception = new ExpectationException ( 'No files can be added to the specified filemanager' , $ this -> getSession ( ) ) ; try { $ add = $ this -> find ( 'css' , 'div.fp-btn-add a' , $ exception , $ filemanagernode ) ; } catch ( Except... | Opens the filepicker modal window and selects the repository . |
34,425 | protected function wait_until_contents_are_updated ( $ filepickernode ) { $ exception = new ExpectationException ( 'The file manager contents are requiring too much time to be updated' , $ this -> getSession ( ) ) ; $ this -> find ( 'xpath' , "//div[contains(concat(' ', normalize-space(@class), ' '), ' filemanager ')]"... | Checks that the file manager contents are not being updated . |
34,426 | public function get_api_functions ( ) { return [ 'create_share' => [ 'endpoint' => $ this -> ocsendpoint -> out ( false ) , 'method' => 'post' , 'args' => [ 'path' => PARAM_TEXT , 'shareType' => PARAM_INT , 'shareWith' => PARAM_TEXT , 'publicUpload' => PARAM_RAW , 'permissions' => PARAM_INT , 'shareWith' => PARAM_TEXT ... | Define relevant functions of the OCS API . |
34,427 | private function build_share_url ( ) { $ shareurl = $ this -> ocsendpoint -> get_scheme ( ) . '://' . $ this -> ocsendpoint -> get_host ( ) . ':' . $ this -> ocsendpoint -> get_port ( ) . $ this -> ocsendpoint -> get_path ( ) . '/{share_id}?' . $ this -> ocsendpoint -> get_query_string ( false ) ; return $ shareurl ; } | Private Function to return a url with the shareid in the path . |
34,428 | public function execute ( ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/repository/lib.php' ) ; $ fs = get_file_storage ( ) ; $ allfiles = array_merge ( $ fs -> get_area_files ( SYSCONTEXTID , 'repository_filesystem' , 'thumb' ) , $ fs -> get_area_files ( SYSCONTEXTID , 'repository_filesystem' , 'icon' ) ) ; $... | Run file system repository cron . |
34,429 | public static function is_defined ( $ forguests = false ) { global $ CFG ; if ( ! empty ( $ CFG -> sitepolicyhandler ) ) { return false ; } if ( ! $ forguests ) { return ! empty ( $ CFG -> sitepolicy ) ; } else { return ! empty ( $ CFG -> sitepolicyguest ) ; } } | Checks if the site has site policy defined |
34,430 | public static function create_subscription ( $ ruleid , $ courseid , $ cmid , $ userid = 0 ) { global $ DB , $ USER ; $ subscription = new \ stdClass ( ) ; $ subscription -> ruleid = $ ruleid ; $ subscription -> courseid = $ courseid ; $ subscription -> cmid = $ cmid ; $ subscription -> userid = empty ( $ userid ) ? $ ... | Subscribe a user to a given rule . |
34,431 | public static function delete_subscription ( $ subscriptionorid , $ checkuser = true ) { global $ DB , $ USER ; if ( is_object ( $ subscriptionorid ) ) { $ subscription = $ subscriptionorid ; } else { $ subscription = self :: get_subscription ( $ subscriptionorid ) ; } if ( $ checkuser && $ subscription -> userid != $ ... | Delete a subscription . |
34,432 | public static function remove_all_subscriptions_for_rule ( $ ruleid , $ coursecontext = null ) { global $ DB ; $ subscriptions = $ DB -> get_recordset ( 'tool_monitor_subscriptions' , array ( 'ruleid' => $ ruleid ) ) ; $ success = $ DB -> delete_records ( 'tool_monitor_subscriptions' , array ( 'ruleid' => $ ruleid ) ) ... | Delete all subscribers for a given rule . |
34,433 | public static function remove_all_subscriptions_in_course ( $ coursecontext ) { global $ DB ; if ( $ subscriptions = $ DB -> get_records ( 'tool_monitor_subscriptions' , [ 'courseid' => $ coursecontext -> instanceid ] ) ) { $ DB -> delete_records ( 'tool_monitor_subscriptions' , [ 'courseid' => $ coursecontext -> insta... | Delete all subscriptions in a course . |
34,434 | public static function get_subscription ( $ subscriptionorid ) { global $ DB ; if ( is_object ( $ subscriptionorid ) ) { return new subscription ( $ subscriptionorid ) ; } $ sql = self :: get_subscription_join_rule_sql ( ) ; $ sql .= "WHERE s.id = :id" ; $ sub = $ DB -> get_record_sql ( $ sql , array ( 'id' => $ subscr... | Get a subscription instance for an given subscription id . |
34,435 | public static function get_user_subscriptions_for_course ( $ courseid , $ limitfrom = 0 , $ limitto = 0 , $ userid = 0 , $ order = 's.timecreated DESC' ) { global $ DB , $ USER ; if ( $ userid == 0 ) { $ userid = $ USER -> id ; } $ sql = self :: get_subscription_join_rule_sql ( ) ; $ sql .= "WHERE s.courseid = :coursei... | Get an array of subscriptions for a given user in a given course . |
34,436 | public static function count_user_subscriptions_for_course ( $ courseid , $ userid = 0 ) { global $ DB , $ USER ; if ( $ userid == 0 ) { $ userid = $ USER -> id ; } $ sql = self :: get_subscription_join_rule_sql ( true ) ; $ sql .= "WHERE s.courseid = :courseid AND s.userid = :userid" ; return $ DB -> count_records_sql... | Get count of subscriptions for a given user in a given course . |
34,437 | public static function count_user_subscriptions ( $ userid = 0 ) { global $ DB , $ USER ; ; if ( $ userid == 0 ) { $ userid = $ USER -> id ; } $ sql = self :: get_subscription_join_rule_sql ( true ) ; $ sql .= "WHERE s.userid = :userid" ; return $ DB -> count_records_sql ( $ sql , array ( 'userid' => $ userid ) ) ; } | Get count of subscriptions for a given user . |
34,438 | public static function get_subscriptions_by_event ( \ stdClass $ event ) { global $ DB ; $ sql = self :: get_subscription_join_rule_sql ( ) ; if ( $ event -> contextlevel == CONTEXT_MODULE && $ event -> contextinstanceid != 0 ) { $ sql .= "WHERE r.eventname = :eventname AND s.courseid = :courseid AND (s.cmid = :cmid OR... | Return a list of subscriptions for a given event . |
34,439 | public static function count_rule_subscriptions ( $ ruleid ) { global $ DB ; $ sql = self :: get_subscription_join_rule_sql ( true ) ; $ sql .= "WHERE s.ruleid = :ruleid" ; return $ DB -> count_records_sql ( $ sql , array ( 'ruleid' => $ ruleid ) ) ; } | Get count of subscriptions for a given rule . |
34,440 | public static function event_has_subscriptions ( $ eventname , $ courseid ) { global $ DB ; $ cache = \ cache :: make ( 'tool_monitor' , 'eventsubscriptions' ) ; $ sql = "SELECT DISTINCT(r.eventname) FROM {tool_monitor_subscriptions} s INNER JOIN {tool_monitor_rules} r ON ... | Returns true if an event in a particular course has a subscription . |
34,441 | public static function activate_subscriptions ( array $ ids ) { global $ DB ; if ( ! empty ( $ ids ) ) { list ( $ sql , $ params ) = $ DB -> get_in_or_equal ( $ ids ) ; $ success = $ DB -> set_field_select ( 'tool_monitor_subscriptions' , 'inactivedate' , '0' , 'id ' . $ sql , $ params ) ; return $ success ; } return f... | Activates a group of subscriptions based on an input array of ids . |
34,442 | public static function deactivate_subscriptions ( array $ ids ) { global $ DB ; if ( ! empty ( $ ids ) ) { $ inactivedate = time ( ) ; list ( $ sql , $ params ) = $ DB -> get_in_or_equal ( $ ids ) ; $ success = $ DB -> set_field_select ( 'tool_monitor_subscriptions' , 'inactivedate' , $ inactivedate , 'id ' . $ sql , $... | Deactivates a group of subscriptions based on an input array of ids . |
34,443 | public static function delete_stale_subscriptions ( $ userid = 0 ) { global $ DB ; $ cutofftime = strtotime ( "-" . self :: INACTIVE_SUBSCRIPTION_LIFESPAN_IN_DAYS . " days" , time ( ) ) ; if ( ! empty ( $ userid ) ) { $ success = $ DB -> delete_records_select ( 'tool_monitor_subscriptions' , 'userid = ? AND inactivedat... | Deletes subscriptions which have been inactive for a period of time . |
34,444 | public function encode ( $ string ) { $ ret = '' ; for ( $ i = 0 , $ c = strlen ( $ string ) ; $ i < $ c ; $ i ++ ) { if ( $ string [ $ i ] !== '%' && ! isset ( $ this -> preserve [ $ int = ord ( $ string [ $ i ] ) ] ) ) { $ ret .= '%' . sprintf ( '%02X' , $ int ) ; } else { $ ret .= $ string [ $ i ] ; } } return $ ret... | Our replacement for urlencode it encodes all non - reserved characters as well as any extra characters that were instructed to be preserved . |
34,445 | protected function value_editor_options ( ) { $ field = $ this -> get_field ( ) ; return $ field -> value_editor_options ( $ this -> get ( 'id' ) ? $ this -> get_context ( ) : null ) ; } | Options for the editor |
34,446 | public function display ( core_backup_renderer $ renderer ) { $ form = $ this -> initialise_stage_form ( ) ; flush ( ) ; ob_start ( ) ; $ form -> display ( ) ; $ output = ob_get_contents ( ) ; ob_end_clean ( ) ; return $ output ; } | Displays the stage . |
34,447 | public static function get_components_and_fileareas ( $ filter = null ) { $ components = array ( ) ; $ qtypes = core_component :: get_plugin_list ( 'qtype' ) ; foreach ( $ qtypes as $ name => $ path ) { if ( ! is_null ( $ filter ) && $ filter != $ name ) { continue ; } $ componentname = 'qtype_' . $ name ; $ classname ... | Returns all the components and fileareas used by all the installed qtypes |
34,448 | public function upload ( $ saveas_filename , $ maxbytes ) { global $ CFG ; $ types = optional_param_array ( 'accepted_types' , '*' , PARAM_RAW ) ; $ savepath = optional_param ( 'savepath' , '/' , PARAM_PATH ) ; $ itemid = optional_param ( 'itemid' , 0 , PARAM_INT ) ; $ license = optional_param ( 'license' , $ CFG -> si... | Process uploaded file |
34,449 | public function get_listing ( $ path = '' , $ page = '' ) { global $ CFG ; $ ret = array ( ) ; $ ret [ 'nologin' ] = true ; $ ret [ 'nosearch' ] = true ; $ ret [ 'norefresh' ] = true ; $ ret [ 'list' ] = array ( ) ; $ ret [ 'dynload' ] = false ; $ ret [ 'upload' ] = array ( 'label' => get_string ( 'attachment' , 'repos... | Return a upload form |
34,450 | public function is_feedback_modified ( stdClass $ grade , stdClass $ data ) { debugging ( 'This plugin (' . $ this -> get_name ( ) . ') has not overwritten the is_feedback_modified() method. Please add this method to your plugin' , DEBUG_DEVELOPER ) ; return true ; } | Has the plugin form element been modified in the current submission? |
34,451 | public function get_sql_filter ( $ extra = '' , array $ params = null ) { global $ SESSION ; $ sqls = array ( ) ; if ( $ extra != '' ) { $ sqls [ ] = $ extra ; } $ params = ( array ) $ params ; if ( ! empty ( $ SESSION -> user_filtering ) ) { foreach ( $ SESSION -> user_filtering as $ fname => $ datas ) { if ( ! array_... | Returns sql where statement based on active user filters |
34,452 | public function definition ( ) { $ form = $ this -> _form ; $ form -> addElement ( 'hidden' , 'areaid' ) ; $ form -> setType ( 'areaid' , PARAM_INT ) ; $ form -> addElement ( 'hidden' , 'returnurl' ) ; $ form -> setType ( 'returnurl' , PARAM_LOCALURL ) ; $ form -> addElement ( 'text' , 'name' , get_string ( 'name' , 'g... | Form element definition |
34,453 | public function need_confirm_regrading ( $ controller ) { $ data = $ this -> get_data ( ) ; if ( isset ( $ data -> guide [ 'regrade' ] ) ) { return false ; } if ( ! isset ( $ data -> saveguide ) || ! $ data -> saveguide ) { return false ; } if ( ! $ controller -> has_active_instances ( ) ) { return false ; } $ changele... | Check if there are changes in the guide and it is needed to ask user whether to mark the current grades for re - grading . User may confirm re - grading and continue return to editing or cancel the changes |
34,454 | public function process_question ( array $ data , array $ raw ) { if ( isset ( $ data [ 'answers' ] ) ) { $ this -> write_answers ( $ data [ 'answers' ] , $ this -> pluginname ) ; } if ( isset ( $ data [ 'numerical' ] [ 0 ] [ 'numerical_units' ] ) ) { $ numericalunits = $ data [ 'numerical' ] [ 0 ] [ 'numerical_units' ... | Appends the numerical specific information to the question |
34,455 | public static function export_user_data ( approved_contextlist $ contextlist ) { global $ DB ; $ context = \ context_user :: instance ( $ contextlist -> get_user ( ) -> id ) ; $ rules = $ DB -> get_records ( 'tool_monitor_rules' , [ 'userid' => $ contextlist -> get_user ( ) -> id ] ) ; if ( $ rules ) { static :: export... | Export all event monitor information for the list of contexts and this user . |
34,456 | protected static function delete_user_data ( int $ userid ) { global $ DB ; subscription_manager :: delete_user_subscriptions ( $ userid ) ; $ rules = $ DB -> get_records ( 'tool_monitor_rules' , [ 'userid' => $ userid ] ) ; foreach ( $ rules as $ ruledata ) { $ rule = rule_manager :: get_rule ( $ ruledata ) ; if ( $ r... | This does the deletion of user data for the event monitor . |
34,457 | protected static function export_monitor_rules ( array $ rules , \ context_user $ context ) { foreach ( $ rules as $ rule ) { $ rule = rule_manager :: get_rule ( $ rule ) ; $ ruledata = new \ stdClass ( ) ; $ ruledata -> name = $ rule -> name ; $ ruledata -> eventname = $ rule -> get_event_name ( ) ; $ ruledata -> desc... | This formats and then exports the monitor rules . |
34,458 | protected static function export_monitor_subscriptions ( array $ subscriptions , \ context_user $ context ) { foreach ( $ subscriptions as $ subscription ) { $ subscriptiondata = new \ stdClass ( ) ; $ subscriptiondata -> instancename = $ subscription -> get_instance_name ( ) ; $ subscriptiondata -> eventname = $ subsc... | This formats and then exports the event monitor subscriptions . |
34,459 | public function readUntilStopped ( ) { while ( $ this -> xmlReader -> read ( ) ) { $ nodeType = $ this -> xmlReader -> nodeType ; $ nodeNamePossiblyWithPrefix = $ this -> xmlReader -> name ; $ nodeNameWithoutPrefix = $ this -> xmlReader -> localName ; $ callbackData = $ this -> getRegisteredCallbackData ( $ nodeNamePos... | Resumes the reading of the XML file where it was left off . Stops whenever a callback indicates that reading should stop or at the end of the file . |
34,460 | public function expected_time_file ( ) { if ( $ this -> multifiles ) { return portfolio_expected_time_file ( $ this -> multifiles ) ; } else if ( $ this -> singlefile ) { return portfolio_expected_time_file ( $ this -> singlefile ) ; } return PORTFOLIO_TIME_LOW ; } | Helper method to calculate expected time for multi or single file exports |
34,461 | public function get_sha1_file ( ) { if ( empty ( $ this -> singlefile ) && empty ( $ this -> multifiles ) ) { throw new portfolio_caller_exception ( 'invalidsha1file' , 'portfolio' , $ this -> get_return_url ( ) ) ; } if ( $ this -> singlefile ) { return $ this -> singlefile -> get_contenthash ( ) ; } $ sha1s = array (... | Helper function to calculate the sha1 for multi or single file exports |
34,462 | public function prepare_package_file ( ) { if ( empty ( $ this -> singlefile ) && empty ( $ this -> multifiles ) ) { throw new portfolio_caller_exception ( 'invalidpreparepackagefile' , 'portfolio' , $ this -> get_return_url ( ) ) ; } if ( $ this -> singlefile ) { return $ this -> exporter -> copy_existing_file ( $ thi... | Helper function to copy files into the temp area for single or multi file exports . |
34,463 | public final function supported_formats ( ) { $ basic = $ this -> base_supported_formats ( ) ; if ( empty ( $ this -> supportedformats ) ) { $ specific = array ( ) ; } else if ( ! is_array ( $ this -> supportedformats ) ) { debugging ( get_class ( $ this ) . ' has set a non array value of member variable supported form... | Array of formats this caller supports . |
34,464 | public function set_formats_from_button ( $ formats ) { $ base = $ this -> base_supported_formats ( ) ; if ( count ( $ base ) != count ( $ formats ) || count ( $ base ) != count ( array_intersect ( $ base , $ formats ) ) ) { $ this -> supportedformats = portfolio_most_specific_formats ( $ formats , $ base ) ; return ; ... | The button - location always knows best what the formats are ... so it should be trusted . |
34,465 | protected function add_format ( $ format ) { if ( in_array ( $ format , $ this -> supportedformats ) ) { return ; } $ this -> supportedformats = portfolio_most_specific_formats ( array ( $ format ) , $ this -> supportedformats ) ; } | Adds a new format to the list of supported formats . This functions also handles removing conflicting and less specific formats at the same time . |
34,466 | public function get_return_url ( ) { global $ CFG ; return $ CFG -> wwwroot . '/mod/' . $ this -> cm -> modname . '/view.php?id=' . $ this -> cm -> id ; } | The url to return to after export or on cancel . Defaults value is set to the module view page . Override this if it s deeper inside the module . |
34,467 | public function get ( $ key ) { if ( $ key != 'course' ) { return parent :: get ( $ key ) ; } global $ DB ; if ( empty ( $ this -> course ) ) { $ this -> course = $ DB -> get_record ( 'course' , array ( 'id' => $ this -> cm -> course ) ) ; } return $ this -> course ; } | Override the parent get function to make sure when we re asked for a course We retrieve the object from the database as needed . |
34,468 | public function get_doc_url ( \ core_search \ document $ doc ) { $ cminfo = $ this -> get_cm ( $ this -> get_module_name ( ) , strval ( $ doc -> get ( 'itemid' ) ) , $ doc -> get ( 'courseid' ) ) ; $ format = course_get_format ( $ cminfo -> get_course ( ) ) ; $ url = $ format -> get_view_url ( $ cminfo -> sectionnum ) ... | Overwritten as labels are displayed in - course . |
34,469 | public static function get_all_events_list ( $ detail = true ) { return array_merge ( self :: get_core_events_list ( $ detail ) , self :: get_non_core_event_list ( $ detail ) ) ; } | Convenience method . Returns all of the core events either with or without details . |
34,470 | public static function get_edulevel_string ( $ edulevel ) { switch ( $ edulevel ) { case \ core \ event \ base :: LEVEL_PARTICIPATING : return get_string ( 'participating' , 'report_eventlist' ) ; break ; case \ core \ event \ base :: LEVEL_TEACHING : return get_string ( 'teaching' , 'report_eventlist' ) ; break ; case... | Returns the appropriate string for the event education level . |
34,471 | public static function get_observer_list ( ) { $ events = \ core \ event \ manager :: get_all_observers ( ) ; foreach ( $ events as $ key => $ observers ) { foreach ( $ observers as $ observerskey => $ observer ) { $ events [ $ key ] [ $ observerskey ] -> parentplugin = \ core_plugin_manager :: instance ( ) -> get_pare... | Get the full list of observers for the system . |
34,472 | private static function format_data ( $ eventdata , $ eventfullpath ) { $ eventdata [ $ eventfullpath ] = $ eventfullpath :: get_static_info ( ) ; $ url = new \ moodle_url ( 'eventdetail.php' , array ( 'eventname' => $ eventfullpath ) ) ; $ link = \ html_writer :: link ( $ url , $ eventfullpath :: get_name_with_info ( ... | Returns the event data list section with url links and other formatting . |
34,473 | public function define_enrol_plugin_structure ( ) { $ plugin = $ this -> get_plugin_element ( ) ; $ tool = new backup_nested_element ( 'tool' , array ( 'id' ) , array ( 'enrolid' , 'contextid' , 'institution' , 'lang' , 'timezone' , 'maxenrolled' , 'maildisplay' , 'city' , 'country' , 'gradesync' , 'gradesynccompletion... | Defines the other LTI enrolment structures to append . |
34,474 | public function determine_default_rolemapping ( $ imscode ) { global $ DB ; switch ( $ imscode ) { case '01' : case '04' : $ shortname = 'student' ; break ; case '06' : case '08' : $ shortname = 'teacher' ; break ; case '02' : case '03' : $ shortname = 'editingteacher' ; break ; case '05' : case '07' : $ shortname = 'a... | This function is only used when first setting up the plugin to decide which role assignments to recommend by default . For example IMS role 01 is Learner so may map to student in Moodle . |
34,475 | public function get_imsnames ( $ courseattr ) { $ values = $ this -> imsnames ; if ( $ courseattr == 'summary' ) { $ values = array_merge ( array ( 'ignore' => get_string ( 'emptyattribute' , 'enrol_imsenterprise' ) ) , $ values ) ; } return $ values ; } | Returns the assignable values for the course attribute |
34,476 | protected function unxmlise ( $ xml ) { if ( ! is_array ( $ xml ) ) { $ text = s ( $ xml ) ; } else { $ text = '' ; foreach ( $ xml as $ tag => $ data ) { if ( $ tag !== '@' ) { $ text = $ text . $ this -> unxmlise ( $ data ) ; } } } $ text = strip_tags ( $ text ) ; return $ text ; } | unxmlise reconstructs part of the xml data structure in order to identify the actual data therein |
34,477 | protected function getVNodeValue ( $ node ) { $ vNode = $ node -> getElementsByTagName ( self :: XML_NODE_VALUE ) -> item ( 0 ) ; return ( $ vNode !== null ) ? $ vNode -> nodeValue : '' ; } | Returns the cell s string value from a node s nested value node |
34,478 | protected function formatInlineStringCellValue ( $ node ) { $ tNode = $ node -> getElementsByTagName ( self :: XML_NODE_INLINE_STRING_VALUE ) -> item ( 0 ) ; $ cellValue = $ this -> escaper -> unescape ( $ tNode -> nodeValue ) ; return $ cellValue ; } | Returns the cell String value where string is inline . |
34,479 | protected function formatSharedStringCellValue ( $ nodeValue ) { $ sharedStringIndex = intval ( $ nodeValue ) ; $ escapedCellValue = $ this -> sharedStringsHelper -> getStringAtIndex ( $ sharedStringIndex ) ; $ cellValue = $ this -> escaper -> unescape ( $ escapedCellValue ) ; return $ cellValue ; } | Returns the cell String value from shared - strings file using nodeValue index . |
34,480 | protected function formatStrCellValue ( $ nodeValue ) { $ escapedCellValue = trim ( $ nodeValue ) ; $ cellValue = $ this -> escaper -> unescape ( $ escapedCellValue ) ; return $ cellValue ; } | Returns the cell String value where string is stored in value node . |
34,481 | protected function formatNumericCellValue ( $ nodeValue , $ cellStyleId ) { $ shouldFormatAsDate = $ this -> styleHelper -> shouldFormatNumericValueAsDate ( $ cellStyleId ) ; if ( $ shouldFormatAsDate ) { return $ this -> formatExcelTimestampValue ( floatval ( $ nodeValue ) , $ cellStyleId ) ; } else { $ nodeIntValue =... | Returns the cell Numeric value from string of nodeValue . The value can also represent a timestamp and a DateTime will be returned . |
34,482 | function _elementToObject ( & $ element , $ required , $ error ) { if ( $ this -> _elementType ) { $ ret = new $ this -> _elementType ; } $ ret -> name = $ element -> getName ( ) ; $ ret -> value = $ element -> getValue ( ) ; $ ret -> type = $ element -> getType ( ) ; $ ret -> frozen = $ element -> isFrozen ( ) ; $ lab... | Creates an object representing an element |
34,483 | function _storeObject ( $ elObj ) { $ name = $ elObj -> name ; if ( is_object ( $ this -> _currentGroup ) && $ elObj -> type != 'group' ) { $ this -> _currentGroup -> elements [ ] = $ elObj ; } elseif ( isset ( $ this -> _currentSection ) ) { $ this -> _obj -> sections [ $ this -> _currentSection ] -> elements [ ] = $ ... | Stores an object representation of an element in the form array |
34,484 | private function makeKey ( $ block , $ valContext ) { $ pwarray = str_repeat ( "\0" , 64 ) ; for ( $ i = 0 ; $ i < 5 ; $ i ++ ) { $ pwarray [ $ i ] = $ valContext [ $ i ] ; } $ pwarray [ 5 ] = chr ( $ block & 0xff ) ; $ pwarray [ 6 ] = chr ( ( $ block >> 8 ) & 0xff ) ; $ pwarray [ 7 ] = chr ( ( $ block >> 16 ) & 0xff )... | Make an RC4 decryptor for the given block |
34,485 | public function definition ( ) { global $ PAGE ; $ mform = $ this -> _form ; $ eventtypes = calendar_get_allowed_event_types ( ) ; if ( in_array ( true , $ eventtypes , true ) === false ) { print_error ( 'nopermissiontoupdatecalendar' ) ; } $ mform -> addElement ( 'header' , 'addsubscriptionform' , get_string ( 'import... | Defines the form used to add calendar subscriptions . |
34,486 | public function validation ( $ data , $ files ) { global $ USER ; $ errors = parent :: validation ( $ data , $ files ) ; $ eventtype = isset ( $ data [ 'eventtype' ] ) ? $ data [ 'eventtype' ] : null ; $ coursekey = ( $ eventtype == 'group' ) ? 'groupcourseid' : 'courseid' ; $ courseid = ( ! empty ( $ data [ $ courseke... | Validates the returned data . |
34,487 | public static function early_error_content ( $ message , $ moreinfourl , $ link , $ backtrace , $ debuginfo = null ) { global $ CFG ; $ content = '<div style="margin-top: 6em; margin-left:auto; margin-right:auto; color:#990000; text-align:center; font-size:large; border-width:1px;border-color:black; background-color:#f... | Returns nicely formatted error message in a div box . |
34,488 | public static function early_error ( $ message , $ moreinfourl , $ link , $ backtrace , $ debuginfo = null , $ errorcode = null ) { global $ CFG ; if ( CLI_SCRIPT ) { echo "!!! $message !!!\n" ; if ( ! empty ( $ CFG -> debug ) and $ CFG -> debug >= DEBUG_DEVELOPER ) { if ( ! empty ( $ debuginfo ) ) { echo "\nDebug info... | This function should only be called by this class or from exception handlers |
34,489 | public static function plain_redirect_message ( $ encodedurl ) { $ message = '<div style="margin-top: 3em; margin-left:auto; margin-right:auto; text-align:center;">' . get_string ( 'pageshouldredirect' ) . '<br /><a href="' . $ encodedurl . '">' . get_string ( 'continue' ) . '</a></div>' ; return self :: plain_page ( g... | Page should redirect message . |
34,490 | public static function plain_page ( $ title , $ content , $ meta = '' ) { if ( function_exists ( 'get_string' ) && function_exists ( 'get_html_lang' ) ) { $ htmllang = get_html_lang ( ) ; } else { $ htmllang = '' ; } $ footer = '' ; if ( MDL_PERF_TEST ) { $ perfinfo = get_performance_info ( ) ; $ footer = '<footer>' . ... | Output basic html page . |
34,491 | function _getAttrString ( $ attributes ) { $ strAttr = '' ; if ( is_array ( $ attributes ) ) { foreach ( $ attributes as $ key => $ value ) { $ strAttr .= ' ' . $ key . '="' . htmlspecialchars ( $ value ) . '"' ; } } return $ strAttr ; } | Returns an HTML formatted attribute string |
34,492 | function _parseAttributes ( $ attributes ) { if ( is_array ( $ attributes ) ) { $ ret = array ( ) ; foreach ( $ attributes as $ key => $ value ) { if ( is_int ( $ key ) ) { $ key = $ value = strtolower ( $ value ) ; } else { $ key = strtolower ( $ key ) ; } $ ret [ $ key ] = $ value ; } return $ ret ; } elseif ( is_str... | Returns a valid atrributes array from either a string or array |
34,493 | function _removeAttr ( $ attr , & $ attributes ) { $ attr = strtolower ( $ attr ) ; if ( isset ( $ attributes [ $ attr ] ) ) { unset ( $ attributes [ $ attr ] ) ; } } | Removes the given attribute from the given array |
34,494 | public function format_message_text ( $ cm , $ post ) { $ message = file_rewrite_pluginfile_urls ( $ post -> message , 'pluginfile.php' , \ context_module :: instance ( $ cm -> id ) -> id , 'mod_forum' , 'post' , $ post -> id ) ; return format_text_email ( $ message , $ post -> messageformat ) ; } | The plaintext version of the e - mail message . |
34,495 | public static function unsafeIconv ( $ in , $ out , $ text ) { set_error_handler ( array ( 'HTMLPurifier_Encoder' , 'muteErrorHandler' ) ) ; $ r = iconv ( $ in , $ out , $ text ) ; restore_error_handler ( ) ; return $ r ; } | iconv wrapper which mutes errors but doesn t work around bugs . |
34,496 | public function setProxyTicket ( $ proxyTicket ) { if ( empty ( $ proxyTicket ) ) { throw new CAS_InvalidArgumentException ( 'Trying to initialize with an empty proxy ticket.' ) ; } if ( ! empty ( $ this -> _proxyTicket ) ) { throw new CAS_OutOfSequenceException ( 'Already initialized, cannot change the proxy ticket.' ... | Register a proxy ticket with the Proxy that it can use when making requests . |
34,497 | protected function initializeProxyTicket ( ) { if ( ! empty ( $ this -> _proxyTicket ) ) { throw new CAS_OutOfSequenceException ( 'Already initialized, cannot initialize again.' ) ; } if ( empty ( $ this -> _casClient ) ) { phpCAS :: initializeProxiedService ( $ this ) ; } else { $ this -> _casClient -> initializeProxi... | Fetch our proxy ticket . |
34,498 | public static function instance ( $ course , ? \ context $ context = null ) { $ courseid = $ course ; if ( ! is_scalar ( $ courseid ) ) { $ courseid = $ course -> id ; } if ( self :: $ cachedid === $ courseid ) { return self :: $ cachedinstance ; } $ cachedinstance = new \ core_analytics \ course ( $ course , $ context... | Returns an analytics course instance . |
34,499 | protected function load ( ) { if ( empty ( $ this -> course -> shortname ) ) { $ this -> course = get_course ( $ this -> course -> id ) ; } $ this -> coursecontext = $ this -> get_context ( ) ; $ this -> now = time ( ) ; $ cache = \ cache :: make_from_params ( \ cache_store :: MODE_REQUEST , 'core_analytics' , 'rolearc... | Loads the analytics course object . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.