idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
28,700 | public static function normalize_component ( $ component ) { if ( $ component === 'moodle' or $ component === 'core' or $ component === '' ) { return array ( 'core' , null ) ; } if ( strpos ( $ component , '_' ) === false ) { self :: init ( ) ; if ( array_key_exists ( $ component , self :: $ subsystems ) ) { $ type = '... | Normalize the component name using the frankenstyle rules . |
28,701 | public static function get_component_directory ( $ component ) { global $ CFG ; list ( $ type , $ plugin ) = self :: normalize_component ( $ component ) ; if ( $ type === 'core' ) { if ( $ plugin === null ) { return $ path = $ CFG -> libdir ; } return self :: get_subsystem_directory ( $ plugin ) ; } return self :: get_... | Return exact absolute path to a plugin directory . |
28,702 | public static function get_plugin_types_with_subplugins ( ) { self :: init ( ) ; $ return = array ( ) ; foreach ( self :: $ supportsubplugins as $ type ) { $ return [ $ type ] = self :: $ plugintypes [ $ type ] ; } return $ return ; } | Returns list of plugin types that allow subplugins . |
28,703 | public static function get_subtype_parent ( $ type ) { self :: init ( ) ; if ( isset ( self :: $ parents [ $ type ] ) ) { return self :: $ parents [ $ type ] ; } return null ; } | Returns parent of this subplugin type . |
28,704 | public static function get_subplugins ( $ component ) { self :: init ( ) ; if ( isset ( self :: $ subplugins [ $ component ] ) ) { return self :: $ subplugins [ $ component ] ; } return null ; } | Return all subplugins of this component . |
28,705 | public static function get_all_versions ( ) : array { global $ CFG ; self :: init ( ) ; $ versions = array ( ) ; $ versions [ 'core' ] = self :: fetch_core_version ( ) ; $ usecache = false ; if ( CACHE_DISABLE_ALL or ( defined ( 'IGNORE_COMPONENT_CACHE' ) and IGNORE_COMPONENT_CACHE ) ) { $ usecache = true ; } $ plugint... | Returns hash of all versions including core and all plugins . |
28,706 | protected static function fill_classmap_renames_cache ( ) { global $ CFG ; self :: $ classmaprenames = array ( ) ; self :: load_renamed_classes ( "$CFG->dirroot/lib/" ) ; foreach ( self :: $ subsystems as $ subsystem => $ fulldir ) { self :: load_renamed_classes ( $ fulldir ) ; } foreach ( self :: $ plugins as $ plugin... | Records all class renames that have been made to facilitate autoloading . |
28,707 | public static function get_component_names ( ) : array { $ componentnames = [ ] ; foreach ( self :: get_plugin_types ( ) as $ plugintype => $ typedir ) { foreach ( self :: get_plugin_list ( $ plugintype ) as $ pluginname => $ plugindir ) { $ componentnames [ ] = $ plugintype . '_' . $ pluginname ; } } foreach ( self ::... | Returns a list of frankenstyle component names . |
28,708 | protected function get_options ( ) { global $ CFG ; $ options = parent :: get_options ( ) ; $ options [ 'file' ] = $ CFG -> admin . '/webservice/lib.php' ; $ options [ 'serviceid' ] = $ this -> serviceid ; $ options [ 'displayallowedusers' ] = $ this -> displayallowedusers ; return $ options ; } | This options are automatically used by the AJAX search |
28,709 | public function add_result ( $ result ) { if ( ! is_null ( $ this -> plan ) ) { $ this -> plan -> add_result ( $ result ) ; } else { debugging ( 'Attempting to add a result of a task not binded with a plan' , DEBUG_DEVELOPER ) ; } } | Add the given info to the current plan s results . |
28,710 | public function get_results ( ) { if ( ! is_null ( $ this -> plan ) ) { return $ this -> plan -> get_results ( ) ; } else { debugging ( 'Attempting to get results of a task not binded with a plan' , DEBUG_DEVELOPER ) ; return null ; } } | Return the current plan s results |
28,711 | public static function create_from_course ( \ stdClass $ course ) { $ params = array ( 'context' => \ context_course :: instance ( $ course -> id ) ) ; $ event = \ mod_assign \ event \ course_module_instance_list_viewed :: create ( $ params ) ; $ event -> add_record_snapshot ( 'course' , $ course ) ; return $ event ; } | Create the event from course record . |
28,712 | public function load_user_defaults ( ) { $ defaults = get_config ( 'question_preview' ) ; foreach ( $ this -> get_user_pref_fields ( ) as $ field ) { $ this -> $ field = get_user_preferences ( self :: OPTIONPREFIX . $ field , $ defaults -> $ field ) ; } $ this -> numpartscorrect = $ this -> feedback ; } | Load the value of the options from the user_preferences table . |
28,713 | public function save_user_preview_options ( $ newoptions ) { foreach ( $ this -> get_user_pref_fields ( ) as $ field ) { if ( isset ( $ newoptions -> $ field ) ) { set_user_preference ( self :: OPTIONPREFIX . $ field , $ newoptions -> $ field ) ; } } } | Save a change to the user s preview options to the database . |
28,714 | public function set_from_request ( ) { foreach ( $ this -> get_field_types ( ) as $ field => $ type ) { $ this -> $ field = optional_param ( $ field , $ this -> $ field , $ type ) ; } $ this -> numpartscorrect = $ this -> feedback ; } | Set the value of any fields included in the request . |
28,715 | protected function _escapeParams ( $ params ) { foreach ( $ params as $ k => $ v ) { foreach ( str_split ( $ v ) as $ c ) { if ( ! Horde_Mime_ContentParam_Decode :: isAtextNonTspecial ( $ c ) ) { $ params [ $ k ] = '"' . addcslashes ( $ v , '\\"' ) . '"' ; break ; } } } return $ params ; } | Escape the parameter array . |
28,716 | public function setContentParamValue ( $ data ) { $ data = $ this -> _sanityCheck ( trim ( $ data ) ) ; if ( ( $ pos = strpos ( $ data , ';' ) ) !== false ) { $ data = substr ( $ data , 0 , $ pos ) ; } $ this -> _values = array ( $ data ) ; } | Set the content - parameter base value . |
28,717 | public function definition ( ) { $ mform = $ this -> _form ; list ( $ assignment , $ data , $ params ) = $ this -> _customdata ; $ this -> assignment = $ assignment ; $ assignment -> add_grade_form_elements ( $ mform , $ data , $ params ) ; if ( $ data ) { $ this -> set_data ( $ data ) ; } } | Define the form - called by parent constructor . |
28,718 | public function validation ( $ data , $ files ) { global $ DB ; $ errors = parent :: validation ( $ data , $ files ) ; $ instance = $ this -> assignment -> get_instance ( ) ; if ( ! array_key_exists ( 'grade' , $ data ) ) { return $ errors ; } if ( $ instance -> grade > 0 ) { if ( unformat_float ( $ data [ 'grade' ] , ... | Perform minimal validation on the grade form |
28,719 | public function delete ( $ source = null ) { global $ DB ; if ( ! empty ( $ this -> courseid ) ) { $ DB -> delete_records ( 'grade_outcomes_courses' , array ( 'outcomeid' => $ this -> id , 'courseid' => $ this -> courseid ) ) ; } if ( parent :: delete ( $ source ) ) { $ context = context_system :: instance ( ) ; $ fs =... | Deletes this outcome from the database . |
28,720 | public function use_in ( $ courseid ) { global $ DB ; if ( ! empty ( $ this -> courseid ) and $ courseid != $ this -> courseid ) { return false ; } if ( ! $ DB -> record_exists ( 'grade_outcomes_courses' , array ( 'courseid' => $ courseid , 'outcomeid' => $ this -> id ) ) ) { $ goc = new stdClass ( ) ; $ goc -> coursei... | Mark outcome as used in a course |
28,721 | public function load_scale ( ) { if ( empty ( $ this -> scale -> id ) or $ this -> scale -> id != $ this -> scaleid ) { $ this -> scale = grade_scale :: fetch ( array ( 'id' => $ this -> scaleid ) ) ; $ this -> scale -> load_items ( ) ; } return $ this -> scale ; } | Instantiates a grade_scale object whose data is retrieved from the database |
28,722 | public static function fetch_all_available ( $ courseid ) { global $ CFG , $ DB ; $ result = array ( ) ; $ params = array ( $ courseid ) ; $ sql = "SELECT go.* FROM {grade_outcomes} go, {grade_outcomes_courses} goc WHERE go.id = goc.outcomeid AND goc.courseid = ? ORDER BY g... | Static method that returns all outcomes available in course |
28,723 | public function can_delete ( ) { if ( $ this -> get_item_uses_count ( ) ) { return false ; } if ( empty ( $ this -> courseid ) ) { if ( $ this -> get_course_uses_count ( ) ) { return false ; } } return true ; } | Checks if outcome can be deleted . |
28,724 | public function decode ( $ data ) { $ out = array ( ) ; $ this -> _data = $ data ; $ this -> _datalen = strlen ( $ data ) ; $ this -> _ptr = 0 ; while ( $ this -> _curr ( ) !== false ) { $ this -> _rfc822SkipLwsp ( ) ; $ this -> _rfc822ParseMimeToken ( $ param ) ; if ( is_null ( $ param ) || ( $ this -> _curr ( ) != '=... | Decode content parameter data . |
28,725 | final public function process_change ( $ changetype , $ oldvalue ) { switch ( $ changetype ) { case base_setting :: CHANGED_STATUS : return $ this -> process_status_change ( $ oldvalue ) ; case base_setting :: CHANGED_VISIBILITY : return $ this -> process_visibility_change ( $ oldvalue ) ; case base_setting :: CHANGED_... | Processes a change is setting called by the primary setting |
28,726 | protected function process_visibility_change ( $ oldvisibility ) { $ prevalue = $ this -> dependentsetting -> get_visibility ( ) ; $ this -> dependentsetting -> set_visibility ( $ this -> setting -> get_visibility ( ) ) ; return ( $ prevalue != $ this -> dependentsetting -> get_visibility ( ) ) ; } | Processes a visibility change |
28,727 | public function is_locked ( ) { if ( $ this -> setting -> get_status ( ) !== base_setting :: NOT_LOCKED || $ this -> evaluate_disabled_condition ( $ this -> setting -> get_value ( ) ) ) { return true ; } return false ; } | Returns true if the dependent setting is locked by this setting_dependency . |
28,728 | protected function process_value_change ( $ oldvalue ) { if ( $ this -> dependentsetting -> get_status ( ) == base_setting :: LOCKED_BY_PERMISSION || $ this -> dependentsetting -> get_status ( ) == base_setting :: LOCKED_BY_CONFIG ) { return false ; } $ prevalue = $ this -> dependentsetting -> get_value ( ) ; $ setting... | Processes a value change in the primary setting |
28,729 | protected function process_status_change ( $ oldstatus ) { $ prevalue = $ this -> dependentsetting -> get_status ( ) ; $ currentstatus = $ this -> setting -> get_status ( ) ; if ( $ currentstatus == base_setting :: NOT_LOCKED ) { if ( $ prevalue == base_setting :: LOCKED_BY_HIERARCHY && ! $ this -> evaluate_disabled_co... | Processes a status change in the primary setting |
28,730 | public function enforce ( ) { $ changes = false ; if ( $ this -> process_value_change ( $ this -> setting -> get_value ( ) ) ) { $ changes = true ; } if ( $ this -> process_status_change ( $ this -> setting -> get_status ( ) ) ) { $ changes = true ; } if ( $ this -> process_visibility_change ( $ this -> setting -> get_... | Enforces the dependency if required . |
28,731 | public function after_restore ( ) { global $ DB ; $ blockid = $ this -> get_blockid ( ) ; if ( $ configdata = $ DB -> get_field ( 'block_instances' , 'configdata' , array ( 'id' => $ blockid ) ) ) { $ config = unserialize ( base64_decode ( $ configdata ) ) ; if ( ! empty ( $ config -> glossary ) ) { if ( $ glossarymap ... | This function executed after all the tasks in the plan have been executed will perform the recode of the target glossary for the block . This must be done here and not in normal execution steps because the glossary may be restored after the block . |
28,732 | public static function create_cohort_role_assignment ( stdClass $ record ) { $ cohortroleassignment = new cohort_role_assignment ( 0 , $ record ) ; $ context = context_system :: instance ( ) ; require_capability ( 'moodle/role:manage' , $ context ) ; if ( ! $ cohortroleassignment -> is_valid ( ) ) { throw new invalid_p... | Create a cohort role assignment from a record containing all the data for the class . |
28,733 | public static function delete_cohort_role_assignment ( $ id ) { $ cohortroleassignment = new cohort_role_assignment ( $ id ) ; $ context = context_system :: instance ( ) ; require_capability ( 'moodle/role:manage' , $ context ) ; return $ cohortroleassignment -> delete ( ) ; } | Delete a cohort role assignment by id . |
28,734 | private function createCommand ( ) { $ cmd = [ 'create' => $ this -> collectionName ] ; foreach ( [ 'autoIndexId' , 'capped' , 'flags' , 'max' , 'maxTimeMS' , 'size' , 'validationAction' , 'validationLevel' ] as $ option ) { if ( isset ( $ this -> options [ $ option ] ) ) { $ cmd [ $ option ] = $ this -> options [ $ op... | Create the create command . |
28,735 | protected function process_attachment ( $ acceptedtypes , \ context_user $ context , $ itemid , \ stdClass $ attachment ) { global $ USER , $ CFG ; $ record = new \ stdClass ( ) ; $ record -> filearea = 'draft' ; $ record -> component = 'user' ; $ record -> itemid = $ itemid ; $ record -> license = $ CFG -> sitedefault... | Process attachments included in a message . |
28,736 | public function get_success_message ( \ stdClass $ messagedata , $ handlerresult ) { $ a = new \ stdClass ( ) ; $ a -> subject = $ handlerresult -> subject ; $ discussionurl = new \ moodle_url ( '/mod/forum/discuss.php' , array ( 'd' => $ handlerresult -> discussion ) ) ; $ discussionurl -> set_anchor ( 'p' . $ handler... | Return the content of any success notification to be sent . Both an HTML and Plain Text variant must be provided . |
28,737 | protected function onError ( ) { global $ OUTPUT ; $ message = $ this -> message ; if ( $ this -> debugMode && ! empty ( $ this -> reason ) ) { $ message = $ this -> reason ; } if ( empty ( $ this -> returnUrl ) ) { $ this -> errorOutput = $ OUTPUT -> notification ( get_string ( 'failedrequest' , 'enrol_lti' , [ 'reaso... | Override onError for custom error handling . |
28,738 | protected function onRegister ( ) { global $ PAGE ; if ( empty ( $ this -> consumer ) ) { $ this -> ok = false ; $ this -> message = get_string ( 'invalidtoolconsumer' , 'enrol_lti' ) ; return ; } if ( empty ( $ this -> returnUrl ) ) { $ this -> ok = false ; $ this -> message = get_string ( 'returnurlnotset' , 'enrol_l... | Override onRegister with registration code . |
28,739 | public function map_tool_to_consumer ( ) { global $ DB ; if ( empty ( $ this -> consumer ) ) { throw new moodle_exception ( 'invalidtoolconsumer' , 'enrol_lti' ) ; } $ mappingparams = [ 'toolid' => $ this -> tool -> id , 'consumerid' => $ this -> consumer -> getRecordId ( ) ] ; $ mappingexists = $ DB -> record_exists (... | Performs mapping of the tool consumer to a published tool . |
28,740 | function get_comments ( $ page ) { global $ DB ; if ( $ page == 0 ) { $ start = 0 ; } else { $ start = $ page * $ this -> perpage ; } $ comments = array ( ) ; $ usernamefields = get_all_user_name_fields ( true , 'u' ) ; $ sql = "SELECT c.id, c.contextid, c.itemid, c.component, c.commentarea, c.userid, c.content, $usern... | Return comments by pages |
28,741 | private function setup_course ( $ courseid ) { global $ PAGE , $ DB ; if ( ! empty ( $ this -> course ) && $ this -> course -> id == $ courseid ) { return ; } if ( $ courseid == $ PAGE -> course -> id ) { $ this -> course = $ PAGE -> course ; } else if ( ! $ this -> course = $ DB -> get_record ( 'course' , array ( 'id'... | Records the course object |
28,742 | private function setup_plugin ( $ comment ) { global $ DB ; $ this -> context = context :: instance_by_id ( $ comment -> contextid , IGNORE_MISSING ) ; if ( ! $ this -> context ) { return false ; } switch ( $ this -> context -> contextlevel ) { case CONTEXT_BLOCK : if ( $ block = $ DB -> get_record ( 'block_instances' ... | Sets up the module or block information for a comment |
28,743 | public function get_component_comments_since ( $ course , $ context , $ component , $ since , $ cm = null ) { global $ DB ; $ commentssince = array ( ) ; $ where = 'contextid = ? AND component = ? AND timecreated > ?' ; $ comments = $ DB -> get_records_select ( 'comments' , $ where , array ( $ context -> id , $ compone... | Get comments created since a given time . |
28,744 | private function do_request ( $ curl , $ request ) { $ url = $ request -> getUrl ( ) ; $ method = $ request -> getRequestMethod ( ) ; switch ( strtoupper ( $ method ) ) { case 'POST' : $ ret = $ curl -> post ( $ url , $ request -> getPostBody ( ) ) ; break ; case 'GET' : $ ret = $ curl -> get ( $ url ) ; break ; case '... | Send the request via our curl object . |
28,745 | public function executeRequest ( Google_Http_Request $ request ) { $ curl = new curl ( ) ; if ( $ request -> getPostBody ( ) ) { $ curl -> setopt ( array ( 'CURLOPT_POSTFIELDS' => $ request -> getPostBody ( ) ) ) ; } $ requestHeaders = $ request -> getRequestHeaders ( ) ; if ( $ requestHeaders && is_array ( $ requestHe... | Execute an API request . |
28,746 | public function get_option_name_from_constant ( $ constant ) { if ( is_null ( self :: $ constants ) ) { $ constants = get_defined_constants ( true ) ; $ constants = isset ( $ constants [ 'curl' ] ) ? $ constants [ 'curl' ] : array ( ) ; $ constants = array_flip ( $ constants ) ; self :: $ constants = $ constants ; } if... | Return the name of an option based on the constant value . |
28,747 | public function add ( $ data , $ merge = false ) { if ( is_array ( $ data ) || ( $ merge && ( $ data instanceof Traversable ) ) ) { foreach ( $ data as $ val ) { $ this -> add ( $ val ) ; } } elseif ( is_object ( $ data ) ) { $ this -> _data [ ] = $ data ; } elseif ( ! is_null ( $ data ) ) { $ this -> _data [ ] = new H... | Add an element to the list . |
28,748 | protected function get_iauthority ( ) { if ( $ this -> iuserinfo !== null || $ this -> ihost !== null || $ this -> port !== null ) { $ iauthority = '' ; if ( $ this -> iuserinfo !== null ) { $ iauthority .= $ this -> iuserinfo . '@' ; } if ( $ this -> ihost !== null ) { $ iauthority .= $ this -> ihost ; } if ( $ this -... | Get the complete iauthority |
28,749 | public static function get_template_directories_for_component ( $ component , $ themename = '' ) { global $ CFG , $ PAGE ; if ( $ themename == '' ) { $ themename = $ PAGE -> theme -> name ; } $ component = clean_param ( $ component , PARAM_COMPONENT ) ; $ themename = clean_param ( $ themename , PARAM_COMPONENT ) ; $ di... | Helper function for getting a list of valid template directories for a specific component . |
28,750 | public static function get_template_filepath ( $ name , $ themename = '' ) { global $ CFG , $ PAGE ; if ( strpos ( $ name , '/' ) === false ) { throw new coding_exception ( 'Templates names must be specified as "componentname/templatename"' . ' (' . s ( $ name ) . ' requested) ' ) ; } list ( $ component , $ templatenam... | Helper function for getting a filename for a template from the template name . |
28,751 | public function render ( renderable $ widget ) { $ namespacedclassname = get_class ( $ widget ) ; $ plainclassname = preg_replace ( '/^.*\\\/' , '' , $ namespacedclassname ) ; $ rendermethod = 'render_' . $ plainclassname ; if ( method_exists ( $ this , $ rendermethod ) ) { return parent :: render ( $ widget ) ; } $ in... | Overrides the parent so that templatable widgets are handled even without their explicit render method . |
28,752 | public static function make_tag ( $ file , $ path , $ attributes ) { $ srcattr = 'href' ; $ tag = 'a' ; $ content = $ file -> get_filename ( ) ; if ( in_array ( $ file -> get_mimetype ( ) , portfolio_format_image :: mimetypes ( ) ) ) { $ srcattr = 'src' ; $ tag = 'img' ; $ content = '' ; } $ attributes [ $ srcattr ] = ... | Create portfolio tag |
28,753 | public static function file_output ( $ file , $ options = null ) { $ id = '' ; if ( ! is_array ( $ options ) ) { $ options = array ( ) ; } if ( ! array_key_exists ( 'entry' , $ options ) ) { $ options [ 'entry' ] = true ; } if ( ! empty ( $ options [ 'entry' ] ) ) { $ path = 'portfolio:' . self :: file_id_prefix ( ) . ... | Return the link to a file |
28,754 | public function get_document_recordset ( $ modifiedfrom = 0 , \ context $ context = null ) { global $ DB ; list ( $ contextjoin , $ contextparams ) = $ this -> get_context_restriction_sql ( $ context , 'wiki' , 'w' ) ; if ( $ contextjoin === null ) { return null ; } $ sql = "SELECT p.*, w.id AS wikiid, w.course AS cour... | Returns a recordset with all required page information . |
28,755 | public function get_document ( $ record , $ options = array ( ) ) { try { $ cm = $ this -> get_cm ( 'wiki' , $ record -> wikiid , $ record -> courseid ) ; $ context = \ context_module :: instance ( $ cm -> id ) ; } catch ( \ dml_missing_record_exception $ ex ) { debugging ( 'Error retrieving ' . $ this -> areaid . ' ' ... | Returns the document for a particular page . |
28,756 | public function getBarcodeSVG ( $ w = 3 , $ h = 3 , $ color = 'black' ) { $ code = $ this -> getBarcodeSVGcode ( $ w , $ h , $ color ) ; header ( 'Content-Type: application/svg+xml' ) ; header ( 'Cache-Control: public, must-revalidate, max-age=0' ) ; header ( 'Pragma: public' ) ; header ( 'Expires: Sat, 26 Jul 1997 05:... | Send barcode as SVG image object to the standard output . |
28,757 | public function setReadorder ( $ pValue = 0 ) { if ( $ pValue < 0 || $ pValue > 2 ) { $ pValue = 0 ; } if ( $ this -> isSupervisor ) { $ styleArray = $ this -> getStyleArray ( array ( 'readorder' => $ pValue ) ) ; $ this -> getActiveSheet ( ) -> getStyle ( $ this -> getSelectedCells ( ) ) -> applyFromArray ( $ styleArr... | Set read order |
28,758 | protected static function times ( ) { return array ( self :: DURING => get_string ( 'reviewduring' , 'quiz' ) , self :: IMMEDIATELY_AFTER => get_string ( 'reviewimmediately' , 'quiz' ) , self :: LATER_WHILE_OPEN => get_string ( 'reviewopen' , 'quiz' ) , self :: AFTER_CLOSE => get_string ( 'reviewclosed' , 'quiz' ) , ) ... | Get an array of the names of all the possible times . |
28,759 | public function is_used ( ) { if ( \ tool_dataprivacy \ contextlevel :: is_category_used ( $ this -> get ( 'id' ) ) || \ tool_dataprivacy \ context_instance :: is_category_used ( $ this -> get ( 'id' ) ) ) { return true ; } $ pluginconfig = get_config ( 'tool_dataprivacy' ) ; $ levels = \ context_helper :: get_all_leve... | Is this category used? . |
28,760 | public function definition_after_data ( ) { $ mform = $ this -> _form ; $ cohortfile = $ mform -> getElementValue ( 'cohortfile' ) ; $ allowsubmitform = false ; if ( $ cohortfile && ( $ file = $ this -> get_cohort_file ( $ cohortfile ) ) ) { $ encoding = $ mform -> getElementValue ( 'encoding' ) [ 0 ] ; $ delimiter = $... | Process the uploaded file and allow the submit button only if it doest not have errors . |
28,761 | protected function get_context_options ( ) { if ( $ this -> contextoptions === null ) { $ this -> contextoptions = array ( ) ; $ displaylist = core_course_category :: make_categories_list ( 'moodle/cohort:manage' ) ; $ syscontext = context_system :: instance ( ) ; if ( has_capability ( 'moodle/cohort:manage' , $ syscon... | Returns the list of contexts where current user can create cohorts . |
28,762 | protected function get_cohort_file ( $ draftid ) { global $ USER ; if ( ! $ draftid ) { return null ; } $ fs = get_file_storage ( ) ; $ context = context_user :: instance ( $ USER -> id ) ; if ( ! $ files = $ fs -> get_area_files ( $ context -> id , 'user' , 'draft' , $ draftid , 'id DESC' , false ) ) { return null ; }... | Returns the uploaded file if it is present . |
28,763 | public function get_cohorts_data ( ) { $ cohorts = array ( ) ; if ( $ this -> processeddata ) { foreach ( $ this -> processeddata as $ idx => $ line ) { if ( $ idx && ! empty ( $ line [ 'data' ] ) ) { $ cohorts [ ] = ( object ) $ line [ 'data' ] ; } } } return $ cohorts ; } | Returns the list of prepared objects to be added as cohorts |
28,764 | protected function preview_uploaded_cohorts ( ) { global $ OUTPUT ; if ( empty ( $ this -> processeddata ) ) { return ; } foreach ( $ this -> processeddata [ 0 ] [ 'errors' ] as $ error ) { echo $ OUTPUT -> notification ( $ error ) ; } foreach ( $ this -> processeddata [ 0 ] [ 'warnings' ] as $ warning ) { echo $ OUTPU... | Displays the preview of the uploaded file |
28,765 | protected function get_previewed_rows ( ) { $ previewlimit = 10 ; if ( count ( $ this -> processeddata ) <= 1 ) { $ rows = array ( ) ; } else if ( count ( $ this -> processeddata ) < $ previewlimit + 1 ) { $ rows = range ( 1 , count ( $ this -> processeddata ) - 1 ) ; } else { $ errorrows = $ warningrows = array ( ) ; ... | Find up rows to show in preview |
28,766 | protected function clean_cohort_data ( & $ hash ) { foreach ( $ hash as $ key => $ value ) { switch ( $ key ) { case 'contextid' : $ hash [ $ key ] = clean_param ( $ value , PARAM_INT ) ; break ; case 'name' : $ hash [ $ key ] = core_text :: substr ( clean_param ( $ value , PARAM_TEXT ) , 0 , 254 ) ; break ; case 'idnu... | Cleans input data about one cohort . |
28,767 | public function startXML ( $ parser , $ name , $ attr ) { if ( $ this -> xml_depth == 0 ) { $ this -> session_id = $ attr [ 'ID' ] ; $ this -> authenticate ( ) ; } parent :: startXML ( $ parser , $ name , $ attr ) ; } | Override XMLStream s startXML |
28,768 | public function authFieldsHandler ( $ xml ) { $ id = $ this -> getId ( ) ; $ this -> addidhandler ( $ id , 'oldAuthResultHandler' ) ; if ( $ xml -> sub ( 'query' ) -> hasSub ( 'digest' ) ) { $ hash = sha1 ( $ this -> session_id . $ this -> password ) ; print "{$this->session_id} {$this->password}\n" ; $ out = "<iq type... | Retrieve auth fields and send auth attempt |
28,769 | public function oldAuthResultHandler ( $ xml ) { if ( $ xml -> attrs [ 'type' ] != 'result' ) { $ this -> log -> log ( "Auth failed!" , XMPPHP_Log :: LEVEL_ERROR ) ; $ this -> disconnect ( ) ; throw new XMPPHP_Exception ( 'Auth failed!' ) ; } else { $ this -> log -> log ( "Session started" ) ; $ this -> event ( 'sessio... | Determine authenticated or failure |
28,770 | function setSelected ( $ values ) { if ( is_string ( $ values ) && $ this -> getMultiple ( ) ) { $ values = preg_split ( "/[ ]?,[ ]?/" , $ values ) ; } if ( is_array ( $ values ) ) { $ this -> _values = array_values ( $ values ) ; } else { $ this -> _values = array ( $ values ) ; } } | Sets the default values of the select box |
28,771 | function loadDbResult ( & $ result , $ textCol = null , $ valueCol = null , $ values = null ) { if ( ! is_object ( $ result ) || ! is_a ( $ result , 'db_result' ) ) { return self :: raiseError ( 'Argument 1 of HTML_Select::loadDbResult is not a valid DB_result' ) ; } if ( isset ( $ values ) ) { $ this -> setValue ( $ v... | Loads the options from DB_result object |
28,772 | function loadQuery ( & $ conn , $ sql , $ textCol = null , $ valueCol = null , $ values = null ) { if ( is_string ( $ conn ) ) { require_once ( 'DB.php' ) ; $ dbConn = & DB :: connect ( $ conn , true ) ; if ( DB :: isError ( $ dbConn ) ) { return $ dbConn ; } } elseif ( is_subclass_of ( $ conn , "db_common" ) ) { $ dbC... | Queries a database and loads the options from the results |
28,773 | function load ( & $ options , $ param1 = null , $ param2 = null , $ param3 = null , $ param4 = null ) { switch ( true ) { case is_array ( $ options ) : return $ this -> loadArray ( $ options , $ param1 ) ; break ; case ( is_a ( $ options , 'db_result' ) ) : return $ this -> loadDbResult ( $ options , $ param1 , $ param... | Loads options from different types of data sources |
28,774 | static public function add ( $ license ) { global $ DB ; if ( $ record = $ DB -> get_record ( 'license' , array ( 'shortname' => $ license -> shortname ) ) ) { if ( $ record -> version < $ license -> version ) { $ license -> enabled = $ record -> enabled ; $ license -> id = $ record -> id ; $ DB -> update_record ( 'lic... | Adding a new license type |
28,775 | static public function get_licenses ( $ param = null ) { global $ DB ; if ( empty ( $ param ) || ! is_array ( $ param ) ) { $ param = array ( ) ; } if ( $ records = $ DB -> get_records ( 'license' , $ param ) ) { return $ records ; } else { return array ( ) ; } } | Get license records |
28,776 | static public function enable ( $ license ) { global $ DB ; if ( $ license = self :: get_license_by_shortname ( $ license ) ) { $ license -> enabled = 1 ; $ DB -> update_record ( 'license' , $ license ) ; } self :: set_active_licenses ( ) ; return true ; } | Enable a license |
28,777 | static public function disable ( $ license ) { global $ DB , $ CFG ; if ( $ license == $ CFG -> sitedefaultlicense ) { print_error ( 'error' ) ; } if ( $ license = self :: get_license_by_shortname ( $ license ) ) { $ license -> enabled = 0 ; $ DB -> update_record ( 'license' , $ license ) ; } self :: set_active_license... | Disable a license |
28,778 | public function addLiteralStream ( $ data ) { $ pos = $ this -> _stream -> pos ( ) ; if ( ! isset ( $ this -> _literals [ $ pos ] ) ) { $ this -> _literals [ $ pos ] = new Horde_Stream_Temp ( ) ; } $ this -> _literals [ $ pos ] -> add ( $ data ) ; } | Add data to literal stream at the current position . |
28,779 | public function flushIterator ( $ return = true , $ sublevel = true ) { $ out = array ( ) ; if ( $ return ) { $ this -> _nextModify = array ( 'level' => $ sublevel ? $ this -> _level : 0 , 'out' => array ( ) ) ; $ this -> next ( ) ; $ out = $ this -> _nextModify [ 'out' ] ; $ this -> _nextModify = array ( ) ; } elseif ... | Flush the remaining entries left in the iterator . |
28,780 | public function getLiteralLength ( ) { if ( $ this -> _stream -> substring ( - 1 , 1 ) === '}' ) { $ literal_data = $ this -> _stream -> getString ( $ this -> _stream -> search ( '{' , true ) - 1 ) ; $ literal_len = substr ( $ literal_data , 2 , - 1 ) ; if ( is_numeric ( $ literal_len ) ) { return array ( 'binary' => (... | Return literal length data located at the end of the stream . |
28,781 | public function nextStream ( ) { $ changed = $ this -> _literalStream ; $ this -> _literalStream = true ; $ out = $ this -> next ( ) ; if ( $ changed ) { $ this -> _literalStream = false ; } return $ out ; } | Force return of literal data as stream if next token . |
28,782 | public function setTextareaDimensions ( $ cols = null , $ rows = null ) { if ( $ cols ) { $ this -> fields [ 'default' ] -> cols = $ cols ; } if ( $ rows ) { $ this -> fields [ 'default' ] -> rows = $ rows ; } } | Sets default column and row size for textareas in sub - printers |
28,783 | public function render ( $ config , $ allowed = true , $ render_controls = true ) { if ( is_array ( $ config ) && isset ( $ config [ 0 ] ) ) { $ gen_config = $ config [ 0 ] ; $ config = $ config [ 1 ] ; } else { $ gen_config = $ config ; } $ this -> config = $ config ; $ this -> genConfig = $ gen_config ; $ this -> pre... | Returns HTML output for a configuration form |
28,784 | public function define_validate_specific ( $ data , $ files ) { $ err = array ( ) ; $ data -> param1 = str_replace ( "\r" , '' , $ data -> param1 ) ; if ( ( $ options = explode ( "\n" , $ data -> param1 ) ) === false ) { $ err [ 'param1' ] = get_string ( 'profilemenunooptions' , 'admin' ) ; } else if ( count ( $ option... | Validates data for the profile field . |
28,785 | private function add_table_row_tuple ( html_table $ table , $ first , $ second ) { $ row = new html_table_row ( ) ; $ cell1 = new html_table_cell ( $ first ) ; $ cell2 = new html_table_cell ( $ second ) ; $ row -> cells = array ( $ cell1 , $ cell2 ) ; $ table -> data [ ] = $ row ; } | Utility function to add a row of data to a table with 2 columns . Modified the table param and does not return a value |
28,786 | public function render_assign_gradingmessage ( assign_gradingmessage $ result ) { $ urlparams = array ( 'id' => $ result -> coursemoduleid , 'action' => 'grading' ) ; if ( ! empty ( $ result -> page ) ) { $ urlparams [ 'page' ] = $ result -> page ; } $ url = new moodle_url ( '/mod/assign/view.php' , $ urlparams ) ; $ c... | Render a grading message notification |
28,787 | public function render_assign_form ( assign_form $ form ) { $ o = '' ; if ( $ form -> jsinitfunction ) { $ this -> page -> requires -> js_init_call ( $ form -> jsinitfunction , array ( ) ) ; } $ o .= $ this -> output -> box_start ( 'boxaligncenter ' . $ form -> classname ) ; $ o .= $ this -> moodleform ( $ form -> form... | Render the generic form |
28,788 | public function render_assign_user_summary ( assign_user_summary $ summary ) { $ o = '' ; $ supendedclass = '' ; $ suspendedicon = '' ; if ( ! $ summary -> user ) { return ; } if ( $ summary -> suspendeduser ) { $ supendedclass = ' usersuspended' ; $ suspendedstring = get_string ( 'userenrolmentsuspended' , 'grades' ) ... | Render the user summary |
28,789 | public function render_assign_submit_for_grading_page ( $ page ) { $ o = '' ; $ o .= $ this -> output -> container_start ( 'submitforgrading' ) ; $ o .= $ this -> output -> heading ( get_string ( 'confirmsubmissionheading' , 'assign' ) , 3 ) ; $ cancelurl = new moodle_url ( '/mod/assign/view.php' , array ( 'id' => $ pa... | Render the submit for grading page |
28,790 | public function render_assign_header ( assign_header $ header ) { $ o = '' ; if ( $ header -> subpage ) { $ this -> page -> navbar -> add ( $ header -> subpage ) ; $ args = [ 'contextname' => $ header -> context -> get_context_name ( false , true ) , 'subpage' => $ header -> subpage ] ; $ title = get_string ( 'subpaget... | Render the header . |
28,791 | public function render_assign_attempt_history_chooser ( assign_attempt_history_chooser $ history ) { $ o = '' ; $ context = $ history -> export_for_template ( $ this ) ; $ o .= $ this -> render_from_template ( 'mod_assign/attempt_history_chooser' , $ context ) ; return $ o ; } | Output the attempt history chooser for this assignment |
28,792 | public function render_assign_grading_table ( assign_grading_table $ table ) { $ o = '' ; $ o .= $ this -> output -> box_start ( 'boxaligncenter gradingtable' ) ; $ this -> page -> requires -> js_init_call ( 'M.mod_assign.init_grading_table' , array ( ) ) ; $ this -> page -> requires -> string_for_js ( 'nousersselected... | Render the grading table . |
28,793 | public function render_assign_course_index_summary ( assign_course_index_summary $ indexsummary ) { $ o = '' ; $ strplural = get_string ( 'modulenameplural' , 'assign' ) ; $ strsectionname = $ indexsummary -> courseformatname ; $ strduedate = get_string ( 'duedate' , 'assign' ) ; $ strsubmission = get_string ( 'submiss... | Render a course index summary |
28,794 | protected function flexible_table ( flexible_table $ table , $ rowsperpage , $ displaylinks ) { $ o = '' ; ob_start ( ) ; $ table -> out ( $ rowsperpage , $ displaylinks ) ; $ o = ob_get_contents ( ) ; ob_end_clean ( ) ; return $ o ; } | Helper method dealing with the fact we can not just fetch the output of flexible_table |
28,795 | public function render_grading_app ( grading_app $ app ) { $ context = $ app -> export_for_template ( $ this ) ; return $ this -> render_from_template ( 'mod_assign/grading_app' , $ context ) ; } | Defer to template .. |
28,796 | private function startelement ( $ parser , $ name , $ attrs ) { $ current = & $ this -> current ; $ level = & $ this -> level ; if ( ! empty ( $ name ) ) { if ( $ level == 0 ) { $ current [ $ level ] [ $ name ] = array ( ) ; $ current [ $ level ] [ $ name ] [ "@" ] = $ attrs ; $ current [ $ level ] [ $ name ] [ "#" ] =... | Is called when tags are opened . |
28,797 | private function endelement ( $ parser , $ name ) { $ current = & $ this -> current ; $ level = & $ this -> level ; if ( ! empty ( $ name ) ) { if ( empty ( $ current [ $ level ] ) ) { $ current [ $ level ] = '' ; } else if ( array_key_exists ( 0 , $ current [ $ level ] ) ) { if ( count ( $ current [ $ level ] ) == 1 )... | Is called when tags are closed . |
28,798 | private function characterdata ( $ parser , $ data ) { $ current = & $ this -> current ; $ level = & $ this -> level ; if ( ( $ data == "0" ) || ( ! empty ( $ data ) && trim ( $ data ) != "" ) ) { $ siz = count ( $ current [ $ level ] ) ; if ( $ siz == 0 ) { $ current [ $ level ] [ 0 ] = $ data ; } else { $ key = max (... | Is called for text between the start and the end of tags . |
28,799 | public function parse ( $ data , $ whitespace = 1 , $ encoding = 'UTF-8' , $ reporterrors = false ) { $ data = trim ( $ data ) ; $ this -> xml = array ( ) ; $ this -> current = array ( ) ; $ this -> level = 0 ; $ this -> current [ 0 ] = & $ this -> xml ; $ parser = xml_parser_create ( $ encoding ) ; xml_parser_set_opti... | Parses XML string . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.