idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
31,300 | protected static function export_posts_in_structure ( int $ userid , \ context $ context , $ parentarea , \ stdClass $ structure ) { foreach ( $ structure -> children as $ post ) { if ( ! $ post -> hasdata ) { continue ; } $ postarea = array_merge ( $ parentarea , static :: get_post_area ( $ post ) ) ; static :: export... | Export all posts in the provided structure . |
31,301 | protected static function export_post_data ( int $ userid , \ context $ context , $ postarea , $ post ) { static :: export_read_data ( $ userid , $ context , $ postarea , $ post ) ; $ postdata = ( object ) [ 'subject' => format_string ( $ post -> subject , true ) , 'created' => transform :: datetime ( $ post -> created... | Export all data in the post . |
31,302 | protected static function export_digest_data ( int $ userid , \ stdClass $ forum , int $ maildigest ) { if ( null !== $ maildigest ) { $ a = ( object ) [ 'forum' => format_string ( $ forum -> name , true ) , ] ; switch ( $ maildigest ) { case 0 : $ a -> type = get_string ( 'emaildigestoffshort' , 'mod_forum' ) ; break ... | Store data about daily digest preferences |
31,303 | protected static function export_subscription_data ( int $ userid , \ stdClass $ forum , int $ subscribed ) { if ( null !== $ subscribed ) { writer :: with_context ( \ context_module :: instance ( $ forum -> cmid ) ) -> export_metadata ( [ ] , 'subscriptionpreference' , 1 , get_string ( 'privacy:subscribedtoforum' , 'm... | Store data about whether the user subscribes to forum . |
31,304 | protected static function export_discussion_subscription_data ( int $ userid , \ context_module $ context , \ stdClass $ discussion ) { $ area = static :: get_discussion_area ( $ discussion ) ; if ( null !== $ discussion -> preference ) { $ a = ( object ) [ ] ; switch ( $ discussion -> preference ) { case \ mod_forum \... | Store data about whether the user subscribes to this particular discussion . |
31,305 | protected static function export_tracking_data ( int $ userid , \ stdClass $ forum , int $ tracked ) { if ( null !== $ tracked ) { writer :: with_context ( \ context_module :: instance ( $ forum -> cmid ) ) -> export_metadata ( [ ] , 'trackreadpreference' , 0 , get_string ( 'privacy:readtrackingdisabled' , 'mod_forum' ... | Store forum read - tracking data about a particular forum . |
31,306 | protected static function export_read_data ( int $ userid , \ context_module $ context , array $ postarea , \ stdClass $ post ) { if ( null !== $ post -> firstread ) { $ a = ( object ) [ 'firstread' => $ post -> firstread , 'lastread' => $ post -> lastread , ] ; writer :: with_context ( $ context ) -> export_metadata (... | Store read - tracking information about a particular forum post . |
31,307 | protected function define_table_columns ( ) { $ extrafields = get_extra_user_fields ( $ this -> context ) ; $ cols = array ( 'timemodified' => get_string ( 'datetime' , 'gradereport_history' ) , 'fullname' => get_string ( 'name' ) ) ; foreach ( $ extrafields as $ field ) { if ( get_string_manager ( ) -> string_exists (... | Setup the headers for the html table . |
31,308 | public function col_finalgrade ( \ stdClass $ history ) { if ( ! empty ( $ this -> gradeitems [ $ history -> itemid ] ) ) { $ decimalpoints = $ this -> gradeitems [ $ history -> itemid ] -> get_decimals ( ) ; } else { $ decimalpoints = $ this -> defaultdecimalpoints ; } return format_float ( $ history -> finalgrade , $... | Method to display the final grade . |
31,309 | public function col_prevgrade ( \ stdClass $ history ) { if ( ! empty ( $ this -> gradeitems [ $ history -> itemid ] ) ) { $ decimalpoints = $ this -> gradeitems [ $ history -> itemid ] -> get_decimals ( ) ; } else { $ decimalpoints = $ this -> defaultdecimalpoints ; } return format_float ( $ history -> prevgrade , $ d... | Method to display the previous grade . |
31,310 | public function col_itemname ( \ stdClass $ history ) { $ itemid = $ history -> itemid ; if ( ! empty ( $ this -> gradeitems [ $ itemid ] ) ) { if ( $ history -> itemtype === 'mod' && ! $ this -> is_downloading ( ) ) { if ( ! empty ( $ this -> cms -> instances [ $ history -> itemmodule ] [ $ history -> iteminstance ] )... | Method to display column itemname . |
31,311 | public function col_grader ( \ stdClass $ history ) { if ( empty ( $ history -> usermodified ) ) { return '' ; } $ grader = new \ stdClass ( ) ; $ grader = username_load_fields_from_object ( $ grader , $ history , 'grader' ) ; $ name = fullname ( $ grader ) ; if ( $ this -> download ) { return $ name ; } $ userid = $ h... | Method to display column grader . |
31,312 | public function col_feedback ( \ stdClass $ history ) { if ( $ this -> is_downloading ( ) ) { return $ history -> feedback ; } else { $ gradeitem = $ this -> gradeitems [ $ history -> itemid ] ; $ context = $ gradeitem -> get_context ( ) ; $ feedback = file_rewrite_pluginfile_urls ( $ history -> feedback , 'pluginfile.... | Method to display column feedback . |
31,313 | protected function get_filters_sql_and_params ( ) { global $ DB ; $ coursecontext = $ this -> context ; $ filter = 'gi.courseid = :courseid' ; $ params = array ( 'courseid' => $ coursecontext -> instanceid , ) ; if ( ! empty ( $ this -> filters -> itemid ) ) { $ filter .= ' AND ggh.itemid = :itemid' ; $ params [ 'itemi... | Builds the sql and param list needed based on the user selected filters . |
31,314 | protected function get_sql_and_params ( $ count = false ) { $ fields = 'ggh.id, ggh.timemodified, ggh.itemid, ggh.userid, ggh.finalgrade, ggh.usermodified, ggh.source, ggh.overridden, ggh.locked, ggh.excluded, ggh.feedback, ggh.feedbackformat, gi.itemtype, gi.itemmodule, gi.iteminsta... | Builds the complete sql with all the joins to get the grade history data . |
31,315 | public function get_sql_sort ( ) { $ columns = $ this -> get_sort_columns ( ) ; if ( count ( $ columns ) == 1 && isset ( $ columns [ 'timemodified' ] ) && $ columns [ 'timemodified' ] == SORT_DESC ) { $ columns [ 'id' ] = SORT_DESC ; return self :: construct_order_by ( $ columns ) ; } return parent :: get_sql_sort ( ) ... | Get the SQL fragment to sort by . |
31,316 | public function get_selected_users ( ) { global $ DB ; $ idlist = array ( ) ; if ( ! empty ( $ this -> filters -> userids ) ) { $ idlist = explode ( ',' , $ this -> filters -> userids ) ; list ( $ where , $ params ) = $ DB -> get_in_or_equal ( $ idlist ) ; return $ DB -> get_records_select ( 'user' , "id $where" , $ pa... | Returns a list of selected users . |
31,317 | public function add_temptable ( $ tablename ) { $ this -> temptables [ $ tablename ] = $ this -> prefix . $ this -> unique_session_id . $ this -> counter ; $ this -> counter ++ ; } | Add one temptable to the store . |
31,318 | public function to_legacy_objects ( array $ discussions ) : array { return array_map ( function ( discussion_entity $ discussion ) { return ( object ) [ 'id' => $ discussion -> get_id ( ) , 'course' => $ discussion -> get_course_id ( ) , 'forum' => $ discussion -> get_forum_id ( ) , 'name' => $ discussion -> get_name (... | Convert a list of discussion entities into stdClasses . |
31,319 | public function load_blocks ( $ includeinvisible = null ) { $ origcontext = $ this -> page -> context ; $ this -> page -> context = context_system :: instance ( ) ; parent :: load_blocks ( $ includeinvisible ) ; $ this -> page -> context = $ origcontext ; } | Load blocks using the system context rather than the user s context . |
31,320 | function check_requisites ( ) { global $ CFG ; $ this -> requisitesok = false ; if ( empty ( $ this -> sourcebase ) || empty ( $ this -> zipfilename ) ) { $ this -> errorstring = 'missingrequiredfield' ; return false ; } if ( ! PHPUNIT_TEST and $ this -> sourcebase != 'https://download.moodle.org' ) { $ this -> errorst... | This function will check if everything is properly set to begin one installation . Also it will check for required settings and will fill everything as needed . |
31,321 | function need_upgrade ( ) { if ( ! $ this -> requisitesok ) { return COMPONENT_ERROR ; } $ local_md5 = $ this -> get_local_md5 ( ) ; if ( ! $ remote_md5 = $ this -> get_component_md5 ( ) ) { return COMPONENT_ERROR ; } if ( $ local_md5 == $ remote_md5 ) { return COMPONENT_UPTODATE ; } else { return COMPONENT_NEEDUPDATE ... | This function will detect if remote component needs to be installed because it s different from the local one |
31,322 | function get_local_md5 ( ) { global $ CFG ; if ( ! $ this -> requisitesok ) { return false ; } $ return_value = 'needtobeinstalled' ; $ source = $ CFG -> dataroot . '/' . $ this -> destpath . '/' . $ this -> componentname . '/' . $ this -> componentname . '.md5' ; if ( file_exists ( $ source ) ) { if ( $ temp = file_ge... | This function will get the local md5 value of the installed component . |
31,323 | function get_component_md5 ( ) { if ( ! $ this -> requisitesok ) { return false ; } if ( ! $ comp_arr = $ this -> get_all_components_md5 ( ) ) { if ( empty ( $ this -> errorstring ) ) { $ this -> errorstring = 'cannotdownloadcomponents' ; } return false ; } if ( empty ( $ comp_arr [ $ this -> componentname ] ) || ! $ c... | This function will download the specified md5 file looking for the current componentname returning its md5 field and storing extramd5info if present . Also it caches results to cachedmd5components for better performance in the same request . |
31,324 | function get_all_components_md5 ( ) { if ( ! $ this -> requisitesok ) { return false ; } $ comp_arr = array ( ) ; if ( $ this -> zippath ) { $ source = $ this -> sourcebase . '/' . $ this -> zippath . '/' . $ this -> md5filename ; } else { $ source = $ this -> sourcebase . '/' . $ this -> md5filename ; } if ( ! empty (... | This function allows you to retrieve the complete array of components found in the md5filename |
31,325 | public function set_queue ( $ langcodes ) { if ( is_array ( $ langcodes ) ) { $ this -> queue = $ langcodes ; } else if ( ! empty ( $ langcodes ) ) { $ this -> queue = array ( $ langcodes ) ; } } | Sets the queue of language packs to be installed |
31,326 | public function get_remote_list_of_languages ( ) { $ source = 'https://download.moodle.org/langpack/' . $ this -> version . '/languages.md5' ; $ availablelangs = array ( ) ; if ( $ content = download_file_content ( $ source ) ) { $ alllines = explode ( "\n" , $ content ) ; foreach ( $ alllines as $ line ) { if ( ! empt... | Returns the list of available language packs from download . moodle . org |
31,327 | protected function is_queued ( $ langcode = '' ) { if ( empty ( $ langcode ) ) { return ! empty ( $ this -> queue ) ; } else { return in_array ( $ langcode , $ this -> queue ) ; } } | Checks if the given language is queued or if the queue is empty |
31,328 | protected function install_language_pack ( $ langcode ) { $ installer = new component_installer ( 'https://download.moodle.org' , 'download.php/direct/langpack/' . $ this -> version , $ langcode . '.zip' , 'languages.md5' , 'lang' ) ; if ( ! $ installer -> requisitesok ) { throw new lang_installer_exception ( 'installe... | Perform the actual language pack installation |
31,329 | public function init ( ) { phpCAS :: traceBegin ( ) ; if ( $ this -> isInitialized ( ) ) { return ; } parent :: init ( ) ; if ( ! ( $ this -> _pdo instanceof PDO ) ) { try { $ this -> _pdo = new PDO ( $ this -> _dsn , $ this -> _username , $ this -> _password , $ this -> _driver_options ) ; } catch ( PDOException $ e )... | This method is used to initialize the storage . Halts on error . |
31,330 | private function _setErrorMode ( ) { $ pdo = $ this -> _getPdo ( ) ; $ this -> _errMode = $ pdo -> getAttribute ( PDO :: ATTR_ERRMODE ) ; $ pdo -> setAttribute ( PDO :: ATTR_ERRMODE , PDO :: ERRMODE_EXCEPTION ) ; } | This method will enable the Exception error mode on the PDO object |
31,331 | private function _resetErrorMode ( ) { $ pdo = $ this -> _getPdo ( ) ; $ pdo -> setAttribute ( PDO :: ATTR_ERRMODE , $ this -> _errMode ) ; } | this method will reset the error mode on the PDO object |
31,332 | public function createTable ( ) { phpCAS :: traceBegin ( ) ; if ( ! $ this -> isInitialized ( ) ) { $ this -> init ( ) ; } $ pdo = $ this -> _getPdo ( ) ; $ this -> _setErrorMode ( ) ; try { $ pdo -> beginTransaction ( ) ; $ query = $ pdo -> query ( $ this -> createTableSQL ( ) ) ; $ query -> closeCursor ( ) ; $ pdo ->... | This method creates the database table used to store pgt s and pgtiou s |
31,333 | public function write ( $ pgt , $ pgt_iou ) { phpCAS :: traceBegin ( ) ; $ pdo = $ this -> _getPdo ( ) ; $ this -> _setErrorMode ( ) ; try { $ pdo -> beginTransaction ( ) ; $ query = $ pdo -> prepare ( $ this -> storePgtSql ( ) ) ; $ query -> bindValue ( ':pgt' , $ pgt , PDO :: PARAM_STR ) ; $ query -> bindValue ( ':pg... | This method stores a PGT and its corresponding PGT Iou in the database . Echoes a warning on error . |
31,334 | public function read ( $ pgt_iou ) { phpCAS :: traceBegin ( ) ; $ pgt = false ; $ pdo = $ this -> _getPdo ( ) ; $ this -> _setErrorMode ( ) ; try { $ pdo -> beginTransaction ( ) ; $ query = $ pdo -> prepare ( $ this -> retrievePgtSql ( ) ) ; $ query -> bindValue ( ':pgt_iou' , $ pgt_iou , PDO :: PARAM_STR ) ; $ query -... | This method reads a PGT corresponding to a PGT Iou and deletes the corresponding db entry . |
31,335 | public static function get_feedbacks_by_courses ( $ courseids = array ( ) ) { global $ PAGE ; $ warnings = array ( ) ; $ returnedfeedbacks = array ( ) ; $ params = array ( 'courseids' => $ courseids , ) ; $ params = self :: validate_parameters ( self :: get_feedbacks_by_courses_parameters ( ) , $ params ) ; $ mycourses... | Returns a list of feedbacks in a provided list of courses . If no list is provided all feedbacks that the user can view will be returned . |
31,336 | protected static function validate_feedback ( $ feedbackid , $ courseid = 0 ) { global $ DB , $ USER ; $ feedback = $ DB -> get_record ( 'feedback' , array ( 'id' => $ feedbackid ) , '*' , MUST_EXIST ) ; list ( $ feedbackcourse , $ cm ) = get_course_and_cm_from_instance ( $ feedback , 'feedback' ) ; $ context = context... | Utility function for validating a feedback . |
31,337 | protected static function validate_feedback_access ( $ feedback , $ course , $ cm , $ context , $ checksubmit = false ) { $ feedbackcompletion = new mod_feedback_completion ( $ feedback , $ cm , $ course -> id ) ; if ( ! $ feedbackcompletion -> can_complete ( ) ) { throw new required_capability_exception ( $ context , ... | Utility function for validating access to feedback . |
31,338 | public static function get_feedback_access_information ( $ feedbackid , $ courseid = 0 ) { global $ PAGE ; $ params = array ( 'feedbackid' => $ feedbackid , 'courseid' => $ courseid , ) ; $ params = self :: validate_parameters ( self :: get_feedback_access_information_parameters ( ) , $ params ) ; list ( $ feedback , $... | Return access information for a given feedback . |
31,339 | public static function get_feedback_access_information_returns ( ) { return new external_single_structure ( array ( 'canviewanalysis' => new external_value ( PARAM_BOOL , 'Whether the user can view the analysis or not.' ) , 'cancomplete' => new external_value ( PARAM_BOOL , 'Whether the user can complete the feedback o... | Describes the get_feedback_access_information return value . |
31,340 | public static function view_feedback_parameters ( ) { return new external_function_parameters ( array ( 'feedbackid' => new external_value ( PARAM_INT , 'Feedback instance id' ) , 'moduleviewed' => new external_value ( PARAM_BOOL , 'If we need to mark the module as viewed for completion' , VALUE_DEFAULT , false ) , 'co... | Describes the parameters for view_feedback . |
31,341 | public static function get_current_completed_tmp ( $ feedbackid , $ courseid = 0 ) { global $ PAGE ; $ params = array ( 'feedbackid' => $ feedbackid , 'courseid' => $ courseid ) ; $ params = self :: validate_parameters ( self :: get_current_completed_tmp_parameters ( ) , $ params ) ; $ warnings = array ( ) ; list ( $ f... | Returns the temporary completion record for the current user . |
31,342 | public static function launch_feedback ( $ feedbackid , $ courseid = 0 ) { global $ PAGE ; $ params = array ( 'feedbackid' => $ feedbackid , 'courseid' => $ courseid ) ; $ params = self :: validate_parameters ( self :: launch_feedback_parameters ( ) , $ params ) ; $ warnings = array ( ) ; list ( $ feedback , $ course ,... | Starts or continues a feedback submission |
31,343 | public static function get_page_items ( $ feedbackid , $ page , $ courseid = 0 ) { global $ PAGE ; $ params = array ( 'feedbackid' => $ feedbackid , 'page' => $ page , 'courseid' => $ courseid ) ; $ params = self :: validate_parameters ( self :: get_page_items_parameters ( ) , $ params ) ; $ warnings = array ( ) ; list... | Get a single feedback page items . |
31,344 | public static function get_page_items_returns ( ) { return new external_single_structure ( array ( 'items' => new external_multiple_structure ( feedback_item_exporter :: get_read_structure ( ) ) , 'hasprevpage' => new external_value ( PARAM_BOOL , 'Whether is a previous page.' ) , 'hasnextpage' => new external_value ( ... | Describes the get_page_items return value . |
31,345 | public static function process_page ( $ feedbackid , $ page , $ responses = [ ] , $ goprevious = false , $ courseid = 0 ) { global $ USER , $ SESSION ; $ params = array ( 'feedbackid' => $ feedbackid , 'page' => $ page , 'responses' => $ responses , 'goprevious' => $ goprevious , 'courseid' => $ courseid ) ; $ params =... | Process a jump between pages . |
31,346 | public static function get_analysis_parameters ( ) { return new external_function_parameters ( array ( 'feedbackid' => new external_value ( PARAM_INT , 'Feedback instance id' ) , 'groupid' => new external_value ( PARAM_INT , 'Group id, 0 means that the function will determine the user group' , VALUE_DEFAULT , 0 ) , 'co... | Describes the parameters for get_analysis . |
31,347 | public static function get_analysis_returns ( ) { return new external_single_structure ( array ( 'completedcount' => new external_value ( PARAM_INT , 'Number of completed submissions.' ) , 'itemscount' => new external_value ( PARAM_INT , 'Number of items (questions).' ) , 'itemsdata' => new external_multiple_structure ... | Describes the get_analysis return value . |
31,348 | public static function get_unfinished_responses ( $ feedbackid , $ courseid = 0 ) { global $ PAGE ; $ params = array ( 'feedbackid' => $ feedbackid , 'courseid' => $ courseid ) ; $ params = self :: validate_parameters ( self :: get_unfinished_responses_parameters ( ) , $ params ) ; $ warnings = $ itemsdata = array ( ) ... | Retrieves responses from the current unfinished attempt . |
31,349 | public static function get_finished_responses ( $ feedbackid , $ courseid = 0 ) { global $ PAGE ; $ params = array ( 'feedbackid' => $ feedbackid , 'courseid' => $ courseid ) ; $ params = self :: validate_parameters ( self :: get_finished_responses_parameters ( ) , $ params ) ; $ warnings = $ itemsdata = array ( ) ; li... | Retrieves responses from the last finished attempt . |
31,350 | public static function get_non_respondents_parameters ( ) { return new external_function_parameters ( array ( 'feedbackid' => new external_value ( PARAM_INT , 'Feedback instance id' ) , 'groupid' => new external_value ( PARAM_INT , 'Group id, 0 means that the function will determine the user group.' , VALUE_DEFAULT , 0... | Describes the parameters for get_non_respondents . |
31,351 | public static function get_non_respondents ( $ feedbackid , $ groupid = 0 , $ sort = 'lastaccess' , $ page = 0 , $ perpage = 0 , $ courseid = 0 ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/mod/feedback/lib.php' ) ; $ params = array ( 'feedbackid' => $ feedbackid , 'groupid' => $ groupid , 'sort' => $ sort , '... | Retrieves a list of students who didn t submit the feedback . |
31,352 | public static function get_non_respondents_returns ( ) { return new external_single_structure ( array ( 'users' => new external_multiple_structure ( new external_single_structure ( array ( 'courseid' => new external_value ( PARAM_INT , 'Course id' ) , 'userid' => new external_value ( PARAM_INT , 'The user id' ) , 'full... | Describes the get_non_respondents return value . |
31,353 | public static function get_responses_analysis_parameters ( ) { return new external_function_parameters ( array ( 'feedbackid' => new external_value ( PARAM_INT , 'Feedback instance id' ) , 'groupid' => new external_value ( PARAM_INT , 'Group id, 0 means that the function will determine the user group' , VALUE_DEFAULT ,... | Describes the parameters for get_responses_analysis . |
31,354 | public static function get_responses_analysis ( $ feedbackid , $ groupid = 0 , $ page = 0 , $ perpage = 0 , $ courseid = 0 ) { $ params = array ( 'feedbackid' => $ feedbackid , 'groupid' => $ groupid , 'page' => $ page , 'perpage' => $ perpage , 'courseid' => $ courseid ) ; $ params = self :: validate_parameters ( self... | Return the feedback user responses . |
31,355 | public static function get_responses_analysis_returns ( ) { $ responsestructure = new external_multiple_structure ( new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'Response id' ) , 'name' => new external_value ( PARAM_RAW , 'Response name' ) , 'printval' => new external_value ( PARAM_R... | Describes the get_responses_analysis return value . |
31,356 | public static function get_last_completed ( $ feedbackid , $ courseid = 0 ) { global $ PAGE ; $ params = array ( 'feedbackid' => $ feedbackid , 'courseid' => $ courseid ) ; $ params = self :: validate_parameters ( self :: get_last_completed_parameters ( ) , $ params ) ; $ warnings = array ( ) ; list ( $ feedback , $ co... | Retrieves the last completion record for the current user . |
31,357 | public function setTitle ( $ title ) { if ( ! empty ( $ title ) ) { $ this -> title = $ title ; } else if ( isset ( $ this -> title ) ) { unset ( $ this -> title ) ; } } | Set a title value for the content - item . |
31,358 | public function setText ( $ text ) { if ( ! empty ( $ text ) ) { $ this -> text = $ text ; } else if ( isset ( $ this -> text ) ) { unset ( $ this -> text ) ; } } | Set a link text value for the content - item . |
31,359 | private function createCommandDocument ( ) { $ cmd = [ 'distinct' => $ this -> collectionName , 'key' => $ this -> fieldName , ] ; if ( ! empty ( $ this -> filter ) ) { $ cmd [ 'query' ] = ( object ) $ this -> filter ; } if ( isset ( $ this -> options [ 'collation' ] ) ) { $ cmd [ 'collation' ] = ( object ) $ this -> o... | Create the distinct command document . |
31,360 | protected function define_ranges ( ) { $ nparts = $ this -> get_number_parts ( ) ; $ rangeduration = ( $ this -> analysable -> get_end ( ) - $ this -> analysable -> get_start ( ) ) / $ nparts ; if ( $ rangeduration < $ nparts ) { $ allowmultipleranges = true ; } $ ranges = array ( ) ; for ( $ i = 0 ; $ i < $ nparts ; $... | Splits the analysable duration in X equal parts from the start to the end . |
31,361 | public static function instance ( $ forcereload = false ) { global $ CFG ; if ( $ forcereload || self :: $ instance === null ) { if ( defined ( 'CACHE_DISABLE_ALL' ) && CACHE_DISABLE_ALL !== false ) { require_once ( $ CFG -> dirroot . '/cache/disabledlib.php' ) ; self :: $ instance = new cache_factory_disabled ( ) ; } ... | Returns an instance of the cache_factor method . |
31,362 | public static function reset ( ) { $ factory = self :: instance ( ) ; $ factory -> reset_cache_instances ( ) ; $ factory -> configs = array ( ) ; $ factory -> definitions = array ( ) ; $ factory -> definitionstores = array ( ) ; $ factory -> lockplugins = array ( ) ; $ factory -> state = self :: STATE_UNINITIALISED ; } | Resets the arrays containing instantiated caches stores and config instances . |
31,363 | public function create_cache ( cache_definition $ definition ) { $ class = $ definition -> get_cache_class ( ) ; $ stores = cache_helper :: get_stores_suitable_for_definition ( $ definition ) ; foreach ( $ stores as $ key => $ store ) { if ( ! $ store :: are_requirements_met ( ) ) { unset ( $ stores [ $ key ] ) ; } } i... | Common public method to create a cache instance given a definition . |
31,364 | public function create_store_from_config ( $ name , array $ details , cache_definition $ definition ) { if ( ! array_key_exists ( $ name , $ this -> stores ) ) { $ class = $ details [ 'class' ] ; if ( ! $ class :: are_requirements_met ( ) ) { return false ; } $ store = new $ class ( $ details [ 'name' ] , $ details [ '... | Creates a store instance given its name and configuration . |
31,365 | public function get_store_instances_in_use ( cache_definition $ definition ) { $ id = $ definition -> get_id ( ) ; if ( ! isset ( $ this -> definitionstores [ $ id ] ) ) { return array ( ) ; } return $ this -> definitionstores [ $ id ] ; } | Returns an array of cache stores that have been initialised for use in definitions . |
31,366 | protected function create_dummy_store ( cache_definition $ definition ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/cache/classes/dummystore.php' ) ; $ store = new cachestore_dummy ( ) ; $ store -> initialise ( $ definition ) ; return $ store ; } | Creates a dummy store object for use when a loader has no potential stores to use . |
31,367 | public function create_lock_instance ( array $ config ) { global $ CFG ; if ( ! array_key_exists ( 'name' , $ config ) || ! array_key_exists ( 'type' , $ config ) ) { throw new coding_exception ( 'Invalid cache lock instance provided' ) ; } $ name = $ config [ 'name' ] ; $ type = $ config [ 'type' ] ; unset ( $ config ... | Returns a lock instance ready for use . |
31,368 | public function set_state ( $ state ) { if ( $ state <= $ this -> state ) { return false ; } $ this -> state = $ state ; return true ; } | Updates the state fo the cache API . |
31,369 | public function updating_started ( ) { if ( $ this -> state !== self :: STATE_READY ) { return false ; } $ this -> state = self :: STATE_UPDATING ; return true ; } | Informs the factory that the cache is currently updating itself . |
31,370 | public static function disable_stores ( ) { $ factory = self :: instance ( ) ; $ factory -> reset_cache_instances ( ) ; $ factory -> set_state ( self :: STATE_STORES_DISABLED ) ; } | Disables cache stores . |
31,371 | protected function _loadMailbox ( $ mailbox , $ uidvalid = null ) { if ( ! isset ( $ this -> _mbox [ $ mailbox ] ) && ( $ ob = $ this -> _hash -> get ( $ this -> _getCid ( $ mailbox ) ) ) ) { try { $ this -> _mbox [ $ mailbox ] = $ this -> _pack -> unpack ( $ ob ) ; } catch ( Horde_Pack_Exception $ e ) { } } if ( isset... | Loads basic mailbox information . |
31,372 | protected function _getCid ( $ mailbox ) { return implode ( self :: CID_SEPARATOR , array ( 'horde_imap_client' , $ this -> _params [ 'username' ] , $ mailbox , $ this -> _params [ 'hostspec' ] , $ this -> _params [ 'port' ] ) ) ; } | Create the unique ID used to store the mailbox data in the cache . |
31,373 | public function get_listing ( $ fullpath = '' , $ page = '' ) { global $ OUTPUT ; $ list = array ( 'list' => array ( ) , 'manage' => false , 'dynload' => true , 'nologin' => true , 'path' => array ( ) ) ; $ fullpath = empty ( $ fullpath ) ? $ this -> build_node_path ( 'root' ) : $ fullpath ; $ trail = explode ( '|' , $... | Get the list of files and directories in that repository . |
31,374 | protected function build_breadcrumb ( $ path ) { $ breadcrumb = array ( array ( 'name' => get_string ( 'root' , 'repository_filesystem' ) , 'path' => $ this -> build_node_path ( 'root' ) ) ) ; $ crumbs = explode ( '|' , $ path ) ; $ trail = '' ; foreach ( $ crumbs as $ crumb ) { list ( $ mode , $ nodepath , $ display )... | Build the breadcrumb from a full path . |
31,375 | protected function build_node ( $ rootpath , $ path , $ name , $ isdir , $ rootnodepath ) { global $ OUTPUT ; $ relpath = trim ( $ path , '/' ) . '/' . $ name ; $ abspath = $ rootpath . $ relpath ; $ node = array ( 'title' => $ name , 'datecreated' => filectime ( $ abspath ) , 'datemodified' => filemtime ( $ abspath ) ... | Build a file or directory node . |
31,376 | protected function build_node_path ( $ mode , $ realpath = '' , $ display = '' , $ root = '' ) { $ path = $ mode . ':' . base64_encode ( $ realpath ) . ':' . base64_encode ( $ display ) ; if ( ! empty ( $ root ) ) { $ path = $ root . '|' . $ path ; } return $ path ; } | Build the path to a browsable node . |
31,377 | protected function explode_node_path ( $ path ) { list ( $ mode , $ realpath , $ display ) = explode ( ':' , $ path ) ; return array ( $ mode , base64_decode ( $ realpath ) , base64_decode ( $ display ) ) ; } | Extract information from a node path . |
31,378 | public function get_file ( $ file , $ title = '' ) { global $ CFG ; $ file = ltrim ( $ file , '/' ) ; if ( ! $ this -> is_in_repository ( $ file ) ) { throw new repository_exception ( 'Invalid file requested.' ) ; } $ file = $ this -> get_rootpath ( ) . $ file ; $ CFG -> repository_no_delete = true ; return array ( 'pa... | Return file path . |
31,379 | public static function instance_form_validation ( $ mform , $ data , $ errors ) { $ fspath = clean_param ( trim ( $ data [ 'fs_path' ] , '/' ) , PARAM_PATH ) ; if ( empty ( $ fspath ) && ! is_numeric ( $ fspath ) ) { $ errors [ 'fs_path' ] = get_string ( 'invalidadminsettingname' , 'error' , 'fs_path' ) ; } return $ er... | Validate repository plugin instance form |
31,380 | public function get_rootpath ( ) { global $ CFG ; $ subdir = clean_param ( trim ( $ this -> subdir , '/' ) , PARAM_PATH ) ; $ path = $ CFG -> dataroot . '/repository/' . $ this -> subdir . '/' ; if ( ( empty ( $ this -> subdir ) && ! is_numeric ( $ this -> subdir ) ) || $ subdir != $ this -> subdir || ! is_dir ( $ path... | Return the rootpath of this repository instance . |
31,381 | protected function get_thumbnail_url ( $ filepath , $ thumbsize , $ token ) { return moodle_url :: make_pluginfile_url ( $ this -> context -> id , 'repository_filesystem' , $ thumbsize , $ this -> id , '/' . trim ( $ filepath , '/' ) . '/' , $ token ) ; } | Returns url of thumbnail file . |
31,382 | public function get_thumbnail ( $ filepath , $ thumbsize ) { global $ CFG ; $ filepath = trim ( $ filepath , '/' ) ; $ origfile = $ this -> get_rootpath ( ) . $ filepath ; if ( ! $ this -> is_in_repository ( $ filepath ) || ! ( $ filecontents = @ file_get_contents ( $ origfile ) ) ) { return null ; } $ filename = file_... | Returns the stored thumbnail file generates it if not present . |
31,383 | public function send_relative_file ( stored_file $ mainfile , $ relativepath ) { global $ CFG ; $ allowlinks = $ this -> supports_relative_file ( ) ; if ( ! empty ( $ allowlinks ) ) { $ mainfilepath = $ mainfile -> get_source ( ) ; $ filename = $ mainfile -> get_filename ( ) ; $ basepath = strstr ( $ mainfilepath , $ f... | Gets a file relative to this file in the repository and sends it to the browser . |
31,384 | public function admin_authorised_user_list ( $ users , $ serviceid ) { global $ CFG ; $ html = $ this -> output -> box_start ( 'generalbox' , 'alloweduserlist' ) ; foreach ( $ users as $ user ) { $ modifiedauthoriseduserurl = new moodle_url ( '/' . $ CFG -> admin . '/webservice/service_user_settings.php' , array ( 'use... | Display list of authorised users |
31,385 | public function admin_remove_service_function_confirmation ( $ function , $ service ) { $ optionsyes = array ( 'id' => $ service -> id , 'action' => 'delete' , 'confirm' => 1 , 'sesskey' => sesskey ( ) , 'fid' => $ function -> id ) ; $ optionsno = array ( 'id' => $ service -> id ) ; $ formcontinue = new single_button (... | Display a confirmation page to remove a function from a service |
31,386 | public function admin_remove_service_confirmation ( $ service ) { global $ CFG ; $ optionsyes = array ( 'id' => $ service -> id , 'action' => 'delete' , 'confirm' => 1 , 'sesskey' => sesskey ( ) ) ; $ optionsno = array ( 'section' => 'externalservices' ) ; $ formcontinue = new single_button ( new moodle_url ( 'service.... | Display a confirmation page to remove a service |
31,387 | public function admin_delete_token_confirmation ( $ token ) { global $ CFG ; $ optionsyes = array ( 'tokenid' => $ token -> id , 'action' => 'delete' , 'confirm' => 1 , 'sesskey' => sesskey ( ) ) ; $ optionsno = array ( 'section' => 'webservicetokens' , 'sesskey' => sesskey ( ) ) ; $ formcontinue = new single_button ( ... | Display a confirmation page to delete a token |
31,388 | public function user_reset_token_confirmation ( $ token ) { global $ CFG ; $ managetokenurl = $ CFG -> wwwroot . "/user/managetoken.php?sesskey=" . sesskey ( ) ; $ optionsyes = array ( 'tokenid' => $ token -> id , 'action' => 'resetwstoken' , 'confirm' => 1 , 'sesskey' => sesskey ( ) ) ; $ optionsno = array ( 'section'... | Display Reset token confirmation box |
31,389 | public function detailed_description_html ( $ params ) { $ paramdesc = "" ; if ( ! empty ( $ params -> desc ) ) { $ paramdesc .= html_writer :: start_tag ( 'span' , array ( 'style' => "color:#2A33A6" ) ) ; if ( $ params -> required == VALUE_REQUIRED ) { $ required = '' ; } if ( $ params -> required == VALUE_DEFAULT ) {... | Return documentation for a ws description object ws description object can be external_multiple_structure external_single_structure or external_value |
31,390 | public function xmlrpc_param_description_html ( $ paramdescription , $ indentation = "" ) { $ indentation = $ indentation . " " ; $ brakeline = <<<EOFEOF ; if ( $ paramdescription instanceof external_multiple_structure ) { $ return = $ brakeline . $ indentation . "Array " ; $ indentation = $ indentation . " " ; ... | Create indented XML - RPC param description |
31,391 | public function colored_box_with_pre_tag ( $ title , $ content , $ rgb = 'FEEBE5' ) { $ coloredbox = html_writer :: start_tag ( 'div' , array ( ) ) ; $ coloredbox .= html_writer :: start_tag ( 'div' , array ( 'style' => "border:solid 1px #DEDEDE;background:#" . $ rgb . ";color:#222222;padding:4px;" ) ) ; $ coloredbox .... | Return the html of a coloured box with content |
31,392 | public function rest_param_description_html ( $ paramdescription , $ paramstring ) { $ brakeline = <<<EOFEOF ; if ( $ paramdescription instanceof external_multiple_structure ) { $ paramstring = $ paramstring . '[0]' ; $ return = $ this -> rest_param_description_html ( $ paramdescription -> content , $ paramstring ) ; ... | Return indented REST param description |
31,393 | public static function list_required_headers ( ) { return array ( get_string ( 'parentidnumber' , 'tool_lpimportcsv' ) , get_string ( 'idnumber' , 'tool_lpimportcsv' ) , get_string ( 'shortname' , 'tool_lpimportcsv' ) , get_string ( 'description' , 'tool_lpimportcsv' ) , get_string ( 'descriptionformat' , 'tool_lpimpor... | Get the list of headers required for import . |
31,394 | protected function read_mapping_data ( $ data ) { if ( $ data ) { return array ( 'parentidnumber' => $ data -> header0 , 'idnumber' => $ data -> header1 , 'shortname' => $ data -> header2 , 'description' => $ data -> header3 , 'descriptionformat' => $ data -> header4 , 'scalevalues' => $ data -> header5 , 'scaleconfigu... | Read the data from the mapping form . |
31,395 | public function add_children ( & $ node , $ parentidnumber ) { foreach ( $ this -> flat as $ competency ) { if ( $ competency -> parentidnumber == $ parentidnumber ) { $ this -> progress -> increment_progress ( ) ; $ node -> children [ ] = $ competency ; $ this -> add_children ( $ competency , $ competency -> idnumber ... | Add a competency to the parent with the specified idnumber . |
31,396 | public function create_competency ( $ record , $ parent , $ framework ) { $ competency = new stdClass ( ) ; $ competency -> competencyframeworkid = $ framework -> get ( 'id' ) ; $ competency -> shortname = $ record -> shortname ; if ( ! empty ( $ record -> description ) ) { $ competency -> description = $ record -> des... | Recursive function to add a competency with all it s children . |
31,397 | public function get_scale_configuration ( $ scaleid , $ config ) { $ asarray = json_decode ( $ config ) ; $ asarray [ 0 ] -> scaleid = $ scaleid ; return json_encode ( $ asarray ) ; } | Recreate the scale config to point to a new scaleid . |
31,398 | public function get_scale_id ( $ scalevalues , $ competencyname ) { global $ CFG , $ USER ; require_once ( $ CFG -> libdir . '/gradelib.php' ) ; if ( empty ( $ this -> scalecache ) ) { $ allscales = grade_scale :: fetch_all_global ( ) ; foreach ( $ allscales as $ scale ) { $ scale -> load_items ( ) ; $ this -> scalecac... | Search for a global scale that matches this set of scalevalues . If one is not found it will be created . |
31,399 | protected function set_related ( $ record ) { $ comp = $ record -> createdcomp ; if ( $ record -> relatedidnumbers ) { $ allidnumbers = explode ( ',' , $ record -> relatedidnumbers ) ; foreach ( $ allidnumbers as $ rawidnumber ) { $ idnumber = str_replace ( '%2C' , ',' , $ rawidnumber ) ; if ( isset ( $ this -> flat [ ... | Walk through the idnumbers in the relatedidnumbers col and set the relations . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.