idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
33,000 | protected static function validate_assign ( $ assignid ) { global $ DB ; $ assign = $ DB -> get_record ( 'assign' , array ( 'id' => $ assignid ) , 'id' , MUST_EXIST ) ; list ( $ course , $ cm ) = get_course_and_cm_from_instance ( $ assign , 'assign' ) ; $ context = context_module :: instance ( $ cm -> id ) ; self :: va... | Utility function for validating an assign . |
33,001 | public static function view_assign ( $ assignid ) { $ warnings = array ( ) ; $ params = array ( 'assignid' => $ assignid , ) ; $ params = self :: validate_parameters ( self :: view_assign_parameters ( ) , $ params ) ; list ( $ assign , $ course , $ cm , $ context ) = self :: validate_assign ( $ params [ 'assignid' ] ) ... | Update the module completion status . |
33,002 | protected function getDefaultConstraintName ( $ xmldb_table , $ xmldb_field ) { $ tablename = $ this -> getTableName ( $ xmldb_table ) ; $ fieldname = $ xmldb_field -> getName ( ) ; if ( $ default = $ this -> mdb -> get_record_sql ( "SELECT object_id, object_name(default_object_id) AS defaultconstraint ... | Given one xmldb_table and one xmldb_field returns the name of its default constraint in DB or false if not found This function should be considered internal and never used outside from generator |
33,003 | protected function setConfig ( $ cfg ) { if ( isset ( $ cfg [ 'die_for_errors' ] ) ) { $ this -> cfg [ 'die_for_errors' ] = ! ! $ cfg [ 'die_for_errors' ] ; } if ( isset ( $ cfg [ 'ignore_filter_decoding_errors' ] ) ) { $ this -> cfg [ 'ignore_filter_decoding_errors' ] = ! ! $ cfg [ 'ignore_filter_decoding_errors' ] ; ... | Set the configuration parameters . |
33,004 | public function duplicate_rule ( $ finalcourseid ) { $ rule = fullclone ( $ this -> rule ) ; unset ( $ rule -> id ) ; $ rule -> courseid = $ finalcourseid ; $ time = time ( ) ; $ rule -> timecreated = $ time ; $ rule -> timemodified = $ time ; rule_manager :: add_rule ( $ rule ) ; } | Api to duplicate a rule in a given courseid . |
33,005 | public function get_subscribe_options ( $ courseid ) { global $ CFG ; $ url = new \ moodle_url ( $ CFG -> wwwroot . '/admin/tool/monitor/index.php' , array ( 'courseid' => $ courseid , 'ruleid' => $ this -> id , 'action' => 'subscribe' , 'sesskey' => sesskey ( ) ) ) ; if ( strpos ( $ this -> plugin , 'mod_' ) !== 0 ) {... | Gets the rule subscribe options for a given course and rule . |
33,006 | public function subscribe_user ( $ courseid , $ cmid , $ userid = 0 ) { global $ USER ; if ( $ this -> courseid != $ courseid && $ this -> courseid != 0 ) { throw new \ coding_exception ( 'Can not subscribe to rules from a different course' ) ; } if ( $ cmid !== 0 ) { $ cms = get_fast_modinfo ( $ courseid ) ; $ cminfo ... | Subscribe an user to this rule . |
33,007 | public function get_mform_set_data ( ) { if ( ! empty ( $ this -> rule ) ) { $ rule = fullclone ( $ this -> rule ) ; $ rule -> description = array ( 'text' => $ rule -> description , 'format' => $ rule -> descriptionformat ) ; $ rule -> template = array ( 'text' => $ rule -> template , 'format' => $ rule -> templatefor... | Return the rule data to be used while setting mform . |
33,008 | public static function list_components ( ) { $ list [ 'moodle' ] = 'core' ; $ coresubsystems = core_component :: get_core_subsystems ( ) ; ksort ( $ coresubsystems ) ; foreach ( $ coresubsystems as $ name => $ location ) { $ list [ $ name ] = 'core_' . $ name ; } $ plugintypes = core_component :: get_plugin_types ( ) ;... | Returns a list of all components installed on the server |
33,009 | public static function checkin ( $ lang ) { global $ DB , $ USER , $ CFG ; require_once ( $ CFG -> libdir . '/filelib.php' ) ; if ( $ lang !== clean_param ( $ lang , PARAM_LANG ) ) { return false ; } $ sql = "SELECT s.*, c.name AS component FROM {tool_customlang} s JOIN {tool_customlan... | Exports the translator database into disk files |
33,010 | protected static function dump_strings ( $ lang , $ component , $ strings ) { global $ CFG ; if ( $ lang !== clean_param ( $ lang , PARAM_LANG ) ) { debugging ( 'Unable to dump local strings for non-installed language pack .' . s ( $ lang ) ) ; return false ; } if ( $ component !== clean_param ( $ component , PARAM_COM... | Writes strings into a local language pack file |
33,011 | protected static function get_component_filename ( $ component ) { if ( is_null ( self :: $ components ) ) { self :: $ components = self :: list_components ( ) ; } $ return = false ; foreach ( self :: $ components as $ legacy => $ normalized ) { if ( $ component === $ normalized ) { $ return = $ legacy . '.php' ; break... | Returns the name of the file where the component s local strings should be exported into |
33,012 | public static function save_filter ( stdclass $ data , stdclass $ persistant ) { if ( ! isset ( $ persistant -> tool_customlang_filter ) ) { $ persistant -> tool_customlang_filter = array ( ) ; } foreach ( $ data as $ key => $ value ) { if ( $ key !== 'submit' ) { $ persistant -> tool_customlang_filter [ $ key ] = seri... | Saves filter data into a persistant storage such as user session |
33,013 | public static function load_filter ( stdclass $ persistant ) { $ data = new stdclass ( ) ; if ( isset ( $ persistant -> tool_customlang_filter ) ) { foreach ( $ persistant -> tool_customlang_filter as $ key => $ value ) { $ data -> { $ key } = unserialize ( $ value ) ; } } return $ data ; } | Loads the previously saved filter settings from a persistent storage |
33,014 | public function add_item ( $ key , $ title , moodle_url $ url , $ method ) { if ( isset ( $ this -> items [ $ key ] ) ) { throw new coding_exception ( 'Menu item already exists' ) ; } if ( empty ( $ title ) or empty ( $ key ) ) { throw new coding_exception ( 'Empty title or item key not allowed' ) ; } $ item = new stdc... | Adds item into the menu |
33,015 | private static function get_assignment_from_param ( $ assignment ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/mod/assign/locallib.php' ) ; if ( ! is_object ( $ assignment ) ) { $ cm = get_coursemodule_from_instance ( 'assign' , $ assignment , 0 , false , MUST_EXIST ) ; $ context = \ context_module :: instance... | This function will take an int or an assignment instance and return an assignment instance . It is just for convenience . |
33,016 | private static function hash ( $ assignment , $ userid , $ attemptnumber ) { if ( is_object ( $ assignment ) ) { $ assignmentid = $ assignment -> get_instance ( ) -> id ; } else { $ assignmentid = $ assignment ; } return sha1 ( $ assignmentid . '_' . $ userid . '_' . $ attemptnumber ) ; } | Get a hash that will be unique and can be used in a path name . |
33,017 | protected static function strip_images ( $ html ) { $ dom = new DOMDocument ( ) ; libxml_use_internal_errors ( true ) ; $ dom -> loadHTML ( '<?xml version="1.0" encoding="UTF-8" ?>' . $ html ) ; libxml_clear_errors ( ) ; if ( $ imgnodes = $ dom -> getElementsByTagName ( 'img' ) ) { for ( $ i = ( $ imgnodes -> length - ... | Use a DOM parser to accurately replace images with their alt text . |
33,018 | public static function get_combined_document_for_attempt ( $ assignment , $ userid , $ attemptnumber ) { global $ USER , $ DB ; $ assignment = self :: get_assignment_from_param ( $ assignment ) ; if ( ! $ assignment -> can_view_submission ( $ userid ) ) { print_error ( 'nopermission' ) ; } $ grade = $ assignment -> get... | Fetch the current combined document ready for state checking . |
33,019 | public static function get_combined_pdf_for_attempt ( $ assignment , $ userid , $ attemptnumber ) { $ document = self :: get_combined_document_for_attempt ( $ assignment , $ userid , $ attemptnumber ) ; if ( $ document -> get_status ( ) === combined_document :: STATUS_COMPLETE ) { return $ document ; } else { $ grade =... | This function return the combined pdf for all valid submission files . |
33,020 | public static function page_number_for_attempt ( $ assignment , $ userid , $ attemptnumber , $ readonly = false ) { global $ CFG ; require_once ( $ CFG -> libdir . '/pdflib.php' ) ; $ assignment = self :: get_assignment_from_param ( $ assignment ) ; if ( ! $ assignment -> can_view_submission ( $ userid ) ) { print_erro... | This function will return the number of pages of a pdf . |
33,021 | protected static function get_downloadable_feedback_filename ( $ assignment , $ userid , $ attemptnumber ) { global $ DB ; $ assignment = self :: get_assignment_from_param ( $ assignment ) ; $ groupmode = groups_get_activity_groupmode ( $ assignment -> get_course_module ( ) ) ; $ groupname = '' ; if ( $ groupmode ) { $... | This function returns sensible filename for a feedback file . |
33,022 | public static function copy_pages_to_readonly_area ( $ assignment , $ grade ) { $ fs = get_file_storage ( ) ; $ assignment = self :: get_assignment_from_param ( $ assignment ) ; $ contextid = $ assignment -> get_context ( ) -> id ; $ component = 'assignfeedback_editpdf' ; $ itemid = $ grade -> id ; $ originalfiles = $ ... | Copy the pages image to the readonly area . |
33,023 | public static function delete_feedback_document ( $ assignment , $ userid , $ attemptnumber ) { $ assignment = self :: get_assignment_from_param ( $ assignment ) ; if ( ! $ assignment -> can_view_submission ( $ userid ) ) { print_error ( 'nopermission' ) ; } if ( ! $ assignment -> can_grade ( ) ) { print_error ( 'noper... | This function deletes the generated pdf for a student . |
33,024 | private static function get_files ( $ assignment , $ userid , $ attemptnumber , $ filearea , $ filepath = '/' ) { $ grade = $ assignment -> get_user_grade ( $ userid , true , $ attemptnumber ) ; $ itemid = $ grade -> id ; $ contextid = $ assignment -> get_context ( ) -> id ; $ component = self :: COMPONENT ; $ fs = get... | Get All files in a File area |
33,025 | public static function rotate_page ( $ assignment , $ userid , $ attemptnumber , $ index , $ rotateleft ) { $ assignment = self :: get_assignment_from_param ( $ assignment ) ; $ grade = $ assignment -> get_user_grade ( $ userid , true , $ attemptnumber ) ; if ( ! $ assignment -> can_view_submission ( $ userid ) ) { pri... | This function rotate a page and mark the page as rotated . |
33,026 | public function definition ( ) { global $ CFG ; $ mform = $ this -> _form ; $ mform -> addElement ( 'header' , 'general' , get_string ( 'general' , 'form' ) ) ; $ mform -> addElement ( 'text' , 'name' , get_string ( 'chatname' , 'chat' ) , array ( 'size' => '64' ) ) ; if ( ! empty ( $ CFG -> formatstringstriptags ) ) {... | Define the chat activity settings form |
33,027 | public function update_grading_grades ( stdclass $ settings , $ restrict = null ) { global $ DB ; if ( empty ( $ this -> settings ) ) { $ record = new stdclass ( ) ; $ record -> workshopid = $ this -> workshop -> id ; $ record -> comparison = $ settings -> comparison ; $ DB -> insert_record ( 'workshopeval_best_setting... | Calculates the grades for assessment and updates gradinggrade fields in workshop_assessments table |
33,028 | protected function process_assessments ( array $ assessments , array $ diminfo , stdclass $ settings ) { global $ DB ; if ( empty ( $ assessments ) ) { return ; } $ assessments = $ this -> prepare_data_from_recordset ( $ assessments ) ; $ assessments = $ this -> normalize_grades ( $ assessments , $ diminfo ) ; $ averag... | Given a list of all assessments of a single submission updates the grading grades in database |
33,029 | protected function prepare_data_from_recordset ( $ assessments ) { $ data = array ( ) ; foreach ( $ assessments as $ a ) { $ id = $ a -> assessmentid ; if ( ! isset ( $ data [ $ id ] ) ) { $ data [ $ id ] = new stdclass ( ) ; $ data [ $ id ] -> assessmentid = $ a -> assessmentid ; $ data [ $ id ] -> weight = $ a -> ass... | Prepares a structure of assessments and given grades |
33,030 | protected function normalize_grades ( array $ assessments , array $ diminfo ) { foreach ( $ assessments as $ asid => $ assessment ) { foreach ( $ assessment -> dimgrades as $ dimid => $ dimgrade ) { $ dimmin = $ diminfo [ $ dimid ] -> min ; $ dimmax = $ diminfo [ $ dimid ] -> max ; if ( $ dimmin == $ dimmax ) { $ asses... | Normalizes the dimension grades to the interval 0 . 00000 - 100 . 00000 |
33,031 | protected function average_assessment ( array $ assessments ) { $ sumdimgrades = array ( ) ; foreach ( $ assessments as $ a ) { foreach ( $ a -> dimgrades as $ dimid => $ dimgrade ) { if ( ! isset ( $ sumdimgrades [ $ dimid ] ) ) { $ sumdimgrades [ $ dimid ] = 0 ; } $ sumdimgrades [ $ dimid ] += $ dimgrade * $ a -> wei... | Given a set of a submission s assessments returns a hypothetical average assessment |
33,032 | protected function weighted_variance ( array $ assessments ) { $ first = reset ( $ assessments ) ; if ( empty ( $ first ) ) { return null ; } $ dimids = array_keys ( $ first -> dimgrades ) ; $ asids = array_keys ( $ assessments ) ; $ vars = array ( ) ; foreach ( $ dimids as $ dimid ) { $ n = 0 ; $ s = 0 ; $ sumweight =... | Given a set of a submission s assessments returns standard deviations of all their dimensions |
33,033 | protected function assessments_distance ( stdclass $ assessment , stdclass $ referential , array $ diminfo , stdclass $ settings ) { $ distance = 0 ; $ n = 0 ; foreach ( array_keys ( $ assessment -> dimgrades ) as $ dimid ) { $ agrade = $ assessment -> dimgrades [ $ dimid ] ; $ rgrade = $ referential -> dimgrades [ $ d... | Measures the distance of the assessment from a referential one |
33,034 | protected function definition_sub ( ) { $ mform = $ this -> _form ; $ plugindefaults = get_config ( 'workshopeval_best' ) ; $ current = $ this -> _customdata [ 'current' ] ; $ options = array ( ) ; for ( $ i = 9 ; $ i >= 1 ; $ i = $ i - 2 ) { $ options [ $ i ] = get_string ( 'comparisonlevel' . $ i , 'workshopeval_best... | Defines specific fields for this evaluation method . |
33,035 | public function execute ( ) { global $ CFG , $ DB ; $ now = time ( ) ; mtrace ( ' processing workshop subplugins ...' ) ; $ workshops = $ DB -> get_records_select ( "workshop" , "phase = 20 AND phaseswitchassessment = 1 AND submissionend > 0 AND submissionend < ?" , [ $ now ] ) ; if ( ! empty ( $ workshops ) ) { mtrace... | Run workshop cron . |
33,036 | protected function get_subplugin_handler ( $ subplugin ) { global $ CFG ; if ( is_null ( $ this -> subpluginhandlers ) ) { $ this -> subpluginhandlers = array ( ) ; $ subplugins = core_component :: get_plugin_list ( 'assignment' ) ; foreach ( $ subplugins as $ name => $ dir ) { $ handlerfile = $ dir . '/backup/moodle1/... | Factory method returning the handler of the given assignment subplugin |
33,037 | protected function definition ( ) { $ mform = $ this -> _form ; $ data = $ this -> _customdata ; $ options = array ( ) ; $ group = get_string ( 'other' ) ; $ options [ $ group ] = array ( ) ; $ options [ $ group ] [ 0 ] = get_string ( 'norole' , 'core_role' ) ; $ group = get_string ( 'role' , 'core' ) ; $ options [ $ g... | Definition of this form . |
33,038 | public function validation ( $ data , $ files ) { $ errors = parent :: validation ( $ data , $ files ) ; if ( $ files = $ this -> get_draft_files ( 'rolepreset' ) ) { $ file = reset ( $ files ) ; $ xml = $ file -> get_content ( ) ; if ( ! core_role_preset :: is_valid_preset ( $ xml ) ) { $ errors [ 'rolepreset' ] = get... | Validate this form . |
33,039 | public function render_form_filemanager ( $ fm ) { $ html = $ this -> fm_print_generallayout ( $ fm ) ; $ module = array ( 'name' => 'form_filemanager' , 'fullpath' => '/lib/form/filemanager.js' , 'requires' => array ( 'moodle-core-notification-dialogue' , 'core_filepicker' , 'base' , 'io-base' , 'node' , 'json' , 'cor... | Prints the file manager and initializes all necessary libraries |
33,040 | protected function fm_print_generallayout ( $ fm ) { $ context = [ 'client_id' => $ fm -> options -> client_id , 'helpicon' => $ this -> help_icon ( 'setmainfile' , 'repository' ) , 'restrictions' => $ this -> fm_print_restrictions ( $ fm ) ] ; return $ this -> render_from_template ( 'core/filemanager_page_generallayou... | Returns html for displaying one file manager |
33,041 | public function filemanager_js_templates ( ) { $ class_methods = get_class_methods ( $ this ) ; $ templates = array ( ) ; foreach ( $ class_methods as $ method_name ) { if ( preg_match ( '/^fm_js_template_(.*)$/' , $ method_name , $ matches ) ) $ templates [ $ matches [ 1 ] ] = $ this -> $ method_name ( ) ; } return $ ... | Returns all FileManager JavaScript templates as an array . |
33,042 | protected function fm_print_restrictions ( $ fm ) { $ maxbytes = display_size ( $ fm -> options -> maxbytes ) ; $ strparam = ( object ) array ( 'size' => $ maxbytes , 'attachments' => $ fm -> options -> maxfiles , 'areasize' => display_size ( $ fm -> options -> areamaxbytes ) ) ; $ hasmaxfiles = ! empty ( $ fm -> optio... | Displays restrictions for the file manager |
33,043 | private function print_heading ( ) { $ fontfamily = $ this -> pdf -> getFontFamily ( ) ; $ fontstyle = $ this -> pdf -> getFontStyle ( ) ; $ this -> pdf -> SetFont ( $ fontfamily , 'B' ) ; $ rowheight = 0 ; foreach ( $ this -> columns as $ columns ) { $ rowheight = max ( $ rowheight , $ this -> pdf -> getStringHeight (... | Prints the heading row . |
33,044 | private function get_role_name ( $ rid ) { global $ DB , $ PAGE ; $ rec = $ DB -> get_record ( 'role' , array ( 'id' => $ rid ) ) ; if ( $ rec ) { return role_get_name ( $ rec , $ PAGE -> context , ROLENAME_ALIAS ) ; } else { return null ; } } | Gets role name . If no such role exists this function returns null . |
33,045 | public static function define_decode_contents ( ) { $ prefix = 'qtype_' . self :: qtype_name ( ) ; $ contents = array ( ) ; $ fields = array ( 'correctfeedback' , 'partiallycorrectfeedback' , 'incorrectfeedback' ) ; $ contents [ ] = new restore_decode_content ( $ prefix , $ fields , $ prefix ) ; return $ contents ; } | Return the contents of this qtype to be processed by the links decoder |
33,046 | public static function get_status_list ( ) { static $ list = null ; if ( $ list === null ) { $ list = array ( self :: STATUS_IDLE => self :: get_status_name ( self :: STATUS_IDLE ) , self :: STATUS_WAITING_FOR_REVIEW => self :: get_status_name ( self :: STATUS_WAITING_FOR_REVIEW ) , self :: STATUS_IN_REVIEW => self :: ... | Get list of competency status . |
33,047 | protected function validate_reviewerid ( $ value ) { global $ DB ; if ( $ value !== null && ! $ DB -> record_exists ( 'user' , array ( 'id' => $ value ) ) ) { return new lang_string ( 'invaliduserid' , 'error' ) ; } return true ; } | Validate the reviewer ID . |
33,048 | public static function can_comment_user ( $ userid ) { global $ USER ; $ capabilities = array ( 'moodle/competency:usercompetencycomment' ) ; if ( $ USER -> id == $ userid ) { $ capabilities [ ] = 'moodle/competency:usercompetencycommentown' ; } if ( has_any_capability ( $ capabilities , context_user :: instance ( $ us... | Can the current user comment on a user s competency? |
33,049 | public static function can_grade_user_in_course ( $ userid , $ courseid ) { $ ratecap = 'moodle/competency:competencygrade' ; return has_capability ( $ ratecap , context_course :: instance ( $ courseid ) ) || static :: can_grade_user ( $ userid ) ; } | Can the current user grade a user s user competency in a course? |
33,050 | public static function can_read_user_in_course ( $ userid , $ courseid ) { $ capability = 'moodle/competency:usercompetencyview' ; return has_capability ( $ capability , context_course :: instance ( $ courseid ) ) || static :: can_read_user ( $ userid ) ; } | Can the current user read the user competencies of a user in a course? |
33,051 | public static function can_read_user ( $ userid ) { $ capability = 'moodle/competency:usercompetencyview' ; return has_capability ( $ capability , context_user :: instance ( $ userid ) ) || plan :: can_read_user ( $ userid ) ; } | Can the current user read a user s competency? |
33,052 | public static function get_competency_by_usercompetencyid ( $ id ) { global $ DB ; $ sql = "SELECT c.* FROM {" . self :: TABLE . "} uc JOIN {" . competency :: TABLE . "} c ON c.id = uc.competencyid WHERE uc.id = ?" ; $ record = $ DB -> get_record_sql ... | Fetch a competency by user competency ID . |
33,053 | public static function get_multiple ( $ userid , array $ competenciesorids = null ) { global $ DB ; $ params = array ( ) ; $ params [ 'userid' ] = $ userid ; $ sql = '1 = 1' ; if ( ! empty ( $ competenciesorids ) ) { $ test = reset ( $ competenciesorids ) ; if ( is_number ( $ test ) ) { $ ids = $ competenciesorids ; } ... | Get multiple user_competency for a user . |
33,054 | public static function has_records_for_framework ( $ frameworkid ) { global $ DB ; $ sql = "SELECT 'x' FROM {" . self :: TABLE . "} uc JOIN {" . competency :: TABLE . "} c ON uc.competencyid = c.id WHERE c.competencyframeworkid = ?" ; $ params = array... | Checks if any of the competencies of a framework has a user competency record . |
33,055 | public function get_files ( ) { $ fs = get_file_storage ( ) ; $ files = $ fs -> get_area_files ( $ this -> get_context ( ) -> id , 'core_competency' , 'userevidence' , $ this -> get ( 'id' ) , 'filename' , false ) ; return $ files ; } | Return the files associated with this evidence . |
33,056 | public static function can_read_user ( $ evidenceuserid ) { $ context = context_user :: instance ( $ evidenceuserid ) ; $ capabilities = array ( 'moodle/competency:userevidenceview' ) ; return has_any_capability ( $ capabilities , $ context ) || self :: can_manage_user ( $ evidenceuserid ) ; } | Can the current user view a user s evidence? |
33,057 | public function display_publish_anonymous ( $ choices , $ displaylayout ) { global $ OUTPUT ; $ count = 0 ; $ data = [ ] ; $ numberofuser = 0 ; $ percentageamount = 0 ; foreach ( $ choices -> options as $ optionid => $ option ) { if ( ! empty ( $ option -> user ) ) { $ numberofuser = count ( $ option -> user ) ; } if (... | Generate the choice result chart . |
33,058 | public function use_editor ( $ elementid , array $ options = null , $ fpoptions = null ) { global $ PAGE , $ CFG ; if ( $ CFG -> debugdeveloper ) { $ PAGE -> requires -> js ( new moodle_url ( '/lib/editor/tinymce/tiny_mce/' . $ this -> version . '/tiny_mce_src.js' ) ) ; } else { $ PAGE -> requires -> js ( new moodle_ur... | Use this editor for give element . |
33,059 | public static function parse_toolbar_setting ( $ customtoolbar ) { $ result = array ( ) ; $ customtoolbar = trim ( $ customtoolbar ) ; if ( $ customtoolbar === '' ) { return $ result ; } $ customtoolbar = str_replace ( "\r" , "\n" , $ customtoolbar ) ; $ customtoolbar = strtolower ( $ customtoolbar ) ; $ i = 0 ; foreac... | Parse the custom toolbar setting . |
33,060 | private function get_axis ( $ type , $ index , $ createifnotexists ) { $ isx = $ type === 'x' ; if ( $ isx ) { $ axis = isset ( $ this -> xaxes [ $ index ] ) ? $ this -> xaxes [ $ index ] : null ; } else { $ axis = isset ( $ this -> yaxes [ $ index ] ) ? $ this -> yaxes [ $ index ] : null ; } if ( $ axis === null ) { i... | Get an axis . |
33,061 | public function set_xaxis ( chart_axis $ axis , $ index = 0 ) { $ this -> validate_axis ( 'x' , $ axis , $ index ) ; return $ this -> xaxes [ $ index ] = $ axis ; } | Set an X axis . |
33,062 | public function set_yaxis ( chart_axis $ axis , $ index = 0 ) { $ this -> validate_axis ( 'y' , $ axis , $ index ) ; return $ this -> yaxes [ $ index ] = $ axis ; } | Set an Y axis . |
33,063 | protected function validate_axis ( $ xy , chart_axis $ axis , $ index = 0 ) { if ( $ index > 0 ) { $ axes = $ xy == 'x' ? $ this -> xaxes : $ this -> yaxes ; if ( ! isset ( $ axes [ $ index - 1 ] ) ) { throw new coding_exception ( 'Missing ' . $ xy . ' axis at index lower than ' . $ index ) ; } } } | Validate an axis . |
33,064 | protected function add_event_repeat_elements ( $ mform ) { $ event = $ this -> _customdata [ 'event' ] ; $ mform -> addElement ( 'hidden' , 'repeatid' ) ; $ mform -> setType ( 'repeatid' , PARAM_INT ) ; if ( ! empty ( $ event -> repeatid ) ) { $ group = [ ] ; $ group [ ] = $ mform -> createElement ( 'radio' , 'repeated... | Add the repeat elements for the form when editing an existing event . |
33,065 | private function createCommand ( Server $ server ) { $ cmd = [ 'aggregate' => isset ( $ this -> collectionName ) ? $ this -> collectionName : 1 , 'pipeline' => $ this -> pipeline , ] ; $ cmdOptions = [ ] ; $ cmd [ 'allowDiskUse' ] = $ this -> options [ 'allowDiskUse' ] ; if ( isset ( $ this -> options [ 'bypassDocument... | Create the aggregate command . |
33,066 | public function calculate_sample ( $ sampleid , $ sampleorigin , $ notusedstarttime = false , $ notusedendtime = false ) { $ course = $ this -> retrieve ( 'course' , $ sampleid ) ; $ cm = $ this -> retrieve ( 'course_modules' , $ sampleid ) ; $ completion = new \ completion_info ( $ course ) ; if ( ! $ completion -> is... | Is completion enabled? Work both with courses and activities . |
33,067 | public function set_condition ( $ conditionparam , $ conditionvalue ) { if ( $ this -> get_parent ( ) && $ this -> get_parent ( ) -> get_parent ( ) && $ conditionparam !== null ) { $ this -> procconditionparam = $ this -> find_element ( $ conditionparam ) ; } $ this -> conditionparam = $ conditionparam ; $ this -> cond... | Sets the condition for this optigroup |
33,068 | public function process ( $ processor ) { if ( ! $ processor instanceof base_processor ) { throw new base_element_struct_exception ( 'incorrect_processor' ) ; } $ iterator = $ this -> get_iterator ( $ processor ) ; $ itcounter = 0 ; foreach ( $ iterator as $ key => $ values ) { $ this -> fill_values ( $ values ) ; fore... | process one optigroup_element |
33,069 | protected function set_parent ( $ element ) { parent :: set_parent ( $ element ) ; $ this -> set_condition ( $ this -> conditionparam , $ this -> conditionvalue ) ; } | Set the parent of the optigroup_element and at the same time process the condition param |
33,070 | public static function size_for_name ( $ sizename ) { for ( $ size = self :: MIN_SIZE ; $ size <= self :: MAX_SIZE ; $ size ++ ) { if ( $ sizename == get_string ( 'shortsize_' . $ size , 'tool_generator' ) ) { return $ size ; } } throw new coding_exception ( "Unknown size name '$sizename'" ) ; } | Converts a size name into the numeric constant . |
33,071 | protected function log ( $ langstring , $ a = null , $ leaveopen = false ) { if ( ! $ this -> progress ) { return ; } if ( CLI_SCRIPT ) { echo '* ' ; } else { echo html_writer :: start_tag ( 'li' ) ; } echo get_string ( 'progress_' . $ langstring , 'tool_generator' , $ a ) ; if ( ! $ leaveopen ) { if ( CLI_SCRIPT ) { e... | Displays information as part of progress . |
33,072 | protected function dot ( $ number , $ total ) { if ( ! $ this -> progress ) { return ; } $ now = time ( ) ; if ( $ now == $ this -> lastdot ) { return ; } $ this -> lastdot = $ now ; if ( CLI_SCRIPT ) { echo '.' ; } else { echo ' . ' ; } if ( $ now - $ this -> lastpercentage >= 30 ) { echo round ( 100.0 * $ number / $ ... | Outputs dots . There is up to one dot per second . Once a minute it displays a percentage . |
33,073 | function Replace ( ) { global $ ADODB_ASSOC_CASE ; $ db = $ this -> DB ( ) ; if ( ! $ db ) { return false ; } $ table = $ this -> TableInfo ( ) ; $ pkey = $ table -> keys ; foreach ( $ table -> flds as $ name => $ fld ) { $ val = $ this -> $ name ; if ( is_null ( $ val ) && ! empty ( $ fld -> auto_increment ) ) { conti... | returns 0 on error 1 on update 2 on insert |
33,074 | public static function get_tag_areas ( ) { global $ CFG , $ PAGE ; if ( empty ( $ CFG -> usetags ) ) { throw new moodle_exception ( 'tagsaredisabled' , 'tag' ) ; } $ context = context_system :: instance ( ) ; self :: validate_context ( $ context ) ; $ PAGE -> set_context ( $ context ) ; $ output = $ PAGE -> get_rendere... | Retrieves existing tag areas . |
33,075 | public static function get_tag_collections ( ) { global $ CFG , $ PAGE ; if ( empty ( $ CFG -> usetags ) ) { throw new moodle_exception ( 'tagsaredisabled' , 'tag' ) ; } $ context = context_system :: instance ( ) ; self :: validate_context ( $ context ) ; $ PAGE -> set_context ( $ context ) ; $ output = $ PAGE -> get_r... | Retrieves existing tag collections . |
33,076 | public static function get_tag_cloud ( $ tagcollid = 0 , $ isstandard = false , $ limit = 150 , $ sort = 'name' , $ search = '' , $ fromctx = 0 , $ ctx = 0 , $ rec = 1 ) { global $ CFG , $ PAGE ; $ params = self :: validate_parameters ( self :: get_tag_cloud_parameters ( ) , array ( 'tagcollid' => $ tagcollid , 'isstan... | Retrieves a tag cloud for display . |
33,077 | protected function get_glossary_cm ( ) { global $ DB ; if ( empty ( $ this -> config -> glossary ) ) { return null ; } if ( ! empty ( $ this -> glossarycm ) ) { return $ this -> glossarycm ; } if ( ! empty ( $ this -> page -> course -> id ) ) { $ modinfo = get_fast_modinfo ( $ this -> page -> course ) ; if ( isset ( $ ... | Checks if glossary is available - it should be either located in the same course or be global |
33,078 | protected function sasl_success_handler ( $ xml ) { $ this -> log -> log ( "Auth success!" ) ; $ this -> authed = true ; $ this -> reset ( ) ; } | SASL success handler |
33,079 | protected function resource_bind_handler ( $ xml ) { if ( $ xml -> attrs [ 'type' ] == 'result' ) { $ this -> log -> log ( "Bound to " . $ xml -> sub ( 'bind' ) -> sub ( 'jid' ) -> data ) ; $ this -> fulljid = $ xml -> sub ( 'bind' ) -> sub ( 'jid' ) -> data ; $ jidarray = explode ( '/' , $ this -> fulljid ) ; $ this -... | Resource bind handler |
33,080 | protected function session_start_handler ( $ xml ) { $ this -> log -> log ( "Session started" ) ; $ this -> session_started = true ; $ this -> event ( 'session_start' ) ; } | Session start handler |
33,081 | protected function tls_proceed_handler ( $ xml ) { $ this -> log -> log ( "Starting TLS encryption" ) ; stream_socket_enable_crypto ( $ this -> socket , true , STREAM_CRYPTO_METHOD_SSLv23_CLIENT ) ; $ this -> reset ( ) ; } | TLS proceed handler |
33,082 | public function getVCard ( $ jid = Null ) { $ id = $ this -> getID ( ) ; $ this -> addIdHandler ( $ id , 'vcard_get_handler' ) ; if ( $ jid ) { $ this -> send ( "<iq type='get' id='$id' to='$jid'><vCard xmlns='vcard-temp' /></iq>" ) ; } else { $ this -> send ( "<iq type='get' id='$id'><vCard xmlns='vcard-temp' /></iq>"... | Retrieves the vcard |
33,083 | protected function vcard_get_handler ( $ xml ) { $ vcard_array = array ( ) ; $ vcard = $ xml -> sub ( 'vcard' ) ; foreach ( $ vcard -> subs as $ sub ) { if ( $ sub -> subs ) { $ vcard_array [ $ sub -> name ] = array ( ) ; foreach ( $ sub -> subs as $ sub_child ) { $ vcard_array [ $ sub -> name ] [ $ sub_child -> name ]... | VCard retrieval handler |
33,084 | public function get_item ( $ itemid ) { global $ DB ; $ item = $ DB -> get_record ( 'tool_recyclebin_category' , array ( 'id' => $ itemid ) , '*' , MUST_EXIST ) ; $ item -> name = get_course_display_name_for_list ( $ item ) ; return $ item ; } | Returns an item from the recycle bin . |
33,085 | public function get_items ( ) { global $ DB ; $ items = $ DB -> get_records ( 'tool_recyclebin_category' , array ( 'categoryid' => $ this -> _categoryid ) ) ; foreach ( $ items as $ item ) { $ item -> name = get_course_display_name_for_list ( $ item ) ; } return $ items ; } | Returns a list of items in the recycle bin for this course . |
33,086 | public function store_item ( $ course ) { global $ CFG , $ DB ; require_once ( $ CFG -> dirroot . '/backup/util/includes/backup_includes.php' ) ; $ CFG -> forced_plugin_settings [ 'backup' ] = [ 'backup_auto_storage' => 0 ] ; $ user = get_admin ( ) ; $ controller = new \ backup_controller ( \ backup :: TYPE_1COURSE , $... | Store a course in the recycle bin . |
33,087 | public function out ( $ pagesize , $ useinitialsbar , $ downloadhelpbutton = '' ) { global $ PAGE ; parent :: out ( $ pagesize , $ useinitialsbar , $ downloadhelpbutton ) ; if ( has_capability ( 'moodle/course:enrolreview' , $ this -> context ) ) { $ params = [ 'contextid' => $ this -> context -> id , 'courseid' => $ t... | Render the participants table . |
33,088 | public function col_fullname ( $ data ) { global $ OUTPUT ; return $ OUTPUT -> user_picture ( $ data , array ( 'size' => 35 , 'courseid' => $ this -> course -> id , 'includefullname' => true ) ) ; } | Generate the fullname column . |
33,089 | public function col_roles ( $ data ) { global $ OUTPUT ; $ roles = isset ( $ this -> allroleassignments [ $ data -> id ] ) ? $ this -> allroleassignments [ $ data -> id ] : [ ] ; $ editable = new \ core_user \ output \ user_roles_editable ( $ this -> course , $ this -> context , $ data , $ this -> allroles , $ this -> ... | User roles column . |
33,090 | public function col_groups ( $ data ) { global $ OUTPUT ; $ usergroups = [ ] ; foreach ( $ this -> groups as $ coursegroup ) { if ( isset ( $ coursegroup -> members [ $ data -> id ] ) ) { $ usergroups [ ] = $ coursegroup -> id ; } } $ editable = new \ core_group \ output \ user_groups_editable ( $ this -> course , $ th... | Generate the groups column . |
33,091 | public function col_status ( $ data ) { global $ CFG , $ OUTPUT , $ PAGE ; $ enrolstatusoutput = '' ; $ canreviewenrol = has_capability ( 'moodle/course:enrolreview' , $ this -> context ) ; if ( $ canreviewenrol ) { $ canviewfullnames = has_capability ( 'moodle/site:viewfullnames' , $ this -> context ) ; $ fullname = f... | Generate the status column . |
33,092 | public function other_cols ( $ colname , $ data ) { if ( ! in_array ( $ colname , $ this -> extrafields ) ) { return '' ; } return s ( $ data -> { $ colname } ) ; } | This function is used for the extra user fields . |
33,093 | protected function define_referenceassessment_subplugin_structure ( ) { $ paths = array ( ) ; $ elename = $ this -> get_namefor ( 'referencegrade' ) ; $ elepath = $ this -> get_pathfor ( '/workshopform_accumulative_referencegrade' ) ; $ paths [ ] = new restore_path_element ( $ elename , $ elepath ) ; return $ paths ; } | Returns the paths to be handled by the subplugin at referenceassessment level |
33,094 | protected function define_exampleassessment_subplugin_structure ( ) { $ paths = array ( ) ; $ elename = $ this -> get_namefor ( 'examplegrade' ) ; $ elepath = $ this -> get_pathfor ( '/workshopform_accumulative_examplegrade' ) ; $ paths [ ] = new restore_path_element ( $ elename , $ elepath ) ; return $ paths ; } | Returns the paths to be handled by the subplugin at exampleassessment level |
33,095 | protected function define_assessment_subplugin_structure ( ) { $ paths = array ( ) ; $ elename = $ this -> get_namefor ( 'grade' ) ; $ elepath = $ this -> get_pathfor ( '/workshopform_accumulative_grade' ) ; $ paths [ ] = new restore_path_element ( $ elename , $ elepath ) ; return $ paths ; } | Returns the paths to be handled by the subplugin at assessment level |
33,096 | public function process_workshopform_accumulative_dimension ( $ data ) { global $ DB ; $ data = ( object ) $ data ; $ oldid = $ data -> id ; $ data -> workshopid = $ this -> get_new_parentid ( 'workshop' ) ; if ( $ data -> grade < 0 ) { $ data -> grade = - ( $ this -> get_mappingid ( 'scale' , abs ( $ data -> grade ) )... | Processes the workshopform_accumulative_dimension element |
33,097 | public function set_component ( $ component ) { $ this -> areacache = null ; list ( $ type , $ name ) = core_component :: normalize_component ( $ component ) ; $ this -> component = $ type . '_' . $ name ; } | Sets the component the manager operates on |
33,098 | public function get_component_title ( ) { $ this -> ensure_isset ( array ( 'context' , 'component' ) ) ; if ( $ this -> get_context ( ) -> contextlevel == CONTEXT_SYSTEM ) { if ( $ this -> get_component ( ) == 'core_grading' ) { $ title = '' ; } else { throw new coding_exception ( 'Unsupported component at the system c... | Returns a text describing the context and the component |
33,099 | public function get_area_title ( ) { if ( $ this -> get_context ( ) -> contextlevel == CONTEXT_SYSTEM ) { return '' ; } else if ( $ this -> get_context ( ) -> contextlevel >= CONTEXT_COURSE ) { $ this -> ensure_isset ( array ( 'context' , 'component' , 'area' ) ) ; $ areas = $ this -> get_available_areas ( ) ; if ( arr... | Returns the localized title of the currently set area |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.