idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
35,000 | public static function export_question_attempt_steps ( int $ userid , \ context $ context , array $ questionnocontext , \ question_attempt $ qa , \ question_display_options $ options , $ isowner ) { $ attemptdata = ( object ) [ 'steps' => [ ] , ] ; $ stepno = 0 ; foreach ( $ qa -> get_step_iterator ( ) as $ i => $ step... | Export the data for each step transition for each question in each question attempt . |
35,001 | public static function get_related_question_usages_for_user ( string $ prefix , string $ component , string $ joinfield , int $ userid ) : \ qubaid_join { return new \ qubaid_join ( " JOIN {question_usages} {$prefix}_qu ON {$prefix}_qu.id = {$joinfield} AND {$prefix}_qu.component = :{$pre... | Determine related question usages for a user . |
35,002 | function ExecuteSQLArray ( $ sql , $ continueOnError = true ) { $ rez = 2 ; $ conn = $ this -> connection ; $ saved = $ conn -> debug ; foreach ( $ sql as $ line ) { if ( $ this -> debug ) $ conn -> debug = true ; $ ok = $ conn -> Execute ( $ line ) ; $ conn -> debug = $ saved ; if ( ! $ ok ) { if ( $ this -> debug ) A... | Executes the sql array returned by GetTableSQL and GetIndexSQL |
35,003 | function AlterColumnSQL ( $ tabname , $ flds , $ tableflds = '' , $ tableoptions = '' ) { $ tabname = $ this -> TableName ( $ tabname ) ; $ sql = array ( ) ; list ( $ lines , $ pkey , $ idxs ) = $ this -> _GenFields ( $ flds ) ; if ( $ lines == null ) $ lines = array ( ) ; $ alter = 'ALTER TABLE ' . $ tabname . $ this ... | Change the definition of one column |
35,004 | function RenameColumnSQL ( $ tabname , $ oldcolumn , $ newcolumn , $ flds = '' ) { $ tabname = $ this -> TableName ( $ tabname ) ; if ( $ flds ) { list ( $ lines , $ pkey , $ idxs ) = $ this -> _GenFields ( $ flds ) ; if ( $ lines == null ) $ lines = array ( ) ; $ first = current ( $ lines ) ; list ( , $ column_def ) =... | Rename one column |
35,005 | function CreateTableSQL ( $ tabname , $ flds , $ tableoptions = array ( ) ) { list ( $ lines , $ pkey , $ idxs ) = $ this -> _GenFields ( $ flds , true ) ; if ( $ lines == null ) $ lines = array ( ) ; $ taboptions = $ this -> _Options ( $ tableoptions ) ; $ tabname = $ this -> TableName ( $ tabname ) ; $ sql = $ this -... | Generate the SQL to create table . Returns an array of sql strings . |
35,006 | function _Options ( $ opts ) { if ( ! is_array ( $ opts ) ) return array ( ) ; $ newopts = array ( ) ; foreach ( $ opts as $ k => $ v ) { if ( is_numeric ( $ k ) ) $ newopts [ strtoupper ( $ v ) ] = $ v ; else $ newopts [ strtoupper ( $ k ) ] = $ v ; } return $ newopts ; } | Sanitize options so that array elements with no keys are promoted to keys |
35,007 | public static function cartesian ( Set $ a , Set $ b ) : array { $ cartesian = [ ] ; foreach ( $ a as $ multiplier ) { foreach ( $ b as $ multiplicand ) { $ cartesian [ ] = new self ( array_merge ( [ $ multiplicand ] , [ $ multiplier ] ) ) ; } } return $ cartesian ; } | Creates the Cartesian product of A and B . |
35,008 | public static function power ( Set $ a ) : array { $ power = [ new self ( ) ] ; foreach ( $ a as $ multiplicand ) { foreach ( $ power as $ multiplier ) { $ power [ ] = new self ( array_merge ( [ $ multiplicand ] , $ multiplier -> toArray ( ) ) ) ; } } return $ power ; } | Creates the power set of A . |
35,009 | private function writeFonts ( $ objWriter , $ latinFont , $ fontSet ) { $ objWriter -> startElement ( 'a:latin' ) ; $ objWriter -> writeAttribute ( 'typeface' , $ latinFont ) ; $ objWriter -> endElement ( ) ; $ objWriter -> startElement ( 'a:ea' ) ; $ objWriter -> writeAttribute ( 'typeface' , '' ) ; $ objWriter -> end... | Write fonts to XML format |
35,010 | public function update_rating ( $ rating ) { global $ DB ; $ time = time ( ) ; $ data = new stdClass ; $ data -> rating = $ rating ; $ data -> timemodified = $ time ; $ item = new stdclass ( ) ; $ item -> id = $ this -> itemid ; $ items = array ( $ item ) ; $ ratingoptions = new stdClass ; $ ratingoptions -> context = ... | Update this rating in the database |
35,011 | public function get_aggregate_string ( ) { $ aggregate = $ this -> aggregate ; $ method = $ this -> settings -> aggregationmethod ; $ aggregatestr = '' ; if ( is_numeric ( $ aggregate ) && $ method != RATING_AGGREGATE_COUNT ) { if ( $ method != RATING_AGGREGATE_SUM && ! $ this -> settings -> scale -> isnumeric ) { $ ag... | Returns this ratings aggregate value as a string . |
35,012 | public function user_can_rate ( $ userid = null ) { if ( empty ( $ userid ) ) { global $ USER ; $ userid = $ USER -> id ; } if ( $ this -> itemuserid == $ userid ) { return false ; } if ( ! $ this -> settings -> permissions -> rate ) { return false ; } if ( ! $ this -> settings -> pluginpermissions -> rate ) { return f... | Returns true if the user is able to rate this rating object |
35,013 | public function user_can_view_aggregate ( $ userid = null ) { if ( empty ( $ userid ) ) { global $ USER ; $ userid = $ USER -> id ; } if ( ( empty ( $ this -> itemuserid ) or $ this -> itemuserid != $ userid ) && $ this -> settings -> permissions -> viewany && $ this -> settings -> pluginpermissions -> viewany ) { retu... | Returns true if the user is able to view the aggregate for this rating object . |
35,014 | public function get_view_ratings_url ( $ popup = false ) { $ attributes = array ( 'contextid' => $ this -> context -> id , 'component' => $ this -> component , 'ratingarea' => $ this -> ratingarea , 'itemid' => $ this -> itemid , 'scaleid' => $ this -> settings -> scale -> id ) ; if ( $ popup ) { $ attributes [ 'popup'... | Returns a URL to view all of the ratings for the item this rating is for . |
35,015 | public function get_rate_url ( $ rating = null , $ returnurl = null ) { if ( empty ( $ returnurl ) ) { if ( ! empty ( $ this -> settings -> returnurl ) ) { $ returnurl = $ this -> settings -> returnurl ; } else { global $ PAGE ; $ returnurl = $ PAGE -> url ; } } $ args = array ( 'contextid' => $ this -> context -> id ,... | Returns a URL that can be used to rate the associated item . |
35,016 | public function delete_ratings ( $ options ) { global $ DB ; if ( empty ( $ options -> contextid ) ) { throw new coding_exception ( 'The context option is a required option when deleting ratings.' ) ; } $ conditions = array ( 'contextid' => $ options -> contextid ) ; $ possibleconditions = array ( 'ratingid' => 'id' , ... | Delete one or more ratings . Specify either a rating id an item id or just the context id . |
35,017 | protected function generate_rating_settings_object ( $ options ) { if ( ! isset ( $ options -> context ) ) { throw new coding_exception ( 'The context option is a required option when generating a rating settings object.' ) ; } if ( ! isset ( $ options -> component ) ) { throw new coding_exception ( 'The component opti... | Generates a rating settings object based upon the options it is provided . |
35,018 | protected function generate_rating_scale_object ( $ scaleid ) { global $ DB ; if ( ! array_key_exists ( 's' . $ scaleid , $ this -> scales ) ) { $ scale = new stdClass ; $ scale -> id = $ scaleid ; $ scale -> name = null ; $ scale -> courseid = null ; $ scale -> scaleitems = array ( ) ; $ scale -> isnumeric = true ; $ ... | Generates a scale object that can be returned |
35,019 | protected function get_item_time_created ( $ item ) { if ( ! empty ( $ item -> created ) ) { return $ item -> created ; } else if ( ! empty ( $ item -> timecreated ) ) { return $ item -> timecreated ; } else { return null ; } } | Gets the time the given item was created |
35,020 | public function get_aggregate_types ( ) { return array ( RATING_AGGREGATE_NONE => get_string ( 'aggregatenone' , 'rating' ) , RATING_AGGREGATE_AVERAGE => get_string ( 'aggregateavg' , 'rating' ) , RATING_AGGREGATE_COUNT => get_string ( 'aggregatecount' , 'rating' ) , RATING_AGGREGATE_MAXIMUM => get_string ( 'aggregatem... | Returns array of aggregate types . Used by ratings . |
35,021 | public function get_aggregation_method ( $ aggregate ) { $ aggregatestr = null ; switch ( $ aggregate ) { case RATING_AGGREGATE_AVERAGE : $ aggregatestr = 'AVG' ; break ; case RATING_AGGREGATE_COUNT : $ aggregatestr = 'COUNT' ; break ; case RATING_AGGREGATE_MAXIMUM : $ aggregatestr = 'MAX' ; break ; case RATING_AGGREGA... | Converts an aggregation method constant into something that can be included in SQL |
35,022 | public function check_rating_is_valid ( $ params ) { if ( ! isset ( $ params [ 'context' ] ) ) { throw new coding_exception ( 'The context option is a required option when checking rating validity.' ) ; } if ( ! isset ( $ params [ 'component' ] ) ) { throw new coding_exception ( 'The component option is now a required ... | Validates a submitted rating |
35,023 | public function initialise_rating_javascript ( moodle_page $ page ) { global $ CFG ; static $ done = false ; if ( $ done ) { return true ; } $ page -> requires -> js_init_call ( 'M.core_rating.init' ) ; $ done = true ; return true ; } | Initialises JavaScript to enable AJAX ratings on the provided page |
35,024 | public function get_aggregate_label ( $ aggregationmethod ) { $ aggregatelabel = '' ; switch ( $ aggregationmethod ) { case RATING_AGGREGATE_AVERAGE : $ aggregatelabel .= get_string ( "aggregateavg" , "rating" ) ; break ; case RATING_AGGREGATE_COUNT : $ aggregatelabel .= get_string ( "aggregatecount" , "rating" ) ; bre... | Returns a string that describes the aggregation method that was provided . |
35,025 | public function get_component_ratings_since ( $ context , $ component , $ since ) { global $ DB , $ USER ; $ ratingssince = array ( ) ; $ where = 'contextid = ? AND component = ? AND (timecreated > ? OR timemodified > ?)' ; $ ratings = $ DB -> get_records_select ( 'rating' , $ where , array ( $ context -> id , $ compon... | Get ratings created since a given time . |
35,026 | protected function col_name ( $ row ) { return html_writer :: link ( new moodle_url ( '/admin/tool/lp/plan.php' , array ( 'id' => $ row -> id ) ) , format_string ( $ row -> name , true , array ( 'context' => $ this -> context ) ) ) ; } | Format column name . |
35,027 | public function get_all_samples ( \ core_analytics \ analysable $ course ) { $ context = \ context_course :: instance ( $ course -> get_id ( ) ) ; return array ( array ( $ course -> get_id ( ) => $ course -> get_id ( ) ) , array ( $ course -> get_id ( ) => array ( 'course' => $ course -> get_course_data ( ) , 'context'... | This will return just one course as we analyse by_course . |
35,028 | public function print_login ( ) { if ( $ this -> options [ 'ajax' ] ) { $ ret = array ( ) ; $ fulltext = new stdClass ( ) ; $ fulltext -> label = get_string ( 'fulltext' , 'repository_flickr_public' ) . ': ' ; $ fulltext -> id = 'el_fulltext' ; $ fulltext -> type = 'text' ; $ fulltext -> name = 'flickr_fulltext' ; $ ta... | construct login form |
35,029 | public function get_listing ( $ path = '' , $ page = 1 ) { $ people = $ this -> flickr -> people_findByEmail ( $ this -> flickr_account ) ; $ this -> nsid = $ people [ 'nsid' ] ; $ photos = $ this -> flickr -> people_getPublicPhotos ( $ people [ 'nsid' ] , 'original_format' , 24 , $ page ) ; $ ret = array ( ) ; return ... | return an image list |
35,030 | private function build_list ( $ photos , $ page = 1 , & $ ret ) { if ( ! empty ( $ this -> nsid ) ) { $ photos_url = $ this -> flickr -> urls_getUserPhotos ( $ this -> nsid ) ; $ ret [ 'manage' ] = $ photos_url ; } $ ret [ 'list' ] = array ( ) ; $ ret [ 'nosearch' ] = true ; $ ret [ 'norefresh' ] = true ; $ ret [ 'logo... | build an image list |
35,031 | public function print_search ( ) { $ str = '' ; $ str .= '<input type="hidden" name="repo_id" value="' . $ this -> id . '" />' ; $ str .= '<input type="hidden" name="ctx_id" value="' . $ this -> context -> id . '" />' ; $ str .= '<input type="hidden" name="seekey" value="' . sesskey ( ) . '" />' ; $ str .= '<label>' . ... | Print a search form |
35,032 | private function build_photo_url ( $ photoid ) { $ bestsize = $ this -> get_best_size ( $ photoid ) ; if ( ! isset ( $ bestsize [ 'source' ] ) ) { throw new repository_exception ( 'cannotdownload' , 'repository' ) ; } return $ bestsize [ 'source' ] ; } | Return photo url by given photo id |
35,033 | protected function get_best_size ( $ photoid ) { if ( ! isset ( self :: $ sizes [ $ photoid ] ) ) { self :: $ sizes [ $ photoid ] = $ this -> flickr -> photos_getSizes ( $ photoid ) ; } $ sizes = self :: $ sizes [ $ photoid ] ; $ bestsize = array ( ) ; if ( is_array ( $ sizes ) ) { while ( $ bestsize = array_pop ( $ si... | Returns the best size for a photo |
35,034 | public static function plugin_init ( ) { $ id = repository :: static_function ( 'flickr_public' , 'create' , 'flickr_public' , 0 , context_system :: instance ( ) , array ( 'name' => '' , 'email_address' => null , 'usewatermarks' => false ) , 0 ) ; if ( empty ( $ id ) ) { return false ; } else { return true ; } } | is run when moodle administrator add the plugin |
35,035 | public static function instance ( $ prototype = null ) { static $ instance = null ; if ( $ prototype !== null ) { $ instance = $ prototype ; } elseif ( $ instance === null || $ prototype == true ) { $ instance = new HTMLPurifier_LanguageFactory ( ) ; $ instance -> setup ( ) ; } return $ instance ; } | Retrieve sole instance of the factory . |
35,036 | public function create ( $ config , $ context , $ code = false ) { if ( $ code === false ) { $ code = $ this -> validator -> validate ( $ config -> get ( 'Core.Language' ) , $ config , $ context ) ; } else { $ code = $ this -> validator -> validate ( $ code , $ config , $ context ) ; } if ( $ code === false ) { $ code ... | Creates a language object handles class fallbacks |
35,037 | function find_range ( $ data , $ min , $ max , $ resolution ) { if ( sizeof ( $ data ) == 0 ) return array ( 'min' => 0 , 'max' => 0 ) ; foreach ( $ data as $ key => $ value ) { if ( $ value == 'none' ) continue ; if ( $ value > $ max ) $ max = $ value ; if ( $ value < $ min ) $ min = $ value ; } if ( $ max == 0 ) { $ ... | find max and min values for a data array given the resolution . |
35,038 | function update_boundaryBox ( & $ boundaryBox , $ coords ) { $ width = $ boundaryBox [ 'width' ] ; $ height = $ boundaryBox [ 'height' ] ; $ x = $ coords [ 'x' ] ; $ y = $ coords [ 'y' ] ; $ reference = $ coords [ 'reference' ] ; switch ( $ reference ) { case 'top-left' : case 'left-top' : $ top = $ y ; $ bottom = $ y ... | move boundaryBox to coordinates specified |
35,039 | function draw_brush_line ( $ x0 , $ y0 , $ x1 , $ y1 , $ size , $ type , $ colour ) { $ dy = $ y1 - $ y0 ; $ dx = $ x1 - $ x0 ; $ t = 0 ; $ watchdog = 1024 ; $ this -> draw_brush ( $ x0 , $ y0 , $ size , $ type , $ colour ) ; if ( abs ( $ dx ) > abs ( $ dy ) ) { $ m = $ dy / $ dx ; $ t += $ y0 ; $ dx = ( $ dx < 0 ) ? -... | function to draw line . would prefer to use gdBrush but this is not supported yet . |
35,040 | protected function navigation_add_activity ( navigation_node $ node , $ cm ) { if ( ! $ cm -> uservisible ) { return null ; } $ action = $ cm -> url ; if ( ! $ action ) { return null ; } $ activityname = format_string ( $ cm -> name , true , array ( 'context' => context_module :: instance ( $ cm -> id ) ) ) ; if ( $ cm... | Adds a course module to the navigation node |
35,041 | public function reorder_activities ( ) { course_create_sections_if_missing ( $ this -> courseid , array ( 0 , 1 ) ) ; foreach ( $ this -> get_sections ( ) as $ sectionnum => $ section ) { if ( ( $ sectionnum && $ section -> visible ) || ( ! $ sectionnum && ! $ section -> visible ) ) { set_section_visible ( $ this -> co... | Make sure that current active activity is in section 0 |
35,042 | protected function get_activitytype ( ) { $ options = $ this -> get_format_options ( ) ; $ availabletypes = $ this -> get_supported_activities ( ) ; if ( ! empty ( $ options [ 'activitytype' ] ) && array_key_exists ( $ options [ 'activitytype' ] , $ availabletypes ) ) { return $ options [ 'activitytype' ] ; } else { re... | Returns the name of activity type used for this course |
35,043 | protected function get_activity ( ) { if ( $ this -> activity === false ) { $ this -> activity = $ this -> reorder_activities ( ) ; } return $ this -> activity ; } | Returns the current activity if exists |
35,044 | public static function get_supported_activities ( ) { $ availabletypes = get_module_types_names ( ) ; foreach ( $ availabletypes as $ module => $ name ) { if ( plugin_supports ( 'mod' , $ module , FEATURE_NO_VIEW_LINK , false ) ) { unset ( $ availabletypes [ $ module ] ) ; } } return $ availabletypes ; } | Get the activities supported by the format . |
35,045 | protected function can_add_activity ( ) { global $ CFG ; if ( ! ( $ modname = $ this -> get_activitytype ( ) ) ) { return false ; } if ( ! has_capability ( 'moodle/course:manageactivities' , context_course :: instance ( $ this -> courseid ) ) ) { return false ; } if ( ! course_allowed_module ( $ this -> get_course ( ) ... | Checks if the current user can add the activity of the specified type to this course . |
35,046 | public function config_form_definition ( \ MoodleQuickForm $ mform ) { $ mform -> addElement ( 'header' , 'header_specificsettings' , get_string ( 'specificsettings' , 'customfield_select' ) ) ; $ mform -> setExpanded ( 'header_specificsettings' , true ) ; $ mform -> addElement ( 'textarea' , 'configdata[options]' , ge... | Add fields for editing a select field . |
35,047 | public static function get_options_array ( \ core_customfield \ field_controller $ field ) : array { if ( $ field -> get_configdata_property ( 'options' ) ) { $ options = preg_split ( "/\s*\n\s*/" , trim ( $ field -> get_configdata_property ( 'options' ) ) ) ; } else { $ options = array ( ) ; } return array_merge ( [ '... | Returns the options available as an array . |
35,048 | public function config_form_validation ( array $ data , $ files = array ( ) ) : array { $ options = preg_split ( "/\s*\n\s*/" , trim ( $ data [ 'configdata' ] [ 'options' ] ) ) ; $ errors = [ ] ; if ( ! $ options || count ( $ options ) < 2 ) { $ errors [ 'configdata[options]' ] = get_string ( 'errornotenoughoptions' , ... | Validate the data from the config form . Sub classes must reimplement it . |
35,049 | public function question_setup ( $ reporturl , $ questiondata , $ s , $ responseanalysis ) { $ this -> questiondata = $ questiondata ; $ this -> s = $ s ; $ this -> define_baseurl ( $ reporturl -> out ( ) ) ; $ this -> collapsible ( false ) ; $ this -> set_attribute ( 'class' , 'generaltable generalbox boxaligncenter q... | Set up columns and column names and other table settings . |
35,050 | protected function col_frequency ( $ response ) { if ( ! $ this -> s ) { return '' ; } return $ this -> format_percentage ( $ response -> totalcount / $ this -> s ) ; } | The frequency with which this response was given . |
35,051 | protected static function connection_string_to_memcache_servers ( string $ str ) : array { $ servers = [ ] ; $ parts = explode ( ',' , $ str ) ; foreach ( $ parts as $ part ) { $ part = trim ( $ part ) ; $ pos = strrpos ( $ part , ':' ) ; if ( $ pos !== false ) { $ host = substr ( $ part , 0 , $ pos ) ; $ port = substr... | Convert a connection string to an array of servers . |
35,052 | function validate ( $ value , $ options = null ) { if ( isset ( $ this -> _data [ $ this -> name ] ) ) { $ callback = $ this -> _data [ $ this -> name ] ; if ( isset ( $ callback [ 1 ] ) ) { return call_user_func ( array ( $ callback [ 1 ] , $ callback [ 0 ] ) , $ value , $ options ) ; } elseif ( $ this -> _BCMode [ $ ... | Validates a value using a callback |
35,053 | function addData ( $ name , $ callback , $ class = null , $ BCMode = false ) { if ( ! empty ( $ class ) ) { $ this -> _data [ $ name ] = array ( $ callback , $ class ) ; } else { $ this -> _data [ $ name ] = array ( $ callback ) ; } $ this -> _BCMode [ $ name ] = $ BCMode ; } | Adds new callbacks to the callbacks list |
35,054 | public function validation ( $ data , $ files ) { global $ CFG ; $ errors = parent :: validation ( $ data , $ files ) ; require_once ( $ CFG -> libdir . '/simplepie/moodle_simplepie.php' ) ; $ rss = new moodle_simplepie ( ) ; $ rssfile = $ rss -> registry -> create ( 'File' , array ( $ data [ 'url' ] ) ) ; $ filetest =... | Additional validation includes checking URL and tags |
35,055 | protected function _getxobjectdict ( ) { $ out = parent :: _getxobjectdict ( ) ; foreach ( $ this -> _tpls as $ tplIdx => $ tpl ) { $ out .= sprintf ( '%s%d %d 0 R' , $ this -> tplPrefix , $ tplIdx , $ tpl [ 'n' ] ) ; } return $ out ; } | Return XObjects Dictionary . |
35,056 | protected function _prepareValue ( & $ value ) { switch ( $ value [ 0 ] ) { case pdf_parser :: TYPE_STRING : if ( $ this -> encrypted ) { $ value [ 1 ] = $ this -> _unescape ( $ value [ 1 ] ) ; $ value [ 1 ] = $ this -> _encrypt_data ( $ this -> _currentObjId , $ value [ 1 ] ) ; $ value [ 1 ] = TCPDF_STATIC :: _escape ... | Writes a PDF value to the resulting document . |
35,057 | protected function _unescape ( $ s ) { $ out = '' ; for ( $ count = 0 , $ n = strlen ( $ s ) ; $ count < $ n ; $ count ++ ) { if ( $ s [ $ count ] != '\\' || $ count == $ n - 1 ) { $ out .= $ s [ $ count ] ; } else { switch ( $ s [ ++ $ count ] ) { case ')' : case '(' : case '\\' : $ out .= $ s [ $ count ] ; break ; ca... | Un - escapes a PDF string |
35,058 | public function hex2str ( $ data ) { $ data = preg_replace ( '/[^0-9A-Fa-f]/' , '' , rtrim ( $ data , '>' ) ) ; if ( ( strlen ( $ data ) % 2 ) == 1 ) { $ data .= '0' ; } return pack ( 'H*' , $ data ) ; } | Hexadecimal to string |
35,059 | public function get_forum_view_url_from_forum ( forum_entity $ forum , ? int $ pageno = null , ? int $ sortorder = null ) : moodle_url { return $ this -> get_forum_view_url_from_course_module_id ( $ forum -> get_course_module_record ( ) -> id , $ pageno , $ sortorder ) ; } | Get the view forum url for the given forum and optionally a page number . |
35,060 | public function get_forum_view_url_from_course_module_id ( int $ coursemoduleid , ? int $ pageno = null , ? int $ sortorder = null ) : moodle_url { $ url = new moodle_url ( '/mod/forum/view.php' , [ 'id' => $ coursemoduleid , ] ) ; if ( null !== $ pageno ) { $ url -> param ( 'p' , $ pageno ) ; } if ( null !== $ sortord... | Get the view forum url for the given course module id and optionally a page number . |
35,061 | public function get_discussion_view_first_unread_post_url_from_discussion ( discussion_entity $ discussion ) { $ viewurl = $ this -> get_discussion_view_url_from_discussion_id ( $ discussion -> get_id ( ) ) ; $ viewurl -> set_anchor ( 'unread' ) ; return $ viewurl ; } | Get the url to view the first unread post in a discussion . |
35,062 | public function get_view_post_url_from_post_id ( int $ discussionid , int $ postid ) : moodle_url { $ url = $ this -> get_discussion_view_url_from_discussion_id ( $ discussionid ) ; $ url -> set_anchor ( 'p' . $ postid ) ; return $ url ; } | Get the url to view a discussion from a discussion id and post id . |
35,063 | public function get_view_post_url_from_post ( post_entity $ post ) : moodle_url { return $ this -> get_view_post_url_from_post_id ( $ post -> get_discussion_id ( ) , $ post -> get_id ( ) ) ; } | Get the url to view a post in the context of the rest of the discussion . |
35,064 | public function get_edit_post_url_from_post ( forum_entity $ forum , post_entity $ post ) : moodle_url { if ( $ forum -> get_type ( ) == 'single' ) { return new moodle_url ( '/course/modedit.php' , [ 'update' => $ forum -> get_course_module_record ( ) -> id , 'sesskey' => sesskey ( ) , 'return' => 1 ] ) ; } else { retu... | Get the url to edit a post . |
35,065 | public function get_mark_post_as_read_url_from_post ( post_entity $ post , int $ displaymode = FORUM_MODE_THREADED ) : moodle_url { $ params = [ 'd' => $ post -> get_discussion_id ( ) , 'postid' => $ post -> get_id ( ) , 'mark' => 'read' ] ; $ url = new moodle_url ( '/mod/forum/discuss.php' , $ params ) ; if ( $ displa... | Get the url to mark a post as read . |
35,066 | public function get_export_attachment_url_from_post_and_attachment ( post_entity $ post , stored_file $ attachment ) : ? moodle_url { global $ CFG ; require_once ( $ CFG -> libdir . '/portfoliolib.php' ) ; $ button = new \ portfolio_add_button ( ) ; $ button -> set_callback_options ( 'forum_portfolio_caller' , [ 'posti... | Get the url to export attachments for a post . |
35,067 | public function get_author_profile_image_url ( author_entity $ author , int $ authorcontextid = null ) : moodle_url { global $ PAGE ; $ datamapper = $ this -> legacydatamapperfactory -> get_author_data_mapper ( ) ; $ record = $ datamapper -> to_legacy_object ( $ author ) ; $ record -> contextid = $ authorcontextid ; $ ... | Get the url to view the author s profile image . The author s context id should be provided to prevent the code from needing to load it . |
35,068 | public function get_mark_discussion_as_read_url_from_discussion ( forum_entity $ forum , discussion_entity $ discussion ) : moodle_url { return new moodle_url ( '/mod/forum/markposts.php' , [ 'f' => $ discussion -> get_forum_id ( ) , 'd' => $ discussion -> get_id ( ) , 'mark' => 'read' , 'sesskey' => sesskey ( ) , 'ret... | Get the url to mark a discussion as read . |
35,069 | public function get_mark_all_discussions_as_read_url ( forum_entity $ forum ) : moodle_url { return new moodle_url ( '/mod/forum/markposts.php' , [ 'f' => $ forum -> get_id ( ) , 'mark' => 'read' , 'sesskey' => sesskey ( ) , 'return' => $ this -> get_forum_view_url_from_forum ( $ forum ) -> out ( ) , ] ) ; } | Get the url to mark all discussions as read . |
35,070 | public function get_discussion_subscribe_url ( discussion_entity $ discussion ) : moodle_url { return new moodle_url ( '/mod/forum/subscribe.php' , [ 'sesskey' => sesskey ( ) , 'id' => $ discussion -> get_forum_id ( ) , 'd' => $ discussion -> get_id ( ) ] ) ; } | Get the url to subscribe to a discussion . |
35,071 | public function get_pin_discussion_url_from_discussion ( discussion_entity $ discussion ) : moodle_url { return new moodle_url ( 'discuss.php' , [ 'sesskey' => sesskey ( ) , 'd' => $ discussion -> get_id ( ) , 'pin' => $ discussion -> is_pinned ( ) ? FORUM_DISCUSSION_UNPINNED : FORUM_DISCUSSION_PINNED ] ) ; } | Generate the pinned discussion link |
35,072 | public function finish ( ) { if ( $ this -> outputmode == self :: NO_OUTPUT ) { return ; } if ( $ this -> outputmode == self :: OUTPUT_HTML ) { echo html_writer :: end_tag ( 'table' ) ; } } | Finish the output . |
35,073 | public function results ( $ total , $ created , $ updated , $ deleted , $ errors ) { if ( $ this -> outputmode == self :: NO_OUTPUT ) { return ; } $ message = array ( get_string ( 'coursestotal' , 'tool_uploadcourse' , $ total ) , get_string ( 'coursescreated' , 'tool_uploadcourse' , $ created ) , get_string ( 'courses... | Output the results . |
35,074 | public function output ( $ line , $ outcome , $ status , $ data ) { global $ OUTPUT ; if ( $ this -> outputmode == self :: NO_OUTPUT ) { return ; } if ( $ this -> outputmode == self :: OUTPUT_PLAIN ) { $ message = array ( $ line , $ outcome ? 'OK' : 'NOK' , isset ( $ data [ 'id' ] ) ? $ data [ 'id' ] : '' , isset ( $ d... | Output one more line . |
35,075 | public function start ( ) { if ( $ this -> outputmode == self :: NO_OUTPUT ) { return ; } if ( $ this -> outputmode == self :: OUTPUT_PLAIN ) { $ columns = array_flip ( $ this -> columns ) ; unset ( $ columns [ 'status' ] ) ; $ columns = array_flip ( $ columns ) ; $ this -> buffer -> output ( implode ( "\t" , $ columns... | Start the output . |
35,076 | public function close ( ) { if ( $ this -> isClosed ) { return ; } if ( strlen ( $ this -> buffer ) > 0 ) { $ this -> insertChunkFromBuffer ( ) ; } $ this -> fileCollectionInsert ( ) ; $ this -> isClosed = true ; } | Closes an active stream and flushes all buffered data to GridFS . |
35,077 | public function writeBytes ( $ data ) { if ( $ this -> isClosed ) { return ; } $ bytesRead = 0 ; while ( $ bytesRead != strlen ( $ data ) ) { $ initialBufferLength = strlen ( $ this -> buffer ) ; $ this -> buffer .= substr ( $ data , $ bytesRead , $ this -> chunkSize - $ initialBufferLength ) ; $ bytesRead += strlen ( ... | Inserts binary data into GridFS via chunks . |
35,078 | protected function init ( ) { if ( isset ( $ this -> stores ) ) { return ; } $ this -> stores = array ( ) ; $ this -> readers = array ( ) ; $ this -> writers = array ( ) ; \ core_shutdown_manager :: register_function ( array ( $ this , 'dispose' ) ) ; $ plugins = get_config ( 'tool_log' , 'enabled_stores' ) ; if ( empt... | Delayed initialisation of singleton . |
35,079 | public function process ( \ core \ event \ base $ event ) { $ this -> init ( ) ; foreach ( $ this -> writers as $ plugin => $ writer ) { try { $ writer -> write ( $ event , $ this ) ; } catch ( \ Exception $ e ) { debugging ( 'Exception detected when logging event ' . $ event -> eventname . ' in ' . $ plugin . ': ' . $... | Called from the observer only . |
35,080 | public function get_readers ( $ interface = null ) { $ this -> init ( ) ; $ return = array ( ) ; foreach ( $ this -> readers as $ plugin => $ reader ) { if ( empty ( $ interface ) || ( $ reader instanceof $ interface ) ) { $ return [ $ plugin ] = $ reader ; } } return $ return ; } | Returns list of available log readers . |
35,081 | public function get_supported_reports ( $ logstore ) { $ allstores = self :: get_store_plugins ( ) ; if ( empty ( $ allstores [ $ logstore ] ) ) { return array ( ) ; } $ reports = get_plugin_list_with_function ( 'report' , 'supports_logstore' , 'lib.php' ) ; $ enabled = $ this -> stores ; if ( empty ( $ enabled [ $ log... | Get a list of reports that support the given store instance . |
35,082 | public function get_supported_logstores ( $ component ) { $ allstores = self :: get_store_plugins ( ) ; $ enabled = $ this -> stores ; $ function = component_callback_exists ( $ component , 'supports_logstore' ) ; if ( ! $ function ) { return false ; } $ return = array ( ) ; foreach ( $ allstores as $ store => $ logcla... | For a given report returns a list of log stores that are supported . |
35,083 | public function dispose ( ) { if ( $ this -> stores ) { foreach ( $ this -> stores as $ store ) { $ store -> dispose ( ) ; } } $ this -> stores = null ; $ this -> readers = null ; $ this -> writers = null ; } | Usually called automatically from shutdown manager this allows us to implement buffering of write operations . |
35,084 | public function get_badge_assertion ( ) { global $ CFG ; $ assertion = array ( ) ; if ( $ this -> _data ) { $ hash = $ this -> _data -> uniquehash ; $ email = empty ( $ this -> _data -> backpackemail ) ? $ this -> _data -> email : $ this -> _data -> backpackemail ; $ assertionurl = new moodle_url ( '/badges/assertion.p... | Get badge assertion . |
35,085 | public function get_badge_class ( ) { $ class = array ( ) ; if ( $ this -> _data ) { if ( empty ( $ this -> _data -> courseid ) ) { $ context = context_system :: instance ( ) ; } else { $ context = context_course :: instance ( $ this -> _data -> courseid ) ; } $ issuerurl = new moodle_url ( '/badges/assertion.php' , ar... | Get badge class information . |
35,086 | public function get_issuer ( ) { $ issuer = array ( ) ; if ( $ this -> _data ) { $ issuer [ 'name' ] = $ this -> _data -> issuername ; $ issuer [ 'url' ] = $ this -> _data -> issuerurl ; if ( ! empty ( $ this -> _data -> issuercontact ) ) { $ issuer [ 'email' ] = $ this -> _data -> issuercontact ; } } $ this -> embed_d... | Get badge issuer information . |
35,087 | public function get_related_badges ( badge $ badge ) { global $ DB ; $ arraybadges = array ( ) ; $ relatedbadges = $ badge -> get_related_badges ( true ) ; if ( $ relatedbadges ) { foreach ( $ relatedbadges as $ rb ) { $ url = new moodle_url ( '/badges/badge_json.php' , array ( 'id' => $ rb -> id ) ) ; $ arraybadges [ ... | Get related badges of the badge . |
35,088 | public function get_endorsement ( ) { global $ DB ; $ endorsement = array ( ) ; $ record = $ DB -> get_record_select ( 'badge_endorsement' , 'badgeid = ?' , array ( $ this -> _data -> id ) ) ; return $ record ; } | Get endorsement of the badge . |
35,089 | public function get_criteria_badge_class ( ) { $ badge = new badge ( $ this -> _data -> id ) ; $ narrative = $ badge -> markdown_badge_criteria ( ) ; if ( ! empty ( $ narrative ) ) { $ criteria = array ( ) ; $ criteria [ 'id' ] = $ this -> _url -> out ( false ) ; $ criteria [ 'narrative' ] = $ narrative ; return $ crit... | Get criteria of badge class . |
35,090 | public function get_alignments ( ) { global $ DB ; $ badgeid = $ this -> _data -> id ; $ alignments = array ( ) ; $ items = $ DB -> get_records_select ( 'badge_alignment' , 'badgeid = ?' , array ( $ badgeid ) ) ; foreach ( $ items as $ item ) { $ alignment = array ( 'targetName' => $ item -> targetname , 'targetUrl' =>... | Get alignment of the badge . |
35,091 | public static function get_ruleoutcome_name ( $ ruleoutcome ) { switch ( $ ruleoutcome ) { case self :: OUTCOME_NONE : $ strname = 'none' ; break ; case self :: OUTCOME_EVIDENCE : $ strname = 'evidence' ; break ; case self :: OUTCOME_RECOMMEND : $ strname = 'recommend' ; break ; case self :: OUTCOME_COMPLETE : $ strnam... | Human readable rule name . |
35,092 | public static function list_course_modules ( $ competencyid , $ courseid ) { global $ DB ; $ results = $ DB -> get_records_sql ( 'SELECT coursemodules.id as id FROM {' . self :: TABLE . '} modcomp JOIN {course_modules} coursemodules ... | Return the module IDs and visible flags that include this competency in a single course . |
35,093 | public static function list_course_module_competencies ( $ cmid ) { global $ DB ; $ sql = 'SELECT coursemodcomp.* FROM {' . self :: TABLE . '} coursemodcomp JOIN {' . competency :: TABLE . '} comp ON coursemodcomp.competencyid = comp.id WHERE coursemo... | List the course_module_competencies in this course module . |
35,094 | public static function get_records_by_competencyid_in_course ( $ competencyid , $ courseid ) { global $ DB ; $ sql = 'SELECT cmc.* FROM {' . self :: TABLE . '} cmc JOIN {course_modules} cm ON cm.course = ? AND cmc.cmid = cm.id WHERE ... | List the relationship objects for a competency in a course . |
35,095 | protected function configuration_definition ( ) { global $ OUTPUT ; $ form = $ this -> _form ; if ( ! version_compare ( phpversion ( 'mongodb' ) , '1.5' , 'ge' ) ) { $ form -> addElement ( 'html' , $ OUTPUT -> notification ( get_string ( 'pleaseupgrademongo' , 'cachestore_mongodb' ) ) ) ; } $ form -> addElement ( 'text... | The forms custom definitions . |
35,096 | public static function start ( ) { global $ CFG , $ DB , $ PERF ; if ( isset ( self :: $ sessionactive ) ) { debugging ( 'Session was already started!' , DEBUG_DEVELOPER ) ; return ; } $ PERF -> sessionlock [ 'start' ] = microtime ( true ) ; self :: load_handler ( ) ; if ( empty ( $ DB ) or empty ( $ CFG -> version ) o... | Start user session . |
35,097 | public static function get_performance_info ( ) { global $ CFG , $ PERF ; if ( ! session_id ( ) ) { return array ( ) ; } self :: load_handler ( ) ; $ size = display_size ( strlen ( session_encode ( ) ) ) ; $ handler = get_class ( self :: $ handler ) ; $ info = array ( ) ; $ info [ 'size' ] = $ size ; $ info [ 'html' ] ... | Returns current page performance info . |
35,098 | public static function get_handler_class ( ) { global $ CFG , $ DB ; if ( PHPUNIT_TEST ) { return '\core\session\file' ; } else if ( ! empty ( $ CFG -> session_handler_class ) ) { return $ CFG -> session_handler_class ; } else if ( ! empty ( $ CFG -> dbsessions ) and $ DB -> session_lock_supported ( ) ) { return '\core... | Get fully qualified name of session handler class . |
35,099 | public static function init_empty_session ( ) { global $ CFG ; if ( isset ( $ GLOBALS [ 'SESSION' ] -> notifications ) ) { $ notifications = $ GLOBALS [ 'SESSION' ] -> notifications ; } $ GLOBALS [ 'SESSION' ] = new \ stdClass ( ) ; $ GLOBALS [ 'USER' ] = new \ stdClass ( ) ; $ GLOBALS [ 'USER' ] -> id = 0 ; if ( ! emp... | Empty current session fill it with not - logged - in user info . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.