idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
32,500
public static function change_items_context ( $ component , $ itemtype , $ itemids , $ newcontext ) { global $ DB ; if ( empty ( $ itemids ) ) { return ; } if ( ! is_array ( $ itemids ) ) { $ itemids = array ( $ itemids ) ; } list ( $ sql , $ params ) = $ DB -> get_in_or_equal ( $ itemids , SQL_PARAMS_NAMED ) ; $ param...
Moves all tags of the specified items to the new context
32,501
public static function change_instances_context ( array $ taginstanceids , context $ newcontext ) { global $ DB ; if ( empty ( $ taginstanceids ) ) { return ; } list ( $ sql , $ params ) = $ DB -> get_in_or_equal ( $ taginstanceids ) ; $ DB -> set_field_select ( 'tag_instance' , 'contextid' , $ newcontext -> id , "id {...
Moves all of the specified tag instances into a new context .
32,502
public function flag ( ) { global $ DB ; $ this -> ensure_fields_exist ( array ( 'name' , 'userid' , 'rawname' , 'flag' ) , 'flag' ) ; $ this -> timemodified = time ( ) ; $ this -> flag ++ ; $ DB -> update_record ( 'tag' , array ( 'timemodified' => $ this -> timemodified , 'flag' => $ this -> flag , 'id' => $ this -> i...
Flag a tag as inappropriate
32,503
public function set_related_tags ( $ tagnames ) { $ context = context_system :: instance ( ) ; $ tagobjects = $ tagnames ? static :: create_if_missing ( $ this -> tagcollid , $ tagnames ) : array ( ) ; unset ( $ tagobjects [ $ this -> name ] ) ; $ currenttags = static :: get_item_tags ( 'core' , 'tag' , $ this -> id ) ...
Sets the list of tags related to this one .
32,504
public function add_related_tags ( $ tagnames ) { $ context = context_system :: instance ( ) ; $ tagobjects = static :: create_if_missing ( $ this -> tagcollid , $ tagnames ) ; $ currenttags = static :: get_item_tags ( 'core' , 'tag' , $ this -> id ) ; foreach ( $ tagobjects as $ name => $ tag ) { foreach ( $ currentta...
Adds to the list of related tags without removing existing
32,505
public function get_correlated_tags ( $ keepduplicates = false ) { global $ DB ; $ correlated = $ DB -> get_field ( 'tag_correlation' , 'correlatedtags' , array ( 'tagid' => $ this -> id ) ) ; if ( ! $ correlated ) { return array ( ) ; } $ correlated = preg_split ( '/\s*,\s*/' , trim ( $ correlated ) , - 1 , PREG_SPLIT...
Returns the correlated tags of a tag retrieved from the tag_correlation table .
32,506
public function get_related_tags ( ) { $ manual = $ this -> get_manual_related_tags ( ) ; $ automatic = $ this -> get_correlated_tags ( ) ; $ relatedtags = array_merge ( $ manual , $ automatic ) ; $ seen = array ( ) ; foreach ( $ relatedtags as $ instance => $ tag ) { if ( isset ( $ seen [ $ tag -> id ] ) ) { unset ( $...
Returns tags related to a tag
32,507
public function count_tagged_items ( $ component , $ itemtype , $ subquery = '' , $ params = array ( ) ) { global $ DB ; if ( empty ( $ itemtype ) || ! $ DB -> get_manager ( ) -> table_exists ( $ itemtype ) ) { return 0 ; } $ params = $ params ? $ params : array ( ) ; $ query = "SELECT COUNT(it.id) F...
Count how many items are tagged with a specific tag .
32,508
public static function is_item_tagged_with ( $ component , $ itemtype , $ itemid , $ tagname ) { global $ DB ; $ tagcollid = core_tag_area :: get_collection ( $ component , $ itemtype ) ; $ query = 'SELECT 1 FROM {tag} t JOIN {tag_instance} ti ON ti.tagid = t.id WHERE t.name = ? AN...
Determine if an item is tagged with a specific tag
32,509
public function get_formatted_description ( $ options = array ( ) ) { $ options = empty ( $ options ) ? array ( ) : ( array ) $ options ; $ options += array ( 'para' => false , 'overflowdiv' => true ) ; $ description = file_rewrite_pluginfile_urls ( $ this -> description , 'pluginfile.php' , context_system :: instance ...
Returns formatted description of the tag
32,510
public static function delete_tags ( $ tagids ) { global $ DB ; if ( ! is_array ( $ tagids ) ) { $ tagids = array ( $ tagids ) ; } if ( empty ( $ tagids ) ) { return ; } list ( $ tagsql , $ tagparams ) = $ DB -> get_in_or_equal ( $ tagids ) ; $ tags = $ DB -> get_records_select ( 'tag' , 'id ' . $ tagsql , $ tagparams ...
Delete one or more tag and all their instances if there are any left .
32,511
protected function combine_correlated_tags ( $ tags ) { global $ DB ; $ ids = array_map ( function ( $ t ) { return $ t -> id ; } , $ tags ) ; list ( $ sql , $ params ) = $ DB -> get_in_or_equal ( $ ids ) ; $ params [ ] = $ this -> id ; $ records = $ DB -> get_records_select ( 'tag_correlation' , 'tagid ' . $ sql . ' O...
Combine together correlated tags of several tags
32,512
public function display_regrade_confirmation ( $ elementname , $ changelevel , $ value ) { $ html = html_writer :: start_tag ( 'div' , array ( 'class' => 'gradingform_guide-regrade' , 'role' => 'alert' ) ) ; if ( $ changelevel <= 2 ) { $ html .= get_string ( 'regrademessage1' , 'gradingform_guide' ) ; $ selectoptions =...
Displays a confirmation message after a regrade has occured
32,513
public function display_guide_mapping_explained ( $ scores ) { $ html = '' ; if ( ! $ scores ) { return $ html ; } if ( isset ( $ scores [ 'modulegrade' ] ) && $ scores [ 'maxscore' ] != $ scores [ 'modulegrade' ] ) { $ html .= $ this -> box ( html_writer :: tag ( 'div' , get_string ( 'guidemappingexplained' , 'grading...
Generates and returns HTML code to display information box about how guide score is converted to the grade
32,514
public function render_item ( \ templatable $ item ) { $ data = $ item -> export_for_template ( $ this ) ; return $ this -> render_from_template ( 'block_rss_client/item' , $ data ) ; }
Render an RSS Item
32,515
public function render_feed ( \ templatable $ feed ) { $ data = $ feed -> export_for_template ( $ this ) ; return $ this -> render_from_template ( 'block_rss_client/feed' , $ data ) ; }
Render an RSS Feed
32,516
public function render_block ( \ templatable $ block ) { $ data = $ block -> export_for_template ( $ this ) ; return $ this -> render_from_template ( 'block_rss_client/block' , $ data ) ; }
Render an RSS feeds block
32,517
public function render_footer ( \ templatable $ footer ) { $ data = $ footer -> export_for_template ( $ this ) ; return $ this -> render_from_template ( 'block_rss_client/footer' , $ data ) ; }
Render the block footer
32,518
public function format_description ( $ description ) { $ description = format_text ( $ description , FORMAT_HTML , array ( 'para' => false ) ) ; $ description = break_up_long_words ( $ description , 30 ) ; return $ description ; }
Format an RSS item description
32,519
private function get_number_of_questions_to_add_choices ( ) { $ maxrand = 100 ; $ randomcount = array ( ) ; for ( $ i = 1 ; $ i <= min ( 10 , $ maxrand ) ; $ i ++ ) { $ randomcount [ $ i ] = $ i ; } for ( $ i = 20 ; $ i <= min ( 100 , $ maxrand ) ; $ i += 10 ) { $ randomcount [ $ i ] = $ i ; } return $ randomcount ; }
Return an arbitrary array for the dropdown menu
32,520
protected function define_definition_plugin_structure ( ) { $ plugin = $ this -> get_plugin_element ( null , '../../method' , 'guide' ) ; $ pluginwrapper = new backup_nested_element ( $ this -> get_recommended_name ( ) ) ; $ plugin -> add_child ( $ pluginwrapper ) ; $ criteria = new backup_nested_element ( 'guidecriter...
Declares marking guide structures to append to the grading form definition
32,521
protected function define_instance_plugin_structure ( ) { $ plugin = $ this -> get_plugin_element ( null , '../../../../method' , 'guide' ) ; $ pluginwrapper = new backup_nested_element ( $ this -> get_recommended_name ( ) ) ; $ plugin -> add_child ( $ pluginwrapper ) ; $ fillings = new backup_nested_element ( 'filling...
Declares marking guide structures to append to the grading form instances
32,522
public static function add_disabled_constraints_to_form ( \ MoodleQuickForm $ mform ) { $ myvalue = \ tool_usertours \ target :: get_target_constant_for_class ( get_class ( ) ) ; foreach ( array_keys ( self :: $ forcedsettings ) as $ settingname ) { $ mform -> hideIf ( $ settingname , 'targettype' , 'eq' , $ myvalue ) ...
Add the disabledIf values .
32,523
public function get_doc_url ( \ core_search \ document $ doc ) { $ users = $ this -> get_current_other_users ( $ doc ) ; $ position = 'm' . $ doc -> get ( 'itemid' ) ; return new \ moodle_url ( '/message/index.php' , array ( 'history' => MESSAGE_HISTORY_ALL , 'user1' => $ users [ 'currentuserid' ] , 'user2' => $ users ...
Link to the message .
32,524
public function get_context_url ( \ core_search \ document $ doc ) { $ users = $ this -> get_current_other_users ( $ doc ) ; return new \ moodle_url ( '/message/index.php' , array ( 'user1' => $ users [ 'currentuserid' ] , 'user2' => $ users [ 'otheruserid' ] ) ) ; }
Link to the conversation .
32,525
protected function get_document_recordset_helper ( $ modifiedfrom , \ context $ context = null , $ userfield ) { global $ DB ; if ( $ userfield == 'useridto' ) { $ userfield = 'mcm.userid' ; } else { $ userfield = 'm.useridfrom' ; } $ where = $ userfield . ' != :noreplyuser AND ' . $ userfield . ' != :supportuser AND m...
Helper function to implement get_document_recordset for subclasses .
32,526
public function get_settings ( MoodleQuickForm $ mform ) { global $ CFG , $ COURSE ; if ( $ this -> assignment -> has_instance ( ) ) { $ defaultmaxfilesubmissions = $ this -> get_config ( 'maxfilesubmissions' ) ; $ defaultmaxsubmissionsizebytes = $ this -> get_config ( 'maxsubmissionsizebytes' ) ; $ defaultfiletypes = ...
Get the default setting for file submission plugin
32,527
public function save_settings ( stdClass $ data ) { $ this -> set_config ( 'maxfilesubmissions' , $ data -> assignsubmission_file_maxfiles ) ; $ this -> set_config ( 'maxsubmissionsizebytes' , $ data -> assignsubmission_file_maxsizebytes ) ; if ( ! empty ( $ data -> assignsubmission_file_filetypes ) ) { $ this -> set_c...
Save the settings for file submission plugin
32,528
private function get_file_options ( ) { $ fileoptions = array ( 'subdirs' => 1 , 'maxbytes' => $ this -> get_config ( 'maxsubmissionsizebytes' ) , 'maxfiles' => $ this -> get_config ( 'maxfilesubmissions' ) , 'accepted_types' => $ this -> get_configured_typesets ( ) , 'return_types' => ( FILE_INTERNAL | FILE_CONTROLLED...
File format options
32,529
public function get_form_elements ( $ submission , MoodleQuickForm $ mform , stdClass $ data ) { global $ OUTPUT ; if ( $ this -> get_config ( 'maxfilesubmissions' ) <= 0 ) { return false ; } $ fileoptions = $ this -> get_file_options ( ) ; $ submissionid = $ submission ? $ submission -> id : 0 ; $ data = file_prepare_...
Add elements to submission form
32,530
private function count_files ( $ submissionid , $ area ) { $ fs = get_file_storage ( ) ; $ files = $ fs -> get_area_files ( $ this -> assignment -> get_context ( ) -> id , 'assignsubmission_file' , $ area , $ submissionid , 'id' , false ) ; return count ( $ files ) ; }
Count the number of files
32,531
public function remove ( stdClass $ submission ) { $ fs = get_file_storage ( ) ; $ fs -> delete_area_files ( $ this -> assignment -> get_context ( ) -> id , 'assignsubmission_file' , ASSIGNSUBMISSION_FILE_FILEAREA , $ submission -> id ) ; return true ; }
Remove files from this submission .
32,532
public function get_files ( stdClass $ submission , stdClass $ user ) { $ result = array ( ) ; $ fs = get_file_storage ( ) ; $ files = $ fs -> get_area_files ( $ this -> assignment -> get_context ( ) -> id , 'assignsubmission_file' , ASSIGNSUBMISSION_FILE_FILEAREA , $ submission -> id , 'timemodified' , false ) ; forea...
Produce a list of files suitable for export that represent this feedback or submission
32,533
public function view_summary ( stdClass $ submission , & $ showviewlink ) { $ count = $ this -> count_files ( $ submission -> id , ASSIGNSUBMISSION_FILE_FILEAREA ) ; $ showviewlink = $ count > ASSIGNSUBMISSION_FILE_MAXSUMMARYFILES ; if ( $ count <= ASSIGNSUBMISSION_FILE_MAXSUMMARYFILES ) { return $ this -> assignment -...
Display the list of files in the submission status table
32,534
public function get_config_for_external ( ) { global $ CFG ; $ configs = $ this -> get_config ( ) ; if ( $ configs -> maxsubmissionsizebytes == 0 ) { $ configs -> maxsubmissionsizebytes = get_max_upload_file_size ( $ CFG -> maxbytes , $ this -> assignment -> get_course ( ) -> maxbytes , get_config ( 'assignsubmission_f...
Return the plugin configs for external functions .
32,535
private function get_configured_typesets ( ) { $ typeslist = ( string ) $ this -> get_config ( 'filetypeslist' ) ; $ util = new \ core_form \ filetypes_util ( ) ; $ sets = $ util -> normalize_file_types ( $ typeslist ) ; return $ sets ; }
Get the type sets configured for this assignment .
32,536
public static function get_metadata ( collection $ collection ) : collection { $ assigngrades = [ 'userid' => 'privacy:metadata:userid' , 'timecreated' => 'privacy:metadata:timecreated' , 'timemodified' => 'timemodified' , 'grader' => 'privacy:metadata:grader' , 'grade' => 'privacy:metadata:grade' , 'attemptnumber' => ...
Provides meta data that is stored about a user with mod_assign
32,537
public static function get_contexts_for_userid ( int $ userid ) : contextlist { $ params = [ 'modulename' => 'assign' , 'contextlevel' => CONTEXT_MODULE , 'userid' => $ userid , 'graderid' => $ userid , 'aouserid' => $ userid , 'asnuserid' => $ userid , 'aufuserid' => $ userid , 'aumuserid' => $ userid ] ; $ sql = "SEL...
Returns all of the contexts that has information relating to the userid .
32,538
public static function export_user_data ( approved_contextlist $ contextlist ) { foreach ( $ contextlist -> get_contexts ( ) as $ context ) { if ( $ context -> contextlevel != CONTEXT_MODULE ) { continue ; } $ user = $ contextlist -> get_user ( ) ; $ assigndata = helper :: get_context_data ( $ context , $ user ) ; help...
Write out the user data filtered by contexts .
32,539
public static function delete_data_for_all_users_in_context ( \ context $ context ) { global $ DB ; if ( $ context -> contextlevel == CONTEXT_MODULE ) { $ cm = get_coursemodule_from_id ( 'assign' , $ context -> instanceid ) ; if ( $ cm ) { $ assign = new \ assign ( $ context , null , null ) ; $ requestdata = new assign...
Delete all use data which matches the specified context .
32,540
protected static function delete_overrides_for_users ( \ assign $ assign , array $ userids = [ ] ) { global $ DB ; $ assignid = $ assign -> get_instance ( ) -> id ; $ usersql = '' ; $ params = [ 'assignid' => $ assignid ] ; if ( ! empty ( $ userids ) ) { list ( $ usersql , $ userparams ) = $ DB -> get_in_or_equal ( $ u...
Deletes assignment overrides in bulk
32,541
protected static function get_graded_users ( int $ userid , \ assign $ assign ) { $ params = [ 'grader' => $ userid , 'assignid' => $ assign -> get_instance ( ) -> id ] ; $ sql = "SELECT DISTINCT userid AS id FROM {assign_grades} WHERE grader = :grader AND assignment = :assignid" ; $ us...
Find out if this user has graded any users .
32,542
protected static function store_assign_user_flags ( \ context $ context , \ assign $ assign , int $ userid ) { $ datatypes = [ 'locked' => get_string ( 'locksubmissions' , 'mod_assign' ) , 'mailed' => get_string ( 'privacy:metadata:mailed' , 'mod_assign' ) , 'extensionduedate' => get_string ( 'extensionduedate' , 'mod_...
Writes out various user meta data about the assignment .
32,543
protected static function export_grade_data ( \ stdClass $ grade , \ context $ context , array $ currentpath ) { $ gradedata = ( object ) [ 'timecreated' => transform :: datetime ( $ grade -> timecreated ) , 'timemodified' => transform :: datetime ( $ grade -> timemodified ) , 'grader' => transform :: user ( $ grade ->...
Formats and then exports the user s grade data .
32,544
protected static function export_submission_data ( \ stdClass $ submission , \ context $ context , array $ currentpath ) { $ submissiondata = ( object ) [ 'timecreated' => transform :: datetime ( $ submission -> timecreated ) , 'timemodified' => transform :: datetime ( $ submission -> timemodified ) , 'status' => get_s...
Formats and then exports the user s submission data .
32,545
public static function export_user_preferences ( int $ userid ) { $ context = \ context_system :: instance ( ) ; $ assignpreferences = [ 'assign_perpage' => [ 'string' => get_string ( 'privacy:metadata:assignperpage' , 'mod_assign' ) , 'bool' => false ] , 'assign_filter' => [ 'string' => get_string ( 'privacy:metadata:...
Stores the user preferences related to mod_assign .
32,546
public static function export_overrides ( \ context $ context , \ assign $ assign , \ stdClass $ user ) { $ overrides = $ assign -> override_exists ( $ user -> id ) ; if ( isset ( $ overrides -> assignid ) ) { $ data = new \ stdClass ( ) ; if ( ! empty ( $ overrides -> duedate ) ) { $ data -> duedate = transform :: dat...
Export overrides for this assignment .
32,547
protected static function export_submission ( \ assign $ assign , \ stdClass $ user , \ context_module $ context , array $ path , bool $ exportforteacher = false ) { $ submissions = $ assign -> get_all_submissions ( $ user -> id ) ; $ teacher = ( $ exportforteacher ) ? $ user : null ; $ gradingmanager = get_grading_man...
Exports assignment submission data for a user .
32,548
private function get_favourites ( stdClass $ user ) : array { $ ids = [ ] ; if ( isloggedin ( ) ) { $ usercontext = \ context_user :: instance ( $ user -> id ) ; $ ufservice = \ core_favourites \ service_factory :: get_service_for_user_context ( $ usercontext ) ; $ favourites = $ ufservice -> find_favourites_by_type ( ...
Get a list of all favourited discussions .
32,549
private function get_author_groups_from_posts ( array $ posts , $ forum ) : array { $ course = $ forum -> get_course_record ( ) ; $ coursemodule = $ forum -> get_course_module_record ( ) ; $ authorids = array_reduce ( $ posts , function ( $ carry , $ post ) { $ carry [ $ post -> get_author_id ( ) ] = true ; return $ ca...
Get the author s groups for a list of posts .
32,550
public function hasSharedStrings ( ) { $ hasSharedStrings = false ; $ zip = new \ ZipArchive ( ) ; if ( $ zip -> open ( $ this -> filePath ) === true ) { $ hasSharedStrings = ( $ zip -> locateName ( self :: SHARED_STRINGS_XML_FILE_PATH ) !== false ) ; $ zip -> close ( ) ; } return $ hasSharedStrings ; }
Returns whether the XLSX file contains a shared strings XML file
32,551
protected function processSharedStringsItem ( $ xmlReader , $ sharedStringIndex ) { $ sharedStringValue = '' ; $ siNode = $ xmlReader -> expand ( ) ; $ textNodes = $ siNode -> getElementsByTagName ( self :: XML_NODE_T ) ; foreach ( $ textNodes as $ textNode ) { if ( $ this -> shouldExtractTextNodeValue ( $ textNode ) )...
Processes the shared strings item XML node which the given XML reader is positioned on .
32,552
function definition_after_data ( ) { global $ DB ; $ mform = $ this -> _form ; $ courseid = $ mform -> getElementValue ( 'id' ) ; if ( $ courseid and $ mform -> elementExists ( 'defaultgroupingid' ) ) { $ options = array ( ) ; if ( $ groupings = $ DB -> get_records ( 'groupings' , array ( 'courseid' => $ courseid ) ) )...
Fill in the current page data for this course .
32,553
public function openToFile ( $ outputFilePath ) { $ this -> outputFilePath = $ outputFilePath ; $ this -> filePointer = $ this -> globalFunctionsHelper -> fopen ( $ this -> outputFilePath , 'wb+' ) ; $ this -> throwIfFilePointerIsNotAvailable ( ) ; $ this -> openWriter ( ) ; $ this -> isWriterOpened = true ; return $ t...
Inits the writer and opens it to accept data . By using this method the data will be written to a file .
32,554
public function openToBrowser ( $ outputFileName ) { $ this -> outputFilePath = $ this -> globalFunctionsHelper -> basename ( $ outputFileName ) ; $ this -> filePointer = $ this -> globalFunctionsHelper -> fopen ( 'php://output' , 'w' ) ; $ this -> throwIfFilePointerIsNotAvailable ( ) ; $ this -> globalFunctionsHelper ...
Inits the writer and opens it to accept data . By using this method the data will be outputted directly to the browser .
32,555
public function close ( ) { if ( ! $ this -> isWriterOpened ) { return ; } $ this -> closeWriter ( ) ; if ( is_resource ( $ this -> filePointer ) ) { $ this -> globalFunctionsHelper -> fclose ( $ this -> filePointer ) ; } $ this -> isWriterOpened = false ; }
Closes the writer . This will close the streamer as well preventing new data to be written to the file .
32,556
public function execute ( ) { global $ CFG , $ DB ; require_once ( $ CFG -> dirroot . '/mod/chat/lib.php' ) ; chat_update_chat_times ( ) ; chat_delete_old_users ( ) ; $ timenow = time ( ) ; $ subselect = "SELECT c.keepdays FROM {chat} c WHERE c.id = {chat_messages}.chatid" ;...
Run chat cron .
32,557
public function pix ( $ text , Mustache_LambdaHelper $ helper ) { $ key = strtok ( $ text , "," ) ; $ key = trim ( $ helper -> render ( $ key ) ) ; $ component = strtok ( "," ) ; $ component = trim ( $ helper -> render ( $ component ) ) ; if ( ! $ component ) { $ component = '' ; } $ component = $ helper -> render ( $ ...
Read a pix icon name from a template and get it from pix_icon .
32,558
protected static function is_field_condition_met ( $ operator , $ uservalue , $ value ) { if ( $ uservalue === false ) { return false ; } $ fieldconditionmet = true ; $ uservalue = ( string ) $ uservalue ; switch ( $ operator ) { case self :: OP_CONTAINS : $ pos = strpos ( $ uservalue , $ value ) ; if ( $ pos === false...
Returns true if a field meets the required conditions false otherwise .
32,559
public static function get_custom_profile_fields ( ) { global $ DB , $ CFG ; if ( self :: $ customprofilefields === null ) { require_once ( $ CFG -> dirroot . '/user/profile/lib.php' ) ; $ fields = profile_get_custom_fields ( true ) ; self :: $ customprofilefields = array ( ) ; foreach ( $ fields as $ field ) { self ::...
Gets data about custom profile fields . Cached statically in current request .
32,560
protected function get_cached_user_profile_field ( $ userid ) { global $ USER , $ DB , $ CFG ; $ iscurrentuser = $ USER -> id == $ userid ; if ( isguestuser ( $ userid ) || ( $ iscurrentuser && ! isloggedin ( ) ) ) { return false ; } $ iscustomprofilefield = $ this -> customfield ? true : false ; if ( $ iscustomprofile...
Return the value for a user s profile field
32,561
private function get_condition_sql ( $ field , $ field2 = null , $ istext = false ) { global $ DB ; if ( is_null ( $ field2 ) ) { $ field2 = $ field ; } $ params = array ( ) ; switch ( $ this -> operator ) { case self :: OP_CONTAINS : $ sql = $ DB -> sql_like ( $ field , self :: unique_sql_parameter ( $ params , '%' . ...
Gets SQL to match a field against this condition . The second copy of the field is in case you re using variables for the field so that it needs to be two different ones .
32,562
public function get_thumb_url ( $ image_url , $ orig_width , $ orig_height , $ thumb_width = 75 , $ force = false ) { global $ OUTPUT ; if ( ! $ force && $ orig_width <= $ thumb_width && $ orig_height <= $ thumb_width ) { return $ image_url ; } else { $ thumb_url = '' ; $ commons_main_dir = 'https://upload.wikimedia.or...
Generate thumbnail URL from image URL .
32,563
private function guess_type ( ) { global $ CFG ; if ( ! $ type = behat_field_manager :: guess_field_type ( $ this -> field , $ this -> session ) ) { $ type = 'text' ; } $ classname = 'behat_form_' . $ type ; $ classpath = $ CFG -> dirroot . '/lib/behat/form_field/' . $ classname . '.php' ; require_once ( $ classpath ) ...
Guesses the element type we are dealing with in case is not a text - based element .
32,564
protected function get_internal_field_id ( ) { if ( ! $ this -> running_javascript ( ) ) { throw new coding_exception ( 'You can only get an internal ID using the selenium driver.' ) ; } return $ this -> session -> getDriver ( ) -> getWebDriverSession ( ) -> element ( 'xpath' , $ this -> field -> getXPath ( ) ) -> getI...
Gets the field internal id used by selenium wire protocol .
32,565
protected function get_field_locator ( $ locatortype = false ) { if ( ! empty ( $ this -> fieldlocator ) ) { return $ this -> fieldlocator ; } $ fieldid = $ this -> field -> getAttribute ( 'id' ) ; if ( $ locatortype == 'label' || $ locatortype == false ) { $ labelnode = $ this -> session -> getPage ( ) -> find ( 'xpat...
Gets the field locator .
32,566
public function setLineColorProperties ( $ value , $ alpha = 0 , $ type = self :: EXCEL_COLOR_TYPE_STANDARD ) { $ this -> activateObject ( ) -> lineProperties [ 'color' ] = $ this -> setColorProperties ( $ value , $ alpha , $ type ) ; }
Set Line Color Properties
32,567
public function setGlowProperties ( $ size , $ color_value = null , $ color_alpha = null , $ color_type = null ) { $ this -> activateObject ( ) -> setGlowSize ( $ size ) -> setGlowColor ( $ color_value , $ color_alpha , $ color_type ) ; }
Set Glow Properties
32,568
public function setSoftEdgesSize ( $ size ) { if ( ! is_null ( $ size ) ) { $ this -> activateObject ( ) ; $ softEdges [ 'size' ] = ( string ) $ this -> getExcelPointsWidth ( $ size ) ; } }
Set Soft Edges Size
32,569
public function navigation ( $ courseorid , $ page ) { $ tabs = core_completion \ manager :: get_available_completion_tabs ( $ courseorid ) ; if ( count ( $ tabs ) > 1 ) { return $ this -> tabtree ( $ tabs , $ page ) ; } else { return '' ; } }
Render the navigation tabs for the completion page .
32,570
public function edit_bulk_completion ( $ form , $ activities ) { ob_start ( ) ; $ form -> display ( ) ; $ formhtml = ob_get_contents ( ) ; ob_end_clean ( ) ; $ data = ( object ) [ 'form' => $ formhtml , 'activities' => array_values ( $ activities ) , 'activitiescount' => count ( $ activities ) , ] ; return parent :: re...
Renders the form for bulk editing activities completion
32,571
public function edit_default_completion ( $ form , $ modules ) { ob_start ( ) ; $ form -> display ( ) ; $ formhtml = ob_get_contents ( ) ; ob_end_clean ( ) ; $ data = ( object ) [ 'form' => $ formhtml , 'modules' => array_values ( $ modules ) , 'modulescount' => count ( $ modules ) , ] ; return parent :: render_from_te...
Renders the form for editing default completion
32,572
private function isResumableError ( RuntimeException $ exception ) { if ( $ exception instanceof ConnectionException ) { return true ; } if ( ! $ exception instanceof ServerException ) { return false ; } if ( in_array ( $ exception -> getCode ( ) , [ self :: $ errorCodeCappedPositionLost , self :: $ errorCodeCursorKill...
Determines if an exception is a resumable error .
32,573
private function resume ( ) { $ newChangeStream = call_user_func ( $ this -> resumeCallable , $ this -> resumeToken ) ; $ this -> csIt = $ newChangeStream -> csIt ; $ this -> csIt -> rewind ( ) ; }
Creates a new changeStream after a resumable server error .
32,574
public function getMergeRange ( ) { foreach ( $ this -> getWorksheet ( ) -> getMergeCells ( ) as $ mergeRange ) { if ( $ this -> isInRange ( $ mergeRange ) ) { return $ mergeRange ; } } return false ; }
If this cell is in a merge range then return the range
32,575
public function isInRange ( $ pRange = 'A1:A1' ) { list ( $ rangeStart , $ rangeEnd ) = self :: rangeBoundaries ( $ pRange ) ; $ myColumn = self :: columnIndexFromString ( $ this -> getColumn ( ) ) ; $ myRow = $ this -> getRow ( ) ; return ( ( $ rangeStart [ 0 ] <= $ myColumn ) && ( $ rangeEnd [ 0 ] >= $ myColumn ) && ...
Is cell in a specific range?
32,576
public static function rangeBoundaries ( $ pRange = 'A1:A1' ) { if ( empty ( $ pRange ) ) { $ pRange = self :: DEFAULT_RANGE ; } $ pRange = strtoupper ( $ pRange ) ; if ( strpos ( $ pRange , ':' ) === false ) { $ rangeA = $ rangeB = $ pRange ; } else { list ( $ rangeA , $ rangeB ) = explode ( ':' , $ pRange ) ; } $ ran...
Calculate range boundaries
32,577
public static function rangeDimension ( $ pRange = 'A1:A1' ) { list ( $ rangeStart , $ rangeEnd ) = self :: rangeBoundaries ( $ pRange ) ; return array ( ( $ rangeEnd [ 0 ] - $ rangeStart [ 0 ] + 1 ) , ( $ rangeEnd [ 1 ] - $ rangeStart [ 1 ] + 1 ) ) ; }
Calculate range dimension
32,578
public static function compareCells ( PHPExcel_Cell $ a , PHPExcel_Cell $ b ) { if ( $ a -> getRow ( ) < $ b -> getRow ( ) ) { return - 1 ; } elseif ( $ a -> getRow ( ) > $ b -> getRow ( ) ) { return 1 ; } elseif ( self :: columnIndexFromString ( $ a -> getColumn ( ) ) < self :: columnIndexFromString ( $ b -> getColumn...
Compare 2 cells
32,579
private function writeComment ( PHPExcel_Shared_XMLWriter $ objWriter = null , $ pCellReference = 'A1' , PHPExcel_Comment $ pComment = null , $ pAuthors = null ) { $ objWriter -> startElement ( 'comment' ) ; $ objWriter -> writeAttribute ( 'ref' , $ pCellReference ) ; $ objWriter -> writeAttribute ( 'authorId' , $ pAut...
Write comment to XML format
32,580
public function writeVMLComments ( PHPExcel_Worksheet $ pWorksheet = null ) { $ objWriter = null ; if ( $ this -> getParentWriter ( ) -> getUseDiskCaching ( ) ) { $ objWriter = new PHPExcel_Shared_XMLWriter ( PHPExcel_Shared_XMLWriter :: STORAGE_DISK , $ this -> getParentWriter ( ) -> getDiskCachingDirectory ( ) ) ; } ...
Write VML comments to XML format
32,581
protected function get_parent_record ( ) { global $ DB ; if ( ! isset ( $ this -> parentrecord ) ) { $ this -> parentrecord = $ DB -> get_record ( 'event' , [ 'id' => $ this -> parentid ] ) ; } return $ this -> parentrecord ; }
Return the parent DB record .
32,582
protected function load_event_records ( $ start = 0 ) { global $ DB ; while ( $ records = $ DB -> get_records_select ( 'event' , 'id <> :parentid AND repeatid = :repeatid' , [ 'parentid' => $ this -> parentid , 'repeatid' => $ this -> parentid , ] , 'id ASC' , '*' , $ start , self :: DB_QUERY_LIMIT ) ) { yield $ record...
Generate more event records .
32,583
public function execute ( ) { $ manager = new \ tool_dataprivacy \ expired_contexts_manager ( new \ text_progress_trace ( ) ) ; list ( $ courses , $ users ) = $ manager -> process_approved_deletions ( ) ; mtrace ( "Processed deletions for {$courses} course contexts, and {$users} user contexts as expired" ) ; }
Run the task to delete context instances based on their retention periods .
32,584
protected function helper_setup ( \ tool_log \ log \ manager $ manager ) { $ this -> manager = $ manager ; $ called = get_called_class ( ) ; $ parts = explode ( '\\' , $ called ) ; if ( ! isset ( $ parts [ 0 ] ) || strpos ( $ parts [ 0 ] , 'logstore_' ) !== 0 ) { throw new \ coding_exception ( "Store $called doesn't de...
Setup store specific variables .
32,585
protected function get_config ( $ name , $ default = null ) { $ value = get_config ( $ this -> component , $ name ) ; if ( $ value !== false ) { return $ value ; } return $ default ; }
Api to get plugin config
32,586
protected function evaluateClassifier ( Classifier $ classifier ) { $ total = ( float ) array_sum ( $ this -> weights ) ; $ wrong = 0 ; foreach ( $ this -> samples as $ index => $ sample ) { $ predicted = $ classifier -> predict ( $ sample ) ; if ( $ predicted != $ this -> targets [ $ index ] ) { $ wrong += $ this -> w...
Evaluates the classifier and returns the classification error rate
32,587
protected function updateWeights ( Classifier $ classifier , float $ alpha ) { $ sumOfWeights = array_sum ( $ this -> weights ) ; $ weightsT1 = [ ] ; foreach ( $ this -> weights as $ index => $ weight ) { $ desired = $ this -> targets [ $ index ] ; $ output = $ classifier -> predict ( $ this -> samples [ $ index ] ) ; ...
Updates the sample weights
32,588
public static function fetch ( $ params ) { if ( $ records = self :: retrieve_record_set ( $ params ) ) { return reset ( $ records ) ; } $ record = grade_object :: fetch_helper ( 'grade_categories' , 'grade_category' , $ params ) ; $ records = false ; if ( $ record ) { $ records = array ( $ record -> id => $ record ) ;...
Finds and returns a grade_category instance based on params .
32,589
public static function fetch_all ( $ params ) { if ( $ records = self :: retrieve_record_set ( $ params ) ) { return $ records ; } $ records = grade_object :: fetch_all_helper ( 'grade_categories' , 'grade_category' , $ params ) ; self :: set_record_set ( $ params , $ records ) ; return $ records ; }
Finds and returns all grade_category instances based on params .
32,590
public function qualifies_for_regrading ( ) { if ( empty ( $ this -> id ) ) { debugging ( "Can not regrade non existing category" ) ; return false ; } $ db_item = grade_category :: fetch ( array ( 'id' => $ this -> id ) ) ; $ aggregationdiff = $ db_item -> aggregation != $ this -> aggregation ; $ keephighdiff = $ db_it...
Compares the values held by this object with those of the matching record in DB and returns whether or not these differences are sufficient to justify an update of all parent objects . This assumes that this object has an ID number and a matching record in DB . If not it will return false .
32,591
public function aggregate_values ( $ grade_values , $ items ) { debugging ( 'grade_category::aggregate_values() is deprecated. Call grade_category::aggregate_values_and_adjust_bounds() instead.' , DEBUG_DEVELOPER ) ; $ result = $ this -> aggregate_values_and_adjust_bounds ( $ grade_values , $ items ) ...
Internal function that calculates the aggregated grade for this grade category
32,592
private function auto_update_max ( ) { global $ CFG , $ DB ; if ( $ this -> aggregation != GRADE_AGGREGATE_SUM ) { return ; } $ this -> load_grade_item ( ) ; $ depends_on = $ this -> grade_item -> depends_on ( ) ; $ gradebookcalculationfreeze = 'gradebook_calculations_freeze_' . $ this -> courseid ; $ oldextracreditcal...
Some aggregation types may need to update their max grade .
32,593
public function can_apply_limit_rules ( ) { if ( $ this -> canapplylimitrules !== null ) { return $ this -> canapplylimitrules ; } $ this -> canapplylimitrules = true ; if ( $ this -> aggregation == GRADE_AGGREGATE_SUM ) { $ canapply = true ; $ gradeitems = $ this -> get_children ( ) ; $ validitems = 0 ; $ lastweight =...
Returns whether or not we can apply the limit rules .
32,594
public static function aggregation_uses_aggregationcoef ( $ aggregation ) { return ( $ aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN or $ aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN2 or $ aggregation == GRADE_AGGREGATE_EXTRACREDIT_MEAN or $ aggregation == GRADE_AGGREGATE_SUM ) ; }
Returns true if aggregation uses aggregationcoef
32,595
public static function fetch_course_tree ( $ courseid , $ include_category_items = false ) { $ course_category = grade_category :: fetch_course_category ( $ courseid ) ; $ category_array = array ( 'object' => $ course_category , 'type' => 'category' , 'depth' => 1 , 'children' => $ course_category -> get_children ( $ i...
Returns tree with all grade_items and categories as elements
32,596
static private function _fetch_course_tree_recursion ( $ category_array , & $ sortorder ) { if ( isset ( $ category_array [ 'object' ] -> gradetype ) && $ category_array [ 'object' ] -> gradetype == GRADE_TYPE_NONE ) { return null ; } $ result = array ( 'object' => $ category_array [ 'object' ] , 'type' => $ category_a...
An internal function that recursively sorts grade categories within a course
32,597
private static function _get_children_recursion ( $ category ) { $ children_array = array ( ) ; foreach ( $ category -> children as $ sortorder => $ child ) { if ( array_key_exists ( 'itemtype' , $ child ) ) { $ grade_item = new grade_item ( $ child , false ) ; if ( in_array ( $ grade_item -> itemtype , array ( 'course...
Private method used to retrieve all children of this category recursively
32,598
public function get_grade_item ( ) { if ( empty ( $ this -> id ) ) { debugging ( "Attempt to obtain a grade_category's associated grade_item without the category's ID being set." ) ; return false ; } if ( empty ( $ this -> parent ) ) { $ params = array ( 'courseid' => $ this -> courseid , 'itemtype' => 'course' , 'item...
Retrieves this grade categories associated grade_item from the database
32,599
public function get_name ( ) { global $ DB ; if ( empty ( $ this -> parent ) && $ this -> fullname == '?' ) { $ course = $ DB -> get_record ( 'course' , array ( 'id' => $ this -> courseid ) ) ; return format_string ( $ course -> fullname , false , array ( "context" => context_course :: instance ( $ this -> courseid ) )...
Returns the most descriptive field for this grade category