idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
31,900 | protected function process_post_data ( $ posts ) { $ discussionids = [ ] ; $ forumids = [ ] ; $ courseids = [ ] ; $ this -> log_start ( "Processing post information" ) ; $ start = microtime ( true ) ; foreach ( $ posts as $ id => $ post ) { $ discussionids [ $ post -> discussion ] = true ; $ forumids [ $ post -> forum ... | Process all posts and convert to appropriated hoc tasks . |
31,901 | protected function fill_course_cache ( $ courseids ) { global $ DB ; list ( $ in , $ params ) = $ DB -> get_in_or_equal ( $ courseids ) ; $ this -> courses = $ DB -> get_records_select ( 'course' , "id $in" , $ params ) ; } | Fill the course cache . |
31,902 | protected function fill_forum_cache ( $ forumids ) { global $ DB ; $ requiredfields = [ 'id' , 'course' , 'forcesubscribe' , 'type' , ] ; list ( $ in , $ params ) = $ DB -> get_in_or_equal ( $ forumids ) ; $ this -> forums = $ DB -> get_records_select ( 'forum' , "id $in" , $ params , '' , implode ( ', ' , $ requiredfi... | Fill the forum cache . |
31,903 | protected function fill_discussion_cache ( $ discussionids ) { global $ DB ; if ( empty ( $ discussionids ) ) { $ this -> discussion = [ ] ; } else { $ requiredfields = [ 'id' , 'groupid' , 'firstpost' , 'timestart' , 'timeend' , ] ; list ( $ in , $ params ) = $ DB -> get_in_or_equal ( $ discussionids ) ; $ this -> dis... | Fill the discussion cache . |
31,904 | protected function fill_digest_cache ( ) { global $ DB ; if ( empty ( $ this -> users ) ) { return ; } list ( $ in , $ params ) = $ DB -> get_in_or_equal ( array_keys ( $ this -> users ) ) ; $ digestspreferences = $ DB -> get_recordset_select ( 'forum_digests' , "userid $in" , $ params , '' , 'id, userid, forum, maildi... | Fill the cache of user digest preferences . |
31,905 | protected function add_data_for_post ( $ post ) { if ( ! isset ( $ this -> adhocdata [ $ post -> course ] ) ) { $ this -> adhocdata [ $ post -> course ] = [ ] ; } if ( ! isset ( $ this -> adhocdata [ $ post -> course ] [ $ post -> forum ] ) ) { $ this -> adhocdata [ $ post -> course ] [ $ post -> forum ] = [ ] ; } if (... | Add dsta for the current forum post to the structure of adhoc data . |
31,906 | protected function fill_user_subscription_cache ( ) { foreach ( $ this -> forums as $ forum ) { $ cm = get_fast_modinfo ( $ this -> courses [ $ forum -> course ] ) -> instances [ 'forum' ] [ $ forum -> id ] ; $ modcontext = \ context_module :: instance ( $ cm -> id ) ; $ this -> subscribedusers [ $ forum -> id ] = [ ] ... | Fill the cache of user subscriptions . |
31,907 | protected function queue_user_tasks ( ) { global $ CFG , $ DB ; $ timenow = time ( ) ; $ sitetimezone = \ core_date :: get_server_timezone ( ) ; $ counts = [ 'digests' => 0 , 'individuals' => 0 , 'users' => 0 , 'ignored' => 0 , 'messages' => 0 , ] ; $ this -> log ( "Processing " . count ( $ this -> users ) . " users" ,... | Queue the user tasks . |
31,908 | protected function get_unmailed_posts ( $ starttime , $ endtime , $ now = null ) { global $ CFG , $ DB ; $ params = array ( ) ; $ params [ 'mailed' ] = FORUM_MAILED_PENDING ; $ params [ 'ptimestart' ] = $ starttime ; $ params [ 'ptimeend' ] = $ endtime ; $ params [ 'mailnow' ] = 1 ; if ( ! empty ( $ CFG -> forum_enable... | Returns a list of all new posts that have not been mailed yet |
31,909 | protected function process_data_record_tag ( $ data ) { $ data = ( object ) $ data ; if ( ! core_tag_tag :: is_enabled ( 'mod_data' , 'data_records' ) ) { return ; } if ( ! $ itemid = $ this -> get_mappingid ( 'data_record' , $ data -> itemid ) ) { return ; } $ tag = $ data -> rawname ; $ context = context_module :: in... | Add tags to restored records . |
31,910 | public function dispose ( ) { if ( $ temptables = $ this -> get_temptables ( ) ) { error_log ( 'Potential coding error - existing temptables found when disposing database. Must be dropped!' ) ; foreach ( $ temptables as $ temptable ) { $ this -> mdb -> get_manager ( ) -> drop_table ( new xmldb_table ( $ temptable ) ) ;... | Dispose the temptables stuff checking for wrong situations informing and recovering from them |
31,911 | public function get_analysables_iterator ( ? string $ action = null ) { global $ DB , $ CFG ; $ siteadmins = explode ( ',' , $ CFG -> siteadmins ) ; list ( $ sql , $ params ) = $ this -> get_iterator_sql ( 'user' , CONTEXT_USER , $ action , 'u' ) ; $ sql .= " AND u.deleted = :deleted AND u.confirmed = :confirmed AND u.... | The site users are the analysable elements returned by this analyser . |
31,912 | public function get_all_samples ( \ core_analytics \ analysable $ user ) { $ context = \ context_user :: instance ( $ user -> get_id ( ) ) ; return [ [ $ user -> get_id ( ) => $ user -> get_id ( ) ] , [ $ user -> get_id ( ) => [ 'user' => $ user -> get_user_data ( ) , 'context' => $ context ] ] ] ; } | This will return just one user as we analyse users separately . |
31,913 | public function get_samples ( $ sampleids ) { global $ DB ; list ( $ sql , $ params ) = $ DB -> get_in_or_equal ( $ sampleids , SQL_PARAMS_NAMED ) ; $ users = $ DB -> get_records_select ( 'user' , "id $sql" , $ params ) ; $ userids = array_keys ( $ users ) ; $ sampleids = array_combine ( $ userids , $ userids ) ; $ use... | Returns samples data from sample ids . |
31,914 | public function remove ( $ capability , $ params = null ) { $ capability = Horde_String :: upper ( $ capability ) ; if ( is_null ( $ params ) ) { unset ( $ this -> _data [ $ capability ] ) ; } elseif ( isset ( $ this -> _data [ $ capability ] ) ) { if ( ! is_array ( $ params ) ) { $ params = array ( $ params ) ; } $ pa... | Remove a capability . |
31,915 | public function query ( $ capability , $ parameter = null ) { $ capability = Horde_String :: upper ( $ capability ) ; if ( ! isset ( $ this -> _data [ $ capability ] ) ) { return false ; } return is_null ( $ parameter ) ? : ( is_array ( $ this -> _data [ $ capability ] ) && in_array ( Horde_String :: upper ( $ paramete... | Returns whether the server supports the given capability . |
31,916 | public function getParams ( $ capability ) { return ( $ this -> query ( $ capability ) && is_array ( $ out = $ this -> _data [ Horde_String :: upper ( $ capability ) ] ) ) ? $ out : array ( ) ; } | Return the list of parameters for an extension . |
31,917 | public function add ( $ data , $ reset = false ) { if ( $ reset ) { $ pos = $ this -> pos ( ) ; } if ( is_resource ( $ data ) ) { $ dpos = ftell ( $ data ) ; while ( ! feof ( $ data ) ) { $ this -> add ( fread ( $ data , 8192 ) ) ; } fseek ( $ data , $ dpos ) ; } elseif ( $ data instanceof Horde_Stream ) { $ dpos = $ d... | Adds data to the stream . |
31,918 | public function length ( $ utf8 = false ) { $ pos = $ this -> pos ( ) ; if ( $ utf8 && $ this -> _utf8_char ) { $ this -> rewind ( ) ; $ len = 0 ; while ( $ this -> getChar ( ) !== false ) { ++ $ len ; } } elseif ( ! $ this -> end ( ) ) { throw new Horde_Stream_Exception ( 'ERROR' ) ; } else { $ len = $ this -> pos ( )... | Returns the length of the data . Does not change the stream position . |
31,919 | public function substring ( $ start = 0 , $ length = null , $ char = false ) { if ( $ start !== 0 ) { $ this -> seek ( $ start , true , $ char ) ; } $ out = '' ; $ to_end = is_null ( $ length ) ; if ( $ char && $ this -> _utf8_char && ! $ to_end && ( $ length >= 0 ) && ( $ length < ( $ this -> length ( ) - $ this -> po... | Return part of the stream as a string . |
31,920 | public function getEOL ( ) { $ pos = $ this -> pos ( ) ; $ this -> rewind ( ) ; $ pos2 = $ this -> search ( "\n" , false , false ) ; if ( $ pos2 ) { $ this -> seek ( - 1 ) ; $ eol = ( $ this -> getChar ( ) == "\r" ) ? "\r\n" : "\n" ; } else { $ eol = is_null ( $ pos2 ) ? null : "\n" ; } $ this -> seek ( $ pos , false )... | Auto - determine the EOL string . |
31,921 | public function getChar ( ) { $ char = fgetc ( $ this -> stream ) ; if ( ! $ this -> _utf8_char ) { return $ char ; } $ c = ord ( $ char ) ; if ( $ c < 0x80 ) { return $ char ; } if ( $ c < 0xe0 ) { $ n = 1 ; } elseif ( $ c < 0xf0 ) { $ n = 2 ; } elseif ( $ c < 0xf8 ) { $ n = 3 ; } else { throw new Horde_Stream_Excepti... | Return a character from the string . |
31,922 | public function seek ( $ offset = 0 , $ curr = true , $ char = false ) { if ( ! $ offset ) { return ( bool ) $ curr ? : $ this -> rewind ( ) ; } if ( $ offset < 0 ) { if ( ! $ curr ) { return true ; } elseif ( abs ( $ offset ) > $ this -> pos ( ) ) { return $ this -> rewind ( ) ; } } if ( $ char && $ this -> _utf8_char... | Move internal pointer . |
31,923 | public function get_next_question_id ( $ categoryid , $ includesubcategories , $ tagids = [ ] ) { $ this -> ensure_questions_for_category_loaded ( $ categoryid , $ includesubcategories , $ tagids ) ; $ categorykey = $ this -> get_category_key ( $ categoryid , $ includesubcategories , $ tagids ) ; if ( empty ( $ this ->... | Pick a question at random from the given category from among those with the fewest uses . If an array of tag ids are specified then only the questions that are tagged with ALL those tags will be selected . |
31,924 | protected function use_question ( $ questionid ) { if ( isset ( $ this -> recentlyusedquestions [ $ questionid ] ) ) { $ this -> recentlyusedquestions [ $ questionid ] += 1 ; } else { $ this -> recentlyusedquestions [ $ questionid ] = 1 ; } foreach ( $ this -> availablequestionscache as $ categorykey => $ questionsforc... | Update the internal data structures to indicate that a given question has been used one more time . |
31,925 | protected function get_question_ids ( $ categoryid , $ includesubcategories , $ tagids = [ ] ) { $ this -> ensure_questions_for_category_loaded ( $ categoryid , $ includesubcategories , $ tagids ) ; $ categorykey = $ this -> get_category_key ( $ categoryid , $ includesubcategories , $ tagids ) ; $ cachedvalues = $ this... | Get the list of available question ids for the given criteria . |
31,926 | public function is_question_available ( $ categoryid , $ includesubcategories , $ questionid , $ tagids = [ ] ) { $ this -> ensure_questions_for_category_loaded ( $ categoryid , $ includesubcategories , $ tagids ) ; $ categorykey = $ this -> get_category_key ( $ categoryid , $ includesubcategories , $ tagids ) ; foreac... | Check whether a given question is available in a given category . If so mark it used . If an optional list of tag ids are provided then the question must be tagged with ALL of the provided tags to be considered as available . |
31,927 | public function get_questions ( $ categoryid , $ includesubcategories , $ tagids = [ ] , $ limit = 100 , $ offset = 0 , $ fields = [ ] ) { global $ DB ; $ questionids = $ this -> get_question_ids ( $ categoryid , $ includesubcategories , $ tagids ) ; if ( empty ( $ questionids ) ) { return [ ] ; } if ( empty ( $ fields... | Get the list of available questions for the given criteria . |
31,928 | public function count_questions ( $ categoryid , $ includesubcategories , $ tagids = [ ] ) { $ questionids = $ this -> get_question_ids ( $ categoryid , $ includesubcategories , $ tagids ) ; return count ( $ questionids ) ; } | Count the number of available questions for the given criteria . |
31,929 | public function isProxyListAllowed ( array $ proxies ) { phpCAS :: traceBegin ( ) ; if ( empty ( $ proxies ) ) { phpCAS :: trace ( "No proxies were found in the response" ) ; phpCAS :: traceEnd ( true ) ; return true ; } elseif ( ! $ this -> isProxyingAllowed ( ) ) { phpCAS :: trace ( "Proxies are not allowed" ) ; phpC... | Check if the proxies found in the response match the allowed proxies |
31,930 | public function contains ( array $ list ) { phpCAS :: traceBegin ( ) ; $ count = 0 ; foreach ( $ this -> _chains as $ chain ) { phpCAS :: trace ( "Checking chain " . $ count ++ ) ; if ( $ chain -> matches ( $ list ) ) { phpCAS :: traceEnd ( true ) ; return true ; } } phpCAS :: trace ( "No proxy chain matches." ) ; phpC... | Validate the proxies from the proxy ticket validation against the chains that were definded . |
31,931 | public function get_columns ( ) { if ( isset ( $ this -> _columns ) ) { return $ this -> _columns ; } global $ USER , $ CFG ; $ filename = $ CFG -> tempdir . '/csvimport/' . $ this -> _type . '/' . $ USER -> id . '/' . $ this -> _iid ; if ( ! file_exists ( $ filename ) ) { return false ; } $ fp = fopen ( $ filename , "... | Returns list of columns |
31,932 | public function init ( ) { global $ CFG , $ USER ; if ( ! empty ( $ this -> _fp ) ) { $ this -> close ( ) ; } $ filename = $ CFG -> tempdir . '/csvimport/' . $ this -> _type . '/' . $ USER -> id . '/' . $ this -> _iid ; if ( ! file_exists ( $ filename ) ) { return false ; } if ( ! $ this -> _fp = fopen ( $ filename , "... | Init iterator . |
31,933 | public function next ( ) { if ( empty ( $ this -> _fp ) or feof ( $ this -> _fp ) ) { return false ; } if ( $ ser = fgetcsv ( $ this -> _fp ) ) { return $ ser ; } else { return false ; } } | Get next line |
31,934 | public function close ( ) { if ( ! empty ( $ this -> _fp ) ) { fclose ( $ this -> _fp ) ; $ this -> _fp = null ; } } | Release iteration related resources |
31,935 | public function cleanup ( $ full = false ) { global $ USER , $ CFG ; if ( $ full ) { @ remove_dir ( $ CFG -> tempdir . '/csvimport/' . $ this -> _type . '/' . $ USER -> id ) ; } else { @ unlink ( $ CFG -> tempdir . '/csvimport/' . $ this -> _type . '/' . $ USER -> id . '/' . $ this -> _iid ) ; } } | Cleanup temporary data |
31,936 | public static function get_delimiter_list ( ) { global $ CFG ; $ delimiters = array ( 'comma' => ',' , 'semicolon' => ';' , 'colon' => ':' , 'tab' => '\\t' ) ; if ( isset ( $ CFG -> CSV_DELIMITER ) and strlen ( $ CFG -> CSV_DELIMITER ) === 1 and ! in_array ( $ CFG -> CSV_DELIMITER , $ delimiters ) ) { $ delimiters [ 'c... | Get list of cvs delimiters |
31,937 | public static function get_encoded_delimiter ( $ delimiter_name ) { global $ CFG ; if ( $ delimiter_name == 'cfg' and isset ( $ CFG -> CSV_ENCODE ) ) { return $ CFG -> CSV_ENCODE ; } $ delimiter = csv_import_reader :: get_delimiter ( $ delimiter_name ) ; return '&#' . ord ( $ delimiter ) ; } | Get encoded delimiter character |
31,938 | public static function get_new_iid ( $ type ) { global $ USER ; $ filename = make_temp_directory ( 'csvimport/' . $ type . '/' . $ USER -> id ) ; $ iiid = time ( ) ; while ( file_exists ( $ filename . '/' . $ iiid ) ) { $ iiid -- ; } return $ iiid ; } | Create new import id |
31,939 | protected function set_temp_file_path ( ) { global $ USER , $ CFG ; make_temp_directory ( 'csvimport/' . $ USER -> id ) ; $ path = $ CFG -> tempdir . '/csvimport/' . $ USER -> id . '/' . $ this -> filename ; if ( file_exists ( $ path ) ) { unlink ( $ path ) ; } $ this -> path = $ path ; } | Set the file path to the temporary file . |
31,940 | public function add_data ( $ row ) { if ( ! isset ( $ this -> path ) ) { $ this -> set_temp_file_path ( ) ; $ this -> fp = fopen ( $ this -> path , 'w+' ) ; } $ delimiter = csv_import_reader :: get_delimiter ( $ this -> delimiter ) ; fputcsv ( $ this -> fp , $ row , $ delimiter , $ this -> csvenclosure ) ; } | Add data to the temporary file in csv format |
31,941 | public function print_csv_data ( $ return = false ) { fseek ( $ this -> fp , 0 ) ; $ returnstring = '' ; while ( ( $ content = fgets ( $ this -> fp ) ) !== false ) { if ( ! $ return ) { echo $ content ; } else { $ returnstring .= $ content ; } } if ( $ return ) { return $ returnstring ; } } | Echos or returns a csv data line by line for displaying . |
31,942 | public function set_filename ( $ dataname , $ extension = '.csv' ) { $ filename = clean_filename ( $ dataname ) ; $ filename .= clean_filename ( '-' . gmdate ( "Ymd_Hi" ) ) ; $ filename .= clean_filename ( "-{$this->delimiter}_separated" ) ; $ filename .= $ extension ; $ this -> filename = $ filename ; } | Set the filename for the uploaded csv file |
31,943 | public static function download_array ( $ filename , array & $ records , $ delimiter = 'comma' , $ enclosure = '"' ) { $ csvdata = new csv_export_writer ( $ delimiter , $ enclosure ) ; $ csvdata -> set_filename ( $ filename ) ; foreach ( $ records as $ row ) { $ csvdata -> add_data ( $ row ) ; } $ csvdata -> download_f... | Creates a file for downloading an array into a deliminated format . This function is useful if you are happy with the defaults and all of your information is in one array . |
31,944 | public static function print_array ( array & $ records , $ delimiter = 'comma' , $ enclosure = '"' , $ return = false ) { $ csvdata = new csv_export_writer ( $ delimiter , $ enclosure ) ; foreach ( $ records as $ row ) { $ csvdata -> add_data ( $ row ) ; } $ data = $ csvdata -> print_csv_data ( $ return ) ; if ( $ retu... | This will convert an array of values into a deliminated string . Like the above function this is for convenience . |
31,945 | public function calculate ( $ qubaids , $ whichtries = \ question_attempt :: LAST_TRY ) { $ dm = new \ question_engine_data_mapper ( ) ; $ questionattempts = $ dm -> load_attempts_at_question ( $ this -> questiondata -> id , $ qubaids ) ; foreach ( $ questionattempts as $ qa ) { $ responseparts = $ qa -> classify_respo... | Analyse all the response data for for all the specified attempts at this question . |
31,946 | public function load_cached ( $ qubaids , $ whichtries ) { global $ DB ; $ timemodified = time ( ) - self :: TIME_TO_CACHE ; $ responseanalyses = $ DB -> get_records_select ( 'question_response_analysis' , 'hashcode = ? AND whichtries = ? AND questionid = ? AND timemodified > ?' , array ( $ qubaids -> get_hash_code ( )... | Retrieve the computed response analysis from the question_response_analysis table . |
31,947 | public function get_last_analysed_time ( $ qubaids , $ whichtries ) { global $ DB ; $ timemodified = time ( ) - self :: TIME_TO_CACHE ; return $ DB -> get_field_select ( 'question_response_analysis' , 'timemodified' , 'hashcode = ? AND whichtries = ? AND questionid = ? AND timemodified > ?' , array ( $ qubaids -> get_h... | Find time of non - expired analysis in the database . |
31,948 | public function get_label ( $ strict = false ) { if ( $ this -> label === null && $ strict !== true ) { return $ this -> get_term ( ) ; } return $ this -> label ; } | Get the human readable label |
31,949 | public function validate ( & $ uri , $ config , $ context ) { if ( $ this -> default_port == $ uri -> port ) { $ uri -> port = null ; } if ( ! $ this -> may_omit_host && ( ! is_null ( $ uri -> scheme ) && ( $ uri -> host === '' || is_null ( $ uri -> host ) ) ) || ( is_null ( $ uri -> scheme ) && $ uri -> host === '' ) ... | Public interface for validating components of a URI . Performs a bunch of default actions . Don t overload this method . |
31,950 | protected static function delete_orphan_historical_grades ( $ userid ) { global $ DB ; $ sql = " SELECT ggh.id FROM {grade_grades_history} ggh LEFT JOIN {grade_items} gi ON ggh.itemid = gi.id WHERE gi.id IS NULL AND ggh.userid = :userid" ; $ ids =... | Delete orphan historical grades . |
31,951 | protected static function extract_grade_grade_from_record ( stdClass $ record , $ ishistory = false ) { $ prefix = $ ishistory ? 'ggh_' : 'gg_' ; $ ggrecord = static :: extract_record ( $ record , $ prefix ) ; if ( $ ishistory ) { $ historyid = $ ggrecord -> id ; unset ( $ ggrecord -> id ) ; } $ gg = new grade_grade ( ... | Extract grade_grade from a record . |
31,952 | protected static function extract_record ( $ record , $ prefix ) { $ result = [ ] ; $ prefixlength = strlen ( $ prefix ) ; foreach ( $ record as $ key => $ value ) { if ( strpos ( $ key , $ prefix ) === 0 ) { $ result [ substr ( $ key , $ prefixlength ) ] = $ value ; } } return ( object ) $ result ; } | Extract a record from another one . |
31,953 | protected static function get_fields_sql ( $ target , $ alias , $ prefix ) { switch ( $ target ) { case 'grade_category' : case 'grade_grade' : case 'grade_item' : case 'grade_outcome' : case 'grade_scale' : $ obj = new $ target ( [ ] , false ) ; $ fields = array_merge ( array_keys ( $ obj -> optional_fields ) , $ obj ... | Get fields SQL for a grade related object . |
31,954 | protected static function get_item_ids_from_course_ids ( $ courseids ) { global $ DB ; if ( empty ( $ courseids ) ) { return [ ] ; } list ( $ insql , $ inparams ) = $ DB -> get_in_or_equal ( $ courseids , SQL_PARAMS_NAMED ) ; return $ DB -> get_fieldset_select ( 'grade_items' , 'id' , "courseid $insql" , $ inparams ) ;... | Get all the items IDs from course IDs . |
31,955 | protected static function transform_grade ( grade_grade $ gg , context $ context , bool $ ishistory ) { $ gi = $ gg -> load_grade_item ( ) ; $ timemodified = $ gg -> timemodified ? transform :: datetime ( $ gg -> timemodified ) : null ; $ timecreated = $ gg -> timecreated ? transform :: datetime ( $ gg -> timecreated )... | Transform a grade . |
31,956 | protected static function delete_files ( array $ itemids , bool $ ishistory , array $ userids = null ) { global $ DB ; list ( $ iteminnsql , $ params ) = $ DB -> get_in_or_equal ( $ itemids , SQL_PARAMS_NAMED ) ; if ( ! is_null ( $ userids ) ) { list ( $ userinnsql , $ userparams ) = $ DB -> get_in_or_equal ( $ userids... | Handles deleting files for a given list of grade items . |
31,957 | public function launch_after_restore_methods ( ) { $ afterrestore = 'after_restore_' . basename ( $ this -> connectionpoint -> get_path ( ) ) ; if ( method_exists ( $ this , $ afterrestore ) ) { $ this -> $ afterrestore ( ) ; } } | after_restore dispatcher for any restore_plugin class |
31,958 | static public function get_restore_decode_contents ( $ plugintype ) { $ decodecontents = array ( ) ; if ( ! array_key_exists ( $ plugintype , core_component :: get_plugin_types ( $ plugintype ) ) ) { throw new backup_step_exception ( 'incorrect_plugin_type' , $ plugintype ) ; } $ classname = 'restore_' . $ plugintype .... | Returns one array with all the decode contents to be processed by the links decoder |
31,959 | protected function earlyStop ( $ oldTheta ) { $ diff = array_map ( function ( $ w1 , $ w2 ) { return abs ( $ w1 - $ w2 ) > $ this -> threshold ? 1 : 0 ; } , $ oldTheta , $ this -> theta ) ; if ( array_sum ( $ diff ) == 0 ) { return true ; } $ costs = array_slice ( $ this -> costValues , - 2 ) ; if ( count ( $ costs ) =... | Checks if the optimization is not effective enough and can be stopped in case large enough changes in the solution do not happen |
31,960 | function removeOption ( $ value ) { $ key = array_search ( $ value , $ this -> _values ) ; if ( $ key !== FALSE and $ key !== null ) { unset ( $ this -> _values [ $ key ] ) ; } foreach ( $ this -> _options as $ key => $ option ) { if ( $ option [ 'attr' ] [ 'value' ] == $ value ) { unset ( $ this -> _options [ $ key ] ... | Removes an OPTION from the SELECT |
31,961 | public function process_question ( array $ data , array $ raw ) { global $ CFG ; $ matchids = array ( ) ; if ( isset ( $ data [ 'matchs' ] [ 'match' ] ) ) { foreach ( $ data [ 'matchs' ] [ 'match' ] as $ match ) { $ matchids [ ] = $ match [ 'id' ] ; } } if ( isset ( $ data [ 'matchoptions' ] ) ) { $ matchoptions = $ da... | Appends the match specific information to the question . |
31,962 | public function setMethod ( $ method ) { $ methods = array ( COMPLETION_AGGREGATION_ALL , COMPLETION_AGGREGATION_ANY , ) ; if ( in_array ( $ method , $ methods ) ) { $ this -> method = $ method ; } else { $ this -> method = COMPLETION_AGGREGATION_ALL ; } } | Set the aggregation method |
31,963 | public function start_html ( ) { global $ OUTPUT ; $ this -> id = 'core_progress_display_if_slow' . self :: $ nextid ; self :: $ nextid ++ ; echo \ html_writer :: start_div ( 'core_progress_display_if_slow' , array ( 'id' => $ this -> id ) ) ; if ( $ this -> heading !== '' ) { echo $ OUTPUT -> heading ( $ this -> headi... | Starts displaying the progress bar with optional heading and a special div so it can be hidden later . |
31,964 | public function update_progress ( ) { if ( $ this -> starttime ) { if ( time ( ) > $ this -> starttime ) { $ this -> starttime = 0 ; } else { return ; } } parent :: update_progress ( ) ; } | When progress is updated after a certain time starts actually displaying the progress bar . |
31,965 | public static function update_completion_date_event ( $ cmid , $ modulename , $ instanceorid , $ completionexpectedtime ) { global $ CFG , $ DB ; require_once ( $ CFG -> dirroot . '/calendar/lib.php' ) ; $ instance = null ; if ( is_object ( $ instanceorid ) ) { $ instance = $ instanceorid ; } else { $ instance = $ DB -... | Creates updates or deletes an event for the expected completion date . |
31,966 | public function renderer_prefixes ( ) { global $ CFG ; $ prefixes = array ( 'theme_' . $ this -> name ) ; foreach ( $ this -> parent_configs as $ parent ) { $ prefixes [ ] = 'theme_' . $ parent -> name ; } return $ prefixes ; } | Returns output renderer prefixes these are used when looking for the overridden renderers in themes . |
31,967 | public function editor_css_url ( $ encoded = true ) { global $ CFG ; $ rev = theme_get_revision ( ) ; if ( $ rev > - 1 ) { $ themesubrevision = theme_get_sub_revision_for_theme ( $ this -> name ) ; if ( $ themesubrevision && $ themesubrevision > 0 ) { $ rev .= "_{$themesubrevision}" ; } $ url = new moodle_url ( "/theme... | Returns the stylesheet URL of this editor content |
31,968 | public function editor_css_files ( ) { $ files = array ( ) ; $ plugins = core_component :: get_plugin_list ( 'editor' ) ; foreach ( $ plugins as $ plugin => $ fulldir ) { $ sheetfile = "$fulldir/editor_styles.css" ; if ( is_readable ( $ sheetfile ) ) { $ files [ 'plugin_' . $ plugin ] = $ sheetfile ; } } foreach ( arra... | Returns the content of the CSS to be used in editor content |
31,969 | public function editor_scss_to_css ( ) { $ css = '' ; if ( ! empty ( $ this -> editor_scss ) ) { $ compiler = new core_scss ( ) ; foreach ( $ this -> editor_scss as $ filename ) { $ compiler -> set_file ( "{$this->dir}/scss/{$filename}.scss" ) ; try { $ css .= $ compiler -> to_css ( ) ; } catch ( \ Exception $ e ) { de... | Compiles and returns the content of the SCSS to be used in editor content |
31,970 | public function get_css_content ( ) { $ csscontent = '' ; foreach ( $ this -> get_css_files ( false ) as $ type => $ value ) { foreach ( $ value as $ identifier => $ val ) { if ( is_array ( $ val ) ) { foreach ( $ val as $ v ) { $ csscontent .= file_get_contents ( $ v ) . "\n" ; } } else { if ( $ type === 'theme' && $ ... | Get the whole css stylesheet for production mode . |
31,971 | public function set_css_content_cache ( $ csscontent ) { $ cache = cache :: make ( 'core' , 'postprocessedcss' ) ; $ key = $ this -> get_css_cache_key ( ) ; return $ cache -> set ( $ key , $ csscontent ) ; } | Set post processed CSS content cache . |
31,972 | public function has_css_cached_content ( ) { $ key = $ this -> get_css_cache_key ( ) ; $ cache = cache :: make ( 'core' , 'postprocessedcss' ) ; return $ cache -> has ( $ key ) ; } | Return whether the post processed CSS content has been cached . |
31,973 | public function get_css_cached_content ( ) { $ key = $ this -> get_css_cache_key ( ) ; $ cache = cache :: make ( 'core' , 'postprocessedcss' ) ; return $ cache -> get ( $ key ) ; } | Return cached post processed CSS content . |
31,974 | public function get_css_cache_key ( ) { $ nosvg = ( ! $ this -> use_svg_icons ( ) ) ? 'nosvg_' : '' ; $ rtlmode = ( $ this -> rtlmode == true ) ? 'rtl' : 'ltr' ; return $ nosvg . $ this -> name . '_' . $ rtlmode ; } | Generate the css content cache key . |
31,975 | public function get_css_content_editor ( ) { $ css = '' ; $ cssfiles = $ this -> editor_css_files ( ) ; foreach ( $ cssfiles as $ file ) { $ css .= file_get_contents ( $ file ) . "\n" ; } if ( ( $ convertedscss = $ this -> editor_scss_to_css ( ) ) ) { $ css .= $ convertedscss ; } $ output = $ this -> post_process ( $ c... | Get the whole css stylesheet for editor iframe . |
31,976 | protected function get_css_content_from_less ( $ themedesigner ) { global $ CFG ; $ lessfile = $ this -> lessfile ; if ( ! $ lessfile || ! is_readable ( $ this -> dir . '/less/' . $ lessfile . '.less' ) ) { throw new coding_exception ( 'The theme did not define a LESS file, or it is not readable.' ) ; } raise_memory_li... | Return the CSS content generated from LESS the file . |
31,977 | protected function get_css_content_from_scss ( $ themedesigner ) { global $ CFG ; list ( $ paths , $ scss ) = $ this -> get_scss_property ( ) ; if ( ! $ scss ) { throw new coding_exception ( 'The theme did not define a SCSS file, or it is not readable.' ) ; } raise_memory_limit ( MEMORY_EXTRA ) ; core_php_time_limit ::... | Return the CSS content generated from the SCSS file . |
31,978 | public function get_precompiled_css_content ( ) { $ configs = [ $ this ] + $ this -> parent_configs ; $ css = '' ; foreach ( $ configs as $ config ) { if ( isset ( $ config -> precompiledcsscallback ) ) { $ function = $ config -> precompiledcsscallback ; if ( function_exists ( $ function ) ) { $ css .= $ function ( $ t... | Return the precompiled CSS if the precompiledcsscallback exists . |
31,979 | public function get_icon_system ( ) { $ system = false ; if ( isset ( $ this -> iconsystem ) && \ core \ output \ icon_system :: is_valid_system ( $ this -> iconsystem ) ) { return $ this -> iconsystem ; } foreach ( $ this -> parent_configs as $ parent_config ) { if ( isset ( $ parent_config -> iconsystem ) && \ core \... | Get the icon system to use . |
31,980 | protected function get_less_variables ( ) { $ variables = array ( ) ; $ candidates = array ( ) ; foreach ( $ this -> parent_configs as $ parent_config ) { if ( ! isset ( $ parent_config -> lessvariablescallback ) ) { continue ; } $ candidates [ ] = $ parent_config -> lessvariablescallback ; } $ candidates [ ] = $ this ... | Return extra LESS variables to use when compiling . |
31,981 | protected function get_extra_less_code ( ) { $ content = '' ; $ candidates = array ( ) ; foreach ( $ this -> parent_configs as $ parent_config ) { if ( ! isset ( $ parent_config -> extralesscallback ) ) { continue ; } $ candidates [ ] = $ parent_config -> extralesscallback ; } $ candidates [ ] = $ this -> extralesscall... | Return extra LESS code to add when compiling . |
31,982 | protected function get_extra_scss_code ( ) { $ content = '' ; $ candidates = array ( ) ; foreach ( $ this -> parent_configs as $ parent_config ) { if ( ! isset ( $ parent_config -> extrascsscallback ) ) { continue ; } $ candidates [ ] = $ parent_config -> extrascsscallback ; } $ candidates [ ] = $ this -> extrascsscall... | Return extra SCSS code to add when compiling . |
31,983 | protected function get_pre_scss_code ( ) { $ content = '' ; $ candidates = array ( ) ; foreach ( $ this -> parent_configs as $ parent_config ) { if ( ! isset ( $ parent_config -> prescsscallback ) ) { continue ; } $ candidates [ ] = $ parent_config -> prescsscallback ; } $ candidates [ ] = $ this -> prescsscallback ; f... | SCSS code to prepend when compiling . |
31,984 | public function get_scss_property ( ) { if ( $ this -> scsscache === null ) { $ configs = [ $ this ] + $ this -> parent_configs ; $ scss = null ; foreach ( $ configs as $ config ) { $ path = "{$config->dir}/scss" ; if ( empty ( $ scss ) && ! empty ( $ config -> scss ) ) { $ candidate = is_string ( $ config -> scss ) ? ... | Get the SCSS property . |
31,985 | public function javascript_url ( $ inhead ) { global $ CFG ; $ rev = theme_get_revision ( ) ; $ params = array ( 'theme' => $ this -> name , 'rev' => $ rev ) ; $ params [ 'type' ] = $ inhead ? 'head' : 'footer' ; if ( count ( $ this -> javascript_files ( $ params [ 'type' ] ) ) === 0 ) { return null ; } if ( ! empty ( ... | Generate a URL to the file that serves theme JavaScript files . |
31,986 | protected function resolve_excludes ( $ variable , $ default = null ) { $ setting = $ default ; if ( is_array ( $ this -> { $ variable } ) or $ this -> { $ variable } === true ) { $ setting = $ this -> { $ variable } ; } else { foreach ( $ this -> parent_configs as $ parent_config ) { if ( ! isset ( $ parent_config -> ... | Resolves an exclude setting to the themes setting is applicable or the setting of its closest parent . |
31,987 | public function javascript_content ( $ type ) { $ jsfiles = $ this -> javascript_files ( $ type ) ; $ js = '' ; foreach ( $ jsfiles as $ jsfile ) { $ js .= file_get_contents ( $ jsfile ) . "\n" ; } return $ js ; } | Returns the content of the one huge javascript file merged from all theme javascript files . |
31,988 | public function post_process ( $ css ) { if ( preg_match_all ( '/\[\[pix:([a-z0-9_]+\|)?([^\]]+)\]\]/' , $ css , $ matches , PREG_SET_ORDER ) ) { $ replaced = array ( ) ; foreach ( $ matches as $ match ) { if ( isset ( $ replaced [ $ match [ 0 ] ] ) ) { continue ; } $ replaced [ $ match [ 0 ] ] = true ; $ imagename = $... | Post processes CSS . |
31,989 | public function font_url ( $ font , $ component ) { global $ CFG ; $ params = array ( 'theme' => $ this -> name ) ; if ( empty ( $ component ) or $ component === 'moodle' or $ component === 'core' ) { $ params [ 'component' ] = 'core' ; } else { $ params [ 'component' ] = $ component ; } $ rev = theme_get_revision ( ) ... | Return the URL for a font |
31,990 | public function setting_file_url ( $ setting , $ filearea ) { global $ CFG ; if ( empty ( $ this -> settings -> $ setting ) ) { return null ; } $ component = 'theme_' . $ this -> name ; $ itemid = theme_get_revision ( ) ; $ filepath = $ this -> settings -> $ setting ; $ syscontext = context_system :: instance ( ) ; $ u... | Returns URL to the stored file via pluginfile . php . |
31,991 | public function setting_file_serve ( $ filearea , $ args , $ forcedownload , $ options ) { global $ CFG ; require_once ( "$CFG->libdir/filelib.php" ) ; $ syscontext = context_system :: instance ( ) ; $ component = 'theme_' . $ this -> name ; $ revision = array_shift ( $ args ) ; if ( $ revision < 0 ) { $ lifetime = 0 ;... | Serve the theme setting file . |
31,992 | public function resolve_image_location ( $ image , $ component , $ svg = false ) { global $ CFG ; if ( ! is_bool ( $ svg ) ) { $ svg = $ this -> use_svg_icons ( ) ; } if ( $ component === 'moodle' or $ component === 'core' or empty ( $ component ) ) { if ( $ imagefile = $ this -> image_exists ( "$this->dir/pix_core/$im... | Resolves the real image location . |
31,993 | public function resolve_font_location ( $ font , $ component ) { global $ CFG ; if ( $ component === 'moodle' or $ component === 'core' or empty ( $ component ) ) { if ( file_exists ( "$this->dir/fonts_core/$font" ) ) { return "$this->dir/fonts_core/$font" ; } foreach ( array_reverse ( $ this -> parent_configs ) as $ p... | Resolves the real font location . |
31,994 | public function use_svg_icons ( ) { global $ CFG ; if ( $ this -> usesvg === null ) { if ( ! isset ( $ CFG -> svgicons ) ) { $ this -> usesvg = core_useragent :: supports_svg ( ) ; } else { $ this -> usesvg = ( bool ) $ CFG -> svgicons ; } } return $ this -> usesvg ; } | Return true if we should look for SVG images as well . |
31,995 | private static function image_exists ( $ filepath , $ svg = false ) { if ( $ svg && file_exists ( "$filepath.svg" ) ) { return "$filepath.svg" ; } else if ( file_exists ( "$filepath.png" ) ) { return "$filepath.png" ; } else if ( file_exists ( "$filepath.gif" ) ) { return "$filepath.gif" ; } else if ( file_exists ( "$f... | Checks if file with any image extension exists . |
31,996 | private static function find_theme_config ( $ themename , $ settings , $ parentscheck = true ) { if ( ! $ dir = theme_config :: find_theme_location ( $ themename ) ) { return null ; } $ THEME = new stdClass ( ) ; $ THEME -> name = $ themename ; $ THEME -> dir = $ dir ; $ THEME -> settings = $ settings ; global $ CFG ; ... | Loads the theme config from config . php file . |
31,997 | private static function find_theme_location ( $ themename ) { global $ CFG ; if ( file_exists ( "$CFG->dirroot/theme/$themename/config.php" ) ) { $ dir = "$CFG->dirroot/theme/$themename" ; } else if ( ! empty ( $ CFG -> themedir ) and file_exists ( "$CFG->themedir/$themename/config.php" ) ) { $ dir = "$CFG->themedir/$t... | Finds the theme location and verifies the theme has all needed files and is not obsoleted . |
31,998 | public function get_renderer ( moodle_page $ page , $ component , $ subtype = null , $ target = null ) { if ( is_null ( $ this -> rf ) ) { $ classname = $ this -> rendererfactory ; $ this -> rf = new $ classname ( $ this ) ; } return $ this -> rf -> get_renderer ( $ page , $ component , $ subtype , $ target ) ; } | Get the renderer for a part of Moodle for this theme . |
31,999 | public function layout_file ( $ pagelayout ) { global $ CFG ; $ layoutinfo = $ this -> layout_info_for_page ( $ pagelayout ) ; $ layoutfile = $ layoutinfo [ 'file' ] ; if ( array_key_exists ( 'theme' , $ layoutinfo ) ) { $ themes = array ( $ layoutinfo [ 'theme' ] ) ; } else { $ themes = array_merge ( array ( $ this ->... | Given the settings of this theme and the page pagelayout return the full path of the page layout file to use . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.