idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
32,900 | public function get_versions ( ) { if ( $ this -> versions === null ) { $ policyid = $ this -> get_policy_id_filter ( ) ; $ versionid = $ this -> get_version_id_filter ( ) ; $ this -> versions = [ ] ; foreach ( $ this -> get_avaliable_policies ( ) as $ policy ) { if ( $ policyid && $ policy -> id != $ policyid ) { cont... | List of policies that match current filters |
32,901 | public function get_single_version ( ) { if ( $ this -> get_version_id_filter ( ) || $ this -> get_policy_id_filter ( ) ) { $ versions = $ this -> get_versions ( ) ; return reset ( $ versions ) ; } return null ; } | If policyid or versionid is specified return one single policy that needs to be shown |
32,902 | public function get_url ( ) { $ urlparams = [ ] ; if ( $ policyid = $ this -> get_policy_id_filter ( ) ) { $ urlparams [ 'policyid' ] = $ policyid ; } if ( $ versionid = $ this -> get_version_id_filter ( ) ) { $ urlparams [ 'versionid' ] = $ versionid ; } $ i = 0 ; foreach ( $ this -> filtersapplied as $ filter ) { if ... | Returns URL of the acceptances page with all current filters applied |
32,903 | protected function get_version_option_for_filter ( $ version ) { if ( $ version -> status == policy_version :: STATUS_ACTIVE ) { $ a = ( object ) [ 'name' => format_string ( $ version -> revision ) , 'status' => get_string ( 'status' . policy_version :: STATUS_ACTIVE , 'tool_policy' ) , ] ; return get_string ( 'filterr... | Creates an option name for the smart select for the version |
32,904 | protected function render_management ( \ core_customfield \ output \ management $ list ) { $ context = $ list -> export_for_template ( $ this ) ; return $ this -> render_from_template ( 'core_customfield/list' , $ context ) ; } | Render custom field management interface . |
32,905 | protected function render_field_data ( \ core_customfield \ output \ field_data $ field ) { $ context = $ field -> export_for_template ( $ this ) ; return $ this -> render_from_template ( 'core_customfield/field_data' , $ context ) ; } | Render single custom field value |
32,906 | public static function instance ( $ itemid , $ componentname , $ areaname , $ engine = false ) { if ( $ engine === false ) { $ search = \ core_search \ manager :: instance ( ) ; $ engine = $ search -> get_engine ( ) ; } $ pluginname = $ engine -> get_plugin_name ( ) ; if ( ! empty ( self :: $ docclassnames [ $ pluginna... | Returns the appropiate document object as it depends on the engine . |
32,907 | public function get_document ( $ record , $ options = array ( ) ) { try { $ cm = $ this -> get_cm ( 'book' , $ record -> bookid , $ record -> courseid ) ; $ context = \ context_module :: instance ( $ cm -> id ) ; } catch ( \ dml_missing_record_exception $ ex ) { debugging ( 'Error retrieving ' . $ this -> areaid . ' ' ... | Returns the document for a particular chapter . |
32,908 | public function get_doc_url ( \ core_search \ document $ doc ) { $ contextmodule = \ context :: instance_by_id ( $ doc -> get ( 'contextid' ) ) ; $ params = array ( 'id' => $ contextmodule -> instanceid , 'chapterid' => $ doc -> get ( 'itemid' ) ) ; return new \ moodle_url ( '/mod/book/view.php' , $ params ) ; } | Returns a url to the chapter . |
32,909 | public static function get_other_mapping ( ) { return [ 'stepindex' => \ core \ event \ base :: NOT_MAPPED , 'stepid' => [ 'db' => 'tool_usertours_steps' , 'restore' => \ core \ event \ base :: NOT_MAPPED , ] , 'pageurl' => \ core \ event \ base :: NOT_MAPPED , ] ; } | This is used when restoring course logs where it is required that we map the information in other to it s new value in the new course . |
32,910 | public function col_name ( $ expiredctx ) { global $ OUTPUT ; $ context = context_helper :: instance_by_id ( $ expiredctx -> get ( 'contextid' ) ) ; $ parent = $ context -> get_parent_context ( ) ; $ contextdata = ( object ) [ 'name' => $ context -> get_context_name ( false , true ) , 'parent' => $ parent -> get_contex... | The context name column . |
32,911 | public function col_info ( $ expiredctx ) { global $ OUTPUT ; $ context = context_helper :: instance_by_id ( $ expiredctx -> get ( 'contextid' ) ) ; $ children = $ context -> get_child_contexts ( ) ; if ( empty ( $ children ) ) { return get_string ( 'none' ) ; } else { $ childnames = [ ] ; foreach ( $ children as $ chi... | The context information column . |
32,912 | public function col_category ( $ expiredctx ) { $ context = context_helper :: instance_by_id ( $ expiredctx -> get ( 'contextid' ) ) ; $ category = api :: get_effective_context_category ( $ context ) ; return s ( $ category -> get ( 'name' ) ) ; } | The category name column . |
32,913 | public function col_retentionperiod ( $ expiredctx ) { $ purpose = $ this -> get_purpose_for_expiry ( $ expiredctx ) ; $ expiries = [ ] ; $ expiry = html_writer :: tag ( 'dt' , get_string ( 'default' ) , [ 'class' => 'col-sm-3' ] ) ; if ( $ expiredctx -> get ( 'defaultexpired' ) ) { $ expiries [ get_string ( 'default' ... | The retention period column . |
32,914 | public function col_select ( $ expiredctx ) { $ id = $ expiredctx -> get ( 'id' ) ; return html_writer :: checkbox ( 'expiredcontext_' . $ id , $ id , $ this -> selectall , '' , [ 'class' => 'selectcontext' ] ) ; } | Generate the select column . |
32,915 | public function col_tobedeleted ( $ expiredctx ) { if ( $ expiredctx -> is_fully_expired ( ) ) { return get_string ( 'defaultexpired' , 'tool_dataprivacy' ) ; } $ purpose = $ this -> get_purpose_for_expiry ( $ expiredctx ) ; $ a = ( object ) [ ] ; $ expiredroles = [ ] ; foreach ( $ expiredctx -> get ( 'expiredroles' ) ... | Formatting for the tobedeleted column which indicates in a friendlier fashion whose data will be removed . |
32,916 | protected function get_purpose_for_expiry ( expired_context $ expiredcontext ) : purpose { $ context = context_helper :: instance_by_id ( $ expiredcontext -> get ( 'contextid' ) ) ; if ( empty ( $ this -> purposemap [ $ context -> id ] ) ) { $ purpose = api :: get_effective_context_purpose ( $ context ) ; $ this -> pur... | Get the purpose for the specified expired context . |
32,917 | protected function preload_contexts ( array $ contextids ) { global $ DB ; if ( empty ( $ contextids ) ) { return ; } $ ctxfields = \ context_helper :: get_preload_record_columns_sql ( 'ctx' ) ; list ( $ insql , $ inparams ) = $ DB -> get_in_or_equal ( $ contextids , SQL_PARAMS_NAMED ) ; $ sql = "SELECT {$ctxfields} FR... | Preload context records given a set of contextids . |
32,918 | public function get_calculation_outcome ( $ value , $ ignoredsubtype = false ) { if ( ! self :: is_a_class ( $ value ) ) { throw new \ moodle_exception ( 'errorpredictionformat' , 'analytics' ) ; } if ( in_array ( $ value , $ this -> ignored_predicted_classes ( ) , false ) ) { return self :: OUTCOME_VERY_POSITIVE ; } i... | Is the calculated value a positive outcome of this target? |
32,919 | public function fopen ( ) { return fopen ( self :: WNAME . '://' . spl_object_hash ( $ this ) , 'rb' , false , stream_context_create ( array ( self :: WNAME => array ( 'string' => $ this ) ) ) ) ; } | Return a stream handle to this string stream . |
32,920 | public function getFileObject ( ) { return new SplFileObject ( self :: WNAME . '://' . spl_object_hash ( $ this ) , 'rb' , false , stream_context_create ( array ( self :: WNAME => array ( 'string' => $ this ) ) ) ) ; } | Return an SplFileObject representing this string stream |
32,921 | public function add_tab ( admin_settingpage $ tab ) { foreach ( $ tab -> settings as $ setting ) { $ this -> settings -> { $ setting -> name } = $ setting ; } $ this -> tabs [ ] = $ tab ; return true ; } | Add a tab . |
32,922 | public function output_html ( ) { global $ OUTPUT ; $ activetab = optional_param ( 'activetab' , '' , PARAM_TEXT ) ; $ context = array ( 'tabs' => array ( ) ) ; $ havesetactive = false ; foreach ( $ this -> get_tabs ( ) as $ tab ) { $ active = false ; if ( empty ( $ activetab ) && ! $ havesetactive ) { $ active = true ... | Generate the HTML output . |
32,923 | public function apply_expired_context_filters ( array $ expireduserids , array $ unexpireduserids ) : filtered_userlist { $ userids = $ this -> get_userids ( ) ; if ( ! empty ( $ expireduserids ) ) { $ userids = array_intersect ( $ userids , $ expireduserids ) ; } if ( ! empty ( $ unexpireduserids ) ) { $ userids = arr... | Apply filters to only remove users in the expireduserids list and to remove any who are in the unexpired list . The unexpired list wins where a user is in both lists . |
32,924 | public static function distinct_settings ( & $ systemsettings , & $ contextsettings , $ linksettings ) { if ( ! empty ( $ systemsettings ) ) { foreach ( $ systemsettings as $ key => $ value ) { if ( ( ! empty ( $ contextsettings ) && array_key_exists ( $ key , $ contextsettings ) ) || ( ! empty ( $ linksettings ) && ar... | Get the distinct settings from each level by removing any duplicates from higher levels . |
32,925 | public static function settings_to_json ( $ settings , $ simpleformat , $ type , $ resource ) { $ json = '' ; if ( ! empty ( $ resource ) ) { $ indent = '' ; if ( ! $ simpleformat ) { $ json .= " {\n \"@type\":\"{$type}\",\n" ; $ json .= " \"@id\":\"{$resource->get_endpoint()}\",\n" ; $ json .= " \"cu... | Get the JSON representation of the settings . |
32,926 | function user_login_webservice ( $ username , $ password ) { global $ CFG , $ DB ; if ( $ user = $ DB -> get_record ( 'user' , array ( 'username' => $ username , 'mnethostid' => $ CFG -> mnet_localhost_id ) ) ) { return validate_internal_user_password ( $ user , $ password ) ; } return false ; } | Custom auth hook for web services . |
32,927 | public static function external_ratings_structure ( ) { return new external_single_structure ( [ 'contextid' => new external_value ( PARAM_INT , 'Context id.' ) , 'component' => new external_value ( PARAM_COMPONENT , 'Context name.' ) , 'ratingarea' => new external_value ( PARAM_AREA , 'Rating area name.' ) , 'canviewa... | Returns the ratings definition for external functions . |
32,928 | protected function before_parsing ( ) { $ this -> toc = array ( ) ; $ this -> string = preg_replace ( '/\r\n/' , "\n" , $ this -> string ) ; $ this -> string = preg_replace ( '/\r/' , "\n" , $ this -> string ) ; $ this -> string .= "\n\n" ; if ( ! $ this -> printable && $ this -> section_editing ) { $ this -> returnval... | Before and after parsing ... |
32,929 | protected function process_toc ( ) { if ( empty ( $ this -> toc ) ) { return ; } $ toc = "" ; $ currentsection = array ( 0 , 0 , 0 ) ; $ i = 1 ; foreach ( $ this -> toc as & $ header ) { switch ( $ header [ 0 ] ) { case 1 : $ currentsection = array ( $ currentsection [ 0 ] + 1 , 0 , 0 ) ; break ; case 2 : $ currentsect... | Table of contents processing after parsing |
32,930 | protected function link ( $ link , $ anchor = "" ) { $ link = trim ( $ link ) ; if ( preg_match ( "/^(https?|s?ftp):\/\/.+$/i" , $ link ) ) { $ link = trim ( $ link , ",.?!" ) ; return array ( 'content' => $ link , 'url' => $ link ) ; } else { $ callbackargs = $ this -> linkgeneratorcallbackargs ; $ callbackargs [ 'anc... | Link internal callback |
32,931 | public static function get_imscps_by_courses ( $ courseids = array ( ) ) { global $ CFG ; $ returnedimscps = array ( ) ; $ warnings = array ( ) ; $ params = self :: validate_parameters ( self :: get_imscps_by_courses_parameters ( ) , array ( 'courseids' => $ courseids ) ) ; $ courses = array ( ) ; if ( empty ( $ params... | Returns a list of IMSCP packages in a provided list of courses if no list is provided all IMSCP packages that the user can view will be returned . |
32,932 | public static function get_imscps_by_courses_returns ( ) { return new external_single_structure ( array ( 'imscps' => new external_multiple_structure ( new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'IMSCP id' ) , 'coursemodule' => new external_value ( PARAM_INT , 'Course module id' ) ... | Describes the get_imscps_by_courses return value . |
32,933 | public static function get_potential_users_parameters ( ) { return new external_function_parameters ( array ( 'courseid' => new external_value ( PARAM_INT , 'course id' ) , 'enrolid' => new external_value ( PARAM_INT , 'enrolment id' ) , 'search' => new external_value ( PARAM_RAW , 'query' ) , 'searchanywhere' => new e... | Returns description of method parameters value |
32,934 | public static function get_potential_users ( $ courseid , $ enrolid , $ search , $ searchanywhere , $ page , $ perpage ) { global $ PAGE , $ DB , $ CFG ; require_once ( $ CFG -> dirroot . '/enrol/locallib.php' ) ; require_once ( $ CFG -> dirroot . '/user/lib.php' ) ; $ params = self :: validate_parameters ( self :: get... | Get potential users . |
32,935 | public static function get_course_enrolment_methods ( $ courseid ) { global $ DB ; $ params = self :: validate_parameters ( self :: get_course_enrolment_methods_parameters ( ) , array ( 'courseid' => $ courseid ) ) ; self :: validate_context ( context_system :: instance ( ) ) ; $ course = $ DB -> get_record ( 'course' ... | Get list of active course enrolment methods for current user . |
32,936 | public static function edit_user_enrolment ( $ courseid , $ ueid , $ status , $ timestart = 0 , $ timeend = 0 ) { global $ CFG , $ DB , $ PAGE ; $ params = self :: validate_parameters ( self :: edit_user_enrolment_parameters ( ) , [ 'courseid' => $ courseid , 'ueid' => $ ueid , 'status' => $ status , 'timestart' => $ t... | External function that updates a given user enrolment . |
32,937 | public static function unenrol_user_enrolment ( $ ueid ) { global $ CFG , $ DB , $ PAGE ; $ params = self :: validate_parameters ( self :: unenrol_user_enrolment_parameters ( ) , [ 'ueid' => $ ueid ] ) ; $ result = false ; $ errors = [ ] ; $ userenrolment = $ DB -> get_record ( 'user_enrolments' , [ 'id' => $ params [ ... | External function that unenrols a given user enrolment . |
32,938 | public static function assign_roles ( $ assignments ) { global $ DB ; $ params = self :: validate_parameters ( self :: assign_roles_parameters ( ) , array ( 'assignments' => $ assignments ) ) ; $ transaction = $ DB -> start_delegated_transaction ( ) ; foreach ( $ params [ 'assignments' ] as $ assignment ) { $ context =... | Manual role assignments to users |
32,939 | public static function unassign_roles ( $ unassignments ) { global $ DB ; $ params = self :: validate_parameters ( self :: unassign_roles_parameters ( ) , array ( 'unassignments' => $ unassignments ) ) ; $ transaction = $ DB -> start_delegated_transaction ( ) ; foreach ( $ params [ 'unassignments' ] as $ unassignment )... | Unassign roles from users |
32,940 | public static function instance ( $ reload = false , $ forceuseragent = null ) { if ( ! self :: $ instance || $ reload ) { self :: $ instance = new core_useragent ( $ forceuseragent ) ; } return self :: $ instance ; } | Get an instance of the user agent object . |
32,941 | public static function get_device_type ( ) { $ instance = self :: instance ( ) ; if ( $ instance -> devicetype === null ) { return $ instance -> guess_device_type ( ) ; } return $ instance -> devicetype ; } | Returns the device type we believe is being used . |
32,942 | protected function guess_device_type ( ) { global $ CFG ; if ( empty ( $ CFG -> enabledevicedetection ) ) { $ this -> devicetype = self :: DEVICETYPE_DEFAULT ; return $ this -> devicetype ; } foreach ( $ this -> devicetypecustoms as $ value => $ regex ) { if ( preg_match ( $ regex , $ this -> useragent ) ) { $ this -> ... | Guesses the device type the user agent is running on . |
32,943 | protected function is_useragent_mobile ( ) { $ phonesregex = '/android .+ mobile|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|... | Returns true if the user appears to be on a mobile device . |
32,944 | public static function get_device_type_list ( $ includecustomtypes = true ) { $ types = self :: $ devicetypes ; if ( $ includecustomtypes ) { $ instance = self :: instance ( ) ; $ types = array_merge ( $ types , array_keys ( $ instance -> devicetypecustoms ) ) ; } return $ types ; } | Gets a list of known device types . |
32,945 | public static function get_device_type_theme ( $ devicetype = null ) { global $ CFG ; if ( $ devicetype === null ) { $ devicetype = self :: get_device_type ( ) ; } $ themevarname = self :: get_device_type_cfg_var_name ( $ devicetype ) ; if ( empty ( $ CFG -> $ themevarname ) ) { return false ; } return $ CFG -> $ theme... | Returns the theme to use for the given device type . |
32,946 | public static function get_user_device_type ( ) { $ device = self :: get_device_type ( ) ; $ switched = get_user_preferences ( 'switchdevice' . $ device , false ) ; if ( $ switched != false ) { return $ switched ; } return $ device ; } | Gets the device type the user is currently using . |
32,947 | public static function set_user_device_type ( $ newdevice ) { $ devicetype = self :: get_device_type ( ) ; if ( $ newdevice == $ devicetype ) { unset_user_preference ( 'switchdevice' . $ devicetype ) ; return true ; } else { $ devicetypes = self :: get_device_type_list ( ) ; if ( in_array ( $ newdevice , $ devicetypes ... | Switches the device type we think the user is using to what ever was given . |
32,948 | public static function check_browser_version ( $ brand , $ version = null ) { switch ( $ brand ) { case 'MSIE' : return self :: check_ie_version ( $ version ) ; case 'Edge' : return self :: check_edge_version ( $ version ) ; case 'Firefox' : return self :: check_firefox_version ( $ version ) ; case 'Chrome' : return se... | Returns true if the user agent matches the given brand and the version is equal to or greater than that specified . |
32,949 | public static function check_gecko_version ( $ version = null ) { $ useragent = self :: get_user_agent_string ( ) ; if ( $ useragent === false ) { return false ; } if ( empty ( $ version ) ) { $ version = 1 ; } else if ( $ version > 20000000 ) { if ( preg_match ( '/^201/' , $ version ) ) { $ version = 3.6 ; } else if (... | Checks the user agent is Gecko based and that the version is equal to or greater than that specified . |
32,950 | public static function check_edge_version ( $ version = null ) { $ useragent = self :: get_user_agent_string ( ) ; if ( $ useragent === false ) { return false ; } if ( strpos ( $ useragent , 'Edge/' ) === false ) { return false ; } if ( empty ( $ version ) ) { return true ; } preg_match ( '%Edge/([\d]+)\.(.*)$%' , $ us... | Check the User Agent for the version of Edge . |
32,951 | public static function check_ie_version ( $ version = null ) { $ properties = self :: check_ie_properties ( ) ; if ( ! is_array ( $ properties ) ) { return false ; } if ( is_null ( $ version ) ) { $ version = 5.5 ; } $ version = round ( $ version , 1 ) ; return ( $ properties [ 'version' ] >= $ version ) ; } | Checks the user agent is IE and that the version is equal to or greater than that specified . |
32,952 | public static function check_webkit_android_version ( $ version = null ) { $ useragent = self :: get_user_agent_string ( ) ; if ( $ useragent === false ) { return false ; } if ( strpos ( $ useragent , 'Android' ) === false ) { return false ; } if ( empty ( $ version ) ) { return true ; } if ( preg_match ( "/AppleWebKit... | Checks the user agent is Webkit based and on Android and that the version is equal to or greater than that specified . |
32,953 | public static function get_browser_version_classes ( ) { $ classes = array ( ) ; if ( self :: is_edge ( ) ) { $ classes [ ] = 'edge' ; } else if ( self :: is_ie ( ) ) { $ classes [ ] = 'ie' ; for ( $ i = 12 ; $ i >= 6 ; $ i -- ) { if ( self :: check_ie_version ( $ i ) ) { $ classes [ ] = 'ie' . $ i ; break ; } } } else... | Gets an array of CSS classes to represent the user agent . |
32,954 | public static function supports_svg ( ) { $ instance = self :: instance ( ) ; if ( $ instance -> supportssvg === null ) { if ( $ instance -> useragent === false ) { $ instance -> supportssvg = false ; } else if ( self :: check_ie_version ( '0' ) and ! self :: check_ie_version ( '9' ) ) { $ instance -> supportssvg = fal... | Returns true if the user agent supports the display of SVG images . |
32,955 | public static function supports_json_contenttype ( ) { if ( ! self :: check_ie_version ( '0' ) ) { return true ; } if ( self :: check_ie_version ( 8 ) && ! self :: check_ie_compatibility_view ( ) ) { return true ; } return false ; } | Returns true if the user agent supports the MIME media type for JSON text as defined in RFC 4627 . |
32,956 | public function calculate ( $ sampleids , $ samplesorigin , $ starttime = false , $ endtime = false , $ existingcalculations = array ( ) ) { if ( ! PHPUNIT_TEST && CLI_SCRIPT ) { echo '.' ; } $ calculations = array ( ) ; $ newcalculations = array ( ) ; $ notnulls = array ( ) ; foreach ( $ sampleids as $ sampleid => $ u... | Calculates the indicator . |
32,957 | public function definition ( ) { global $ CFG ; $ mform = & $ this -> _form ; $ mform -> addElement ( 'header' , 'setup' , get_string ( 'registration_options' , 'lti' ) ) ; $ strrequired = get_string ( 'required' ) ; $ mform -> addElement ( 'text' , 'lti_registrationname' , get_string ( 'registrationname' , 'lti' ) ) ;... | Set up the form definition . |
32,958 | public function disable_fields ( ) { $ mform = & $ this -> _form ; $ mform -> disabledIf ( 'lti_registrationurl' , null ) ; $ mform -> disabledIf ( 'lti_capabilities' , null ) ; $ mform -> disabledIf ( 'lti_services' , null ) ; } | Set up rules for disabling fields . |
32,959 | protected function get_course_areas ( $ extensions = '*' , $ returnemptyfolders = false ) { global $ DB ; $ allareas = [ 'course_summary' , 'course_overviewfiles' , 'course_section' , 'backup_section' , 'backup_course' , 'backup_automated' , 'course_legacy' ] ; if ( $ returnemptyfolders ) { return $ allareas ; } $ para... | Returns list of areas inside this course |
32,960 | protected function get_area_course_section ( $ itemid , $ filepath , $ filename ) { global $ CFG , $ DB ; if ( ! has_capability ( 'moodle/course:update' , $ this -> context ) ) { return null ; } if ( empty ( $ itemid ) ) { return new file_info_area_course_section ( $ this -> browser , $ this -> context , $ this -> cour... | Gets a stored file for the course section filearea directory |
32,961 | protected function get_area_course_legacy ( $ itemid , $ filepath , $ filename ) { if ( ! has_capability ( 'moodle/course:managefiles' , $ this -> context ) ) { return null ; } if ( $ this -> course -> id != SITEID and $ this -> course -> legacyfiles != 2 ) { } if ( is_null ( $ itemid ) ) { return $ this ; } $ fs = get... | Gets a stored file for the course legacy filearea directory |
32,962 | protected function get_area_backup_section ( $ itemid , $ filepath , $ filename ) { global $ CFG , $ DB ; if ( ! has_capability ( 'moodle/backup:backupcourse' , $ this -> context ) and ! has_capability ( 'moodle/restore:restorecourse' , $ this -> context ) ) { return null ; } if ( empty ( $ itemid ) ) { return new file... | Gets a stored file for the backup section filearea directory |
32,963 | protected function get_child_module ( $ cm ) { $ cmid = is_object ( $ cm ) ? $ cm -> id : $ cm ; if ( ! array_key_exists ( $ cmid , $ this -> childrenmodules ) ) { $ this -> childrenmodules [ $ cmid ] = null ; if ( ! ( $ cm instanceof cm_info ) ) { $ cms = get_fast_modinfo ( $ this -> course ) -> cms ; $ cm = array_key... | Returns the child module if it is accessible by the current user |
32,964 | protected function get_module_areas_with_files ( $ extensions = '*' ) { global $ DB ; $ params1 = [ 'contextid' => $ this -> context -> id , 'emptyfilename' => '.' , 'contextlevel' => CONTEXT_MODULE , 'course' => $ this -> course -> id ] ; $ ctxfieldsas = context_helper :: get_preload_record_columns_sql ( 'ctx' ) ; $ c... | Returns list of areas inside the course modules that have files with the given extension |
32,965 | protected function get_fullmessagehtml ( $ processorname = '' ) { if ( ! empty ( $ processorname ) && isset ( $ this -> additionalcontent [ $ processorname ] ) ) { return $ this -> get_message_with_additional_content ( $ processorname , 'fullmessagehtml' ) ; } else { return $ this -> fullmessagehtml ; } } | Fullmessagehtml content including any processor specific content . |
32,966 | protected function get_fullmessage ( $ processorname = '' ) { if ( ! empty ( $ processorname ) && isset ( $ this -> additionalcontent [ $ processorname ] ) ) { return $ this -> get_message_with_additional_content ( $ processorname , 'fullmessage' ) ; } else { return $ this -> fullmessage ; } } | Fullmessage content including any processor specific content . |
32,967 | protected function get_smallmessage ( $ processorname = '' ) { if ( ! empty ( $ processorname ) && isset ( $ this -> additionalcontent [ $ processorname ] ) ) { return $ this -> get_message_with_additional_content ( $ processorname , 'smallmessage' ) ; } else { return $ this -> smallmessage ; } } | Smallmessage content including any processor specific content . |
32,968 | protected function set_customdata ( $ customdata ) { if ( ! empty ( $ this -> courseid ) && ( is_object ( $ customdata ) || is_array ( $ customdata ) ) ) { $ customdata = ( array ) $ customdata ; $ customdata [ 'courseid' ] = $ this -> courseid ; } $ this -> customdata = json_encode ( $ customdata ) ; } | Always JSON encode customdata . |
32,969 | protected function get_message_with_additional_content ( $ processorname , $ messagetype ) { $ message = $ this -> $ messagetype ; if ( isset ( $ this -> additionalcontent [ $ processorname ] [ '*' ] ) ) { $ pattern = $ this -> additionalcontent [ $ processorname ] [ '*' ] ; $ message = empty ( $ pattern [ 'header' ] )... | Helper method used to get message content added with processor specific content . |
32,970 | public function __isset ( $ prop ) { if ( in_array ( $ prop , $ this -> properties ) ) { return isset ( $ this -> $ prop ) ; } throw new \ coding_exception ( "Invalid property $prop specified" ) ; } | Magic method to check if property is set . |
32,971 | public function get_eventobject_for_processor ( $ processorname ) { $ eventdata = new \ stdClass ( ) ; foreach ( $ this -> properties as $ prop ) { $ func = "get_$prop" ; $ eventdata -> $ prop = method_exists ( $ this , $ func ) ? $ this -> $ func ( $ processorname ) : $ this -> $ prop ; } return $ eventdata ; } | Get a event object for a specific processor in stdClass format . |
32,972 | public static function set_enabled_plugins ( $ list ) { if ( empty ( $ list ) ) { $ list = [ ] ; } else if ( ! is_array ( $ list ) ) { $ list = explode ( ',' , $ list ) ; } if ( $ list ) { $ plugins = \ core_plugin_manager :: instance ( ) -> get_installed_plugins ( 'media' ) ; $ list = array_intersect ( $ list , array_... | Set the list of enabled media players in the specified sort order To be used when changing settings or in unit tests |
32,973 | public function get_rank ( ) { $ classname = '\media_' . $ this -> name . '_plugin' ; if ( class_exists ( $ classname ) ) { $ object = new $ classname ( ) ; return $ object -> get_rank ( ) ; } return 0 ; } | Returns the default rank of this plugin for default sort order |
32,974 | private static function generate_warning ( $ assignmentid , $ warningcode , $ detail ) { $ warningmessages = array ( 'couldnotlock' => 'Could not lock the submission for this user.' , 'couldnotunlock' => 'Could not unlock the submission for this user.' , 'couldnotsubmitforgrading' => 'Could not submit assignment for gr... | Generate a warning in a standard structure for a known failure . |
32,975 | private static function get_grade_structure ( $ required = VALUE_REQUIRED ) { return new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'grade id' ) , 'assignment' => new external_value ( PARAM_INT , 'assignment id' , VALUE_OPTIONAL ) , 'userid' => new external_value ( PARAM_INT , 'student... | Creates a grade single structure . |
32,976 | private static function get_assignments_assignment_structure ( ) { return new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'assignment id' ) , 'cmid' => new external_value ( PARAM_INT , 'course module id' ) , 'course' => new external_value ( PARAM_INT , 'course id' ) , 'name' => new exte... | Creates an assignment external_single_structure |
32,977 | private static function get_assignments_config_structure ( ) { return new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'assign_plugin_config id' , VALUE_OPTIONAL ) , 'assignment' => new external_value ( PARAM_INT , 'assignment id' , VALUE_OPTIONAL ) , 'plugin' => new external_value ( PAR... | Creates an assign_plugin_config external_single_structure |
32,978 | private static function get_assignments_course_structure ( ) { return new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'course id' ) , 'fullname' => new external_value ( PARAM_TEXT , 'course full name' ) , 'shortname' => new external_value ( PARAM_TEXT , 'course short name' ) , 'timemodi... | Creates a course external_single_structure |
32,979 | public static function get_submissions_parameters ( ) { return new external_function_parameters ( array ( 'assignmentids' => new external_multiple_structure ( new external_value ( PARAM_INT , 'assignment id' ) , '1 or more assignment ids' , VALUE_REQUIRED ) , 'status' => new external_value ( PARAM_ALPHA , 'status' , VA... | Describes the parameters for get_submissions |
32,980 | private static function get_plugin_structure ( ) { return new external_single_structure ( array ( 'type' => new external_value ( PARAM_TEXT , 'submission plugin type' ) , 'name' => new external_value ( PARAM_TEXT , 'submission plugin name' ) , 'fileareas' => new external_multiple_structure ( new external_single_structu... | Creates an assignment plugin structure . |
32,981 | private static function get_submission_structure ( $ required = VALUE_REQUIRED ) { return new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'submission id' ) , 'userid' => new external_value ( PARAM_INT , 'student id' ) , 'attemptnumber' => new external_value ( PARAM_INT , 'attempt number... | Creates a submission structure . |
32,982 | public static function set_user_flags_parameters ( ) { return new external_function_parameters ( array ( 'assignmentid' => new external_value ( PARAM_INT , 'assignment id' ) , 'userflags' => new external_multiple_structure ( new external_single_structure ( array ( 'userid' => new external_value ( PARAM_INT , 'student i... | Describes the parameters for set_user_flags |
32,983 | public static function set_user_flags_returns ( ) { return new external_multiple_structure ( new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'id of record if successful, -1 for failure' ) , 'userid' => new external_value ( PARAM_INT , 'userid of record' ) , 'errormessage' => new externa... | Describes the set_user_flags return value |
32,984 | private static function assign_user_flags ( ) { return new external_single_structure ( array ( 'assignmentid' => new external_value ( PARAM_INT , 'assignment id' ) , 'userflags' => new external_multiple_structure ( new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'user flag id' ) , 'user... | Creates an assign_user_flags external_single_structure |
32,985 | private static function assign_user_mappings ( ) { return new external_single_structure ( array ( 'assignmentid' => new external_value ( PARAM_INT , 'assignment id' ) , 'mappings' => new external_multiple_structure ( new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'user mapping id' ) , ... | Creates an assign_user_mappings external_single_structure |
32,986 | public static function revert_submissions_to_draft ( $ assignmentid , $ userids ) { global $ CFG ; $ params = self :: validate_parameters ( self :: revert_submissions_to_draft_parameters ( ) , array ( 'assignmentid' => $ assignmentid , 'userids' => $ userids ) ) ; list ( $ assignment , $ course , $ cm , $ context ) = s... | Reverts a list of user submissions to draft for a single assignment . |
32,987 | public static function save_user_extensions_parameters ( ) { return new external_function_parameters ( array ( 'assignmentid' => new external_value ( PARAM_INT , 'The assignment id to operate on' ) , 'userids' => new external_multiple_structure ( new external_value ( PARAM_INT , 'user id' ) , '1 or more user ids' , VAL... | Describes the parameters for save_user_extensions |
32,988 | public static function save_user_extensions ( $ assignmentid , $ userids , $ dates ) { global $ CFG ; $ params = self :: validate_parameters ( self :: save_user_extensions_parameters ( ) , array ( 'assignmentid' => $ assignmentid , 'userids' => $ userids , 'dates' => $ dates ) ) ; if ( count ( $ params [ 'userids' ] ) ... | Grant extension dates to students for an assignment . |
32,989 | public static function reveal_identities ( $ assignmentid ) { global $ CFG , $ USER ; $ params = self :: validate_parameters ( self :: reveal_identities_parameters ( ) , array ( 'assignmentid' => $ assignmentid ) ) ; list ( $ assignment , $ course , $ cm , $ context ) = self :: validate_assign ( $ params [ 'assignmenti... | Reveal the identities of anonymous students to markers for a single assignment . |
32,990 | public static function save_submission_parameters ( ) { global $ CFG ; $ instance = new assign ( null , null , null ) ; $ pluginsubmissionparams = array ( ) ; foreach ( $ instance -> get_submission_plugins ( ) as $ plugin ) { if ( $ plugin -> is_visible ( ) ) { $ pluginparams = $ plugin -> get_external_parameters ( ) ;... | Describes the parameters for save_submission |
32,991 | public static function save_submission ( $ assignmentid , $ plugindata ) { global $ CFG , $ USER ; $ params = self :: validate_parameters ( self :: save_submission_parameters ( ) , array ( 'assignmentid' => $ assignmentid , 'plugindata' => $ plugindata ) ) ; list ( $ assignment , $ course , $ cm , $ context ) = self ::... | Save a student submission for a single assignment |
32,992 | public static function save_grade_parameters ( ) { global $ CFG ; require_once ( "$CFG->dirroot/grade/grading/lib.php" ) ; $ instance = new assign ( null , null , null ) ; $ pluginfeedbackparams = array ( ) ; foreach ( $ instance -> get_feedback_plugins ( ) as $ plugin ) { if ( $ plugin -> is_visible ( ) ) { $ pluginpa... | Describes the parameters for save_grade |
32,993 | public static function save_grade ( $ assignmentid , $ userid , $ grade , $ attemptnumber , $ addattempt , $ workflowstate , $ applytoall , $ plugindata = array ( ) , $ advancedgradingdata = array ( ) ) { global $ CFG , $ USER ; $ params = self :: validate_parameters ( self :: save_grade_parameters ( ) , array ( 'assig... | Save a student grade for a single assignment . |
32,994 | public static function save_grades ( $ assignmentid , $ applytoall = false , $ grades ) { global $ CFG , $ USER ; $ params = self :: validate_parameters ( self :: save_grades_parameters ( ) , array ( 'assignmentid' => $ assignmentid , 'applytoall' => $ applytoall , 'grades' => $ grades ) ) ; list ( $ assignment , $ cou... | Save multiple student grades for a single assignment . |
32,995 | public static function copy_previous_attempt ( $ assignmentid ) { $ params = self :: validate_parameters ( self :: copy_previous_attempt_parameters ( ) , array ( 'assignmentid' => $ assignmentid ) ) ; list ( $ assignment , $ course , $ cm , $ context ) = self :: validate_assign ( $ params [ 'assignmentid' ] ) ; $ notic... | Copy a students previous attempt to a new attempt . |
32,996 | public static function view_grading_table ( $ assignid ) { $ params = self :: validate_parameters ( self :: view_grading_table_parameters ( ) , array ( 'assignid' => $ assignid ) ) ; $ warnings = array ( ) ; list ( $ assign , $ course , $ cm , $ context ) = self :: validate_assign ( $ params [ 'assignid' ] ) ; $ assign... | Trigger the grading_table_viewed event . |
32,997 | public static function view_submission_status ( $ assignid ) { $ warnings = array ( ) ; $ params = array ( 'assignid' => $ assignid , ) ; $ params = self :: validate_parameters ( self :: view_submission_status_parameters ( ) , $ params ) ; list ( $ assign , $ course , $ cm , $ context ) = self :: validate_assign ( $ pa... | Trigger the submission status viewed event . |
32,998 | public static function get_submission_status_parameters ( ) { return new external_function_parameters ( array ( 'assignid' => new external_value ( PARAM_INT , 'assignment instance id' ) , 'userid' => new external_value ( PARAM_INT , 'user id (empty for current user)' , VALUE_DEFAULT , 0 ) , 'groupid' => new external_va... | Describes the parameters for get_submission_status . |
32,999 | public static function get_participant ( $ assignid , $ userid , $ embeduser ) { global $ DB , $ CFG ; require_once ( $ CFG -> dirroot . "/mod/assign/locallib.php" ) ; require_once ( $ CFG -> dirroot . "/user/lib.php" ) ; $ params = self :: validate_parameters ( self :: get_participant_parameters ( ) , array ( 'assigni... | Get the user participating in the given assignment . An error with code usernotincourse is thrown is the user isn t a participant of the given assignment . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.