idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
33,700 | public static function update_request_status ( $ requestid , $ status , $ dpoid = 0 , $ comment = '' ) { $ datarequest = new data_request ( $ requestid ) ; $ datarequest -> set ( 'status' , $ status ) ; if ( $ dpoid ) { $ datarequest -> set ( 'dpo' , $ dpoid ) ; } if ( ! empty ( trim ( $ comment ) ) ) { $ params = [ 'd... | Cancels the data request for a given request ID . |
33,701 | public static function approve_data_request ( $ requestid ) { global $ USER ; if ( ! self :: can_manage_data_requests ( $ USER -> id ) ) { $ context = context_system :: instance ( ) ; throw new required_capability_exception ( $ context , 'tool/dataprivacy:managedatarequests' , 'nopermissions' , '' ) ; } $ request = new... | Approves a data request based on the request ID . |
33,702 | public static function deny_data_request ( $ requestid ) { global $ USER ; if ( ! self :: can_manage_data_requests ( $ USER -> id ) ) { $ context = context_system :: instance ( ) ; throw new required_capability_exception ( $ context , 'tool/dataprivacy:managedatarequests' , 'nopermissions' , '' ) ; } $ request = new da... | Rejects a data request based on the request ID . |
33,703 | public static function notify_dpo ( $ dpo , data_request $ request ) { global $ PAGE , $ SITE ; $ output = $ PAGE -> get_renderer ( 'tool_dataprivacy' ) ; $ usercontext = \ context_user :: instance ( $ request -> get ( 'requestedby' ) ) ; $ requestexporter = new data_request_exporter ( $ request , [ 'context' => $ user... | Sends a message to the site s Data Protection Officer about a request . |
33,704 | public static function can_create_data_request_for_user ( $ user , $ requester = null ) { $ usercontext = \ context_user :: instance ( $ user ) ; return has_capability ( 'tool/dataprivacy:makedatarequestsforchildren' , $ usercontext , $ requester ) ; } | Checks whether a non - DPO user can make a data request for another user . |
33,705 | public static function require_can_create_data_request_for_user ( $ user , $ requester = null ) { $ usercontext = \ context_user :: instance ( $ user ) ; require_capability ( 'tool/dataprivacy:makedatarequestsforchildren' , $ usercontext , $ requester ) ; return true ; } | Require that the current user can make a data request for the specified other user . |
33,706 | public static function can_create_data_deletion_request_for_self ( int $ userid = null ) : bool { global $ USER ; $ userid = $ userid ? : $ USER -> id ; return has_capability ( 'tool/dataprivacy:requestdelete' , \ context_user :: instance ( $ userid ) , $ userid ) ; } | Check if user has permisson to create data deletion request for themselves . |
33,707 | public static function can_create_data_deletion_request_for_other ( int $ userid = null ) : bool { global $ USER ; $ userid = $ userid ? : $ USER -> id ; return has_capability ( 'tool/dataprivacy:requestdeleteforotheruser' , context_system :: instance ( ) , $ userid ) ; } | Check if user has permission to create data deletion request for another user . |
33,708 | public static function can_create_data_deletion_request_for_children ( int $ userid , int $ requesterid = null ) : bool { global $ USER ; $ requesterid = $ requesterid ? : $ USER -> id ; return has_capability ( 'tool/dataprivacy:makedatadeletionrequestsforchildren' , \ context_user :: instance ( $ userid ) , $ requeste... | Check if parent can create data deletion request for their children . |
33,709 | public static function can_download_data_request_for_user ( $ userid , $ requesterid , $ downloaderid = null ) { global $ USER ; if ( ! $ downloaderid ) { $ downloaderid = $ USER -> id ; } $ usercontext = \ context_user :: instance ( $ userid ) ; if ( $ userid == $ downloaderid && has_capability ( 'tool/dataprivacy:dow... | Checks whether a user can download a data request . |
33,710 | public static function get_download_link ( \ context_user $ usercontext , $ requestid ) { $ downloadurl = moodle_url :: make_pluginfile_url ( $ usercontext -> id , 'tool_dataprivacy' , 'export' , $ requestid , '/' , 'export.zip' , true ) ; $ downloadtext = get_string ( 'download' , 'tool_dataprivacy' ) ; return new \ a... | Gets an action menu link to download a data request . |
33,711 | public static function update_purpose ( stdClass $ record ) { if ( ! isset ( $ record -> sensitivedatareasons ) ) { $ record -> sensitivedatareasons = '' ; } $ purpose = new purpose ( $ record -> id ) ; $ purpose -> from_record ( $ record ) ; $ result = $ purpose -> update ( ) ; return $ purpose ; } | Updates an existing data purpose . |
33,712 | public static function update_category ( stdClass $ record ) { $ category = new category ( $ record -> id ) ; $ category -> from_record ( $ record ) ; $ result = $ category -> update ( ) ; return $ category ; } | Updates an existing data category . |
33,713 | public static function set_context_instance ( $ record ) { if ( $ instance = context_instance :: get_record_by_contextid ( $ record -> contextid , false ) ) { $ instance -> from_record ( $ record ) ; if ( empty ( $ record -> purposeid ) && empty ( $ record -> categoryid ) ) { self :: unset_context_instance ( $ instance... | Sets the context instance purpose and category . |
33,714 | public static function set_contextlevel ( $ record ) { global $ DB ; if ( $ record -> contextlevel != CONTEXT_SYSTEM && $ record -> contextlevel != CONTEXT_USER ) { throw new \ coding_exception ( 'Only context system and context user can set a contextlevel ' . 'purpose and retention' ) ; } if ( $ contextlevel = context... | Sets the context level purpose and category . |
33,715 | public static function get_effective_context_category ( \ context $ context , $ forcedvalue = false ) { if ( ! data_registry :: defaults_set ( ) ) { return false ; } return data_registry :: get_effective_context_value ( $ context , 'category' , $ forcedvalue ) ; } | Returns the effective category given a context instance . |
33,716 | public static function get_effective_context_purpose ( \ context $ context , $ forcedvalue = false ) { if ( ! data_registry :: defaults_set ( ) ) { return false ; } return data_registry :: get_effective_context_value ( $ context , 'purpose' , $ forcedvalue ) ; } | Returns the effective purpose given a context instance . |
33,717 | public static function get_effective_contextlevel_purpose ( $ contextlevel , $ forcedvalue = false ) { if ( ! data_registry :: defaults_set ( ) ) { return false ; } return data_registry :: get_effective_contextlevel_value ( $ contextlevel , 'purpose' , $ forcedvalue ) ; } | Returns the effective purpose given a context level . |
33,718 | public static function create_expired_context ( $ contextid ) { $ record = ( object ) [ 'contextid' => $ contextid , 'status' => expired_context :: STATUS_EXPIRED , ] ; $ expiredctx = new expired_context ( 0 , $ record ) ; $ expiredctx -> save ( ) ; return $ expiredctx ; } | Creates an expired context record for the provided context id . |
33,719 | public static function get_approved_contextlist_collection_for_collection ( contextlist_collection $ collection , \ stdClass $ foruser , int $ type ) : contextlist_collection { $ approvedcollection = new contextlist_collection ( $ collection -> get_userid ( ) ) ; $ isconfigured = data_registry :: defaults_set ( ) ; for... | Finds all contextlists having at least one approved context and returns them as in a contextlist_collection . |
33,720 | public static function format_retention_period ( \ DateInterval $ interval ) : string { if ( $ interval -> y ) { $ formattedtime = get_string ( 'numyears' , 'moodle' , $ interval -> format ( '%y' ) ) ; } else if ( $ interval -> m ) { $ formattedtime = get_string ( 'nummonths' , 'moodle' , $ interval -> format ( '%m' ) ... | Format the supplied date interval as a retention period . |
33,721 | public function write_files ( $ files , $ indent ) { if ( empty ( $ files ) ) { return '' ; } $ string = '' ; foreach ( $ files as $ file ) { if ( $ file -> is_directory ( ) ) { continue ; } $ string .= str_repeat ( ' ' , $ indent ) ; $ string .= '<file name="' . $ file -> get_filename ( ) . '" encoding="base64">' ; $... | Convert files into text output in the given format . This method is copied from qformat_default as a quick fix as the method there is protected . |
33,722 | public function verify ( $ responsestr ) { global $ CFG ; require_once ( $ CFG -> libdir . '/recaptchalib_v2.php' ) ; $ response = recaptcha_check_response ( RECAPTCHA_VERIFY_URL , $ CFG -> recaptchaprivatekey , getremoteaddr ( ) , $ responsestr ) ; if ( ! $ response [ 'isvalid' ] ) { $ attributes = $ this -> getAttrib... | Checks recaptcha response with Google . |
33,723 | protected function init ( ) { $ this -> escapableControlCharactersPattern = $ this -> getEscapableControlCharactersPattern ( ) ; $ this -> controlCharactersEscapingMap = $ this -> getControlCharactersEscapingMap ( ) ; $ this -> controlCharactersEscapingReverseMap = array_flip ( $ this -> controlCharactersEscapingMap ) ... | Initializes the singleton instance |
33,724 | protected function getControlCharactersEscapingMap ( ) { $ controlCharactersEscapingMap = [ ] ; for ( $ charValue = 0x00 ; $ charValue <= 0x1F ; $ charValue ++ ) { $ character = chr ( $ charValue ) ; if ( preg_match ( "/{$this->escapableControlCharactersPattern}/" , $ character ) ) { $ charHexValue = dechex ( $ charVal... | Builds the map containing control characters to be escaped mapped to their escaped values . \ t \ r and \ n don t need to be escaped . |
33,725 | protected function escapeControlCharacters ( $ string ) { $ escapedString = $ this -> escapeEscapeCharacter ( $ string ) ; if ( ! preg_match ( "/{$this->escapableControlCharactersPattern}/" , $ escapedString ) ) { return $ escapedString ; } return preg_replace_callback ( "/({$this->escapableControlCharactersPattern})/"... | Converts PHP control characters from the given string to OpenXML escaped control characters |
33,726 | protected function unescapeControlCharacters ( $ string ) { $ unescapedString = $ string ; foreach ( $ this -> controlCharactersEscapingMap as $ escapedCharValue => $ charValue ) { $ unescapedString = preg_replace ( "/(?<!_x005F)($escapedCharValue)/" , $ charValue , $ unescapedString ) ; } return $ this -> unescapeEsca... | Converts OpenXML escaped control characters from the given string to PHP control characters |
33,727 | public static function is_enabled ( ) { global $ CFG ; if ( ! isset ( $ CFG -> messageinbound_enabled ) || ! $ CFG -> messageinbound_enabled ) { return false ; } if ( ! isset ( $ CFG -> messageinbound_mailbox ) || empty ( $ CFG -> messageinbound_mailbox ) ) { return false ; } if ( ! isset ( $ CFG -> messageinbound_doma... | Whether the Inbound Message interface is enabled . |
33,728 | public static function update_handlers_for_component ( $ componentname ) { global $ DB ; $ componentname = \ core_component :: normalize_componentname ( $ componentname ) ; $ existinghandlers = $ DB -> get_recordset ( 'messageinbound_handlers' , array ( 'component' => $ componentname ) ) ; foreach ( $ existinghandlers ... | Update the database to create update and remove handlers . |
33,729 | public static function create_missing_messageinbound_handlers_for_component ( $ componentname ) { global $ DB ; $ componentname = \ core_component :: normalize_componentname ( $ componentname ) ; $ expectedhandlers = self :: load_default_handlers_for_component ( $ componentname ) ; foreach ( $ expectedhandlers as $ han... | Update the database to contain a list of handlers for a component adding any handlers which do not exist in the database . |
33,730 | public static function remove_messageinbound_handler ( $ handler ) { global $ DB ; $ DB -> delete_records ( 'messageinbound_datakeys' , array ( 'handler' => $ handler -> id ) ) ; $ DB -> delete_records ( 'messageinbound_handlers' , array ( 'id' => $ handler -> id ) ) ; } | Remove the specified handler . |
33,731 | public static function record_from_handler ( $ handler ) { $ record = new \ stdClass ( ) ; $ record -> id = $ handler -> id ; $ record -> component = $ handler -> component ; $ record -> classname = get_class ( $ handler ) ; if ( strpos ( $ record -> classname , '\\' ) !== 0 ) { $ record -> classname = '\\' . $ record ... | Create a flat stdClass for the handler appropriate for inserting into the database . |
33,732 | protected static function handler_from_record ( $ record ) { $ classname = $ record -> classname ; if ( strpos ( $ classname , '\\' ) !== 0 ) { $ classname = '\\' . $ classname ; } if ( ! class_exists ( $ classname ) ) { return false ; } $ handler = new $ classname ; if ( isset ( $ record -> id ) ) { $ handler -> set_i... | Load the Inbound Message handler details for a given record . |
33,733 | public static function get_handler ( $ classname ) { global $ DB ; if ( strpos ( $ classname , '\\' ) !== 0 ) { $ classname = '\\' . $ classname ; } $ record = $ DB -> get_record ( 'messageinbound_handlers' , array ( 'classname' => $ classname ) , '*' , IGNORE_MISSING ) ; if ( ! $ record ) { return false ; } return sel... | Load the Inbound Message handler details for a given classname . |
33,734 | public static function get_handler_from_id ( $ id ) { global $ DB ; $ record = $ DB -> get_record ( 'messageinbound_handlers' , array ( 'id' => $ id ) , '*' , IGNORE_MISSING ) ; if ( ! $ record ) { return false ; } return self :: handler_from_record ( $ record ) ; } | Load the Inbound Message handler with a given ID |
33,735 | public function process_question ( array $ data , array $ raw ) { if ( isset ( $ data [ 'answers' ] ) ) { $ this -> write_answers ( $ data [ 'answers' ] , $ this -> pluginname ) ; } foreach ( $ data [ 'shortanswer' ] as $ shortanswer ) { $ shortanswer [ 'id' ] = $ this -> converter -> get_nextid ( ) ; $ this -> write_x... | Appends the shortanswer specific information to the question |
33,736 | public function get_next_stage ( ) { if ( $ this -> oneclickbackup ) { $ tasks = $ this -> ui -> get_tasks ( ) ; foreach ( $ tasks as $ task ) { if ( $ task instanceof backup_root_task ) { $ setting = $ task -> get_setting ( 'filename' ) ; if ( $ setting ) { $ filename = backup_plan_dbops :: get_default_backup_filename... | Gets the next stage for the backup . |
33,737 | protected function initialise_stage_form ( ) { global $ PAGE ; if ( $ this -> stageform === null ) { $ form = new backup_initial_form ( $ this , $ PAGE -> url ) ; $ tasks = $ this -> ui -> get_tasks ( ) ; $ add_settings = array ( ) ; $ dependencies = array ( ) ; foreach ( $ tasks as & $ task ) { if ( $ task instanceof ... | Initialises the backup_moodleform instance for this stage |
33,738 | private static function get_models_with_user_data ( ) { $ models = \ core_analytics \ manager :: get_all_models ( ) ; foreach ( $ models as $ modelid => $ model ) { $ analyser = $ model -> get_analyser ( [ 'notimesplitting' => true ] ) ; if ( ! $ analyser -> processes_user_data ( ) ) { unset ( $ models [ $ modelid ] ) ... | Returns a list of models with user data . |
33,739 | private static function analytics_prediction_actions_user_sql ( $ userid , $ modelids , $ contextsql = false ) { global $ DB ; list ( $ insql , $ params ) = $ DB -> get_in_or_equal ( $ modelids , SQL_PARAMS_NAMED ) ; $ sql = " FROM {analytics_predictions} ap JOIN {context} ctx ON ctx.id = ap.contextid ... | Returns the sql query to query analytics_prediction_actions table by user ID . |
33,740 | private static function analytics_prediction_actions_context_sql ( $ contextid , $ modelids , $ usersql = false ) { global $ DB ; list ( $ insql , $ params ) = $ DB -> get_in_or_equal ( $ modelids , SQL_PARAMS_NAMED ) ; $ sql = " FROM {analytics_predictions} ap JOIN {analytics_prediction_actions} apa O... | Returns the sql query to query analytics_prediction_actions table by context ID . |
33,741 | public function get_display_name ( $ item , $ withpostfix = true ) { return format_text ( $ item -> name , FORMAT_HTML , array ( 'noclean' => true , 'para' => false ) ) . ( $ withpostfix ? $ this -> get_display_name_postfix ( $ item ) : '' ) ; } | Returns the formatted name of the item for the complete form or response view |
33,742 | public function complete_form_element ( $ item , $ form ) { $ form -> add_form_element ( $ item , [ 'static' , $ item -> typ . '_' . $ item -> id , '' , html_writer :: empty_tag ( 'hr' , [ 'class' => 'feedback_pagebreak' , 'id' => 'feedback_item_' . $ item -> id ] ) ] ) ; } | Adds an input element to the complete form |
33,743 | public static function get_records_by_contextlevel ( $ contextlevel = null , $ status = false , $ sort = 'timecreated' , $ offset = 0 , $ limit = 0 ) { global $ DB ; $ sql = "SELECT expiredctx.* FROM {" . self :: TABLE . "} expiredctx JOIN {context} ctx ON ctx.id = e... | Returns expired_contexts instances that match the provided level and status . |
33,744 | public static function get_record_count_by_contextlevel ( $ contextlevel = null , $ status = false ) { global $ DB ; $ sql = "SELECT COUNT(1) FROM {" . self :: TABLE . "} expiredctx JOIN {context} ctx ON ctx.id = expiredctx.contextid" ; $ conditions = [ ] ; $ params ... | Returns the number of expired_contexts instances that match the provided level and status . |
33,745 | protected function set_roleids_for ( string $ field , array $ roleids ) : expired_context { $ roledata = json_encode ( $ roleids ) ; $ this -> raw_set ( $ field , $ roledata ) ; return $ this ; } | Set the list of role IDs for either expiredroles or unexpiredroles . |
33,746 | protected function get_roleids_for ( string $ field ) { $ value = $ this -> raw_get ( $ field ) ; if ( empty ( $ value ) ) { return [ ] ; } return json_decode ( $ value ) ; } | Get the list of role IDs for either expiredroles or unexpiredroles . |
33,747 | public function add_expiredroles ( array $ roleids ) : expired_context { $ existing = $ this -> get ( 'expiredroles' ) ; $ newvalue = array_merge ( $ existing , $ roleids ) ; $ this -> set ( 'expiredroles' , $ newvalue ) ; return $ this ; } | Add a set of role IDs to the list of expired role IDs . |
33,748 | public static function create_from_expiry_info ( \ context $ context , expiry_info $ info , bool $ save = true ) : expired_context { $ record = ( object ) [ 'contextid' => $ context -> id , 'status' => self :: STATUS_EXPIRED , 'defaultexpired' => ( int ) $ info -> is_default_expired ( ) , ] ; $ expiredcontext = new sta... | Create a new expired_context based on the context and expiry_info object . |
33,749 | public function update_from_expiry_info ( expiry_info $ info ) : expired_context { $ save = false ; $ thisexpired = $ this -> get ( 'expiredroles' ) ; $ infoexpired = $ info -> get_expired_roles ( ) ; sort ( $ thisexpired ) ; sort ( $ infoexpired ) ; if ( $ infoexpired != $ thisexpired ) { $ this -> set ( 'expiredroles... | Update the expired_context from an expiry_info object which relates to this context . |
33,750 | public function extend_lock ( lock $ lock , $ maxlifetime = 86400 ) { $ now = time ( ) ; $ expires = $ now + $ maxlifetime ; $ params = array ( 'expires' => $ expires , 'token' => $ lock -> get_key ( ) ) ; $ sql = 'UPDATE {lock_db} SET expires = :expires, WHE... | Extend a lock that was previously obtained with |
33,751 | protected function validate_relatedcompetencyid ( $ data ) { if ( $ this -> get ( 'competencyid' ) == $ data ) { return new lang_string ( 'invaliddata' , 'error' ) ; } if ( $ this -> get ( 'competencyid' ) > $ data ) { return new lang_string ( 'invaliddata' , 'error' ) ; } else if ( ! competency :: record_exists ( $ da... | Validate related competency ID . |
33,752 | public static function get_relation ( $ competencyid , $ relatedcompetencyid ) { global $ DB ; $ relation = new static ( ) ; if ( $ competencyid > $ relatedcompetencyid ) { $ relation -> set ( 'competencyid' , $ relatedcompetencyid ) ; $ relation -> set ( 'relatedcompetencyid' , $ competencyid ) ; } else { $ relation -... | Get relation specifying both competencies . |
33,753 | public static function get_related_competencies ( $ competencyid ) { global $ DB ; $ fields = competency :: get_sql_fields ( 'c' , 'c_' ) ; $ sql = "(SELECT $fields, " . $ DB -> sql_concat ( 'rc.relatedcompetencyid' , "'_'" , 'rc.competencyid' ) . " AS rid FROM {" . self :: TABLE . "} rc ... | Get the competencies related to a competency . |
33,754 | public static function get_multiple_relations ( $ competencyids ) { global $ DB ; if ( empty ( $ competencyids ) ) { return array ( ) ; } list ( $ insql , $ params ) = $ DB -> get_in_or_equal ( $ competencyids ) ; $ records = $ DB -> get_records_select ( self :: TABLE , "competencyid $insql OR relatedcompetencyid $insq... | Get the related competencies from competency ids . |
33,755 | public static function delete_multiple_relations ( $ competencyids ) { global $ DB ; if ( empty ( $ competencyids ) ) { return true ; } list ( $ insql , $ params ) = $ DB -> get_in_or_equal ( $ competencyids ) ; return $ DB -> delete_records_select ( self :: TABLE , "competencyid $insql OR relatedcompetencyid $insql" ,... | Delete relations using competencies . |
33,756 | protected function get_legacy_eventdata ( ) { $ legacyeventdata = $ this -> get_record_snapshot ( 'user_enrolments' , $ this -> objectid ) ; $ legacyeventdata -> enrol = $ this -> other [ 'enrol' ] ; $ legacyeventdata -> courseid = $ this -> courseid ; return $ legacyeventdata ; } | Return user_enrolled legacy event data . |
33,757 | public function format_row ( $ row ) { if ( $ this -> rownum < 0 ) { $ this -> rownum = $ this -> currpage * $ this -> pagesize ; } else { $ this -> rownum += 1 ; } return parent :: format_row ( $ row ) ; } | Before adding each row to the table make sure rownum is incremented . |
33,758 | public function col_recordid ( stdClass $ row ) { if ( empty ( $ row -> recordid ) ) { $ row -> recordid = $ this -> assignment -> get_uniqueid_for_user ( $ row -> userid ) ; } return get_string ( 'hiddenuser' , 'assign' ) . $ row -> recordid ; } | Add a column with an ID that uniquely identifies this user in this assignment . |
33,759 | public function col_workflowstatus ( stdClass $ row ) { $ o = '' ; $ gradingdisabled = $ this -> assignment -> grading_disabled ( $ row -> id ) ; $ workflowstates = $ this -> assignment -> get_marking_workflow_states_for_current_user ( ) ; $ workflowstate = $ row -> workflowstate ; if ( empty ( $ workflowstate ) ) { $ ... | list current marking workflow state |
33,760 | public function col_workflowstate ( $ row ) { $ state = $ row -> workflowstate ; if ( empty ( $ state ) ) { $ state = ASSIGN_MARKING_WORKFLOW_STATE_NOTMARKED ; } return get_string ( 'markingworkflowstate' . $ state , 'assign' ) ; } | For download only - list current marking workflow state |
33,761 | public function col_allocatedmarker ( stdClass $ row ) { static $ markers = null ; static $ markerlist = array ( ) ; if ( $ markers === null ) { list ( $ sort , $ params ) = users_order_by_sql ( 'u' ) ; $ markers = get_enrolled_users ( $ this -> assignment -> get_context ( ) , 'mod/assign:grade' , 0 , 'u.*' , $ sort ) ... | list current marker |
33,762 | public function col_scale ( $ row ) { global $ DB ; if ( empty ( $ this -> scale ) ) { $ dbparams = array ( 'id' => - ( $ this -> assignment -> get_instance ( ) -> grade ) ) ; $ this -> scale = $ DB -> get_record ( 'scale' , $ dbparams ) ; } if ( ! empty ( $ this -> scale -> scale ) ) { return implode ( "\n" , explode ... | For download only - list all the valid options for this custom scale . |
33,763 | public function display_grade ( $ grade , $ editable , $ userid , $ modified ) { if ( $ this -> is_downloading ( ) ) { if ( $ this -> assignment -> get_instance ( ) -> grade >= 0 ) { if ( $ grade == - 1 || $ grade === null ) { return '' ; } $ gradeitem = $ this -> assignment -> get_grade_item ( ) ; return format_float ... | Display a grade with scales etc . |
33,764 | public function col_team ( stdClass $ row ) { $ submission = false ; $ group = false ; $ this -> get_group_and_submission ( $ row -> id , $ group , $ submission , - 1 ) ; if ( $ group ) { return $ group -> name ; } else if ( $ this -> assignment -> get_instance ( ) -> preventsubmissionnotingroup ) { $ usergroups = $ th... | Get the team info for this user . |
33,765 | protected function get_group_and_submission ( $ userid , & $ group , & $ submission , $ attemptnumber ) { $ group = false ; if ( isset ( $ this -> submissiongroups [ $ userid ] ) ) { $ group = $ this -> submissiongroups [ $ userid ] ; } else { $ group = $ this -> assignment -> get_submission_group ( $ userid , false ) ... | Use a static cache to try and reduce DB calls . |
33,766 | public function col_outcomes ( stdClass $ row ) { $ outcomes = '' ; foreach ( $ this -> gradinginfo -> outcomes as $ index => $ outcome ) { $ options = make_grades_menu ( - $ outcome -> scaleid ) ; $ options [ 0 ] = get_string ( 'nooutcome' , 'grades' ) ; if ( $ this -> quickgrading && ! ( $ outcome -> grades [ $ row -... | Format a list of outcomes . |
33,767 | public function col_select ( stdClass $ row ) { $ selectcol = '<label class="accesshide" for="selectuser_' . $ row -> userid . '">' ; $ selectcol .= get_string ( 'selectuser' , 'assign' , $ this -> assignment -> fullname ( $ row ) ) ; $ selectcol .= '</label>' ; $ selectcol .= '<input type="checkbox" ... | Insert a checkbox for selecting the current row for batch operations . |
33,768 | private function get_gradebook_data_for_user ( $ userid ) { if ( isset ( $ this -> gradinginfo -> items [ 0 ] ) && $ this -> gradinginfo -> items [ 0 ] -> grades [ $ userid ] ) { return $ this -> gradinginfo -> items [ 0 ] -> grades [ $ userid ] ; } return false ; } | Return a users grades from the listing of all grade data for this assignment . |
33,769 | public function get_column_data ( $ columnname ) { $ this -> setup ( ) ; $ this -> currpage = 0 ; $ this -> query_db ( $ this -> tablemaxrows ) ; $ result = array ( ) ; foreach ( $ this -> rawdata as $ row ) { $ result [ ] = $ row -> $ columnname ; } return $ result ; } | Using the current filtering and sorting - load all rows and return a single column from them . |
33,770 | public function get_sort_columns ( ) { $ result = parent :: get_sort_columns ( ) ; $ assignment = $ this -> assignment -> get_instance ( ) ; if ( empty ( $ assignment -> blindmarking ) ) { $ result = array_merge ( $ result , array ( 'userid' => SORT_ASC ) ) ; } else { $ result = array_merge ( $ result , [ 'COALESCE(s.t... | Always return a valid sort - even if the userid column is missing . |
33,771 | protected function show_hide_link ( $ column , $ index ) { if ( $ index > 0 || ! $ this -> hasgrade ) { return parent :: show_hide_link ( $ column , $ index ) ; } return '' ; } | Override the table show_hide_link to not show for select column . |
33,772 | public function createStart ( $ name , $ attr = array ( ) ) { $ p = clone $ this -> p_start ; $ p -> __construct ( $ name , $ attr ) ; return $ p ; } | Creates a HTMLPurifier_Token_Start . |
33,773 | public function createEmpty ( $ name , $ attr = array ( ) ) { $ p = clone $ this -> p_empty ; $ p -> __construct ( $ name , $ attr ) ; return $ p ; } | Creates a HTMLPurifier_Token_Empty . |
33,774 | public function edit_field_add ( $ mform ) { $ mform -> addElement ( 'select' , $ this -> inputname , format_string ( $ this -> field -> name ) , $ this -> options ) ; } | Create the code snippet for this field instance Overwrites the base class method |
33,775 | public function edit_field_set_default ( $ mform ) { $ key = $ this -> field -> defaultdata ; if ( isset ( $ this -> options [ $ key ] ) || ( $ key = array_search ( $ key , $ this -> options ) ) !== false ) { $ defaultkey = $ key ; } else { $ defaultkey = '' ; } $ mform -> setDefault ( $ this -> inputname , $ defaultke... | Set the default value for this field instance Overwrites the base class method . |
33,776 | function get_content ( ) { if ( $ this -> content !== NULL ) { return $ this -> content ; } if ( empty ( $ this -> instance ) ) { $ this -> content = '' ; return $ this -> content ; } $ this -> content = new stdClass ; $ this -> content -> text = '' ; $ this -> content -> footer = '' ; $ renderer = $ this -> page -> ge... | Returns the content object |
33,777 | protected function get_timestart ( ) { global $ USER ; if ( $ this -> timestart === null ) { $ this -> timestart = round ( time ( ) - COURSE_MAX_RECENT_PERIOD , - 2 ) ; if ( ! isguestuser ( ) ) { if ( ! empty ( $ USER -> lastcourseaccess [ $ this -> page -> course -> id ] ) ) { if ( $ USER -> lastcourseaccess [ $ this ... | Returns the time since when we want to show recent activity |
33,778 | protected function get_structural_changes ( ) { global $ DB ; $ course = $ this -> page -> course ; $ context = context_course :: instance ( $ course -> id ) ; $ canviewdeleted = has_capability ( 'block/recent_activity:viewdeletemodule' , $ context ) ; $ canviewupdated = has_capability ( 'block/recent_activity:viewaddu... | Returns list of recent changes in course structure |
33,779 | protected function get_modules_recent_activity ( ) { $ context = context_course :: instance ( $ this -> page -> course -> id ) ; $ viewfullnames = has_capability ( 'moodle/site:viewfullnames' , $ context ) ; $ hascontent = false ; $ modinfo = get_fast_modinfo ( $ this -> page -> course ) ; $ usedmodules = $ modinfo -> ... | Returns list of recent activity within modules |
33,780 | public function getSortedCellList ( ) { $ sortKeys = array ( ) ; foreach ( $ this -> getCellList ( ) as $ coord ) { sscanf ( $ coord , '%[A-Z]%d' , $ column , $ row ) ; $ sortKeys [ sprintf ( '%09d%3s' , $ row , $ column ) ] = $ coord ; } ksort ( $ sortKeys ) ; return array_values ( $ sortKeys ) ; } | Sort the list of all cell addresses currently held in cache by row and column |
33,781 | public function getHighestRowAndColumn ( ) { $ col = array ( 'A' => '1A' ) ; $ row = array ( 1 ) ; foreach ( $ this -> getCellList ( ) as $ coord ) { sscanf ( $ coord , '%[A-Z]%d' , $ c , $ r ) ; $ row [ $ r ] = $ r ; $ col [ $ c ] = strlen ( $ c ) . $ c ; } if ( ! empty ( $ row ) ) { $ highestRow = max ( $ row ) ; $ h... | Get highest worksheet column and highest row that have cell records |
33,782 | public function removeRow ( $ row ) { foreach ( $ this -> getCellList ( ) as $ coord ) { sscanf ( $ coord , '%[A-Z]%d' , $ c , $ r ) ; if ( $ r == $ row ) { $ this -> deleteCacheData ( $ coord ) ; } } } | Remove a row deleting all cells in that row |
33,783 | public function removeColumn ( $ column ) { foreach ( $ this -> getCellList ( ) as $ coord ) { sscanf ( $ coord , '%[A-Z]%d' , $ c , $ r ) ; if ( $ c == $ column ) { $ this -> deleteCacheData ( $ coord ) ; } } } | Remove a column deleting all cells in that column |
33,784 | protected function configuration_definition ( ) { $ form = $ this -> _form ; $ form -> addElement ( 'text' , 'server' , get_string ( 'server' , 'cachestore_redis' ) , array ( 'size' => 24 ) ) ; $ form -> setType ( 'server' , PARAM_TEXT ) ; $ form -> addHelpButton ( 'server' , 'server' , 'cachestore_redis' ) ; $ form ->... | Builds the form for creating an instance . |
33,785 | public function getBestCachingStrategy ( $ sharedStringsUniqueCount , $ tempFolder = null ) { if ( $ this -> isInMemoryStrategyUsageSafe ( $ sharedStringsUniqueCount ) ) { return new InMemoryStrategy ( $ sharedStringsUniqueCount ) ; } else { return new FileBasedStrategy ( $ tempFolder , self :: MAX_NUM_STRINGS_PER_TEMP... | Returns the best caching strategy given the number of unique shared strings and the amount of memory available . |
33,786 | protected function isInMemoryStrategyUsageSafe ( $ sharedStringsUniqueCount ) { if ( $ sharedStringsUniqueCount === null ) { return false ; } $ memoryAvailable = $ this -> getMemoryLimitInKB ( ) ; if ( $ memoryAvailable === - 1 ) { return ( $ sharedStringsUniqueCount < self :: MAX_NUM_STRINGS_PER_TEMP_FILE ) ; } else {... | Returns whether it is safe to use in - memory caching given the number of unique shared strings and the amount of memory available . |
33,787 | protected function getMemoryLimitInKB ( ) { $ memoryLimitFormatted = $ this -> getMemoryLimitFromIni ( ) ; $ memoryLimitFormatted = strtolower ( trim ( $ memoryLimitFormatted ) ) ; if ( $ memoryLimitFormatted === '-1' ) { return - 1 ; } if ( preg_match ( '/(\d+)([bkmgt])b?/' , $ memoryLimitFormatted , $ matches ) ) { $... | Returns the PHP memory_limit in Kilobytes |
33,788 | protected static function delete_user_data ( int $ userid , \ context $ context ) { global $ DB ; $ DB -> delete_records ( 'user_password_history' , [ 'userid' => $ userid ] ) ; $ DB -> delete_records ( 'user_lastaccess' , [ 'userid' => $ userid ] ) ; $ DB -> delete_records ( 'user_password_resets' , [ 'userid' => $ us... | Deletes non vital information about a user . |
33,789 | protected static function export_password_resets ( int $ userid , \ context $ context ) { global $ DB ; $ records = $ DB -> get_records ( 'user_password_resets' , [ 'userid' => $ userid ] ) ; if ( ! empty ( $ records ) ) { $ passwordresets = ( object ) array_map ( function ( $ record ) { return [ 'timerequested' => tra... | Exports information about password resets . |
33,790 | protected static function export_user_devices ( int $ userid , \ context $ context ) { global $ DB ; $ records = $ DB -> get_records ( 'user_devices' , [ 'userid' => $ userid ] ) ; if ( ! empty ( $ records ) ) { $ userdevices = ( object ) array_map ( function ( $ record ) { return [ 'appid' => $ record -> appid , 'name... | Exports information about the user s mobile devices . |
33,791 | protected static function export_course_requests ( int $ userid , \ context $ context ) { global $ DB ; $ sql = "SELECT cr.shortname, cr.fullname, cr.summary, cc.name AS category, cr.reason FROM {course_request} cr JOIN {course_categories} cc ON cr.category = cc.id WHER... | Exports information about course requests this user made . |
33,792 | protected static function export_password_history ( int $ userid , \ context $ context ) { global $ DB ; $ recordcount = $ DB -> count_records ( 'user_password_history' , [ 'userid' => $ userid ] ) ; if ( $ recordcount ) { $ passwordhistory = ( object ) [ 'password_history_count' => $ recordcount ] ; writer :: with_con... | Get details about the user s password history . |
33,793 | protected static function export_user_session_data ( int $ userid , \ context $ context ) { global $ DB , $ SESSION ; $ records = $ DB -> get_records ( 'sessions' , [ 'userid' => $ userid ] ) ; if ( ! empty ( $ records ) ) { $ sessiondata = ( object ) array_map ( function ( $ record ) { return [ 'state' => $ record -> ... | Exports information about the user s session . |
33,794 | protected function _doAnchors_inline_callback ( $ matches ) { $ whole_match = $ matches [ 1 ] ; $ link_text = $ this -> runSpanGamut ( $ matches [ 2 ] ) ; $ url = $ matches [ 3 ] == '' ? $ matches [ 4 ] : $ matches [ 3 ] ; $ title = & $ matches [ 7 ] ; $ attr = $ this -> doExtraAttributes ( "a" , $ dummy = & $ matches ... | Callback for inline anchors |
33,795 | protected function _doTable_leadingPipe_callback ( $ matches ) { $ head = $ matches [ 1 ] ; $ underline = $ matches [ 2 ] ; $ content = $ matches [ 3 ] ; $ content = preg_replace ( '/^ *[|]/m' , '' , $ content ) ; return $ this -> _doTable_callback ( array ( $ matches [ 0 ] , $ head , $ underline , $ content ) ) ; } | Callback for removing the leading pipe for each row |
33,796 | protected function _appendFootnotes_callback ( $ matches ) { $ node_id = $ this -> fn_id_prefix . $ matches [ 1 ] ; if ( isset ( $ this -> footnotes [ $ node_id ] ) ) { $ num = & $ this -> footnotes_numbers [ $ node_id ] ; if ( ! isset ( $ num ) ) { $ this -> footnotes_ordered [ $ node_id ] = $ this -> footnotes [ $ no... | Callback for appending footnotes |
33,797 | protected function _stripAbbreviations_callback ( $ matches ) { $ abbr_word = $ matches [ 1 ] ; $ abbr_desc = $ matches [ 2 ] ; if ( $ this -> abbr_word_re ) { $ this -> abbr_word_re .= '|' ; } $ this -> abbr_word_re .= preg_quote ( $ abbr_word ) ; $ this -> abbr_desciptions [ $ abbr_word ] = trim ( $ abbr_desc ) ; ret... | Callback for stripping abbreviations |
33,798 | public function set_observer ( $ observer ) { $ this -> observer = $ observer ; foreach ( $ this -> questionattempts as $ qa ) { $ qa -> set_observer ( $ observer ) ; } } | You should almost certainly not call this method from your code . It is for internal use only . |
33,799 | public function add_question ( question_definition $ question , $ maxmark = null ) { $ qa = new question_attempt ( $ question , $ this -> get_id ( ) , $ this -> observer , $ maxmark ) ; $ qa -> set_slot ( $ this -> next_slot_number ( ) ) ; $ this -> questionattempts [ $ this -> next_slot_number ( ) ] = $ qa ; $ this ->... | Add another question to this usage . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.