idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
31,200 | protected function file_path_for_key ( $ key , $ create = false ) { if ( $ this -> singledirectory ) { return $ this -> path . '/' . $ key . '.cache' ; } else { $ subdir = substr ( $ key , 0 , 3 ) . '-cache' ; $ dir = $ this -> path . '/' . $ subdir ; if ( $ create ) { make_writable_directory ( $ dir , false ) ; } retu... | Returns the file path to use for the given key . |
31,201 | public function purge ( ) { if ( $ this -> isready ) { $ files = glob ( $ this -> glob_keys_pattern ( ) , GLOB_MARK | GLOB_NOSORT ) ; if ( is_array ( $ files ) ) { foreach ( $ files as $ filename ) { @ unlink ( $ filename ) ; } } $ this -> keys = array ( ) ; } return true ; } | Purges the cache definition deleting all the items within it . |
31,202 | protected function purge_all_definitions ( ) { $ currpath = $ this -> path ; $ this -> path = $ this -> filestorepath . '/*' ; $ result = $ this -> purge ( ) ; $ this -> path = $ currpath ; return $ result ; } | Purges all the cache definitions deleting all items within them . |
31,203 | protected function ensure_path_exists ( ) { global $ CFG ; if ( ! is_writable ( $ this -> path ) ) { if ( $ this -> custompath && ! $ this -> autocreate ) { throw new coding_exception ( 'File store path does not exist. It must exist and be writable by the web server.' ) ; } $ createdcfg = false ; if ( ! isset ( $ CFG )... | Checks to make sure that the path for the file cache exists . |
31,204 | protected function write_file ( $ file , $ content ) { $ path = dirname ( $ file ) ; while ( true ) { $ tempfile = $ path . '/' . uniqid ( sesskey ( ) . '.' , true ) . '.temp' ; if ( ! file_exists ( $ tempfile ) ) { break ; } } $ handle = @ fopen ( $ tempfile , 'xb+' ) ; if ( $ handle === false ) { return false ; } fwr... | Writes your madness to a file . |
31,205 | public function find_all ( ) { $ this -> ensure_path_exists ( ) ; $ files = glob ( $ this -> glob_keys_pattern ( ) , GLOB_MARK | GLOB_NOSORT ) ; $ return = array ( ) ; if ( $ files === false ) { return $ return ; } foreach ( $ files as $ file ) { $ return [ ] = substr ( basename ( $ file ) , 0 , - 6 ) ; } return $ retu... | Finds all of the keys being used by this cache store instance . |
31,206 | public function get_values ( $ itemnumber ) { if ( $ itemnumber <= 0 || $ itemnumber > $ this -> get_number_of_items ( ) ) { $ a = new stdClass ( ) ; $ a -> id = $ this -> questionid ; $ a -> item = $ itemnumber ; throw new moodle_exception ( 'cannotgetdsfordependent' , 'question' , '' , $ a ) ; } return $ this -> load... | Load a particular set of values for each dataset used by this question . |
31,207 | public function format_float ( $ x , $ length = null , $ format = null ) { if ( ! is_null ( $ length ) && ! is_null ( $ format ) ) { if ( $ format == '1' ) { $ x = sprintf ( '%.' . $ length . 'F' , $ x ) ; } else if ( $ x ) { $ answer = $ x ; if ( $ answer < 0 ) { $ answer = - $ answer ; $ sign = '-' ; } else { $ sign ... | Display a float properly formatted with a certain number of decimal places . |
31,208 | public function calculate ( $ expression ) { if ( $ error = qtype_calculated_find_formula_errors ( $ expression ) ) { throw new moodle_exception ( 'illegalformulasyntax' , 'qtype_calculated' , '' , $ error ) ; } $ expression = $ this -> substitute_values_for_eval ( $ expression ) ; if ( $ datasets = question_bank :: ge... | Evaluate an expression using the variable values . |
31,209 | protected function calculate_raw ( $ expression ) { try { if ( @ eval ( 'return true; $result = ' . $ expression . ';' ) ) { return eval ( 'return ' . $ expression . ';' ) ; } } catch ( Throwable $ e ) { } throw new moodle_exception ( 'illegalformulasyntax' , 'qtype_calculated' , '' , $ expression ) ; } | Evaluate an expression after the variable values have been substituted . |
31,210 | final public function prepare_to_cache ( ) { $ result = array ( ) ; foreach ( $ this as $ key => $ value ) { if ( $ value instanceof cacheable_object ) { $ value = new cache_cached_object ( $ value ) ; } else { throw new coding_exception ( 'Only cacheable_object instances can be added to a cacheable_array' ) ; } $ resu... | Returns the data to cache for this object . |
31,211 | final static public function wake_from_cache ( $ data ) { if ( ! is_array ( $ data ) ) { throw new coding_exception ( 'Invalid data type when reviving cacheable_array data' ) ; } $ result = array ( ) ; foreach ( $ data as $ key => $ value ) { $ result [ $ key ] = $ value -> restore_object ( ) ; } $ class = __CLASS__ ; ... | Returns the cacheable_object_array that was originally sent to the cache . |
31,212 | protected function store_file_for_text_field ( & $ text , $ tempdir , $ filepathinsidetempdir , $ filename ) { global $ USER ; $ fs = get_file_storage ( ) ; if ( empty ( $ text [ 'itemid' ] ) ) { $ text [ 'itemid' ] = file_get_unused_draft_itemid ( ) ; } $ newfilename = clean_param ( str_replace ( '/' , '__' , $ filepa... | Store an image file in a draft filearea |
31,213 | public function text_field ( $ text ) { $ data = array ( ) ; preg_match_all ( '|<img[^>]+src="([^"]*)"|i' , $ text , $ out ) ; $ filepaths = array ( ) ; foreach ( $ out [ 1 ] as $ path ) { $ fullpath = $ this -> filebase . '/' . $ path ; if ( is_readable ( $ fullpath ) && ! in_array ( $ path , $ filepaths ) ) { $ dirpa... | Given an HTML text with references to images files store all images in a draft filearea and return an array with all urls in text recoded format set to FORMAT_HTML and itemid set to filearea itemid |
31,214 | public function flag_expired_contexts ( ) : array { $ this -> trace -> output ( 'Checking requirements' ) ; if ( ! $ this -> check_requirements ( ) ) { $ this -> trace -> output ( 'Requirements not met. Cannot process expired retentions.' , 1 ) ; return [ 0 , 0 ] ; } $ this -> trace -> output ( 'Clearing obselete recor... | Flag expired contexts as expired . |
31,215 | protected static function clear_old_records ( ) { global $ DB ; $ sql = "SELECT dpctx.* FROM {tool_dataprivacy_ctxexpired} dpctx LEFT JOIN {context} ctx ON ctx.id = dpctx.contextid WHERE ctx.id IS NULL" ; $ orphaned = $ DB -> get_recordset_sql ( $ sql ) ; foreach ( $ orphane... | Clear old and stale records . |
31,216 | protected static function get_nested_expiry_info ( $ contextpath = '' ) : array { $ coursepaths = self :: get_nested_expiry_info_for_courses ( $ contextpath ) ; $ userpaths = self :: get_nested_expiry_info_for_user ( $ contextpath ) ; return array_merge ( $ coursepaths , $ userpaths ) ; } | Get the full nested set of expiry data relating to all contexts . |
31,217 | protected static function get_nested_expiry_info_for_courses ( $ contextpath = '' ) : array { global $ DB ; $ contextfields = \ context_helper :: get_preload_record_columns_sql ( 'ctx' ) ; $ expiredfields = expired_context :: get_sql_fields ( 'expiredctx' , 'expiredctx' ) ; $ purposefields = 'dpctx.purposeid' ; $ cours... | Get the full nested set of expiry data relating to course - related contexts . |
31,218 | protected static function get_nested_expiry_info_for_user ( $ contextpath = '' ) : array { global $ DB ; $ contextfields = \ context_helper :: get_preload_record_columns_sql ( 'ctx' ) ; $ expiredfields = expired_context :: get_sql_fields ( 'expiredctx' , 'expiredctx' ) ; $ purposefields = 'dpctx.purposeid' ; $ userfiel... | Get the full nested set of expiry data . |
31,219 | protected static function get_nested_expiry_info_from_sql ( string $ sql , array $ params ) : array { global $ DB ; $ fulllist = $ DB -> get_recordset_sql ( $ sql , $ params ) ; $ datalist = [ ] ; $ expiredcontents = [ ] ; $ pathstoskip = [ ] ; $ userpurpose = data_registry :: get_effective_contextlevel_value ( CONTEXT... | Get the full nested set of expiry data given appropriate SQL . Only contexts which have expired will be included . |
31,220 | protected static function is_eligible_for_deletion ( array & $ pathstoskip , \ context $ context ) : bool { $ shouldskip = false ; $ shouldskip = ! empty ( array_filter ( $ pathstoskip , function ( $ path ) use ( $ context ) { return false !== ( strpos ( $ context -> path , $ path ) ) ; } ) ) ; if ( ! $ shouldskip && $... | Check whether the supplied context would be elible for deletion . |
31,221 | public function process_approved_deletions ( ) : array { $ this -> trace -> output ( 'Checking requirements' ) ; if ( ! $ this -> check_requirements ( ) ) { $ this -> trace -> output ( 'Requirements not met. Cannot process expired retentions.' , 1 ) ; return [ 0 , 0 ] ; } $ this -> trace -> output ( 'Fetching all appro... | Deletes the expired contexts . |
31,222 | protected function delete_expired_context ( expired_context $ expiredctx ) { $ context = \ context :: instance_by_id ( $ expiredctx -> get ( 'contextid' ) ) ; $ this -> get_progress ( ) -> output ( "Deleting context {$context->id} - " . $ context -> get_context_name ( true , true ) ) ; $ expiredctx = $ this -> update_e... | Deletes user data from the provided context . |
31,223 | protected function delete_expired_user_context ( expired_context $ expiredctx ) { global $ DB ; $ contextid = $ expiredctx -> get ( 'contextid' ) ; $ context = \ context :: instance_by_id ( $ contextid ) ; $ user = \ core_user :: get_user ( $ context -> instanceid , '*' , MUST_EXIST ) ; $ privacymanager = $ this -> get... | Deletes user data from the provided user context . |
31,224 | protected static function has_expired ( string $ period , int $ comparisondate ) : bool { $ dt = new \ DateTime ( ) ; $ dt -> setTimestamp ( $ comparisondate ) ; $ dt -> add ( new \ DateInterval ( $ period ) ) ; return ( time ( ) >= $ dt -> getTimestamp ( ) ) ; } | Check whether a date is beyond the specified period . |
31,225 | protected static function get_expiry_info ( purpose $ purpose , int $ comparisondate = 0 ) : expiry_info { $ overrides = $ purpose -> get_purpose_overrides ( ) ; $ expiredroles = $ unexpiredroles = [ ] ; if ( empty ( $ overrides ) ) { if ( empty ( $ comparisondate ) ) { $ defaultexpired = false ; } else { $ defaultexpi... | Get the expiry info object for the specified purpose and comparison date . |
31,226 | protected function update_from_expiry_info ( \ stdClass $ expiryrecord ) { if ( $ isanyexpired = $ expiryrecord -> info -> is_any_expired ( ) ) { if ( $ expiryrecord -> record -> expiredctxid ) { $ expiredcontext = new expired_context ( null , expired_context :: extract_record ( $ expiryrecord -> record , 'expiredctx' ... | Update or delete the expired_context from the expiry_info object . This function depends upon the data structure returned from get_nested_expiry_info . |
31,227 | protected function update_expired_context ( expired_context $ expiredctx ) { $ context = \ context :: instance_by_id ( $ expiredctx -> get ( 'contextid' ) ) ; $ expiryrecords = self :: get_nested_expiry_info ( $ context -> path ) ; if ( empty ( $ expiryrecords [ $ context -> path ] ) ) { $ expiredctx -> delete ( ) ; re... | Update the expired context record . |
31,228 | protected function get_role_users_for_expired_context ( expired_context $ expiredctx , \ context $ context ) : \ stdClass { $ expiredroles = $ expiredctx -> get ( 'expiredroles' ) ; $ expiredroleusers = [ ] ; if ( ! empty ( $ expiredroles ) ) { $ expiredroleuserassignments = get_role_users ( $ expiredroles , $ context ... | Get the list of actual users for the combination of expired and unexpired roles . |
31,229 | public static function is_context_expired ( \ context $ context ) : bool { $ parents = $ context -> get_parent_contexts ( true ) ; foreach ( $ parents as $ parent ) { if ( $ parent instanceof \ context_course ) { return self :: is_course_context_expired ( $ context ) ; } if ( $ parent instanceof \ context_user ) { retu... | Determine whether the supplied context has expired . |
31,230 | protected static function is_course_expired ( \ stdClass $ course ) : bool { $ context = \ context_course :: instance ( $ course -> id ) ; return self :: is_course_context_expired ( $ context ) ; } | Check whether the course has expired . |
31,231 | protected static function are_user_context_dependencies_expired ( \ context_user $ context ) : bool { if ( isguestuser ( $ context -> instanceid ) || is_siteadmin ( $ context -> instanceid ) ) { return false ; } $ courses = enrol_get_users_courses ( $ context -> instanceid , false , [ 'enddate' ] ) ; $ requireenddate =... | Determine whether the supplied user context s dependencies have expired . |
31,232 | public static function is_context_expired_or_unprotected_for_user ( \ context $ context , \ stdClass $ user ) : bool { if ( ! data_registry :: defaults_set ( ) ) { return false ; } $ parents = $ context -> get_parent_contexts ( true ) ; foreach ( $ parents as $ parent ) { if ( $ parent instanceof \ context_course ) { r... | Determine whether the supplied context has expired or unprotected for the specified user . |
31,233 | protected function get_privacy_manager ( ) : manager { if ( null === $ this -> manager ) { $ this -> manager = new manager ( ) ; $ this -> manager -> set_observer ( new \ tool_dataprivacy \ manager_observer ( ) ) ; } return $ this -> manager ; } | Create a new instance of the privacy manager . |
31,234 | protected function get_progress ( ) : \ progress_trace { if ( null === $ this -> progresstracer ) { $ this -> set_progress ( new \ text_progress_trace ( ) ) ; } return $ this -> progresstracer ; } | Get the progress tracer . |
31,235 | public function launch_after_execute_methods ( ) { $ afterexecute = 'after_execute_' . basename ( $ this -> connectionpoint -> get_path ( ) ) ; if ( method_exists ( $ this , $ afterexecute ) ) { $ this -> $ afterexecute ( ) ; } } | after_execute dispatcher for any restore_subplugin class |
31,236 | public function launch_after_restore_methods ( ) { $ afterestore = 'after_restore_' . basename ( $ this -> connectionpoint -> get_path ( ) ) ; if ( method_exists ( $ this , $ afterestore ) ) { $ this -> $ afterestore ( ) ; } } | The after_restore dispatcher for any restore_subplugin class . |
31,237 | public function log ( $ message , $ level , $ a = null , $ depth = null , $ display = false ) { return $ this -> step -> log ( $ message , $ level , $ a , $ depth , $ display ) ; } | Call the log function from the step . |
31,238 | protected function config_save ( ) { global $ CFG ; $ cachefile = static :: get_config_file_path ( ) ; $ directory = dirname ( $ cachefile ) ; if ( $ directory !== $ CFG -> dataroot && ! file_exists ( $ directory ) ) { $ result = make_writable_directory ( $ directory , false ) ; if ( ! $ result ) { throw new cache_exce... | Saves the current configuration . |
31,239 | public function add_store_instance ( $ name , $ plugin , array $ configuration = array ( ) ) { if ( array_key_exists ( $ name , $ this -> configstores ) ) { throw new cache_exception ( 'Duplicate name specificed for cache plugin instance. You must provide a unique name.' ) ; } $ class = 'cachestore_' . $ plugin ; if ( ... | Adds a plugin instance . |
31,240 | public function add_lock_instance ( $ name , $ plugin , $ configuration = array ( ) ) { if ( array_key_exists ( $ name , $ this -> configlocks ) ) { throw new cache_exception ( 'Duplicate name specificed for cache lock instance. You must provide a unique name.' ) ; } $ class = 'cachelock_' . $ plugin ; if ( ! class_exi... | Adds a new lock instance to the config file . |
31,241 | public function delete_lock_instance ( $ name ) { if ( ! array_key_exists ( $ name , $ this -> configlocks ) ) { throw new cache_exception ( 'The requested store does not exist.' ) ; } if ( $ this -> configlocks [ $ name ] [ 'default' ] ) { throw new cache_exception ( 'You can not delete the default lock.' ) ; } foreac... | Deletes a lock instance given its name . |
31,242 | public function set_mode_mappings ( array $ modemappings ) { $ mappings = array ( cache_store :: MODE_APPLICATION => array ( ) , cache_store :: MODE_SESSION => array ( ) , cache_store :: MODE_REQUEST => array ( ) , ) ; foreach ( $ modemappings as $ mode => $ stores ) { if ( ! array_key_exists ( $ mode , $ mappings ) ) ... | Sets the mode mappings . |
31,243 | public function edit_store_instance ( $ name , $ plugin , $ configuration ) { if ( ! array_key_exists ( $ name , $ this -> configstores ) ) { throw new cache_exception ( 'The requested instance does not exist.' ) ; } $ plugins = core_component :: get_plugin_list_with_file ( 'cachestore' , 'lib.php' ) ; if ( ! array_key... | Edits a give plugin instance . |
31,244 | public function delete_store_instance ( $ name ) { if ( ! array_key_exists ( $ name , $ this -> configstores ) ) { throw new cache_exception ( 'The requested store does not exist.' ) ; } if ( $ this -> configstores [ $ name ] [ 'default' ] ) { throw new cache_exception ( 'The can not delete the default stores.' ) ; } f... | Deletes a store instance . |
31,245 | protected static function get_default_stores ( ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/cache/stores/file/lib.php' ) ; require_once ( $ CFG -> dirroot . '/cache/stores/session/lib.php' ) ; require_once ( $ CFG -> dirroot . '/cache/stores/static/lib.php' ) ; return array ( 'default_application' => array ( ... | Returns an array of default stores for use . |
31,246 | public static function update_default_config_stores ( ) { $ factory = cache_factory :: instance ( ) ; $ factory -> updating_started ( ) ; $ config = $ factory -> create_config_instance ( true ) ; $ config -> configstores = array_merge ( $ config -> configstores , self :: get_default_stores ( ) ) ; $ config -> config_sa... | Updates the default stores within the MUC config file . |
31,247 | public static function update_definitions ( $ coreonly = false ) { $ factory = cache_factory :: instance ( ) ; $ factory -> updating_started ( ) ; $ config = $ factory -> create_config_instance ( true ) ; $ config -> write_definitions_to_cache ( self :: locate_definitions ( $ coreonly ) ) ; $ factory -> updating_finish... | Updates the definition in the configuration from those found in the cache files . |
31,248 | protected static function locate_definitions ( $ coreonly = false ) { global $ CFG ; $ files = array ( ) ; if ( file_exists ( $ CFG -> dirroot . '/lib/db/caches.php' ) ) { $ files [ 'core' ] = $ CFG -> dirroot . '/lib/db/caches.php' ; } if ( ! $ coreonly ) { $ plugintypes = core_component :: get_plugin_types ( ) ; fore... | Locates all of the definition files . |
31,249 | private function write_definitions_to_cache ( array $ definitions ) { foreach ( $ definitions as $ key => $ definition ) { unset ( $ definitions [ $ key ] [ 'selectedsharingoption' ] ) ; unset ( $ definitions [ $ key ] [ 'userinputsharingkey' ] ) ; if ( isset ( $ this -> configdefinitions [ $ key ] ) && isset ( $ this ... | Writes the updated definitions for the config file . |
31,250 | public function set_definition_mappings ( $ definition , $ mappings ) { if ( ! array_key_exists ( $ definition , $ this -> configdefinitions ) ) { throw new coding_exception ( 'Invalid definition name passed when updating mappings.' ) ; } foreach ( $ mappings as $ store ) { if ( ! array_key_exists ( $ store , $ this ->... | Sets the mappings for a given definition . |
31,251 | public function set_definition_sharing ( $ definition , $ sharingoption , $ userinputsharingkey = null ) { if ( ! array_key_exists ( $ definition , $ this -> configdefinitions ) ) { throw new coding_exception ( 'Invalid definition name passed when updating sharing options.' ) ; } if ( ! ( $ this -> configdefinitions [ ... | Sets the selected sharing options and key for a definition . |
31,252 | public static function get_store_instance_summaries ( ) { $ return = array ( ) ; $ default = array ( ) ; $ instance = cache_config :: instance ( ) ; $ stores = $ instance -> get_all_stores ( ) ; $ locks = $ instance -> get_locks ( ) ; foreach ( $ stores as $ name => $ details ) { $ class = $ details [ 'class' ] ; $ sto... | Returns an array containing all of the information about stores a renderer needs . |
31,253 | public static function get_store_plugin_summaries ( ) { $ return = array ( ) ; $ plugins = core_component :: get_plugin_list_with_file ( 'cachestore' , 'lib.php' , true ) ; foreach ( $ plugins as $ plugin => $ path ) { $ class = 'cachestore_' . $ plugin ; $ return [ $ plugin ] = array ( 'name' => get_string ( 'pluginna... | Returns an array of information about plugins everything a renderer needs . |
31,254 | public static function get_definition_summaries ( ) { $ factory = cache_factory :: instance ( ) ; $ config = $ factory -> create_config_instance ( ) ; $ storenames = array ( ) ; foreach ( $ config -> get_all_stores ( ) as $ key => $ store ) { if ( ! empty ( $ store [ 'default' ] ) ) { $ storenames [ $ key ] = new lang_... | Returns an array about the definitions . All the information a renderer needs . |
31,255 | public static function get_definition_sharing_options ( $ sharingoption , $ isselectedoptions = true ) { $ options = array ( ) ; $ prefix = ( $ isselectedoptions ) ? 'sharingselected' : 'sharing' ; if ( $ sharingoption & cache_definition :: SHARING_ALL ) { $ options [ cache_definition :: SHARING_ALL ] = new lang_string... | Given a sharing option hash this function returns an array of strings that can be used to describe it . |
31,256 | public static function get_definition_actions ( context $ context , array $ definition ) { if ( has_capability ( 'moodle/site:config' , $ context ) ) { $ actions = array ( ) ; $ actions [ ] = array ( 'text' => get_string ( 'editmappings' , 'cache' ) , 'url' => new moodle_url ( '/cache/admin.php' , array ( 'action' => '... | Returns all of the actions that can be performed on a definition . |
31,257 | public static function get_store_instance_actions ( $ name , array $ storedetails ) { $ actions = array ( ) ; if ( has_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ) { $ baseurl = new moodle_url ( '/cache/admin.php' , array ( 'store' => $ name , 'sesskey' => sesskey ( ) ) ) ; if ( empty ( $ stor... | Returns all of the actions that can be performed on a store . |
31,258 | public static function get_store_plugin_actions ( $ name , array $ plugindetails ) { $ actions = array ( ) ; if ( has_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ) { if ( ! empty ( $ plugindetails [ 'canaddinstance' ] ) ) { $ url = new moodle_url ( '/cache/admin.php' , array ( 'action' => 'adds... | Returns all of the actions that can be performed on a plugin . |
31,259 | public static function get_add_store_form ( $ plugin ) { global $ CFG ; $ plugins = core_component :: get_plugin_list ( 'cachestore' ) ; if ( ! array_key_exists ( $ plugin , $ plugins ) ) { throw new coding_exception ( 'Invalid cache plugin used when trying to create an edit form.' ) ; } $ plugindir = $ plugins [ $ plu... | Returns a form that can be used to add a store instance . |
31,260 | public static function get_edit_store_form ( $ plugin , $ store ) { global $ CFG ; $ plugins = core_component :: get_plugin_list ( 'cachestore' ) ; if ( ! array_key_exists ( $ plugin , $ plugins ) ) { throw new coding_exception ( 'Invalid cache plugin used when trying to create an edit form.' ) ; } $ factory = cache_fa... | Returns a form that can be used to edit a store instance . |
31,261 | protected static function get_possible_locks_for_stores ( $ plugindir , $ plugin ) { global $ CFG ; $ supportsnativelocking = false ; if ( file_exists ( $ plugindir . '/lib.php' ) ) { require_once ( $ plugindir . '/lib.php' ) ; $ pluginclass = 'cachestore_' . $ plugin ; if ( class_exists ( $ pluginclass ) ) { $ support... | Returns an array of suitable lock instances for use with this plugin or false if the plugin handles locking itself . |
31,262 | public static function get_definition_store_options ( $ component , $ area ) { $ factory = cache_factory :: instance ( ) ; $ definition = $ factory -> create_definition ( $ component , $ area ) ; $ config = cache_config :: instance ( ) ; $ currentstores = $ config -> get_stores_for_definition ( $ definition ) ; $ possi... | Get an array of stores that are suitable to be used for a given definition . |
31,263 | public static function get_default_mode_stores ( ) { global $ OUTPUT ; $ instance = cache_config :: instance ( ) ; $ adequatestores = cache_helper :: get_stores_suitable_for_mode_default ( ) ; $ icon = new pix_icon ( 'i/warning' , new lang_string ( 'inadequatestoreformapping' , 'cache' ) ) ; $ storenames = array ( ) ; ... | Get the default stores for all modes . |
31,264 | public static function get_lock_summaries ( ) { $ locks = array ( ) ; $ instance = cache_config :: instance ( ) ; $ stores = $ instance -> get_all_stores ( ) ; foreach ( $ instance -> get_locks ( ) as $ lock ) { $ default = ! empty ( $ lock [ 'default' ] ) ; if ( $ default ) { $ name = new lang_string ( $ lock [ 'name'... | Returns an array summarising the locks available in the system |
31,265 | public static function get_addable_lock_options ( ) { $ plugins = core_component :: get_plugin_list_with_class ( 'cachelock' , '' , 'lib.php' ) ; $ options = array ( ) ; $ len = strlen ( 'cachelock_' ) ; foreach ( $ plugins as $ plugin => $ class ) { $ method = "$class::can_add_instance" ; if ( is_callable ( $ method )... | Returns an array of lock plugins for which we can add an instance . |
31,266 | public static function get_add_lock_form ( $ plugin , array $ lockplugin = null ) { global $ CFG ; $ plugins = core_component :: get_plugin_list ( 'cachelock' ) ; if ( ! array_key_exists ( $ plugin , $ plugins ) ) { throw new coding_exception ( 'Invalid cache lock plugin requested when trying to create a form.' ) ; } $... | Gets the form to use when adding a lock instance . |
31,267 | public static function get_lock_configuration_from_data ( $ plugin , $ data ) { global $ CFG ; $ file = $ CFG -> dirroot . '/cache/locks/' . $ plugin . '/lib.php' ; if ( ! file_exists ( $ file ) ) { throw new coding_exception ( 'Invalid cache plugin provided. ' . $ file ) ; } require_once ( $ file ) ; $ class = 'cachel... | Gets configuration data from a new lock instance form . |
31,268 | function getOnclickJs ( $ elementName ) { $ onclickJs = 'if (this.checked) { this.form[\'' . $ elementName . '\'].value=\'' . addcslashes ( $ this -> _values [ 1 ] , '\'' ) . '\'; }' ; $ onclickJs .= 'else { this.form[\'' . $ elementName . '\'].value=\'' . addcslashes ( $ this -> _values [ 0 ] , '\'' ) . '\'; }' ; retu... | Create the javascript for the onclick event which will set the value of the hidden field |
31,269 | function setValues ( $ values ) { if ( empty ( $ values ) ) { $ this -> _values = array ( '' , 1 ) ; } elseif ( is_scalar ( $ values ) ) { $ this -> _values = array ( '' , $ values ) ; } else { $ this -> _values = $ values ; } $ this -> updateAttributes ( array ( 'value' => $ this -> _values [ 1 ] ) ) ; $ this -> setCh... | Sets the values used by the hidden element |
31,270 | function setValue ( $ value ) { $ this -> setChecked ( isset ( $ this -> _values [ 1 ] ) && $ value == $ this -> _values [ 1 ] ) ; $ this -> _currentValue = $ value ; } | Sets the element s value |
31,271 | function toHtml ( ) { if ( $ this -> _flagFrozen ) { return parent :: toHtml ( ) ; } else { return '<input' . $ this -> _getAttrString ( array ( 'type' => 'hidden' , 'name' => $ this -> getName ( ) , 'value' => $ this -> _values [ 0 ] ) ) . ' />' . parent :: toHtml ( ) ; } } | Returns the checkbox element in HTML and the additional hidden element in HTML |
31,272 | function exportValue ( & $ submitValues , $ assoc = false ) { $ value = $ this -> _findValue ( $ submitValues ) ; if ( null === $ value ) { $ value = $ this -> getValue ( ) ; } elseif ( is_array ( $ this -> _values ) && ( $ value != $ this -> _values [ 0 ] ) && ( $ value != $ this -> _values [ 1 ] ) ) { $ value = null ... | This element has a value even if it is not checked thus we override checkbox s behaviour here |
31,273 | public function edit_page ( \ quiz $ quizobj , structure $ structure , \ question_edit_contexts $ contexts , \ moodle_url $ pageurl , array $ pagevars ) { $ output = '' ; $ output .= $ this -> heading_with_help ( get_string ( 'editingquizx' , 'quiz' , format_string ( $ quizobj -> get_quiz_name ( ) ) ) , 'editingquiz' ,... | Render the edit page |
31,274 | public function quiz_information ( structure $ structure ) { list ( $ currentstatus , $ explanation ) = $ structure -> get_dates_summary ( ) ; $ output = html_writer :: span ( get_string ( 'numquestionsx' , 'quiz' , $ structure -> get_question_count ( ) ) , 'numberofquestions' ) . ' | ' . html_writer :: span ( $ curren... | Render the status bar . |
31,275 | public function maximum_grade_input ( $ structure , \ moodle_url $ pageurl ) { $ output = '' ; $ output .= html_writer :: start_div ( 'maxgrade' ) ; $ output .= html_writer :: start_tag ( 'form' , array ( 'method' => 'post' , 'action' => 'edit.php' , 'class' => 'quizsavegradesform form-inline' ) ) ; $ output .= html_wr... | Render the form for setting a quiz overall grade |
31,276 | protected function repaginate_button ( structure $ structure , \ moodle_url $ pageurl ) { $ header = html_writer :: tag ( 'span' , get_string ( 'repaginatecommand' , 'quiz' ) , array ( 'class' => 'repaginatecommand' ) ) ; $ form = $ this -> repaginate_form ( $ structure , $ pageurl ) ; $ buttonoptions = array ( 'type' ... | Return the repaginate button |
31,277 | protected function selectmultiple_button ( structure $ structure ) { $ buttonoptions = array ( 'type' => 'button' , 'name' => 'selectmultiple' , 'id' => 'selectmultiplecommand' , 'value' => get_string ( 'selectmultipleitems' , 'quiz' ) , 'class' => 'btn btn-secondary mb-1' ) ; if ( ! $ structure -> can_be_edited ( ) ) ... | Generate the bulk action button . |
31,278 | protected function selectmultiple_controls ( structure $ structure ) { $ output = '' ; $ buttondeleteoptions = array ( 'type' => 'button' , 'id' => 'selectmultipledeletecommand' , 'value' => get_string ( 'deleteselected' , 'mod_quiz' ) , 'class' => 'btn btn-secondary' ) ; $ buttoncanceloptions = array ( 'type' => 'butt... | Generate the controls that appear when the bulk action button is pressed . |
31,279 | protected function repaginate_form ( structure $ structure , \ moodle_url $ pageurl ) { $ perpage = array ( ) ; $ perpage [ 0 ] = get_string ( 'allinone' , 'quiz' ) ; for ( $ i = 1 ; $ i <= 50 ; ++ $ i ) { $ perpage [ $ i ] = $ i ; } $ hiddenurl = clone ( $ pageurl ) ; $ hiddenurl -> param ( 'sesskey' , sesskey ( ) ) ;... | Return the repaginate form |
31,280 | public function total_marks ( $ quiz ) { $ totalmark = html_writer :: span ( quiz_format_grade ( $ quiz , $ quiz -> sumgrades ) , 'mod_quiz_summarks' ) ; return html_writer :: tag ( 'span' , get_string ( 'totalmarksx' , 'quiz' , $ totalmark ) , array ( 'class' => 'totalpoints' ) ) ; } | Render the total marks available for the quiz . |
31,281 | protected function start_section ( $ structure , $ section ) { $ output = '' ; $ sectionstyle = '' ; if ( $ structure -> is_only_one_slot_in_section ( $ section ) ) { $ sectionstyle = ' only-has-one-slot' ; } $ output .= html_writer :: start_tag ( 'li' , array ( 'id' => 'section-' . $ section -> id , 'class' => 'sectio... | Display the start of a section before the questions . |
31,282 | public function section_shuffle_questions ( structure $ structure , $ section ) { $ checkboxattributes = array ( 'type' => 'checkbox' , 'id' => 'shuffle-' . $ section -> id , 'value' => 1 , 'data-action' => 'shuffle_questions' , 'class' => 'cm-edit-action' , ) ; if ( ! $ structure -> can_be_edited ( ) ) { $ checkboxatt... | Display a checkbox for shuffling question within a section . |
31,283 | public function section_remove_icon ( $ section ) { $ title = get_string ( 'sectionheadingremove' , 'quiz' , $ section -> heading ) ; $ url = new \ moodle_url ( '/mod/quiz/edit.php' , array ( 'sesskey' => sesskey ( ) , 'removesection' => '1' , 'sectionid' => $ section -> id ) ) ; $ image = $ this -> pix_icon ( 't/delet... | Render an icon to remove a section from the quiz . |
31,284 | public function questions_in_section ( structure $ structure , $ section , $ contexts , $ pagevars , $ pageurl ) { $ output = '' ; foreach ( $ structure -> get_slots_in_section ( $ section -> id ) as $ slot ) { $ output .= $ this -> question_row ( $ structure , $ slot , $ contexts , $ pagevars , $ pageurl ) ; } return ... | Renders HTML to display the questions in a section of the quiz . |
31,285 | public function add_menu_actions ( structure $ structure , $ page , \ moodle_url $ pageurl , \ question_edit_contexts $ contexts , array $ pagevars ) { $ actions = $ this -> edit_menu_actions ( $ structure , $ page , $ pageurl , $ pagevars ) ; if ( empty ( $ actions ) ) { return '' ; } $ menu = new \ action_menu ( ) ; ... | Returns the add menu that is output once per page . |
31,286 | protected function add_question_form ( structure $ structure , $ page , \ moodle_url $ pageurl , array $ pagevars ) { $ questioncategoryid = question_get_category_id_from_pagevars ( $ pagevars ) ; $ output = html_writer :: tag ( 'input' , null , array ( 'type' => 'hidden' , 'name' => 'returnurl' , 'value' => $ pageurl ... | Render the form that contains the data for adding a new question to the quiz . |
31,287 | public function question ( structure $ structure , $ slot , \ moodle_url $ pageurl ) { $ output = '' ; $ output .= html_writer :: start_tag ( 'div' ) ; if ( $ structure -> can_be_edited ( ) ) { $ output .= $ this -> question_move_icon ( $ structure , $ slot ) ; } $ output .= html_writer :: start_div ( 'mod-indent-outer... | Display a question . |
31,288 | public function question_move_icon ( structure $ structure , $ slot ) { return html_writer :: link ( new \ moodle_url ( '#' ) , $ this -> pix_icon ( 'i/dragdrop' , get_string ( 'move' ) , 'moodle' , array ( 'class' => 'iconsmall' , 'title' => '' ) ) , array ( 'class' => 'editing_move' , 'data-action' => 'move' ) ) ; } | Render the move icon . |
31,289 | public function question_number ( $ number ) { if ( is_numeric ( $ number ) ) { $ number = html_writer :: span ( get_string ( 'question' ) , 'accesshide' ) . ' ' . $ number ; } return html_writer :: tag ( 'span' , $ number , array ( 'class' => 'slotnumber' ) ) ; } | Output the question number . |
31,290 | public function question_preview_icon ( $ quiz , $ question , $ label = null , $ variant = null ) { $ url = quiz_question_preview_url ( $ quiz , $ question , $ variant ) ; $ strpreviewlabel = '' ; if ( $ label ) { $ strpreviewlabel = ' ' . get_string ( 'preview' , 'quiz' ) ; } $ strpreviewquestion = get_string ( 'previ... | Render the preview icon . |
31,291 | public function question_remove_icon ( structure $ structure , $ slot , $ pageurl ) { $ url = new \ moodle_url ( $ pageurl , array ( 'sesskey' => sesskey ( ) , 'remove' => $ slot ) ) ; $ strdelete = get_string ( 'delete' ) ; $ image = $ this -> pix_icon ( 't/delete' , $ strdelete ) ; return $ this -> action_link ( $ ur... | Render an icon to remove a question from the quiz . |
31,292 | public function page_split_join_button ( $ structure , $ slot ) { $ insertpagebreak = ! $ structure -> is_last_slot_on_page ( $ slot ) ; $ url = new \ moodle_url ( 'repaginate.php' , array ( 'quizid' => $ structure -> get_quizid ( ) , 'slot' => $ slot , 'repag' => $ insertpagebreak ? 2 : 1 , 'sesskey' => sesskey ( ) ) ... | Display an icon to split or join two pages of the quiz . |
31,293 | public function question_dependency_icon ( $ structure , $ slot ) { $ a = array ( 'thisq' => $ structure -> get_displayed_number_for_slot ( $ slot ) , 'previousq' => $ structure -> get_displayed_number_for_slot ( max ( $ slot - 1 , 1 ) ) , ) ; if ( $ structure -> is_question_dependent_on_previous_slot ( $ slot ) ) { $ ... | Display the icon for whether this question can only be seen if the previous one has been answered . |
31,294 | public function question_name ( structure $ structure , $ slot , $ pageurl ) { $ output = '' ; $ question = $ structure -> get_question_in_slot ( $ slot ) ; $ editurl = new \ moodle_url ( '/question/question.php' , array ( 'returnurl' => $ pageurl -> out_as_local_url ( ) , 'cmid' => $ structure -> get_cmid ( ) , 'id' =... | Renders html to display a name with the link to the question on a quiz edit page |
31,295 | public function random_question ( structure $ structure , $ slotnumber , $ pageurl ) { $ question = $ structure -> get_question_in_slot ( $ slotnumber ) ; $ slot = $ structure -> get_slot_by_number ( $ slotnumber ) ; $ slottags = $ structure -> get_slot_tags_for_slot_id ( $ slot -> id ) ; $ editurl = new \ moodle_url (... | Renders html to display a random question the link to edit the configuration and also to see that category in the question bank . |
31,296 | public function marked_out_of_field ( structure $ structure , $ slot ) { if ( ! $ structure -> is_real_question ( $ slot ) ) { $ output = html_writer :: span ( '' , 'instancemaxmark decimalplaces_' . $ structure -> get_decimal_places_for_question_marks ( ) ) ; $ output .= html_writer :: span ( $ this -> pix_icon ( 'spa... | Display the marked out of information for a question . Along with the regrade action . |
31,297 | public function question_chooser ( ) { $ chooser = \ mod_quiz \ output \ question_chooser :: get ( $ this -> page -> course , [ ] , null ) ; $ container = html_writer :: div ( $ this -> render ( $ chooser ) , '' , array ( 'id' => 'qtypechoicecontainer' ) ) ; return html_writer :: div ( $ container , 'createnewquestion'... | Render the question type chooser dialogue . |
31,298 | public function question_bank_contents ( \ mod_quiz \ question \ bank \ custom_view $ questionbank , array $ pagevars ) { $ qbank = $ questionbank -> render ( 'editq' , $ pagevars [ 'qpage' ] , $ pagevars [ 'qperpage' ] , $ pagevars [ 'cat' ] , $ pagevars [ 'recurse' ] , $ pagevars [ 'showhidden' ] , $ pagevars [ 'qbsh... | Return the contents of the question bank to be displayed in the question - bank pop - up . |
31,299 | protected static function export_discussion_data ( int $ userid , array $ mappings ) { global $ DB ; list ( $ foruminsql , $ forumparams ) = $ DB -> get_in_or_equal ( array_keys ( $ mappings ) , SQL_PARAMS_NAMED ) ; $ sql = "SELECT d.*, g.name as groupname, dsub.... | Store all information about all discussions that we have detected this user to have access to . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.