idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
30,000 | public function display ( $ course , $ orphaned ) { $ courserenderer = $ this -> page -> get_renderer ( 'core' , 'course' ) ; $ output = '' ; $ modinfo = get_fast_modinfo ( $ course ) ; if ( $ orphaned ) { if ( ! empty ( $ modinfo -> sections [ 1 ] ) ) { $ output .= $ this -> output -> heading ( get_string ( 'orphaned'... | Displays the activities list in cases when course view page is not redirected to the activity page . |
30,001 | protected function _binxor ( $ l , $ r ) { $ x = ( ( $ l < 0 ) ? ( float ) ( $ l + 4294967296 ) : ( float ) $ l ) ^ ( ( $ r < 0 ) ? ( float ) ( $ r + 4294967296 ) : ( float ) $ r ) ; return ( float ) ( ( $ x < 0 ) ? $ x + 4294967296 : $ x ) ; } | Workaround for XOR on certain systems . |
30,002 | protected function _decipher ( & $ Xl , & $ Xr ) { if ( $ Xl < 0 ) { $ Xl += 4294967296 ; } if ( $ Xr < 0 ) { $ Xr += 4294967296 ; } for ( $ i = 17 ; $ i > 1 ; -- $ i ) { $ temp = $ Xl ^ $ this -> _P [ $ i ] ; if ( $ temp < 0 ) { $ temp += 4294967296 ; } $ Xl = fmod ( ( fmod ( $ this -> _S [ 0 ] [ ( $ temp >> 24 ) & 25... | Deciphers a single 64 - bit block . |
30,003 | public function setTimeout ( $ timeout ) { $ this -> options [ CURLOPT_CONNECTTIMEOUT ] = $ timeout ; $ this -> options [ CURLOPT_TIMEOUT ] = $ timeout ; } | Set the maximum request time in seconds . |
30,004 | protected function calculate_sample ( $ sampleid , \ core_analytics \ analysable $ course , $ starttime = false , $ endtime = false ) { $ userenrol = $ this -> retrieve ( 'user_enrolments' , $ sampleid ) ; $ ccompletion = new \ completion_completion ( array ( 'userid' => $ userenrol -> userid , 'course' => $ course -> ... | Course completion sets the target value . |
30,005 | protected static function safe_normalize ( $ string ) { if ( $ string === '' ) { return '' ; } if ( ! function_exists ( 'normalizer_normalize' ) ) { return $ string ; } $ normalised = normalizer_normalize ( $ string , Normalizer :: FORM_C ) ; if ( is_null ( $ normalised ) ) { debugging ( 'Failed to normalise string: ' ... | Normalise a UTf - 8 string to FORM_C avoiding the pitfalls in PHP s normalizer_normalize function . |
30,006 | public static function create ( $ readerType ) { $ reader = null ; switch ( $ readerType ) { case Type :: CSV : $ reader = new CSV \ Reader ( ) ; break ; case Type :: XLSX : $ reader = new XLSX \ Reader ( ) ; break ; case Type :: ODS : $ reader = new ODS \ Reader ( ) ; break ; default : throw new UnsupportedTypeExcepti... | This creates an instance of the appropriate reader given the type of the file to be read |
30,007 | public function neighbouring_discussion_navigation ( $ prev , $ next ) { $ html = '' ; if ( $ prev || $ next ) { $ html .= html_writer :: start_tag ( 'div' , array ( 'class' => 'discussion-nav clearfix' ) ) ; $ html .= html_writer :: start_tag ( 'ul' ) ; if ( $ prev ) { $ url = new moodle_url ( '/mod/forum/discuss.php'... | Returns the navigation to the previous and next discussion . |
30,008 | public function subscriber_selection_form ( user_selector_base $ existinguc , user_selector_base $ potentialuc ) { $ output = '' ; $ formattributes = array ( ) ; $ formattributes [ 'id' ] = 'subscriberform' ; $ formattributes [ 'action' ] = '' ; $ formattributes [ 'method' ] = 'post' ; $ output .= html_writer :: start_... | This method is used to generate HTML for a subscriber selection form that uses two user_selector controls |
30,009 | public function subscriber_overview ( $ users , $ forum , $ course ) { $ output = '' ; $ modinfo = get_fast_modinfo ( $ course ) ; if ( ! $ users || ! is_array ( $ users ) || count ( $ users ) === 0 ) { $ output .= $ this -> output -> heading ( get_string ( "nosubscribers" , "forum" ) ) ; } else if ( ! isset ( $ modinf... | This function generates HTML to display a subscriber overview primarily used on the subscribers page if editing was turned off |
30,010 | public function subscribed_users ( user_selector_base $ existingusers ) { $ output = $ this -> output -> box_start ( 'subscriberdiv boxaligncenter' ) ; $ output .= html_writer :: tag ( 'p' , get_string ( 'forcesubscribed' , 'forum' ) ) ; $ output .= $ existingusers -> display ( true ) ; $ output .= $ this -> output -> ... | This is used to display a control containing all of the subscribed users so that it can be searched |
30,011 | public function timed_discussion_tooltip ( $ discussion , $ visiblenow ) { $ dates = array ( ) ; if ( $ discussion -> timestart ) { $ dates [ ] = get_string ( 'displaystart' , 'mod_forum' ) . ': ' . userdate ( $ discussion -> timestart ) ; } if ( $ discussion -> timeend ) { $ dates [ ] = get_string ( 'displayend' , 'mo... | Generate the HTML for an icon to be displayed beside the subject of a timed discussion . |
30,012 | public function render_forum_post_email ( \ mod_forum \ output \ forum_post_email $ post ) { $ data = $ post -> export_for_template ( $ this , $ this -> target === RENDERER_TARGET_TEXTEMAIL ) ; return $ this -> render_from_template ( 'mod_forum/' . $ this -> forum_post_template ( ) , $ data ) ; } | Display a forum post in the relevant context . |
30,013 | public function render_digest_options ( $ forum , $ value ) { $ options = forum_get_user_digest_options ( ) ; $ editable = new \ core \ output \ inplace_editable ( 'mod_forum' , 'digestoptions' , $ forum -> id , true , $ options [ $ value ] , $ value ) ; $ editable -> set_type_select ( $ options ) ; return $ editable ;... | Create the inplace_editable used to select forum digest options . |
30,014 | public function render_quick_search_form ( \ mod_forum \ output \ quick_search_form $ form ) { return $ this -> render_from_template ( 'mod_forum/quick_search_form' , $ form -> export_for_template ( $ this ) ) ; } | Render quick search form . |
30,015 | public function render_big_search_form ( \ mod_forum \ output \ big_search_form $ form ) { return $ this -> render_from_template ( 'mod_forum/big_search_form' , $ form -> export_for_template ( $ this ) ) ; } | Render big search form . |
30,016 | private function executeCommand ( Server $ server ) { $ cmd = [ 'listCollections' => 1 ] ; if ( ! empty ( $ this -> options [ 'filter' ] ) ) { $ cmd [ 'filter' ] = ( object ) $ this -> options [ 'filter' ] ; } if ( isset ( $ this -> options [ 'maxTimeMS' ] ) ) { $ cmd [ 'maxTimeMS' ] = $ this -> options [ 'maxTimeMS' ]... | Returns information for all collections in this database using the listCollections command . |
30,017 | public static function installed_allocators ( ) { $ installed = core_component :: get_plugin_list ( 'workshopallocation' ) ; $ forms = array ( ) ; foreach ( $ installed as $ allocation => $ allocationpath ) { if ( file_exists ( $ allocationpath . '/lib.php' ) ) { $ forms [ $ allocation ] = get_string ( 'pluginname' , '... | Return list of available allocation methods |
30,018 | public static function available_example_modes_list ( ) { $ options = array ( ) ; $ options [ self :: EXAMPLES_VOLUNTARY ] = get_string ( 'examplesvoluntary' , 'workshop' ) ; $ options [ self :: EXAMPLES_BEFORE_SUBMISSION ] = get_string ( 'examplesbeforesubmission' , 'workshop' ) ; $ options [ self :: EXAMPLES_BEFORE_A... | Returns the localized list of supported examples modes |
30,019 | public static function available_strategies_list ( ) { $ installed = core_component :: get_plugin_list ( 'workshopform' ) ; $ forms = array ( ) ; foreach ( $ installed as $ strategy => $ strategypath ) { if ( file_exists ( $ strategypath . '/lib.php' ) ) { $ forms [ $ strategy ] = get_string ( 'pluginname' , 'workshopf... | Returns the list of available grading strategy methods |
30,020 | public static function available_evaluators_list ( ) { $ evals = array ( ) ; foreach ( core_component :: get_plugin_list_with_file ( 'workshopeval' , 'lib.php' , false ) as $ eval => $ evalpath ) { $ evals [ $ eval ] = get_string ( 'pluginname' , 'workshopeval_' . $ eval ) ; } return $ evals ; } | Returns the list of available grading evaluation methods |
30,021 | public static function gcd ( $ a , $ b ) { return ( $ b == 0 ) ? ( $ a ) : ( self :: gcd ( $ b , $ a % $ b ) ) ; } | Helper function returning the greatest common divisor |
30,022 | public static function clean_file_extensions ( $ extensions ) { debugging ( 'The method workshop::clean_file_extensions() is deprecated. Please use the methods provided by the \core_form\filetypes_util class.' , DEBUG_DEVELOPER ) ; $ extensions = self :: normalize_file_extensions ( $ extensions ) ; foreach (... | Cleans the user provided list of file extensions . |
30,023 | public static function is_allowed_file_type ( $ filename , $ whitelist ) { debugging ( 'The method workshop::is_allowed_file_type() is deprecated. Please use the methods provided by the \core_form\filetypes_util class.' , DEBUG_DEVELOPER ) ; $ whitelist = self :: normalize_file_extensions ( $ whitelist ) ; i... | Is the file have allowed to be uploaded to the workshop? |
30,024 | public function is_participant ( $ userid = null ) { global $ USER , $ DB ; if ( is_null ( $ userid ) ) { $ userid = $ USER -> id ; } list ( $ sql , $ params ) = $ this -> get_participants_sql ( ) ; if ( empty ( $ sql ) ) { return false ; } $ sql = "SELECT COUNT(*) FROM {user} uxx JOIN... | Checks if the given user is an actively enrolled participant in the workshop |
30,025 | public function get_grouped ( $ users ) { global $ DB ; global $ CFG ; $ grouped = array ( ) ; if ( empty ( $ users ) ) { return $ grouped ; } if ( $ this -> cm -> groupingid ) { $ groupingid = $ this -> cm -> groupingid ; $ grouped [ 0 ] = array ( ) ; } else { $ groupingid = 0 ; $ grouped [ 0 ] = $ users ; } $ gmember... | Groups the given users by the group membership |
30,026 | public function get_submissions ( $ authorid = 'all' , $ groupid = 0 , $ limitfrom = 0 , $ limitnum = 0 ) { global $ DB ; $ authorfields = user_picture :: fields ( 'u' , null , 'authoridx' , 'author' ) ; $ gradeoverbyfields = user_picture :: fields ( 't' , null , 'gradeoverbyx' , 'over' ) ; $ params = array ( 'workshop... | Returns submissions from this workshop |
30,027 | public function get_submission_by_id ( $ id ) { global $ DB ; $ authorfields = user_picture :: fields ( 'u' , null , 'authoridx' , 'author' ) ; $ gradeoverbyfields = user_picture :: fields ( 'g' , null , 'gradeoverbyx' , 'gradeoverby' ) ; $ sql = "SELECT s.*, $authorfields, $gradeoverbyfields FROM {wor... | Returns a submission record with the author s data |
30,028 | public function get_submission_by_author ( $ authorid ) { global $ DB ; if ( empty ( $ authorid ) ) { return false ; } $ authorfields = user_picture :: fields ( 'u' , null , 'authoridx' , 'author' ) ; $ gradeoverbyfields = user_picture :: fields ( 'g' , null , 'gradeoverbyx' , 'gradeoverby' ) ; $ sql = "SELECT s.*, $au... | Returns a submission submitted by the given author |
30,029 | public function get_published_submissions ( $ orderby = 'finalgrade DESC' ) { global $ DB ; $ authorfields = user_picture :: fields ( 'u' , null , 'authoridx' , 'author' ) ; $ sql = "SELECT s.id, s.authorid, s.timecreated, s.timemodified, s.title, s.grade, s.gradeover, COALESCE(s.gradeover,s.grade... | Returns published submissions with their authors data |
30,030 | public function get_examples_for_reviewer ( $ reviewerid ) { global $ DB ; if ( empty ( $ reviewerid ) ) { return false ; } $ sql = 'SELECT s.id, s.title, a.id AS assessmentid, a.grade, a.gradinggrade FROM {workshop_submissions} s LEFT JOIN {workshop_assessments} a ON ... | Returns the list of all example submissions in this workshop with the information of assessments done by the given user |
30,031 | public function prepare_submission ( stdClass $ record , $ showauthor = false ) { $ submission = new workshop_submission ( $ this , $ record , $ showauthor ) ; $ submission -> url = $ this -> submission_url ( $ record -> id ) ; return $ submission ; } | Prepares renderable submission component |
30,032 | public function prepare_submission_summary ( stdClass $ record , $ showauthor = false ) { $ summary = new workshop_submission_summary ( $ this , $ record , $ showauthor ) ; $ summary -> url = $ this -> submission_url ( $ record -> id ) ; return $ summary ; } | Prepares renderable submission summary component |
30,033 | public function prepare_example_summary ( stdClass $ example ) { $ summary = new workshop_example_submission_summary ( $ this , $ example ) ; if ( is_null ( $ example -> grade ) ) { $ summary -> status = 'notgraded' ; $ summary -> assesslabel = get_string ( 'assess' , 'workshop' ) ; } else { $ summary -> status = 'grad... | Prepares renderable example submission summary component |
30,034 | public function prepare_assessment ( stdClass $ record , $ form , array $ options = array ( ) ) { $ assessment = new workshop_assessment ( $ this , $ record , $ options ) ; $ assessment -> url = $ this -> assess_url ( $ record -> id ) ; $ assessment -> maxgrade = $ this -> real_grade ( 100 ) ; if ( ! empty ( $ options ... | Prepares renderable assessment component |
30,035 | public function prepare_example_assessment ( stdClass $ record , $ form = null , array $ options = array ( ) ) { $ assessment = new workshop_example_assessment ( $ this , $ record , $ options ) ; $ assessment -> url = $ this -> exassess_url ( $ record -> id ) ; $ assessment -> maxgrade = $ this -> real_grade ( 100 ) ; ... | Prepares renderable example submission s assessment component |
30,036 | public function prepare_example_reference_assessment ( stdClass $ record , $ form = null , array $ options = array ( ) ) { $ assessment = new workshop_example_reference_assessment ( $ this , $ record , $ options ) ; $ assessment -> maxgrade = $ this -> real_grade ( 100 ) ; if ( ! empty ( $ options [ 'showform' ] ) and ... | Prepares renderable example submission s reference assessment component |
30,037 | public function delete_submission ( stdclass $ submission ) { global $ DB ; $ assessments = $ DB -> get_records ( 'workshop_assessments' , array ( 'submissionid' => $ submission -> id ) , '' , 'id' ) ; $ this -> delete_assessment ( array_keys ( $ assessments ) ) ; $ fs = get_file_storage ( ) ; $ fs -> delete_area_files... | Removes the submission and all relevant data |
30,038 | public function get_all_assessments ( ) { global $ DB ; $ reviewerfields = user_picture :: fields ( 'reviewer' , null , 'revieweridx' , 'reviewer' ) ; $ authorfields = user_picture :: fields ( 'author' , null , 'authorid' , 'author' ) ; $ overbyfields = user_picture :: fields ( 'overby' , null , 'gradinggradeoverbyx' ,... | Returns the list of all assessments in the workshop with some data added |
30,039 | public function get_assessment_by_id ( $ id ) { global $ DB ; $ reviewerfields = user_picture :: fields ( 'reviewer' , null , 'revieweridx' , 'reviewer' ) ; $ authorfields = user_picture :: fields ( 'author' , null , 'authorid' , 'author' ) ; $ overbyfields = user_picture :: fields ( 'overby' , null , 'gradinggradeover... | Get the complete information about the given assessment |
30,040 | public function get_assessment_of_submission_by_user ( $ submissionid , $ reviewerid ) { global $ DB ; $ reviewerfields = user_picture :: fields ( 'reviewer' , null , 'revieweridx' , 'reviewer' ) ; $ authorfields = user_picture :: fields ( 'author' , null , 'authorid' , 'author' ) ; $ overbyfields = user_picture :: fie... | Get the complete information about the user s assessment of the given submission |
30,041 | public function get_assessments_of_submission ( $ submissionid ) { global $ DB ; $ reviewerfields = user_picture :: fields ( 'reviewer' , null , 'revieweridx' , 'reviewer' ) ; $ overbyfields = user_picture :: fields ( 'overby' , null , 'gradinggradeoverbyx' , 'overby' ) ; list ( $ sort , $ params ) = users_order_by_sql... | Get the complete information about all assessments of the given submission |
30,042 | public function get_assessments_by_reviewer ( $ reviewerid ) { global $ DB ; $ reviewerfields = user_picture :: fields ( 'reviewer' , null , 'revieweridx' , 'reviewer' ) ; $ authorfields = user_picture :: fields ( 'author' , null , 'authorid' , 'author' ) ; $ overbyfields = user_picture :: fields ( 'overby' , null , 'g... | Get the complete information about all assessments allocated to the given reviewer |
30,043 | public function get_pending_assessments_by_reviewer ( $ reviewerid , $ exclude = null ) { $ assessments = $ this -> get_assessments_by_reviewer ( $ reviewerid ) ; foreach ( $ assessments as $ id => $ assessment ) { if ( ! is_null ( $ assessment -> grade ) ) { unset ( $ assessments [ $ id ] ) ; continue ; } if ( ! empty... | Get allocated assessments not graded yet by the given reviewer |
30,044 | public function add_allocation ( stdclass $ submission , $ reviewerid , $ weight = 1 , $ bulk = false ) { global $ DB ; if ( $ DB -> record_exists ( 'workshop_assessments' , array ( 'submissionid' => $ submission -> id , 'reviewerid' => $ reviewerid ) ) ) { return self :: ALLOCATION_EXISTS ; } $ weight = ( int ) $ weig... | Allocate a submission to a user for review |
30,045 | public function delete_assessment ( $ id ) { global $ DB ; if ( empty ( $ id ) ) { return true ; } $ fs = get_file_storage ( ) ; if ( is_array ( $ id ) ) { $ DB -> delete_records_list ( 'workshop_grades' , 'assessmentid' , $ id ) ; foreach ( $ id as $ itemid ) { $ fs -> delete_area_files ( $ this -> context -> id , 'mo... | Delete assessment record or records . |
30,046 | public function grading_strategy_instance ( ) { global $ CFG ; if ( is_null ( $ this -> strategyinstance ) ) { $ strategylib = __DIR__ . '/form/' . $ this -> strategy . '/lib.php' ; if ( is_readable ( $ strategylib ) ) { require_once ( $ strategylib ) ; } else { throw new coding_exception ( 'the grading forms subplugin... | Returns instance of grading strategy class |
30,047 | public function set_grading_evaluation_method ( $ method ) { global $ DB ; $ evaluationlib = __DIR__ . '/eval/' . $ method . '/lib.php' ; if ( is_readable ( $ evaluationlib ) ) { $ this -> evaluationinstance = null ; $ this -> evaluation = $ method ; $ DB -> set_field ( 'workshop' , 'evaluation' , $ method , array ( 'i... | Sets the current evaluation method to the given plugin . |
30,048 | public function grading_evaluation_instance ( ) { global $ CFG ; if ( is_null ( $ this -> evaluationinstance ) ) { if ( empty ( $ this -> evaluation ) ) { $ this -> evaluation = 'best' ; } $ evaluationlib = __DIR__ . '/eval/' . $ this -> evaluation . '/lib.php' ; if ( is_readable ( $ evaluationlib ) ) { require_once ( ... | Returns instance of grading evaluation class |
30,049 | public function allocator_instance ( $ method ) { global $ CFG ; $ allocationlib = __DIR__ . '/allocation/' . $ method . '/lib.php' ; if ( is_readable ( $ allocationlib ) ) { require_once ( $ allocationlib ) ; } else { throw new coding_exception ( 'Unable to find the allocation library ' . $ allocationlib ) ; } $ class... | Returns instance of submissions allocator |
30,050 | public function creating_submission_allowed ( $ userid ) { $ now = time ( ) ; $ ignoredeadlines = has_capability ( 'mod/workshop:ignoredeadlines' , $ this -> context , $ userid ) ; if ( $ this -> latesubmissions ) { if ( $ this -> phase != self :: PHASE_SUBMISSION and $ this -> phase != self :: PHASE_ASSESSMENT ) { ret... | Is the given user allowed to create their submission? |
30,051 | public function modifying_submission_allowed ( $ userid ) { $ now = time ( ) ; $ ignoredeadlines = has_capability ( 'mod/workshop:ignoredeadlines' , $ this -> context , $ userid ) ; if ( $ this -> phase != self :: PHASE_SUBMISSION ) { return false ; } if ( ! $ ignoredeadlines and ! empty ( $ this -> submissionstart ) a... | Is the given user allowed to modify their existing submission? |
30,052 | public function switch_phase ( $ newphase ) { global $ DB ; $ known = $ this -> available_phases_list ( ) ; if ( ! isset ( $ known [ $ newphase ] ) ) { return false ; } if ( self :: PHASE_CLOSED == $ newphase ) { $ workshop = new stdclass ( ) ; foreach ( $ this as $ property => $ value ) { $ workshop -> { $ property } ... | Switch to a new workshop phase |
30,053 | public function set_peer_grade ( $ assessmentid , $ grade ) { global $ DB ; if ( is_null ( $ grade ) ) { return false ; } $ data = new stdclass ( ) ; $ data -> id = $ assessmentid ; $ data -> grade = $ grade ; $ data -> timemodified = time ( ) ; $ DB -> update_record ( 'workshop_assessments' , $ data ) ; return $ grade... | Saves a raw grade for submission as calculated from the assessment form fields |
30,054 | public function real_grade_value ( $ value , $ max ) { $ localized = true ; if ( is_null ( $ value ) or $ value === '' ) { return null ; } elseif ( $ max == 0 ) { return 0 ; } else { return format_float ( $ max * $ value / 100 , $ this -> gradedecimals , $ localized ) ; } } | Calculates the real value of a grade |
30,055 | public function clear_assessments ( ) { global $ DB ; $ submissions = $ this -> get_submissions ( ) ; if ( empty ( $ submissions ) ) { return ; } $ submissions = array_keys ( $ submissions ) ; list ( $ sql , $ params ) = $ DB -> get_in_or_equal ( $ submissions , SQL_PARAMS_NAMED ) ; $ sql = "submissionid $sql" ; $ DB -... | Sets the given grades and received grading grades to null |
30,056 | public function clear_grading_grades ( $ restrict = null ) { global $ DB ; $ sql = "workshopid = :workshopid" ; $ params = array ( 'workshopid' => $ this -> id ) ; if ( is_null ( $ restrict ) ) { } elseif ( ! empty ( $ restrict ) ) { list ( $ usql , $ uparams ) = $ DB -> get_in_or_equal ( $ restrict , SQL_PARAMS_NAMED ... | Sets the aggregated grades for assessment to null |
30,057 | public function get_feedbackreviewer_form ( $ actionurl , stdclass $ assessment , $ options = array ( ) ) { global $ CFG ; require_once ( __DIR__ . '/feedbackreviewer_form.php' ) ; $ current = new stdclass ( ) ; $ current -> asid = $ assessment -> id ; $ current -> weight = $ assessment -> weight ; $ current -> grading... | Returns the mform the teachers use to put a feedback for the reviewer |
30,058 | public function get_feedbackauthor_form ( $ actionurl , stdclass $ submission , $ options = array ( ) ) { global $ CFG ; require_once ( __DIR__ . '/feedbackauthor_form.php' ) ; $ current = new stdclass ( ) ; $ current -> submissionid = $ submission -> id ; $ current -> published = $ submission -> published ; $ current ... | Returns the mform the teachers use to put a feedback for the author on their submission |
30,059 | public function get_gradebook_grades ( $ userid ) { global $ CFG ; require_once ( $ CFG -> libdir . '/gradelib.php' ) ; if ( empty ( $ userid ) ) { throw new coding_exception ( 'User id expected, empty value given.' ) ; } $ gradebook = grade_get_grades ( $ this -> course -> id , 'mod' , 'workshop' , $ this -> id , $ us... | Returns the information about the user s grades as they are stored in the gradebook |
30,060 | public function submission_content_options ( ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/repository/lib.php' ) ; return array ( 'trusttext' => true , 'subdirs' => false , 'maxfiles' => $ this -> nattachments , 'maxbytes' => $ this -> maxbytes , 'context' => $ this -> context , 'return_types' => FILE_INTERNAL... | Return the editor options for the submission content field . |
30,061 | public function submission_attachment_options ( ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/repository/lib.php' ) ; $ options = array ( 'subdirs' => true , 'maxfiles' => $ this -> nattachments , 'maxbytes' => $ this -> maxbytes , 'return_types' => FILE_INTERNAL | FILE_CONTROLLED_LINK , ) ; $ filetypesutil = ... | Return the filemanager options for the submission attachments field . |
30,062 | public function overall_feedback_content_options ( ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/repository/lib.php' ) ; return array ( 'subdirs' => 0 , 'maxbytes' => $ this -> overallfeedbackmaxbytes , 'maxfiles' => $ this -> overallfeedbackfiles , 'changeformat' => 1 , 'context' => $ this -> context , 'retur... | Return the editor options for the overall feedback for the author . |
30,063 | public function overall_feedback_attachment_options ( ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/repository/lib.php' ) ; $ options = array ( 'subdirs' => 1 , 'maxbytes' => $ this -> overallfeedbackmaxbytes , 'maxfiles' => $ this -> overallfeedbackfiles , 'return_types' => FILE_INTERNAL | FILE_CONTROLLED_LIN... | Return the filemanager options for the overall feedback for the author . |
30,064 | public function reset_userdata ( stdClass $ data ) { $ componentstr = get_string ( 'pluginname' , 'workshop' ) . ': ' . format_string ( $ this -> name ) ; $ status = array ( ) ; if ( ! empty ( $ data -> reset_workshop_assessments ) or ! empty ( $ data -> reset_workshop_submissions ) ) { $ result = $ this -> reset_userd... | Performs the reset of this workshop instance . |
30,065 | public function check_group_membership ( $ otheruserid ) { global $ USER ; if ( groups_get_activity_groupmode ( $ this -> cm ) != SEPARATEGROUPS ) { return true ; } else if ( has_capability ( 'moodle/site:accessallgroups' , $ this -> context ) ) { return true ; } else { $ thisusersgroups = groups_get_all_groups ( $ thi... | Check if the current user can access the other user s group . |
30,066 | public function check_examples_assessed_before_submission ( $ userid ) { if ( $ this -> useexamples and $ this -> examplesmode == self :: EXAMPLES_BEFORE_SUBMISSION and ! has_capability ( 'mod/workshop:manageexamples' , $ this -> context ) ) { $ examples = $ this -> get_examples_for_reviewer ( $ userid ) ; foreach ( $ ... | Check whether the given user has assessed all his required examples before submission . |
30,067 | public function check_examples_assessed_before_assessment ( $ userid ) { if ( $ this -> useexamples and $ this -> examplesmode == self :: EXAMPLES_BEFORE_ASSESSMENT and ! has_capability ( 'mod/workshop:manageexamples' , $ this -> context ) ) { $ reviewersubmission = $ this -> get_submission_by_author ( $ userid ) ; if ... | Check that all required examples have been assessed by the given user . |
30,068 | public function validate_submission_data ( $ data ) { global $ DB , $ USER ; $ errors = array ( ) ; if ( empty ( $ data [ 'id' ] ) and empty ( $ data [ 'example' ] ) ) { $ sql = "SELECT COUNT(s.id) FROM {workshop_submissions} s JOIN {workshop} w ON (s.workshopid = w.id) ... | Validates the submission form or WS data . |
30,069 | public function check_view_assessment ( $ assessment , $ submission ) { global $ USER ; $ isauthor = $ submission -> authorid == $ USER -> id ; $ isreviewer = $ assessment -> reviewerid == $ USER -> id ; $ canviewallassessments = has_capability ( 'mod/workshop:viewallassessments' , $ this -> context ) ; $ canviewallsub... | Helper method for validating if the current user can view the given assessment . |
30,070 | public function check_edit_assessment ( $ assessment , $ submission ) { global $ USER ; $ this -> check_view_assessment ( $ assessment , $ submission ) ; $ isreviewer = ( $ USER -> id == $ assessment -> reviewerid ) ; $ assessmenteditable = $ isreviewer && $ this -> assessing_allowed ( $ USER -> id ) ; if ( ! $ assessm... | Helper method for validating if the current user can edit the given assessment . |
30,071 | public function evaluate_assessment ( $ assessment , $ data , $ cansetassessmentweight , $ canoverridegrades ) { global $ DB , $ USER ; $ data = file_postupdate_standard_editor ( $ data , 'feedbackreviewer' , array ( ) , $ this -> context ) ; $ record = new stdclass ( ) ; $ record -> id = $ assessment -> id ; if ( $ ca... | Evaluates an assessment . |
30,072 | public function set_submission_viewed ( $ submission ) { $ params = array ( 'objectid' => $ submission -> id , 'context' => $ this -> context , 'courseid' => $ this -> course -> id , 'relateduserid' => $ submission -> authorid , 'other' => array ( 'workshopid' => $ this -> id ) ) ; $ event = \ mod_workshop \ event \ su... | Trigger submission viewed event . |
30,073 | public function evaluate_submission ( $ submission , $ data , $ canpublish , $ canoverride ) { global $ DB , $ USER ; $ data = file_postupdate_standard_editor ( $ data , 'feedbackauthor' , array ( ) , $ this -> context ) ; $ record = new stdclass ( ) ; $ record -> id = $ submission -> id ; if ( $ canoverride ) { $ reco... | Evaluates a submission . |
30,074 | protected function aggregate_submission_grades_process ( array $ assessments ) { global $ DB ; $ submissionid = null ; $ current = null ; $ finalgrade = null ; $ sumgrades = 0 ; $ sumweights = 0 ; foreach ( $ assessments as $ assessment ) { if ( is_null ( $ submissionid ) ) { $ submissionid = $ assessment -> submission... | Given an array of all assessments of a single submission calculates the final grade for this submission |
30,075 | protected function aggregate_grading_grades_process ( array $ assessments , $ timegraded = null ) { global $ DB ; $ reviewerid = null ; $ current = null ; $ finalgrade = null ; $ agid = null ; $ sumgrades = 0 ; $ count = 0 ; if ( is_null ( $ timegraded ) ) { $ timegraded = time ( ) ; } foreach ( $ assessments as $ asse... | Given an array of all assessments done by a single reviewer calculates the final grading grade |
30,076 | protected function get_users_with_capability_sql ( $ capability , $ musthavesubmission , $ groupid ) { global $ CFG ; static $ inc = 0 ; $ inc ++ ; if ( empty ( $ groupid ) and $ this -> cm -> groupingid ) { $ groupingid = $ this -> cm -> groupingid ; $ groupinggroupids = array_keys ( groups_get_all_groups ( $ this -> ... | Returns SQL to fetch all enrolled users with the given capability in the current workshop |
30,077 | protected function get_participants_sql ( $ musthavesubmission = false , $ groupid = 0 ) { list ( $ sql1 , $ params1 ) = $ this -> get_users_with_capability_sql ( 'mod/workshop:submit' , $ musthavesubmission , $ groupid ) ; list ( $ sql2 , $ params2 ) = $ this -> get_users_with_capability_sql ( 'mod/workshop:peerassess... | Returns SQL statement that can be used to fetch all actively enrolled participants in the workshop |
30,078 | protected function reset_userdata_submissions ( stdClass $ data ) { global $ DB ; $ submissions = $ this -> get_submissions ( ) ; foreach ( $ submissions as $ submission ) { $ this -> delete_submission ( $ submission ) ; } return true ; } | Removes all user data related to participants submissions . |
30,079 | protected function reset_phase ( ) { global $ DB ; $ DB -> set_field ( 'workshop' , 'phase' , self :: PHASE_SETUP , array ( 'id' => $ this -> id ) ) ; $ this -> phase = self :: PHASE_SETUP ; } | Hard set the workshop phase to the setup one . |
30,080 | public function get_examples ( ) { if ( is_null ( $ this -> examples ) ) { $ this -> examples = $ this -> workshop -> get_examples_for_reviewer ( $ this -> userid ) ; } return $ this -> examples ; } | Returns example submissions to be assessed by the owner of the planner |
30,081 | public function anonymize ( ) { $ authorfields = explode ( ',' , user_picture :: fields ( ) ) ; foreach ( $ authorfields as $ field ) { $ prefixedusernamefield = 'author' . $ field ; unset ( $ this -> { $ prefixedusernamefield } ) ; } $ this -> anonymous = true ; } | Unsets all author - related properties so that the renderer does not have access to them |
30,082 | public function add_action ( moodle_url $ url , $ label , $ method = 'get' ) { $ action = new stdClass ( ) ; $ action -> url = $ url ; $ action -> label = $ label ; $ action -> method = $ method ; $ this -> actions [ ] = $ action ; } | Adds a new action |
30,083 | public function get_overall_feedback_content ( ) { if ( $ this -> workshop -> overallfeedbackmode == 0 ) { return false ; } if ( trim ( $ this -> feedbackauthor ) === '' ) { return null ; } $ content = file_rewrite_pluginfile_urls ( $ this -> feedbackauthor , 'pluginfile.php' , $ this -> workshop -> context -> id , 'mo... | Format the overall feedback text content |
30,084 | public function get_overall_feedback_attachments ( ) { if ( $ this -> workshop -> overallfeedbackmode == 0 ) { return false ; } if ( $ this -> workshop -> overallfeedbackfiles == 0 ) { return false ; } if ( empty ( $ this -> feedbackauthorattachment ) ) { return array ( ) ; } $ attachments = array ( ) ; $ fs = get_file... | Prepares the list of overall feedback attachments |
30,085 | public function set_type ( $ type = self :: TYPE_INFO ) { if ( in_array ( $ type , array ( self :: TYPE_OK , self :: TYPE_ERROR , self :: TYPE_INFO ) ) ) { $ this -> type = $ type ; } else { throw new coding_exception ( 'Unknown message type.' ) ; } } | Sets the message type |
30,086 | public function set_action ( moodle_url $ url , $ label ) { $ this -> actionurl = $ url ; $ this -> actionlabel = $ label ; } | Sets the optional message action |
30,087 | public function export_data_for_external ( ) { $ data = $ this -> get_data ( ) ; $ options = $ this -> get_options ( ) ; foreach ( $ data -> grades as $ reportdata ) { if ( $ options -> workshopphase == workshop :: PHASE_SUBMISSION ) { unset ( $ reportdata -> submissiongrade ) ; unset ( $ reportdata -> gradinggrade ) ;... | Prepare the data to be exported to a external system via Web Services . |
30,088 | public static function create ( $ config , $ schema = null ) { if ( $ config instanceof HTMLPurifier_Config ) { return $ config ; } if ( ! $ schema ) { $ ret = HTMLPurifier_Config :: createDefault ( ) ; } else { $ ret = new HTMLPurifier_Config ( $ schema ) ; } if ( is_string ( $ config ) ) { $ ret -> loadIni ( $ config... | Convenience constructor that creates a config object based on a mixed var |
30,089 | public function get ( $ key , $ a = null ) { if ( $ a !== null ) { $ this -> triggerError ( "Using deprecated API: use \$config->get('$key.$a') instead" , E_USER_WARNING ) ; $ key = "$key.$a" ; } if ( ! $ this -> finalized ) { $ this -> autoFinalize ( ) ; } if ( ! isset ( $ this -> def -> info [ $ key ] ) ) { $ this ->... | Retrieves a value from the configuration . |
30,090 | public function getBatch ( $ namespace ) { if ( ! $ this -> finalized ) { $ this -> autoFinalize ( ) ; } $ full = $ this -> getAll ( ) ; if ( ! isset ( $ full [ $ namespace ] ) ) { $ this -> triggerError ( 'Cannot retrieve undefined namespace ' . htmlspecialchars ( $ namespace ) , E_USER_WARNING ) ; return ; } return $... | Retrieves an array of directives to values from a given namespace |
30,091 | public function getBatchSerial ( $ namespace ) { if ( empty ( $ this -> serials [ $ namespace ] ) ) { $ batch = $ this -> getBatch ( $ namespace ) ; unset ( $ batch [ 'DefinitionRev' ] ) ; $ this -> serials [ $ namespace ] = sha1 ( serialize ( $ batch ) ) ; } return $ this -> serials [ $ namespace ] ; } | Returns a SHA - 1 signature of a segment of the configuration object that uniquely identifies that particular configuration |
30,092 | public function getSerial ( ) { if ( empty ( $ this -> serial ) ) { $ this -> serial = sha1 ( serialize ( $ this -> getAll ( ) ) ) ; } return $ this -> serial ; } | Returns a SHA - 1 signature for the entire configuration object that uniquely identifies that particular configuration |
30,093 | private function _listify ( $ lookup ) { $ list = array ( ) ; foreach ( $ lookup as $ name => $ b ) { $ list [ ] = $ name ; } return implode ( ', ' , $ list ) ; } | Convenience function for error reporting |
30,094 | public function isFinalized ( $ error = false ) { if ( $ this -> finalized && $ error ) { $ this -> triggerError ( $ error , E_USER_ERROR ) ; } return $ this -> finalized ; } | Checks whether or not the configuration object is finalized . |
30,095 | public static function create_username ( $ consumerkey , $ ltiuserid ) { if ( ! empty ( $ ltiuserid ) && ! empty ( $ consumerkey ) ) { $ userkey = $ consumerkey . ':' . $ ltiuserid ; } else { $ userkey = false ; } return 'enrol_lti' . sha1 ( $ consumerkey . '::' . $ userkey ) ; } | Creates a unique username . |
30,096 | public static function assign_user_tool_data ( $ tool , $ user ) { global $ CFG ; $ user -> city = ( ! empty ( $ tool -> city ) ) ? $ tool -> city : "" ; $ user -> country = ( ! empty ( $ tool -> country ) ) ? $ tool -> country : "" ; $ user -> institution = ( ! empty ( $ tool -> institution ) ) ? $ tool -> institution... | Adds default values for the user object based on the tool provided . |
30,097 | public static function user_match ( $ newuser , $ olduser ) { if ( $ newuser -> firstname != $ olduser -> firstname ) { return false ; } if ( $ newuser -> lastname != $ olduser -> lastname ) { return false ; } if ( $ newuser -> email != $ olduser -> email ) { return false ; } if ( $ newuser -> city != $ olduser -> city... | Compares two users . |
30,098 | public static function update_user_profile_image ( $ userid , $ url ) { global $ CFG , $ DB ; require_once ( $ CFG -> libdir . '/filelib.php' ) ; require_once ( $ CFG -> libdir . '/gdlib.php' ) ; $ fs = get_file_storage ( ) ; $ context = \ context_user :: instance ( $ userid , MUST_EXIST ) ; $ fs -> delete_area_files (... | Updates the users profile image . |
30,099 | public static function enrol_user ( $ tool , $ userid ) { global $ DB ; if ( ! $ DB -> record_exists ( 'user_enrolments' , array ( 'enrolid' => $ tool -> enrolid , 'userid' => $ userid ) ) ) { if ( $ tool -> maxenrolled ) { if ( $ DB -> count_records ( 'user_enrolments' , array ( 'enrolid' => $ tool -> enrolid ) ) >= $... | Enrol a user in a course . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.