idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
33,300 | public function col_userpic ( $ row ) { global $ OUTPUT ; $ user = user_picture :: unalias ( $ row , [ ] , $ this -> useridfield ) ; return $ OUTPUT -> user_picture ( $ user , array ( 'courseid' => $ this -> feedbackstructure -> get_cm ( ) -> course ) ) ; } | Prepares column userpic for display |
33,301 | public function col_deleteentry ( $ row ) { global $ OUTPUT ; $ deleteentryurl = new moodle_url ( $ this -> baseurl , [ 'delete' => $ row -> id , 'sesskey' => sesskey ( ) ] ) ; $ deleteaction = new confirm_action ( get_string ( 'confirmdeleteentry' , 'feedback' ) ) ; return $ OUTPUT -> action_icon ( $ deleteentryurl , ... | Prepares column deleteentry for display |
33,302 | protected function get_link_single_entry ( $ row ) { return new moodle_url ( $ this -> baseurl , [ 'userid' => $ row -> { $ this -> useridfield } , 'showcompleted' => $ row -> id ] ) ; } | Returns a link for viewing a single response |
33,303 | public function col_completed_timemodified ( $ student ) { if ( $ this -> is_downloading ( ) ) { return userdate ( $ student -> completed_timemodified ) ; } else { return html_writer :: link ( $ this -> get_link_single_entry ( $ student ) , userdate ( $ student -> completed_timemodified ) ) ; } } | Prepares column completed_timemodified for display |
33,304 | public function col_courseid ( $ row ) { $ courses = $ this -> feedbackstructure -> get_completed_courses ( ) ; $ name = '' ; if ( isset ( $ courses [ $ row -> courseid ] ) ) { $ name = $ courses [ $ row -> courseid ] ; if ( ! $ this -> is_downloading ( ) ) { $ name = html_writer :: link ( course_get_url ( $ row -> cou... | Prepares column courseid for display |
33,305 | public function col_groups ( $ row ) { $ groups = '' ; if ( $ usergrps = groups_get_all_groups ( $ this -> feedbackstructure -> get_cm ( ) -> course , $ row -> userid , 0 , 'name' ) ) { foreach ( $ usergrps as $ group ) { $ groups .= format_string ( $ group -> name ) . ' ' ; } } return trim ( $ groups ) ; } | Prepares column groups for display |
33,306 | protected function add_all_values_to_output ( ) { $ tablecolumns = array_keys ( $ this -> columns ) ; $ tableheaders = $ this -> headers ; $ items = $ this -> feedbackstructure -> get_items ( true ) ; if ( ! $ this -> is_downloading ( ) && ! $ this -> buildforexternal ) { $ items = array_slice ( $ items , 0 , self :: P... | Adds common values to the table that do not change the number or order of entries and are only needed when outputting or downloading data . |
33,307 | public function display ( ) { global $ OUTPUT ; groups_print_activity_menu ( $ this -> feedbackstructure -> get_cm ( ) , $ this -> baseurl -> out ( ) ) ; $ grandtotal = $ this -> get_total_responses_count ( ) ; if ( ! $ grandtotal ) { echo $ OUTPUT -> box ( get_string ( 'nothingtodisplay' ) , 'generalbox nothingtodispl... | Displays the table |
33,308 | public function download ( ) { \ core \ session \ manager :: write_close ( ) ; $ this -> out ( $ this -> get_total_responses_count ( ) , false ) ; exit ; } | Download the data . |
33,309 | protected function build_table_chunk ( & $ rows , & $ columnsgroups ) { global $ DB ; if ( ! $ rows ) { return ; } foreach ( $ columnsgroups as $ columnsgroup ) { $ fields = 'c.id' ; $ from = '{feedback_completed} c' ; $ params = [ ] ; foreach ( $ columnsgroup as $ nr => $ item ) { $ fields .= ", v{$nr}.value AS val{$n... | Retrieve additional columns . Database engine may have a limit on number of joins . |
33,310 | protected function get_responses_for_external ( $ row ) { $ responses = [ ] ; foreach ( $ row as $ el => $ val ) { if ( preg_match ( '/^val(\d+)$/' , $ el , $ matches ) ) { $ id = $ matches [ 1 ] ; $ responses [ ] = [ 'id' => $ id , 'name' => $ this -> headers [ $ this -> columns [ $ el ] ] , 'printval' => $ this -> ot... | Return user responses data ready for the external function . |
33,311 | public function export_external_structure ( $ page = 0 , $ perpage = 0 ) { $ this -> buildforexternal = true ; $ this -> add_all_values_to_output ( ) ; $ this -> setup ( ) ; if ( $ perpage > 0 ) { $ this -> pageable = true ; $ this -> currpage = $ page ; $ this -> pagesize = $ perpage ; } else { $ this -> pagesize = $ ... | Exports the table as an external structure handling pagination . |
33,312 | protected function plugin_extend_coursemodule_validation ( $ data ) { $ errors = array ( ) ; $ callbacks = get_plugins_with_function ( 'coursemodule_validation' , 'lib.php' ) ; foreach ( $ callbacks as $ type => $ plugins ) { foreach ( $ plugins as $ plugin => $ pluginfunction ) { $ pluginerrors = $ pluginfunction ( $ ... | Extend the validation function from any other plugin . |
33,313 | protected function plugin_extend_coursemodule_standard_elements ( ) { $ callbacks = get_plugins_with_function ( 'coursemodule_standard_elements' , 'lib.php' ) ; foreach ( $ callbacks as $ type => $ plugins ) { foreach ( $ plugins as $ plugin => $ pluginfunction ) { $ pluginfunction ( $ this , $ this -> _form ) ; } } } | Plugins can extend the coursemodule settings form . |
33,314 | protected function apply_admin_locked_flags ( ) { global $ OUTPUT ; if ( ! $ this -> applyadminlockedflags ) { return ; } $ settings = get_config ( $ this -> _modname ) ; $ mform = $ this -> _form ; $ lockedicon = html_writer :: tag ( 'span' , $ OUTPUT -> pix_icon ( 't/locked' , get_string ( 'locked' , 'admin' ) ) , ar... | Get the list of admin settings for this module and apply any locked settings . This cannot happen in apply_admin_defaults because we do not the current values of the settings in that function because set_data has not been called yet . |
33,315 | public static function export_area_ratings ( int $ userid , \ context $ context , array $ subcontext , string $ component , string $ ratingarea , int $ itemid , bool $ onlyuser = true ) { global $ DB ; $ rm = new \ rating_manager ( ) ; $ ratings = $ rm -> get_all_ratings_for_item ( ( object ) [ 'context' => $ context ,... | Export all ratings which match the specified component areaid and itemid . |
33,316 | public static function get_sql_join ( $ alias , $ component , $ ratingarea , $ itemidjoin , $ userid , $ innerjoin = false ) { static $ count = 0 ; $ count ++ ; $ userwhere = '' ; if ( $ innerjoin ) { $ join = "JOIN {rating} {$alias} ON " ; $ join .= "{$alias}.itemid = {$itemidjoin}" ; $ userwhere .= "{$alias}.userid =... | Get the SQL required to find all submission items where this user has had any involvements . |
33,317 | public static function delete_ratings ( \ context $ context , string $ component = null , string $ ratingarea = null , int $ itemid = null ) { global $ DB ; $ options = [ 'contextid' => $ context -> id ] ; if ( $ component ) { $ options [ 'component' ] = $ component ; } if ( $ ratingarea ) { $ options [ 'ratingarea' ] ... | Deletes all ratings for a specified context component ratingarea and itemid . |
33,318 | function CreateSequence2012 ( $ seq = 'adodbseq' , $ start = 1 ) { if ( ! $ this -> sequences ) { $ sql = "SELECT name FROM sys.sequences" ; $ this -> sequences = $ this -> GetCol ( $ sql ) ; } $ ok = $ this -> Execute ( "CREATE SEQUENCE $seq START WITH $start INCREMENT BY 1" ) ; if ( ! $ ok ) die ( "CANNOT CREATE SEQU... | Proper Sequences Only available to Server 2012 and up |
33,319 | function GenID2012 ( $ seq = 'adodbseq' , $ start = 1 ) { if ( ! $ this -> sequences ) { $ sql = "SELECT name FROM sys.sequences" ; $ this -> sequences = $ this -> GetCol ( $ sql ) ; } if ( ! is_array ( $ this -> sequences ) || is_array ( $ this -> sequences ) && ! in_array ( $ seq , $ this -> sequences ) ) { $ this ->... | Only available to Server 2012 and up Cannot do this the normal adodb way by trapping an error if the sequence does not exist because sql server will auto create a sequence with the starting number of - 9223372036854775808 |
33,320 | function NextRecordSet ( ) { if ( ! sqlsrv_next_result ( $ this -> _queryID ) ) return false ; $ this -> _inited = false ; $ this -> bind = false ; $ this -> _currentRow = - 1 ; $ this -> Init ( ) ; return true ; } | get next resultset - requires PHP 4 . 0 . 5 or later |
33,321 | function db_init ( ) { if ( $ this -> is_configured ( ) === false ) { throw new moodle_exception ( 'auth_dbcantconnect' , 'auth_db' ) ; } $ authdb = ADONewConnection ( $ this -> config -> type ) ; if ( ! empty ( $ this -> config -> debugauthdb ) ) { $ authdb -> debug = true ; ob_start ( ) ; } $ authdb -> Connect ( $ th... | Connect to external database . |
33,322 | function db_attributes ( ) { $ moodleattributes = array ( ) ; $ customfields = $ this -> get_custom_user_profile_fields ( ) ; if ( ! empty ( $ customfields ) && ! empty ( $ this -> userfields ) ) { $ userfields = array_merge ( $ this -> userfields , $ customfields ) ; } else { $ userfields = $ this -> userfields ; } fo... | Returns user attribute mappings between moodle and the external database . |
33,323 | function get_userinfo ( $ username ) { global $ CFG ; $ extusername = core_text :: convert ( $ username , 'utf-8' , $ this -> config -> extencoding ) ; $ authdb = $ this -> db_init ( ) ; $ selectfields = $ this -> db_attributes ( ) ; $ result = array ( ) ; if ( $ selectfields ) { $ select = array ( ) ; $ fieldcount = 0... | Reads any other information for a user from external database then returns it in an array . |
33,324 | function user_update_password ( $ user , $ newpassword ) { global $ DB ; if ( $ this -> is_internal ( ) ) { $ puser = $ DB -> get_record ( 'user' , array ( 'id' => $ user -> id ) , '*' , MUST_EXIST ) ; if ( update_internal_user_password ( $ puser , $ newpassword ) ) { $ user -> password = $ puser -> password ; return t... | Change a user s password . |
33,325 | function get_userinfo_asobj ( $ username ) { $ user_array = truncate_userinfo ( $ this -> get_userinfo ( $ username ) ) ; $ user = new stdClass ( ) ; foreach ( $ user_array as $ key => $ value ) { $ user -> { $ key } = $ value ; } return $ user ; } | Reads user information from DB and return it in an object . |
33,326 | function change_password_url ( ) { if ( $ this -> is_internal ( ) || empty ( $ this -> config -> changepasswordurl ) ) { return null ; } else { return new moodle_url ( $ this -> config -> changepasswordurl ) ; } } | Returns the URL for changing the user s pw or empty if the default can be used . |
33,327 | function ext_addslashes ( $ text ) { if ( empty ( $ this -> config -> sybasequoting ) ) { $ text = str_replace ( '\\' , '\\\\' , $ text ) ; $ text = str_replace ( array ( '\'' , '"' , "\0" ) , array ( '\\\'' , '\\"' , '\\0' ) , $ text ) ; } else { $ text = str_replace ( "'" , "''" , $ text ) ; } return $ text ; } | Add slashes we can not use placeholders or system functions . |
33,328 | public static function record_savepoint ( $ version ) { global $ CFG , $ OUTPUT ; if ( $ CFG -> debugdeveloper && self :: $ isrecording ) { $ time = microtime ( true ) ; $ notification = new \ core \ output \ notification ( $ version . ': ' . get_string ( 'successduration' , '' , format_float ( $ time - self :: $ lasts... | Records current time at the end of a given numbered step . |
33,329 | protected function setup ( ) { $ this -> urls = $ this -> predef_urls ; $ this -> titles = $ this -> predef_titles ; $ this -> html_hashes = array ( ) ; $ this -> in_anchor = false ; } | Called before the transformation process starts to setup parser states . |
33,330 | protected function runSpanGamut ( $ text ) { foreach ( $ this -> span_gamut as $ method => $ priority ) { $ text = $ this -> $ method ( $ text ) ; } return $ text ; } | Run span gamut transformations |
33,331 | protected function doHardBreaks ( $ text ) { if ( $ this -> hard_wrap ) { return preg_replace_callback ( '/ *\n/' , array ( $ this , '_doHardBreaks_callback' ) , $ text ) ; } else { return preg_replace_callback ( '/ {2,}\n/' , array ( $ this , '_doHardBreaks_callback' ) , $ text ) ; } } | Do hard breaks |
33,332 | protected function _generateIdFromHeaderValue ( $ headerValue ) { if ( ! is_callable ( $ this -> header_id_func ) ) { return "" ; } $ idValue = call_user_func ( $ this -> header_id_func , $ headerValue ) ; if ( ! $ idValue ) { return "" ; } return ' id="' . $ this -> encodeAttribute ( $ idValue ) . '"' ; } | If a header_id_func property is set we can use it to automatically generate an id attribute . |
33,333 | protected function _doLists_callback ( $ matches ) { $ marker_ul_re = '[*+-]' ; $ marker_ol_re = '\d+[\.]' ; $ marker_any_re = "(?:$marker_ul_re|$marker_ol_re)" ; $ marker_ol_start_re = '[0-9]+' ; $ list = $ matches [ 1 ] ; $ list_type = preg_match ( "/$marker_ul_re/" , $ matches [ 4 ] ) ? "ul" : "ol" ; $ marker_any_re... | List parsing callback |
33,334 | protected function _processListItems_callback ( $ matches ) { $ item = $ matches [ 4 ] ; $ leading_line = & $ matches [ 1 ] ; $ leading_space = & $ matches [ 2 ] ; $ marker_space = $ matches [ 3 ] ; $ tailing_blank_line = & $ matches [ 5 ] ; if ( $ leading_line || $ tailing_blank_line || preg_match ( '/\n{2,}/' , $ ite... | List item parsing callback |
33,335 | protected function _doCodeBlocks_callback ( $ matches ) { $ codeblock = $ matches [ 1 ] ; $ codeblock = $ this -> outdent ( $ codeblock ) ; if ( $ this -> code_block_content_func ) { $ codeblock = call_user_func ( $ this -> code_block_content_func , $ codeblock , "" ) ; } else { $ codeblock = htmlspecialchars ( $ codeb... | Code block parsing callback |
33,336 | protected function _doAutoLinks_url_callback ( $ matches ) { $ url = $ this -> encodeURLAttribute ( $ matches [ 1 ] , $ text ) ; $ link = "<a href=\"$url\">$text</a>" ; return $ this -> hashPart ( $ link ) ; } | Parse URL callback |
33,337 | protected function _doAutoLinks_email_callback ( $ matches ) { $ addr = $ matches [ 1 ] ; $ url = $ this -> encodeURLAttribute ( "mailto:$addr" , $ text ) ; $ link = "<a href=\"$url\">$text</a>" ; return $ this -> hashPart ( $ link ) ; } | Parse email address callback |
33,338 | function construct_latex_document ( $ formula , $ fontsize = 12 ) { global $ CFG ; $ formula = filter_tex_sanitize_formula ( $ formula ) ; $ doc = "\\documentclass[{$fontsize}pt]{article}\n" ; $ doc .= get_config ( 'filter_tex' , 'latexpreamble' ) ; $ doc .= "\\pagestyle{empty}\n" ; $ doc .= "\\begin{document}\n" ; if ... | Turn the bit of TeX into a valid latex document |
33,339 | function execute ( $ command , $ log = null ) { $ output = array ( ) ; exec ( $ command , $ output , $ return_code ) ; if ( $ log ) { fwrite ( $ log , "COMMAND: $command \n" ) ; $ outputs = implode ( "\n" , $ output ) ; fwrite ( $ log , "OUTPUT: $outputs \n" ) ; fwrite ( $ log , "RETURN_CODE: $return_code\n " ) ; } ret... | execute an external command with optional logging |
33,340 | private function _getServerBaseURL ( ) { if ( empty ( $ this -> _server [ 'base_url' ] ) ) { $ this -> _server [ 'base_url' ] = 'https://' . $ this -> _getServerHostname ( ) ; if ( $ this -> _getServerPort ( ) != 443 ) { $ this -> _server [ 'base_url' ] .= ':' . $ this -> _getServerPort ( ) ; } $ this -> _server [ 'bas... | This method is used to retrieve the base URL of the CAS server . |
33,341 | public function getServerLoginURL ( $ gateway = false , $ renew = false ) { phpCAS :: traceBegin ( ) ; if ( empty ( $ this -> _server [ 'login_url' ] ) ) { $ this -> _server [ 'login_url' ] = $ this -> _buildQueryUrl ( $ this -> _getServerBaseURL ( ) . 'login' , 'service=' . urlencode ( $ this -> getURL ( ) ) ) ; } $ u... | This method is used to retrieve the login URL of the CAS server . |
33,342 | public function getServerSamlValidateURL ( ) { phpCAS :: traceBegin ( ) ; if ( empty ( $ this -> _server [ 'saml_validate_url' ] ) ) { switch ( $ this -> getServerVersion ( ) ) { case SAML_VERSION_1_1 : $ this -> _server [ 'saml_validate_url' ] = $ this -> _getServerBaseURL ( ) . 'samlValidate' ; break ; } } $ url = $ ... | This method is used to retrieve the SAML validating URL of the CAS server . |
33,343 | public function getServerProxyValidateURL ( ) { phpCAS :: traceBegin ( ) ; if ( empty ( $ this -> _server [ 'proxy_validate_url' ] ) ) { switch ( $ this -> getServerVersion ( ) ) { case CAS_VERSION_1_0 : $ this -> _server [ 'proxy_validate_url' ] = '' ; break ; case CAS_VERSION_2_0 : $ this -> _server [ 'proxy_validate... | This method is used to retrieve the proxy validating URL of the CAS server . |
33,344 | public function getServerProxyURL ( ) { if ( empty ( $ this -> _server [ 'proxy_url' ] ) ) { switch ( $ this -> getServerVersion ( ) ) { case CAS_VERSION_1_0 : $ this -> _server [ 'proxy_url' ] = '' ; break ; case CAS_VERSION_2_0 : case CAS_VERSION_3_0 : $ this -> _server [ 'proxy_url' ] = $ this -> _getServerBaseURL (... | This method is used to retrieve the proxy URL of the CAS server . |
33,345 | public function getServerLogoutURL ( ) { if ( empty ( $ this -> _server [ 'logout_url' ] ) ) { $ this -> _server [ 'logout_url' ] = $ this -> _getServerBaseURL ( ) . 'logout' ; } return $ this -> _server [ 'logout_url' ] ; } | This method is used to retrieve the logout URL of the CAS server . |
33,346 | public function ensureAuthenticationCallSuccessful ( ) { $ this -> _ensureAuthenticationCalled ( ) ; if ( ! $ this -> _authentication_caller [ 'result' ] ) { throw new CAS_OutOfSequenceException ( 'authentication was checked (by ' . $ this -> getAuthenticationCallerMethod ( ) . '() at ' . $ this -> getAuthenticationCal... | Ensure that authentication was checked . Terminate with exception if no authentication was performed |
33,347 | public function getAttributes ( ) { $ this -> ensureAuthenticationCallSuccessful ( ) ; if ( empty ( $ this -> _user ) ) { phpCAS :: error ( 'this method should be used only after ' . __CLASS__ . '::forceAuthentication() or ' . __CLASS__ . '::isAuthenticated()' ) ; } return $ this -> _attributes ; } | Get an key values arry of attributes |
33,348 | public function getAttribute ( $ key ) { $ this -> ensureAuthenticationCallSuccessful ( ) ; if ( $ this -> _hasAttribute ( $ key ) ) { return $ this -> _attributes [ $ key ] ; } } | Get a specific attribute by name |
33,349 | public function forceAuthentication ( ) { phpCAS :: traceBegin ( ) ; if ( $ this -> isAuthenticated ( ) ) { phpCAS :: trace ( 'no need to authenticate' ) ; $ res = true ; } else { if ( isset ( $ _SESSION [ 'phpCAS' ] [ 'auth_checked' ] ) ) { unset ( $ _SESSION [ 'phpCAS' ] [ 'auth_checked' ] ) ; } $ this -> redirectToC... | This method is called to be sure that the user is authenticated . When not authenticated halt by redirecting to the CAS server ; otherwise return true . |
33,350 | public function checkAuthentication ( ) { phpCAS :: traceBegin ( ) ; $ res = false ; if ( $ this -> isAuthenticated ( ) ) { phpCAS :: trace ( 'user is authenticated' ) ; unset ( $ _SESSION [ 'phpCAS' ] [ 'auth_checked' ] ) ; $ res = true ; } else if ( isset ( $ _SESSION [ 'phpCAS' ] [ 'auth_checked' ] ) ) { unset ( $ _... | This method is called to check whether the user is authenticated or not . |
33,351 | public function setCasServerCACert ( $ cert , $ validate_cn ) { if ( gettype ( $ cert ) != 'string' ) { throw new CAS_TypeMismatchException ( $ cert , '$cert' , 'string' ) ; } if ( gettype ( $ validate_cn ) != 'boolean' ) { throw new CAS_TypeMismatchException ( $ validate_cn , '$validate_cn' , 'boolean' ) ; } if ( ! fi... | Set the CA certificate of the CAS server . |
33,352 | private function _setSessionAttributes ( $ text_response ) { phpCAS :: traceBegin ( ) ; $ result = false ; $ attr_array = array ( ) ; $ dom = new DOMDocument ( ) ; $ dom -> preserveWhiteSpace = false ; if ( ( $ dom -> loadXML ( $ text_response ) ) ) { $ xPath = new DOMXpath ( $ dom ) ; $ xPath -> registerNamespace ( 's... | This method will parse the DOM and pull out the attributes from the SAML payload and put them into an array then put the array into the session . |
33,353 | public function setCallbackURL ( $ url ) { $ this -> ensureIsProxy ( ) ; if ( gettype ( $ url ) != 'string' ) throw new CAS_TypeMismatchException ( $ url , '$url' , 'string' ) ; return $ this -> _callback_url = $ url ; } | This method sets the callback url . |
33,354 | private function _storePGT ( $ pgt , $ pgt_iou ) { $ this -> _initPGTStorage ( ) ; $ this -> _pgt_storage -> write ( $ pgt , $ pgt_iou ) ; } | This method stores a PGT . Halts on error . |
33,355 | private function _validatePGT ( & $ validate_url , $ text_response , $ tree_response ) { phpCAS :: traceBegin ( ) ; if ( $ tree_response -> getElementsByTagName ( "proxyGrantingTicket" ) -> length == 0 ) { phpCAS :: trace ( '<proxyGrantingTicket> not found' ) ; throw new CAS_AuthenticationException ( $ this , 'Ticket v... | This method is used to validate a PGT ; halt on failure . |
33,356 | private function _readURL ( $ url , & $ headers , & $ body , & $ err_msg ) { phpCAS :: traceBegin ( ) ; $ className = $ this -> _requestImplementation ; $ request = new $ className ( ) ; if ( count ( $ this -> _curl_options ) ) { $ request -> setCurlOptions ( $ this -> _curl_options ) ; } $ request -> setUrl ( $ url ) ... | This method is used to acces a remote URL . |
33,357 | private function _addAttributeToArray ( array & $ attributeArray , $ name , $ value ) { if ( isset ( $ attributeArray [ $ name ] ) ) { if ( ! is_array ( $ attributeArray [ $ name ] ) ) { $ existingValue = $ attributeArray [ $ name ] ; $ attributeArray [ $ name ] = array ( $ existingValue ) ; } $ attributeArray [ $ name... | Add an attribute value to an array of attributes . |
33,358 | private function _isHttps ( ) { if ( ! empty ( $ _SERVER [ 'HTTP_X_FORWARDED_PROTO' ] ) ) { return ( $ _SERVER [ 'HTTP_X_FORWARDED_PROTO' ] === 'https' ) ; } elseif ( ! empty ( $ _SERVER [ 'HTTP_X_FORWARDED_PROTOCOL' ] ) ) { return ( $ _SERVER [ 'HTTP_X_FORWARDED_PROTOCOL' ] === 'https' ) ; } elseif ( isset ( $ _SERVER... | This method checks to see if the request is secured via HTTPS |
33,359 | private function _buildQueryUrl ( $ url , $ query ) { $ url .= ( strstr ( $ url , '?' ) === false ) ? '?' : '&' ; $ url .= $ query ; return $ url ; } | This method is used to append query parameters to an url . Since the url might already contain parameter it has to be detected and to build a proper URL |
33,360 | private function _getNodeType ( $ nodeURL ) { phpCAS :: traceBegin ( ) ; if ( preg_match ( "/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/" , $ nodeURL ) ) { phpCAS :: traceEnd ( self :: IP ) ; return self :: IP ; } else { phpCAS :: traceEnd ( self :: HOSTNAME ) ; return self :: HOSTNAME ; } } | Determine the node type from the URL . |
33,361 | public function to_legacy_objects ( array $ posts ) : array { return array_map ( function ( post_entity $ post ) { return ( object ) [ 'id' => $ post -> get_id ( ) , 'discussion' => $ post -> get_discussion_id ( ) , 'parent' => $ post -> get_parent_id ( ) , 'userid' => $ post -> get_author_id ( ) , 'created' => $ post ... | Convert a list of post entities into stdClasses . |
33,362 | protected function get_legacy_logdata ( ) { $ message = $ this -> get_record_snapshot ( 'chat_messages' , $ this -> objectid ) ; return array ( $ this -> courseid , 'chat' , 'talk' , 'view.php?id=' . $ this -> contextinstanceid , $ message -> chatid , $ this -> contextinstanceid , $ this -> relateduserid ) ; } | Return legacy log data . |
33,363 | public function setup_structure ( ) { $ this -> structure = new grade_structure ( ) ; $ this -> structure -> modinfo = get_fast_modinfo ( $ this -> course ) ; } | Cache the grade_structure class |
33,364 | public function fetch_grade_or_default ( $ item , $ userid ) { $ grade = grade_grade :: fetch ( array ( 'itemid' => $ item -> id , 'userid' => $ userid ) ) ; if ( ! $ grade ) { $ default = new stdClass ; $ default -> userid = $ userid ; $ default -> itemid = $ item -> id ; $ default -> feedback = '' ; $ grade = new gra... | Get the grade_grade |
33,365 | public function make_toggle ( $ key ) { $ attrs = array ( 'href' => '#' ) ; $ strmanager = \ get_string_manager ( ) ; $ titleall = get_string ( 'all' ) ; $ titlenone = get_string ( 'none' ) ; if ( $ strmanager -> string_exists ( strtolower ( $ key ) . 'all' , 'gradereport_singleview' ) ) { $ titleall = get_string ( str... | Make the HTML element that toggles all the checkboxes on or off . |
33,366 | protected function load_users ( ) { global $ CFG ; $ defaultgradeshowactiveenrol = ! empty ( $ CFG -> grade_report_showonlyactiveenrol ) ; $ showonlyactiveenrol = get_user_preferences ( 'grade_report_showonlyactiveenrol' , $ defaultgradeshowactiveenrol ) ; $ showonlyactiveenrol = $ showonlyactiveenrol || ! has_capabili... | Load a valid list of users for this gradebook as the screen items . |
33,367 | public function perpage_select ( ) { global $ PAGE , $ OUTPUT ; $ options = array_combine ( self :: $ validperpage , self :: $ validperpage ) ; $ url = new moodle_url ( $ PAGE -> url ) ; $ url -> remove_params ( [ 'page' , 'perpage' ] ) ; $ out = '' ; $ select = new \ single_select ( $ url , 'perpage' , $ options , $ t... | Allow selection of number of items to display per page . |
33,368 | public function eval_cron_field ( $ field , $ min , $ max ) { $ field = trim ( $ field ) ; $ range = array ( ) ; $ matches = array ( ) ; preg_match_all ( '@[0-9]+|\*|,|/|-@' , $ field , $ matches ) ; $ last = 0 ; $ inrange = false ; $ instep = false ; foreach ( $ matches [ 0 ] as $ match ) { if ( $ match == '*' ) { arr... | Take a cron field definition and return an array of valid numbers with the range min - max . |
33,369 | public function get_next_scheduled_time ( ) { global $ CFG ; $ validminutes = $ this -> eval_cron_field ( $ this -> minute , self :: MINUTEMIN , self :: MINUTEMAX ) ; $ validhours = $ this -> eval_cron_field ( $ this -> hour , self :: HOURMIN , self :: HOURMAX ) ; \ core_date :: set_default_server_timezone ( ) ; $ days... | Calculate when this task should next be run based on the schedule . |
33,370 | protected function get_other_values ( renderer_base $ output ) { $ filters = array ( 'competencyframeworkid' => $ this -> persistent -> get ( 'id' ) ) ; $ context = $ this -> persistent -> get_context ( ) ; $ competenciescount = 0 ; try { api :: count_competencies ( $ filters ) ; } catch ( \ required_capability_excepti... | Get other values that do not belong to the basic persisent . |
33,371 | protected function resetXMLInternalErrorsSettingAndThrowIfXMLErrorOccured ( ) { if ( $ this -> hasXMLErrorOccured ( ) ) { $ this -> resetXMLInternalErrorsSetting ( ) ; throw new XMLProcessingException ( $ this -> getLastXMLErrorMessage ( ) ) ; } $ this -> resetXMLInternalErrorsSetting ( ) ; } | Throws an XMLProcessingException if an error occured . It also always resets the libxml_use_internal_errors setting back to its initial value . |
33,372 | protected function validate_text ( $ errors , $ field , $ text ) { $ problems = qtype_calculated_find_formula_errors_in_text ( $ text ) ; if ( $ problems ) { $ errors [ $ field ] = $ problems ; } return $ errors ; } | Validate the equations in the some question content . |
33,373 | function MetaForeignKeys ( $ table , $ owner = false , $ upper = false ) { global $ ADODB_FETCH_MODE ; $ save = $ ADODB_FETCH_MODE ; $ ADODB_FETCH_MODE = ADODB_FETCH_NUM ; $ table = $ this -> qstr ( strtoupper ( $ table ) ) ; if ( ! $ owner ) { $ owner = $ this -> user ; $ tabp = 'user_' ; } else $ tabp = 'all_' ; $ ow... | returns assoc array where keys are tables and values are foreign keys |
33,374 | public function recode_legacy_state_answer ( $ state ) { global $ DB ; $ answer = $ state -> answer ; $ result = '' ; if ( preg_match ( '~^random([0-9]+)-(.*)$~' , $ answer , $ matches ) ) { $ questionid = $ matches [ 1 ] ; $ subanswer = $ matches [ 2 ] ; $ newquestionid = $ this -> get_mappingid ( 'question' , $ quest... | Given one question_states record return the answer recoded pointing to all the restored stuff for random questions |
33,375 | public function after_execute_question ( ) { global $ DB ; $ problemquestions = $ DB -> get_records_sql_menu ( " SELECT q.id, 1 FROM {question} q JOIN {backup_ids_temp} bi ON q.id = bi.newitemid WHERE q.qtype = 'random' AND " . $ DB -> s... | After restoring make sure questiontext is set properly . |
33,376 | public function set_quiz_has_attempts ( $ quizhasattempts ) { $ this -> quizhasattempts = $ quizhasattempts ; if ( $ quizhasattempts && isset ( $ this -> visiblecolumns [ 'addtoquizaction' ] ) ) { unset ( $ this -> visiblecolumns [ 'addtoquizaction' ] ) ; } } | Let the question bank display know whether the quiz has been attempted hence whether some bits of UI like the add this question to the quiz icon should be displayed . |
33,377 | protected function print_choose_category_message ( $ categoryandcontext ) { global $ OUTPUT ; debugging ( 'print_choose_category_message() is deprecated, ' . 'please use \core_question\bank\search\category_condition instead.' , DEBUG_DEVELOPER ) ; echo $ OUTPUT -> box_start ( 'generalbox questionbank' ) ; $ this -> dis... | Prints a form to choose categories . |
33,378 | public static function get_metadata ( collection $ collection ) : collection { $ collection -> add_database_table ( 'event' , [ 'name' => 'privacy:metadata:calendar:event:name' , 'description' => 'privacy:metadata:calendar:event:description' , 'eventtype' => 'privacy:metadata:calendar:event:eventtype' , 'timestart' => ... | Provides meta data that is stored about a user with core_calendar . |
33,379 | public static function get_contexts_for_userid ( int $ userid ) : contextlist { $ contextlist = new contextlist ( ) ; $ params = [ 'sitecontext' => CONTEXT_SYSTEM , 'categorycontext' => CONTEXT_COURSECAT , 'coursecontext' => CONTEXT_COURSE , 'groupcontext' => CONTEXT_COURSE , 'usercontext' => CONTEXT_USER , 'cuserid' =... | Get the list of contexts that contain calendar user information for the specified user . |
33,380 | public static function delete_data_for_all_users_in_context ( \ context $ context ) { if ( $ eventids = array_keys ( self :: get_calendar_event_ids_by_context ( $ context ) ) ) { self :: delete_batch_records ( 'event' , 'id' , $ eventids ) ; } if ( $ subscriptionids = array_keys ( self :: get_calendar_subscription_ids_... | Delete all Calendar Event and Calendar Subscription data for all users in the specified context . |
33,381 | protected static function export_user_calendar_event_data ( approved_contextlist $ contextlist ) { $ eventdetails = self :: get_calendar_event_details_by_contextlist ( $ contextlist ) ; $ eventrecords = [ ] ; foreach ( $ eventdetails as $ eventdetail ) { $ key = $ eventdetail -> contextid . $ eventdetail -> eventtype .... | Helper function to export Calendar Events data by a User s contextlist . |
33,382 | protected static function export_user_calendar_subscription_data ( approved_contextlist $ contextlist ) { $ subscriptiondetails = self :: get_calendar_subscription_details_by_contextlist ( $ contextlist ) ; $ subscriptionrecords = [ ] ; foreach ( $ subscriptiondetails as $ subscriptiondetail ) { $ key = $ subscriptiond... | Helper function to export Calendar Subscriptions data by a User s contextlist . |
33,383 | protected static function get_calendar_event_ids_by_context ( \ context $ context , $ userids = array ( ) ) { global $ DB ; if ( ! in_array ( $ context -> contextlevel , [ CONTEXT_SYSTEM , CONTEXT_COURSECAT , CONTEXT_COURSE , CONTEXT_USER , CONTEXT_MODULE ] ) ) { return [ ] ; } $ whereusersql = '' ; $ userparams = arra... | Helper function to return all Calendar Event id results for a specified context and optionally included user list . |
33,384 | protected static function get_calendar_event_details_by_contextlist ( approved_contextlist $ contextlist ) { global $ DB ; $ userid = $ contextlist -> get_user ( ) -> id ; list ( $ contextsql1 , $ contextparams1 ) = $ DB -> get_in_or_equal ( $ contextlist -> get_contextids ( ) , SQL_PARAMS_NAMED ) ; list ( $ contextsql... | Helper function to return the Calendar Events for a given user and context list . |
33,385 | protected static function get_calendar_subscription_details_by_contextlist ( approved_contextlist $ contextlist ) { global $ DB ; $ user = $ contextlist -> get_user ( ) ; list ( $ contextsql , $ contextparams ) = $ DB -> get_in_or_equal ( $ contextlist -> get_contextids ( ) , SQL_PARAMS_NAMED ) ; $ params = [ 'sitecont... | Helper function to return the Calendar Subscriptions for a given user and context list . |
33,386 | protected static function delete_batch_records ( $ tablename , $ field , $ values ) { global $ DB ; $ batchrecords = array_chunk ( $ values , 2000 ) ; foreach ( $ batchrecords as $ batchrecord ) { $ DB -> delete_records_list ( $ tablename , $ field , $ batchrecord ) ; } } | Helper function to delete records in batches in order to minimise amount of deletion queries . |
33,387 | public function start_progress ( $ description , $ max = self :: INDETERMINATE , $ parentcount = 1 ) { if ( $ max != self :: INDETERMINATE && $ max < 0 ) { throw new \ coding_exception ( 'start_progress() max value cannot be negative' ) ; } if ( $ parentcount < 1 ) { throw new \ coding_exception ( 'start_progress() par... | Marks the start of an operation that will display progress . |
33,388 | public function end_progress ( ) { if ( ! count ( $ this -> descriptions ) ) { throw new \ coding_exception ( 'end_progress() without start_progress()' ) ; } array_pop ( $ this -> descriptions ) ; array_pop ( $ this -> maxes ) ; array_pop ( $ this -> currents ) ; $ parentcount = array_pop ( $ this -> parentcounts ) ; i... | Marks the end of an operation that will display progress . |
33,389 | public function progress ( $ progress = self :: INDETERMINATE ) { $ max = end ( $ this -> maxes ) ; if ( $ max === false ) { throw new \ coding_exception ( 'progress() without start_progress' ) ; } if ( $ progress === self :: INDETERMINATE ) { if ( $ max !== self :: INDETERMINATE ) { throw new \ coding_exception ( 'pro... | Indicates that progress has occurred . |
33,390 | public function get_progress_proportion_range ( ) { if ( empty ( $ this -> currents ) ) { return array ( 1.0 , 1.0 ) ; } $ count = count ( $ this -> currents ) ; $ min = 0.0 ; $ max = 1.0 ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ sectionmax = $ this -> maxes [ $ i ] ; if ( $ sectionmax === self :: INDETERMINATE ) ... | Obtains current progress in a way suitable for drawing a progress bar . |
33,391 | public function definition ( ) { $ mform = $ this -> _form ; $ course = $ this -> _customdata [ 'course' ] ; $ itemids = $ this -> _customdata [ 'itemids' ] ; $ graders = $ this -> _customdata [ 'graders' ] ; $ userbutton = $ this -> _customdata [ 'userbutton' ] ; $ names = \ html_writer :: span ( '' , 'selectednames' ... | Definition of the Mform for filters displayed in the report . |
33,392 | public function definition_after_data ( ) { $ mform = $ this -> _form ; if ( $ userfullnames = $ mform -> getElementValue ( 'userfullnames' ) ) { $ mform -> getElement ( 'selectednames' ) -> setValue ( \ html_writer :: span ( $ userfullnames , 'selectednames' ) ) ; } } | This method implements changes to the form that need to be made once the form data is set . |
33,393 | function getRenameIndexSQL ( $ xmldb_table , $ xmldb_index , $ newname ) { $ dbindexname = $ this -> mdb -> get_manager ( ) -> find_index_name ( $ xmldb_table , $ xmldb_index ) ; $ xmldb_index -> setName ( $ newname ) ; $ results = array ( 'DROP INDEX ' . $ dbindexname ) ; $ results = array_merge ( $ results , $ this -... | Given one xmldb_table and one xmldb_index return the SQL statements needed to rename the index in the table |
33,394 | protected static function check_report_access ( $ courseid , $ userid , $ groupid = 0 ) { global $ USER ; $ params = self :: validate_parameters ( self :: get_grades_table_parameters ( ) , array ( 'courseid' => $ courseid , 'userid' => $ userid , 'groupid' => $ groupid , ) ) ; $ courseid = $ params [ 'courseid' ] ; $ u... | Validate access permissions to the report |
33,395 | protected static function get_report_data ( $ course , $ context , $ user , $ userid , $ groupid , $ tabledata = true ) { global $ CFG ; $ warnings = array ( ) ; require_once ( $ CFG -> dirroot . '/group/lib.php' ) ; require_once ( $ CFG -> libdir . '/gradelib.php' ) ; require_once ( $ CFG -> dirroot . '/grade/lib.php'... | Get the report data |
33,396 | public static function get_grades_table_parameters ( ) { return new external_function_parameters ( array ( 'courseid' => new external_value ( PARAM_INT , 'Course Id' , VALUE_REQUIRED ) , 'userid' => new external_value ( PARAM_INT , 'Return grades only for this user (optional)' , VALUE_DEFAULT , 0 ) , 'groupid' => new e... | Describes the parameters for get_grades_table . |
33,397 | public static function get_grades_table ( $ courseid , $ userid = 0 , $ groupid = 0 ) { global $ CFG , $ USER ; list ( $ params , $ course , $ context , $ user , $ groupid ) = self :: check_report_access ( $ courseid , $ userid , $ groupid ) ; $ userid = $ params [ 'userid' ] ; list ( $ tables , $ warnings ) = self :: ... | Returns a list of grades tables for users in a course . |
33,398 | public static function get_grades_table_returns ( ) { return new external_single_structure ( array ( 'tables' => new external_multiple_structure ( new external_single_structure ( array ( 'courseid' => new external_value ( PARAM_INT , 'course id' ) , 'userid' => new external_value ( PARAM_INT , 'user id' ) , 'userfullna... | Describes tget_grades_table return value . |
33,399 | public static function get_grade_items ( $ courseid , $ userid = 0 , $ groupid = 0 ) { global $ CFG , $ USER ; list ( $ params , $ course , $ context , $ user , $ groupid ) = self :: check_report_access ( $ courseid , $ userid , $ groupid ) ; $ userid = $ params [ 'userid' ] ; list ( $ gradeitems , $ warnings ) = self ... | Returns the complete list of grade items for users in a course . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.