idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
27,600 | public function set_total_users ( $ totalusers ) { $ this -> totalusers = $ totalusers ; $ this -> pages = ceil ( $ this -> totalusers / $ this -> perpage ) ; if ( $ this -> page > $ this -> pages ) { $ this -> page = $ this -> pages ; } } | Sets the total number of users |
27,601 | public function set_users ( array $ users ) { $ this -> users = $ users ; $ hasbulkops = ! empty ( $ this -> bulkoperations ) ; foreach ( $ users as $ userid => $ user ) { $ user = ( array ) $ user ; $ row = new html_table_row ( ) ; $ row -> attributes = array ( 'class' => 'userinforow' ) ; $ row -> id = 'user_' . $ us... | Sets the users for this table |
27,602 | public function get_paging_bar ( ) { if ( $ this -> pagingbar == null ) { $ this -> pagingbar = new paging_bar ( $ this -> totalusers , $ this -> page , $ this -> perpage , $ this -> manager -> get_moodlepage ( ) -> url , self :: PAGEVAR ) ; } return $ this -> pagingbar ; } | Gets the paging bar instance for this table |
27,603 | protected function get_direction_icon ( $ output , $ field ) { $ direction = self :: DEFAULTSORTDIRECTION ; if ( $ this -> sort == $ field ) { $ direction = $ this -> sortdirection ; } if ( $ direction === 'ASC' ) { return $ output -> pix_icon ( 't/sort_asc' , get_string ( 'sort' ) ) ; } else { return $ output -> pix_i... | Gets the direction icon for the sortable field within this table |
27,604 | public function get_url_params ( ) { return array ( self :: PAGEVAR => $ this -> page , self :: PERPAGEVAR => $ this -> perpage , self :: SORTVAR => $ this -> sort , self :: SORTDIRECTIONVAR => $ this -> sortdirection ) ; } | Gets the params that will need to be added to the url in order to return to this page . |
27,605 | public function get_user_search_button ( ) { static $ count = 0 ; if ( ! has_capability ( 'moodle/role:assign' , $ this -> manager -> get_context ( ) ) ) { return false ; } $ count ++ ; $ url = new moodle_url ( '/admin/roles/assign.php' , array ( 'contextid' => $ this -> manager -> get_context ( ) -> id , 'sesskey' => ... | Gets a button to search users and assign them roles in the course . |
27,606 | public function validate ( $ element ) { $ this -> last_error = null ; $ celement = realpath ( $ element ) ; $ cvalidator = realpath ( $ this -> location . DIRECTORY_SEPARATOR . $ this -> type ) ; $ result = ( empty ( $ celement ) || empty ( $ cvalidator ) ) ; if ( ! $ result ) { $ xml_error = new libxml_errors_mgr ( )... | Validates the item |
27,607 | public static function create ( ) { $ ob = new stdClass ; $ ob -> value = self :: DEFAULT_CONTENT_TYPE ; return new self ( null , $ ob ) ; } | Creates a default Content - Type header conforming to the MIME specification as detailed in RFC 2045 . |
27,608 | public function add_field ( $ field , $ table , $ alias = null ) { $ field = self :: resolve_field ( $ field , $ table ) ; if ( ! empty ( $ alias ) ) { $ field .= ' AS ' . $ alias ; } $ this -> fields [ ] = $ field ; } | Add a field to select . |
27,609 | protected function build_query ( $ count = false ) { $ sql = 'SELECT ' ; if ( $ count ) { $ sql .= 'COUNT(\'x\') ' ; } else { $ sql .= implode ( ', ' , $ this -> fields ) . ' ' ; } $ sql .= $ this -> from . ' ' ; $ sql .= implode ( ' ' , $ this -> joins ) . ' ' ; if ( ! empty ( $ this -> where ) ) { $ sql .= 'WHERE (' ... | Internal method to build the query . |
27,610 | protected function filter_by_letter ( $ letter , $ finalfield ) { global $ DB ; $ letter = core_text :: strtoupper ( $ letter ) ; $ len = core_text :: strlen ( $ letter ) ; $ sql = $ DB -> sql_substr ( sprintf ( 'upper(%s)' , $ finalfield ) , 1 , $ len ) ; $ this -> where [ ] = "$sql = :letter" ; $ this -> params [ 'le... | Filter a field using a letter . |
27,611 | protected function filter_by_non_letter ( $ finalfield ) { global $ DB ; $ alphabet = explode ( ',' , get_string ( 'alphabet' , 'langconfig' ) ) ; list ( $ nia , $ aparams ) = $ DB -> get_in_or_equal ( $ alphabet , SQL_PARAMS_NAMED , 'nonletter' , false ) ; $ sql = $ DB -> sql_substr ( sprintf ( 'upper(%s)' , $ finalfi... | Filter a field by special characters . |
27,612 | public function filter_by_author_letter ( $ letter , $ firstnamefirst = false ) { $ field = self :: get_fullname_field ( $ firstnamefirst ) ; $ this -> filter_by_letter ( $ letter , $ field ) ; } | Filter the author by letter . |
27,613 | public function filter_by_author_non_letter ( $ firstnamefirst = false ) { $ field = self :: get_fullname_field ( $ firstnamefirst ) ; $ this -> filter_by_non_letter ( $ field ) ; } | Filter the author by special characters . |
27,614 | public function filter_by_non_approved ( $ constant , $ userid = null ) { global $ USER ; if ( ! $ userid ) { $ userid = $ USER -> id ; } if ( $ constant === self :: NON_APPROVED_ALL ) { } else if ( $ constant === self :: NON_APPROVED_SELF ) { $ this -> where [ ] = sprintf ( '%s != 0 OR %s = :toapproveuserid' , self ::... | Filter non approved entries . |
27,615 | public function filter_by_term ( $ term ) { $ this -> where [ ] = sprintf ( "(%s = :filterterma OR %s = :filtertermb)" , self :: resolve_field ( 'concept' , 'entries' ) , self :: resolve_field ( 'alias' , 'alias' ) ) ; $ this -> params [ 'filterterma' ] = $ term ; $ this -> params [ 'filtertermb' ] = $ term ; } | Filter by concept or alias . |
27,616 | public static function get_fullname_field ( $ firstnamefirst = false ) { global $ DB ; if ( $ firstnamefirst ) { return $ DB -> sql_fullname ( self :: resolve_field ( 'firstname' , 'user' ) , self :: resolve_field ( 'lastname' , 'user' ) ) ; } return $ DB -> sql_fullname ( self :: resolve_field ( 'lastname' , 'user' ) ... | Convenience method to get get the SQL statement for the full name . |
27,617 | public function get_records ( ) { global $ DB ; return $ DB -> get_records_sql ( $ this -> build_query ( ) , $ this -> params , $ this -> limitfrom , $ this -> limitnum ) ; } | Get the records . |
27,618 | public function get_recordset ( ) { global $ DB ; return $ DB -> get_recordset_sql ( $ this -> build_query ( ) , $ this -> params , $ this -> limitfrom , $ this -> limitnum ) ; } | Get the recordset . |
27,619 | public function join_alias ( ) { $ this -> joins [ ] = sprintf ( 'LEFT JOIN {glossary_alias} %s ON %s = %s' , self :: ALIAS_ALIAS , self :: resolve_field ( 'id' , 'entries' ) , self :: resolve_field ( 'entryid' , 'alias' ) ) ; } | Join the alias table . |
27,620 | public function join_category ( $ categoryid ) { if ( $ categoryid === GLOSSARY_SHOW_ALL_CATEGORIES ) { $ this -> joins [ ] = sprintf ( 'JOIN {glossary_entries_categories} %s ON %s = %s' , self :: ALIAS_ENTRIES_CATEGORIES , self :: resolve_field ( 'id' , 'entries' ) , self :: resolve_field ( 'entryid' , 'entries_catego... | Join on the category tables . |
27,621 | public function join_user ( $ strict = false ) { $ join = $ strict ? 'JOIN' : 'LEFT JOIN' ; $ this -> joins [ ] = sprintf ( "$join {user} %s ON %s = %s" , self :: ALIAS_USER , self :: resolve_field ( 'id' , 'user' ) , self :: resolve_field ( 'userid' , 'entries' ) ) ; } | Join the user table . |
27,622 | public function order_by_author ( $ firstnamefirst = false , $ direction = '' ) { $ field = self :: get_fullname_field ( $ firstnamefirst ) ; $ direction = self :: normalize_direction ( $ direction ) ; $ this -> order [ ] = $ field . ' ' . $ direction ; } | Order by author name . |
27,623 | protected static function resolve_field ( $ field , $ table ) { $ prefix = constant ( __CLASS__ . '::ALIAS_' . core_text :: strtoupper ( $ table ) ) ; return sprintf ( '%s.%s' , $ prefix , $ field ) ; } | Convenience method to transform a field into SQL statement . |
27,624 | public function where ( $ field , $ table , $ value ) { static $ i = 0 ; $ sql = self :: resolve_field ( $ field , $ table ) . ' ' ; if ( $ value === null ) { $ sql .= 'IS NULL' ; } else { $ param = 'where' . $ i ++ ; $ sql .= " = :$param" ; $ this -> params [ $ param ] = $ value ; } $ this -> where [ ] = $ sql ; } | Simple where conditions . |
27,625 | public function render_section_links ( stdClass $ course , array $ sections , $ jumptosection = false ) { $ html = html_writer :: start_tag ( 'ol' , array ( 'class' => 'inline-list' ) ) ; foreach ( $ sections as $ section ) { $ attributes = array ( ) ; if ( ! $ section -> visible ) { $ attributes [ 'class' ] = 'dimmed'... | Render a series of section links . |
27,626 | public static function is_subscribed ( $ userid , $ forum , $ discussionid = null , $ cm = null ) { if ( self :: is_forcesubscribed ( $ forum ) ) { if ( ! $ cm ) { $ cm = get_fast_modinfo ( $ forum -> course ) -> instances [ 'forum' ] [ $ forum -> id ] ; } if ( has_capability ( 'mod/forum:allowforcesubscribe' , \ conte... | Whether a user is subscribed to this forum or a discussion within the forum . |
27,627 | public static function is_subscribable ( $ forum ) { return ( isloggedin ( ) && ! isguestuser ( ) && ! \ mod_forum \ subscriptions :: is_forcesubscribed ( $ forum ) && ! \ mod_forum \ subscriptions :: subscription_disabled ( $ forum ) ) ; } | Helper to determine whether the specified forum can be subscribed to . |
27,628 | public static function get_unsubscribable_forums ( ) { global $ USER , $ DB ; $ courses = enrol_get_my_courses ( ) ; if ( empty ( $ courses ) ) { return array ( ) ; } $ courseids = array ( ) ; foreach ( $ courses as $ course ) { $ courseids [ ] = $ course -> id ; } list ( $ coursesql , $ courseparams ) = $ DB -> get_in... | Returns an array of forums that the current user is subscribed to and is allowed to unsubscribe from |
27,629 | public static function get_potential_subscribers ( $ context , $ groupid , $ fields , $ sort = '' ) { global $ DB ; list ( $ esql , $ params ) = get_enrolled_sql ( $ context , 'mod/forum:allowforcesubscribe' , $ groupid , true ) ; if ( ! $ sort ) { list ( $ sort , $ sortparams ) = users_order_by_sql ( 'u' ) ; $ params ... | Get the list of potential subscribers to a forum . |
27,630 | public static function fetch_subscription_cache ( $ forumid , $ userid ) { if ( isset ( self :: $ forumcache [ $ userid ] ) && isset ( self :: $ forumcache [ $ userid ] [ $ forumid ] ) ) { return self :: $ forumcache [ $ userid ] [ $ forumid ] ; } self :: fill_subscription_cache ( $ forumid , $ userid ) ; if ( ! isset ... | Fetch the forum subscription data for the specified userid and forum . |
27,631 | public static function fill_subscription_cache ( $ forumid , $ userid = null ) { global $ DB ; if ( ! isset ( self :: $ fetchedforums [ $ forumid ] ) ) { if ( isset ( $ userid ) ) { if ( ! isset ( self :: $ forumcache [ $ userid ] ) ) { self :: $ forumcache [ $ userid ] = array ( ) ; } if ( ! isset ( self :: $ forumcac... | Fill the forum subscription data for the specified userid and forum . |
27,632 | public static function fill_subscription_cache_for_course ( $ courseid , $ userid ) { global $ DB ; if ( ! isset ( self :: $ forumcache [ $ userid ] ) ) { self :: $ forumcache [ $ userid ] = array ( ) ; } $ sql = "SELECT f.id AS forumid, s.id AS subscriptionid FROM {... | Fill the forum subscription data for all forums that the specified userid can subscribe to in the specified course . |
27,633 | public static function fetch_subscribed_users ( $ forum , $ groupid = 0 , $ context = null , $ fields = null , $ includediscussionsubscriptions = false ) { global $ CFG , $ DB ; if ( empty ( $ fields ) ) { $ allnames = get_all_user_name_fields ( true , 'u' ) ; $ fields = "u.id, u.username, ... | Returns a list of user objects who are subscribed to this forum . |
27,634 | public static function fetch_discussion_subscription ( $ forumid , $ userid = null ) { self :: fill_discussion_subscription_cache ( $ forumid , $ userid ) ; if ( ! isset ( self :: $ forumdiscussioncache [ $ userid ] ) || ! isset ( self :: $ forumdiscussioncache [ $ userid ] [ $ forumid ] ) ) { return array ( ) ; } retu... | Retrieve the discussion subscription data for the specified userid and forum . |
27,635 | public static function fill_discussion_subscription_cache ( $ forumid , $ userid = null ) { global $ DB ; if ( ! isset ( self :: $ discussionfetchedforums [ $ forumid ] ) ) { if ( isset ( $ userid ) ) { if ( ! isset ( self :: $ forumdiscussioncache [ $ userid ] ) ) { self :: $ forumdiscussioncache [ $ userid ] = array ... | Fill the discussion subscription data for the specified userid and forum . |
27,636 | protected static function add_to_discussion_cache ( $ forumid , $ userid , $ discussion , $ preference ) { if ( ! isset ( self :: $ forumdiscussioncache [ $ userid ] ) ) { self :: $ forumdiscussioncache [ $ userid ] = array ( ) ; } if ( ! isset ( self :: $ forumdiscussioncache [ $ userid ] [ $ forumid ] ) ) { self :: $... | Add the specified discussion and user preference to the discussion subscription cache . |
27,637 | public static function subscribe_user ( $ userid , $ forum , $ context = null , $ userrequest = false ) { global $ DB ; if ( self :: is_subscribed ( $ userid , $ forum ) ) { return true ; } $ sub = new \ stdClass ( ) ; $ sub -> userid = $ userid ; $ sub -> forum = $ forum -> id ; $ result = $ DB -> insert_record ( "for... | Adds user to the subscriber list . |
27,638 | public static function unsubscribe_user ( $ userid , $ forum , $ context = null , $ userrequest = false ) { global $ DB ; $ sqlparams = array ( 'userid' => $ userid , 'forum' => $ forum -> id , ) ; $ DB -> delete_records ( 'forum_digests' , $ sqlparams ) ; if ( $ forumsubscription = $ DB -> get_record ( 'forum_subscrip... | Removes user from the subscriber list |
27,639 | public static function subscribe_user_to_discussion ( $ userid , $ discussion , $ context = null ) { global $ DB ; $ subscription = $ DB -> get_record ( 'forum_discussion_subs' , array ( 'userid' => $ userid , 'discussion' => $ discussion -> id ) ) ; if ( $ subscription ) { if ( $ subscription -> preference != self :: ... | Subscribes the user to the specified discussion . |
27,640 | public static function get_user_default_subscription ( $ forum , $ context , $ cm , ? int $ discussionid ) { global $ USER ; $ manageactivities = has_capability ( 'moodle/course:manageactivities' , $ context ) ; if ( \ mod_forum \ subscriptions :: subscription_disabled ( $ forum ) && ! $ manageactivities ) { $ discussi... | Gets the default subscription value for the logged in user . |
27,641 | function optionExists ( $ value ) { foreach ( $ this -> _options as $ option ) { if ( isset ( $ option [ 'attr' ] [ 'value' ] ) && ( $ option [ 'attr' ] [ 'value' ] == $ value ) ) { return true ; } } return false ; } | Search the current list of options to see if there are any options with this value . |
27,642 | public function get_default_section_name ( $ section ) { if ( $ section -> section == 0 ) { return get_string ( 'section0name' , 'format_weeks' ) ; } else { $ dates = $ this -> get_section_dates ( $ section ) ; $ dates -> end = ( $ dates -> end - 86400 ) ; $ dateformat = get_string ( 'strftimedateshort' ) ; $ weekday =... | Returns the default section name for the weekly course format . |
27,643 | public function get_section_dates ( $ section , $ startdate = false ) { if ( $ startdate === false ) { $ course = $ this -> get_course ( ) ; $ startdate = $ course -> startdate ; } if ( is_object ( $ section ) ) { $ sectionnum = $ section -> section ; } else { $ sectionnum = $ section ; } $ oneweekseconds = 604800 ; $ ... | Return the start and end date of the passed section |
27,644 | public function is_section_current ( $ section ) { if ( is_object ( $ section ) ) { $ sectionnum = $ section -> section ; } else { $ sectionnum = $ section ; } if ( $ sectionnum < 1 ) { return false ; } $ timenow = time ( ) ; $ dates = $ this -> get_section_dates ( $ section ) ; return ( ( $ timenow >= $ dates -> start... | Returns true if the specified week is current |
27,645 | public function get_default_course_enddate ( $ mform , $ fieldnames = array ( ) ) { if ( empty ( $ fieldnames [ 'startdate' ] ) ) { $ fieldnames [ 'startdate' ] = 'startdate' ; } if ( empty ( $ fieldnames [ 'numsections' ] ) ) { $ fieldnames [ 'numsections' ] = 'numsections' ; } $ startdate = $ this -> get_form_start_d... | Returns the default end date for weeks course format . |
27,646 | public static function update_end_date ( $ courseid ) { global $ DB , $ COURSE ; $ insql = "SELECT c.id, c.format, c.startdate, c.enddate, MAX(s.section) AS lastsection FROM {course} c JOIN {course_sections} s ON s.course = c.id WHERE c.format... | Updates the end date for a course in weeks format if option automaticenddate is set . |
27,647 | public static function get_folders_by_courses ( $ courseids = array ( ) ) { $ warnings = array ( ) ; $ returnedfolders = array ( ) ; $ params = array ( 'courseids' => $ courseids , ) ; $ params = self :: validate_parameters ( self :: get_folders_by_courses_parameters ( ) , $ params ) ; $ mycourses = array ( ) ; if ( em... | Returns a list of folders in a provided list of courses . If no list is provided all folders that the user can view will be returned . |
27,648 | public static function get_folders_by_courses_returns ( ) { return new external_single_structure ( array ( 'folders' => new external_multiple_structure ( new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'Module id' ) , 'coursemodule' => new external_value ( PARAM_INT , 'Course module id'... | Describes the get_folders_by_courses return value . |
27,649 | protected function prepare_policy ( $ policyid , $ versionid ) { if ( $ versionid ) { $ this -> policy = api :: get_policy_version ( $ versionid ) ; } else { $ this -> policy = array_reduce ( api :: list_current_versions ( ) , function ( $ carry , $ current ) use ( $ policyid ) { if ( $ current -> policyid == $ policyi... | Loads the policy version to display on the page . |
27,650 | public static function get_mod_name ( $ type ) { static $ types ; if ( ! is_array ( $ types ) ) { global $ DB ; $ types = $ DB -> get_records ( 'modules' ) ; } return $ types [ $ type ] -> name ; } | Get module instance module type |
27,651 | public function cron ( ) { global $ DB ; $ sql = ' SELECT DISTINCT c.id AS course, cr.id AS criteriaid, ra.userid AS userid, mc.timemodified AS timecompleted FROM {course_completion_criteria} cr INNER JOIN ... | Find users who have completed this criteria and mark them accordingly |
27,652 | public function setValue ( $ value ) { global $ DB ; $ values = ( array ) $ value ; $ ids = array ( ) ; foreach ( $ values as $ onevalue ) { if ( ! empty ( $ onevalue ) && ( ! $ this -> optionExists ( $ onevalue ) ) && ( $ onevalue !== '_qf__force_multiselect_submission' ) ) { array_push ( $ ids , $ onevalue ) ; } } if... | Set the value of this element . |
27,653 | public static function create_relation ( $ userid , $ competencyid , $ courseid ) { $ data = new \ stdClass ( ) ; $ data -> userid = $ userid ; $ data -> competencyid = $ competencyid ; $ data -> courseid = $ courseid ; $ relation = new user_competency_course ( 0 , $ data ) ; return $ relation ; } | Create a new user_competency_course object . |
27,654 | protected function validate_proficiency ( $ value ) { $ grade = $ this -> get ( 'grade' ) ; if ( $ grade !== null && $ value === null ) { return new lang_string ( 'invaliddata' , 'error' ) ; } else if ( $ grade === null && $ value !== null ) { return new lang_string ( 'invaliddata' , 'error' ) ; } return true ; } | Validate the proficiency . |
27,655 | public static function count_proficient_competencies ( $ courseid , $ userid ) { global $ DB ; $ sql = 'SELECT COUNT(comp.id) FROM {' . self :: TABLE . '} usercoursecomp JOIN {' . course_competency :: TABLE . '} cc ON usercoursecomp.competencyid = cc.competencyid AND... | Count the proficient competencies in this course for one user . |
27,656 | public static function get_least_proficient_competencies_for_course ( $ courseid , $ skip = 0 , $ limit = 0 ) { global $ DB ; $ fields = competency :: get_sql_fields ( 'c' , 'c_' ) ; $ params = array ( 'courseid' => $ courseid ) ; $ sql = 'SELECT ' . $ fields . ' FROM (SELECT cc.competencyid, SUM(COALE... | Get the list of competencies that were completed the least times in a course . |
27,657 | public function get_instance_name ( ) { if ( $ this -> plugin === 'core' ) { $ string = get_string ( 'allevents' , 'tool_monitor' ) ; } else { if ( $ this -> cmid == 0 ) { $ string = get_string ( 'allmodules' , 'tool_monitor' ) ; } else { $ cms = get_fast_modinfo ( $ this -> courseid ) ; $ cms = $ cms -> get_cms ( ) ; ... | Get a human readable name for instances associated with this subscription . |
27,658 | public function get_filters_description ( ) { $ a = new \ stdClass ( ) ; $ a -> freq = $ this -> frequency ; $ mins = $ this -> timewindow / MINSECS ; $ a -> mins = $ mins ; return get_string ( 'freqdesc' , 'tool_monitor' , $ a ) ; } | Get filter description . |
27,659 | public function get_plugin_name ( ) { if ( $ this -> plugin === 'core' ) { $ string = get_string ( 'core' , 'tool_monitor' ) ; } else if ( get_string_manager ( ) -> string_exists ( 'pluginname' , $ this -> plugin ) ) { $ string = get_string ( 'pluginname' , $ this -> plugin ) ; } else { $ string = $ this -> plugin ; } ... | Get name of the plugin associated with this rule |
27,660 | public function get_course_name ( \ context $ context ) { $ courseid = $ this -> courseid ; if ( empty ( $ courseid ) ) { return get_string ( 'site' ) ; } else { try { $ course = get_course ( $ courseid ) ; return format_string ( $ course -> fullname , true , array ( 'context' => $ context ) ) ; } catch ( \ dml_excepti... | Get properly formatted name of the course associated . |
27,661 | public function can_manage_rule ( ) { $ courseid = $ this -> rulecourseid ; $ context = empty ( $ courseid ) ? \ context_system :: instance ( ) : \ context_course :: instance ( $ courseid ) ; return has_capability ( 'tool/monitor:managerules' , $ context ) ; } | Can the current user manage the rule associate with this subscription? |
27,662 | public function add_from_sql ( string $ fieldname , string $ sql , array $ params ) : userlist { global $ DB ; $ wrapper = " SELECT DISTINCT u.id FROM {user} u JOIN ({$sql}) target ON u.id = target.{$fieldname}" ; $ users = $ DB -> get_records_sql ( $ wrapper , $ params ) ; $ this -> ad... | Add a set of users from SQL . |
27,663 | public function add_users ( array $ userids ) : userlist { global $ DB ; if ( ! empty ( $ userids ) ) { list ( $ useridsql , $ useridparams ) = $ DB -> get_in_or_equal ( $ userids , SQL_PARAMS_NAMED ) ; $ sql = "SELECT DISTINCT u.id FROM {user} u WHERE u.id {$useridsql}" ; $ thi... | Adds the user users for given users . |
27,664 | public function expected_time ( ) { $ filetime = portfolio_expected_time_file ( $ this -> multifiles ) ; $ dbtime = portfolio_expected_time_db ( count ( $ this -> exportdata [ 'entries' ] ) ) ; return ( $ filetime > $ dbtime ) ? $ filetime : $ dbtime ; } | how long might we expect this export to take |
27,665 | public function check_permissions ( ) { $ context = context_module :: instance ( $ this -> cm -> id ) ; return has_capability ( 'mod/glossary:exportentry' , $ context ) || ( $ this -> entry -> userid == $ this -> user -> id && has_capability ( 'mod/glossary:exportownentry' , $ context ) ) ; } | make sure that the current user is allowed to do this |
27,666 | public static function entry_content ( $ course , $ cm , $ glossary , $ entry , $ aliases , $ format ) { global $ OUTPUT , $ DB ; $ entry = clone $ entry ; $ context = context_module :: instance ( $ cm -> id ) ; $ options = portfolio_format_text_options ( ) ; $ options -> trusted = $ entry -> definitiontrust ; $ option... | helper function to get the html content of an entry for both this class and the full glossary exporter this is a very simplified version of the dictionary format output but with its 500 levels of indirection removed and file rewriting handled by the portfolio export format . |
27,667 | public function params ( array $ params = null ) { $ params = ( array ) $ params ; foreach ( $ params as $ key => $ value ) { if ( is_int ( $ key ) ) { throw new coding_exception ( 'Url parameters can not have numeric keys!' ) ; } if ( ! is_string ( $ value ) ) { if ( is_array ( $ value ) ) { throw new coding_exception... | Add an array of params to the params for this url . |
27,668 | public function remove_params ( $ params = null ) { if ( ! is_array ( $ params ) ) { $ params = func_get_args ( ) ; } foreach ( $ params as $ param ) { unset ( $ this -> params [ $ param ] ) ; } return $ this -> params ; } | Remove all params if no arguments passed . Remove selected params if arguments are passed . |
27,669 | public function param ( $ paramname , $ newvalue = '' ) { if ( func_num_args ( ) > 1 ) { $ this -> params ( array ( $ paramname => $ newvalue ) ) ; } if ( isset ( $ this -> params [ $ paramname ] ) ) { return $ this -> params [ $ paramname ] ; } else { return null ; } } | Add a param to the params for this url . |
27,670 | protected function merge_overrideparams ( array $ overrideparams = null ) { $ overrideparams = ( array ) $ overrideparams ; $ params = $ this -> params ; foreach ( $ overrideparams as $ key => $ value ) { if ( is_int ( $ key ) ) { throw new coding_exception ( 'Overridden parameters can not have numeric keys!' ) ; } if ... | Merges parameters and validates them |
27,671 | public function get_query_string ( $ escaped = true , array $ overrideparams = null ) { $ arr = array ( ) ; if ( $ overrideparams !== null ) { $ params = $ this -> merge_overrideparams ( $ overrideparams ) ; } else { $ params = $ this -> params ; } foreach ( $ params as $ key => $ val ) { if ( is_array ( $ val ) ) { fo... | Get the params as as a query string . |
27,672 | public function out ( $ escaped = true , array $ overrideparams = null ) { global $ CFG ; if ( ! is_bool ( $ escaped ) ) { debugging ( 'Escape parameter must be of type boolean, ' . gettype ( $ escaped ) . ' given instead.' ) ; } $ url = $ this ; if ( isset ( $ CFG -> urlrewriteclass ) && ! isset ( $ CFG -> upgraderunn... | Output url . |
27,673 | public function raw_out ( $ escaped = true , array $ overrideparams = null ) { if ( ! is_bool ( $ escaped ) ) { debugging ( 'Escape parameter must be of type boolean, ' . gettype ( $ escaped ) . ' given instead.' ) ; } $ uri = $ this -> out_omit_querystring ( ) . $ this -> slashargument ; $ querystring = $ this -> get_... | Output url without any rewrites |
27,674 | public function out_omit_querystring ( $ includeanchor = false ) { $ uri = $ this -> scheme ? $ this -> scheme . ':' . ( ( strtolower ( $ this -> scheme ) == 'mailto' ) ? '' : '//' ) : '' ; $ uri .= $ this -> user ? $ this -> user . ( $ this -> pass ? ':' . $ this -> pass : '' ) . '@' : '' ; $ uri .= $ this -> host ? $... | Returns url without parameters everything before ? . |
27,675 | public function compare ( moodle_url $ url , $ matchtype = URL_MATCH_EXACT ) { $ baseself = $ this -> out_omit_querystring ( ) ; $ baseother = $ url -> out_omit_querystring ( ) ; if ( substr ( $ baseself , - 1 ) == '/' ) { $ baseself .= 'index.php' ; } if ( substr ( $ baseother , - 1 ) == '/' ) { $ baseother .= 'index.... | Compares this moodle_url with another . |
27,676 | public function set_slashargument ( $ path , $ parameter = 'file' , $ supported = null ) { global $ CFG ; if ( is_null ( $ supported ) ) { $ supported = ! empty ( $ CFG -> slasharguments ) ; } if ( $ supported ) { $ parts = explode ( '/' , $ path ) ; $ parts = array_map ( 'rawurlencode' , $ parts ) ; $ path = implode (... | Sets the url slashargument value . |
27,677 | public static function make_file_url ( $ urlbase , $ path , $ forcedownload = false ) { $ params = array ( ) ; if ( $ forcedownload ) { $ params [ 'forcedownload' ] = 1 ; } $ url = new moodle_url ( $ urlbase , $ params ) ; $ url -> set_slashargument ( $ path ) ; return $ url ; } | General moodle file url . |
27,678 | public static function make_pluginfile_url ( $ contextid , $ component , $ area , $ itemid , $ pathname , $ filename , $ forcedownload = false , $ includetoken = false ) { global $ CFG , $ USER ; $ path = [ ] ; if ( $ includetoken ) { $ urlbase = "$CFG->wwwroot/tokenpluginfile.php" ; $ userid = $ includetoken === true ... | Factory method for creation of url pointing to plugin file . |
27,679 | public static function make_webservice_pluginfile_url ( $ contextid , $ component , $ area , $ itemid , $ pathname , $ filename , $ forcedownload = false ) { global $ CFG ; $ urlbase = "$CFG->wwwroot/webservice/pluginfile.php" ; if ( $ itemid === null ) { return self :: make_file_url ( $ urlbase , "/$contextid/$compone... | Factory method for creation of url pointing to plugin file . This method is the same that make_pluginfile_url but pointing to the webservice pluginfile . php script . It should be used only in external functions . |
27,680 | public static function make_draftfile_url ( $ draftid , $ pathname , $ filename , $ forcedownload = false ) { global $ CFG , $ USER ; $ urlbase = "$CFG->wwwroot/draftfile.php" ; $ context = context_user :: instance ( $ USER -> id ) ; return self :: make_file_url ( $ urlbase , "/$context->id/user/draft/$draftid" . $ pat... | Factory method for creation of url pointing to draft file of current user . |
27,681 | public static function make_legacyfile_url ( $ courseid , $ filepath , $ forcedownload = false ) { global $ CFG ; $ urlbase = "$CFG->wwwroot/file.php" ; return self :: make_file_url ( $ urlbase , '/' . $ courseid . '/' . $ filepath , $ forcedownload ) ; } | Factory method for creating of links to legacy course files . |
27,682 | public function get_param ( $ name ) { if ( array_key_exists ( $ name , $ this -> params ) ) { return $ this -> params [ $ name ] ; } else { return null ; } } | Returns a given parameter value from the URL . |
27,683 | public function output ( $ message , $ depth = 0 ) { $ samedepth = true ; while ( $ this -> currentdepth > $ depth ) { echo "</li>\n</ul>\n" ; $ this -> currentdepth -= 1 ; if ( $ this -> currentdepth == $ depth ) { echo '<li>' ; } $ samedepth = false ; } while ( $ this -> currentdepth < $ depth ) { echo "<ul>\n<li>" ;... | Echo out the list |
27,684 | public function output ( $ message , $ depth = 0 ) { ob_start ( ) ; $ this -> trace -> output ( $ message , $ depth ) ; $ this -> buffer .= ob_get_contents ( ) ; if ( $ this -> passthrough ) { ob_end_flush ( ) ; } else { ob_end_clean ( ) ; } } | Output the trace message . |
27,685 | public function finished ( ) { ob_start ( ) ; $ this -> trace -> finished ( ) ; $ this -> buffer .= ob_get_contents ( ) ; if ( $ this -> passthrough ) { ob_end_flush ( ) ; } else { ob_end_clean ( ) ; } } | Called when the processing is finished . |
27,686 | public function output ( $ message , $ depth = 0 ) { foreach ( $ this -> traces as $ trace ) { $ trace -> output ( $ message , $ depth ) ; } } | Output an progress message in whatever format . |
27,687 | public function set_input_encoding ( $ encoding = false ) { if ( $ encoding ) { $ this -> input_encoding = ( string ) $ encoding ; } else { $ this -> input_encoding = false ; } } | Set the character encoding used to parse the feed |
27,688 | public function set_image_handler ( $ page = false , $ qs = 'i' ) { if ( $ page !== false ) { $ this -> sanitize -> set_image_handler ( $ page . '?' . $ qs . '=' ) ; } else { $ this -> image_handler = '' ; } } | Set the handler to enable the display of cached images . |
27,689 | public function handle_content_type ( $ mime = 'text/html' ) { if ( ! headers_sent ( ) ) { $ header = "Content-type: $mime;" ; if ( $ this -> get_encoding ( ) ) { $ header .= ' charset=' . $ this -> get_encoding ( ) ; } else { $ header .= ' charset=UTF-8' ; } header ( $ header ) ; } } | Send the content - type header with correct encoding |
27,690 | public function get_feed_tags ( $ namespace , $ tag ) { $ type = $ this -> get_type ( ) ; if ( $ type & SIMPLEPIE_TYPE_ATOM_10 ) { if ( isset ( $ this -> data [ 'child' ] [ SIMPLEPIE_NAMESPACE_ATOM_10 ] [ 'feed' ] [ 0 ] [ 'child' ] [ $ namespace ] [ $ tag ] ) ) { return $ this -> data [ 'child' ] [ SIMPLEPIE_NAMESPACE_... | Get data for an feed - level element |
27,691 | public function get_base ( $ element = array ( ) ) { if ( ! ( $ this -> get_type ( ) & SIMPLEPIE_TYPE_RSS_SYNDICATION ) && ! empty ( $ element [ 'xml_base_explicit' ] ) && isset ( $ element [ 'xml_base' ] ) ) { return $ element [ 'xml_base' ] ; } elseif ( $ this -> get_link ( ) !== null ) { return $ this -> get_link ( ... | Get the base URL value from the feed |
27,692 | public function sanitize ( $ data , $ type , $ base = '' ) { try { return $ this -> sanitize -> sanitize ( $ data , $ type , $ base ) ; } catch ( SimplePie_Exception $ e ) { if ( ! $ this -> enable_exceptions ) { $ this -> error = $ e -> getMessage ( ) ; $ this -> registry -> call ( 'Misc' , 'error' , array ( $ this ->... | Sanitize feed data |
27,693 | public function get_category ( $ key = 0 ) { $ categories = $ this -> get_categories ( ) ; if ( isset ( $ categories [ $ key ] ) ) { return $ categories [ $ key ] ; } else { return null ; } } | Get a category for the feed |
27,694 | public function get_author ( $ key = 0 ) { $ authors = $ this -> get_authors ( ) ; if ( isset ( $ authors [ $ key ] ) ) { return $ authors [ $ key ] ; } else { return null ; } } | Get an author for the feed |
27,695 | public function get_contributor ( $ key = 0 ) { $ contributors = $ this -> get_contributors ( ) ; if ( isset ( $ contributors [ $ key ] ) ) { return $ contributors [ $ key ] ; } else { return null ; } } | Get a contributor for the feed |
27,696 | public function get_image_url ( ) { if ( $ return = $ this -> get_channel_tags ( SIMPLEPIE_NAMESPACE_ITUNES , 'image' ) ) { return $ this -> sanitize ( $ return [ 0 ] [ 'attribs' ] [ '' ] [ 'href' ] , SIMPLEPIE_CONSTRUCT_IRI ) ; } elseif ( $ return = $ this -> get_channel_tags ( SIMPLEPIE_NAMESPACE_ATOM_10 , 'logo' ) )... | Get the feed logo s URL |
27,697 | public function set_favicon_handler ( $ page = false , $ qs = 'i' ) { $ level = defined ( 'E_USER_DEPRECATED' ) ? E_USER_DEPRECATED : E_USER_WARNING ; trigger_error ( 'Favicon handling has been removed, please use your own handling' , $ level ) ; return false ; } | Set the favicon handler |
27,698 | public function get_favicon ( ) { $ level = defined ( 'E_USER_DEPRECATED' ) ? E_USER_DEPRECATED : E_USER_WARNING ; trigger_error ( 'Favicon handling has been removed, please use your own handling' , $ level ) ; if ( ( $ url = $ this -> get_link ( ) ) !== null ) { return 'http://g.etfv.co/' . urlencode ( $ url ) ; } ret... | Get the favicon for the current feed |
27,699 | public static function sort_items ( $ a , $ b ) { $ a_date = $ a -> get_date ( 'U' ) ; $ b_date = $ b -> get_date ( 'U' ) ; if ( $ a_date && $ b_date ) { return $ a_date > $ b_date ? - 1 : 1 ; } if ( $ a_date ) { return 1 ; } if ( $ b_date ) { return - 1 ; } return 0 ; } | Sorting callback for items |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.