idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
30,800 | public function toArray ( array $ opts = array ( ) ) { $ charset = array_key_exists ( 'charset' , $ opts ) ? ( empty ( $ opts [ 'charset' ] ) ? 'UTF-8' : $ opts [ 'charset' ] ) : null ; $ eol = empty ( $ opts [ 'canonical' ] ) ? $ this -> _eol : "\r\n" ; $ ret = array ( ) ; foreach ( $ this -> _headers as $ ob ) { $ so... | Returns the headers in array format . |
30,801 | public function toString ( array $ opts = array ( ) ) { $ eol = empty ( $ opts [ 'canonical' ] ) ? $ this -> _eol : "\r\n" ; $ text = '' ; foreach ( $ this -> toArray ( $ opts ) as $ key => $ val ) { foreach ( ( is_array ( $ val ) ? $ val : array ( $ val ) ) as $ entry ) { $ text .= $ key . ': ' . $ entry . $ eol ; } }... | Returns all headers concatenated into a single string . |
30,802 | public function addHeaderOb ( Horde_Mime_Headers_Element $ ob , $ check = false ) { if ( $ check ) { $ cname = $ this -> _getHeaderClassName ( $ ob -> name ) ; if ( ! ( $ ob instanceof $ cname ) ) { throw new InvalidArgumentException ( sprintf ( 'Object is not correct class: %s' , $ cname ) ) ; } } if ( $ hdr = $ this ... | Add a Horde_Mime_Headers_Element object to the current header list . |
30,803 | protected function _getHeaderClassName ( $ header ) { if ( empty ( self :: $ _handlers ) ) { $ search = array ( 'Horde_Mime_Headers_Element_Single' , 'Horde_Mime_Headers_AddressesMulti' , 'Horde_Mime_Headers_Addresses' , 'Horde_Mime_Headers_ContentDescription' , 'Horde_Mime_Headers_ContentId' , 'Horde_Mime_Headers_Cont... | Return the header class to use for a header name . |
30,804 | public static function parseHeaders ( $ text ) { $ curr = null ; $ headers = new Horde_Mime_Headers ( ) ; $ hdr_list = array ( ) ; if ( $ text instanceof Horde_Stream ) { $ stream = $ text ; $ stream -> rewind ( ) ; } else { $ stream = new Horde_Stream_Temp ( ) ; $ stream -> add ( $ text , true ) ; } while ( ! $ stream... | Builds a Horde_Mime_Headers object from header text . |
30,805 | public static function create_from_question_category_instance ( $ category , $ context = null ) { $ params = [ 'objectid' => $ category -> id ] ; if ( ! empty ( $ category -> contextid ) ) { $ params [ 'contextid' ] = $ category -> contextid ; } $ params [ 'context' ] = $ context ; $ event = self :: create ( $ params )... | Create a event from question category object |
30,806 | public function sync ( progress_trace $ trace ) { if ( ! enrol_is_enabled ( 'flatfile' ) ) { return 2 ; } $ mailadmins = $ this -> get_config ( 'mailadmins' , 0 ) ; if ( $ mailadmins ) { $ buffer = new progress_trace_buffer ( new text_progress_trace ( ) , false ) ; $ trace = new combined_progress_trace ( array ( $ trac... | Execute synchronisation . |
30,807 | protected function obfuscate_filepath ( $ filepath ) { global $ CFG ; if ( strpos ( $ filepath , $ CFG -> dataroot . '/' ) === 0 or strpos ( $ filepath , $ CFG -> dataroot . '\\' ) === 0 ) { $ disclosefile = '$CFG->dataroot' . substr ( $ filepath , strlen ( $ CFG -> dataroot ) ) ; } else if ( strpos ( $ filepath , $ CF... | Sorry we do not want to show paths in cron output . |
30,808 | protected function process_buffer ( progress_trace $ trace ) { global $ DB ; if ( ! $ future_enrols = $ DB -> get_records_select ( 'enrol_flatfile' , "timestart < ?" , array ( time ( ) ) ) ) { $ trace -> output ( "No enrolments to be processed in flatfile buffer" ) ; $ trace -> finished ( ) ; return false ; } $ trace -... | Process any future enrollments stored in the buffer . |
30,809 | protected function get_enroller ( $ courseid ) { if ( $ this -> lasternollercourseid == $ courseid and $ this -> lasternoller ) { return $ this -> lasternoller ; } $ context = context_course :: instance ( $ courseid ) ; $ users = get_enrolled_users ( $ context , 'enrol/flatfile:manage' ) ; if ( ! $ users ) { $ users = ... | Returns the user who is responsible for flatfile enrolments in given curse . |
30,810 | protected function get_role_map ( progress_trace $ trace ) { global $ DB ; $ rolemap = array ( ) ; $ roles = $ DB -> get_records ( 'role' , null , '' , 'id, name, shortname' ) ; foreach ( $ roles as $ id => $ role ) { $ alias = $ this -> get_config ( 'map_' . $ id , $ role -> shortname , '' ) ; $ alias = trim ( core_te... | Returns a mapping of ims roles to role ids . |
30,811 | public function getClientFirstMessage ( ) { $ this -> _authmsg = 'n=' . str_replace ( array ( ',' , '=' ) , array ( '=2C' , '=3D' ) , $ this -> _user ) . ',r=' . $ this -> _nonce ; return 'n,,' . $ this -> _authmsg ; } | Return the initial client message . |
30,812 | public function parseServerFirstMessage ( $ msg ) { $ i = $ r = $ s = false ; foreach ( explode ( ',' , $ msg ) as $ val ) { list ( $ attr , $ aval ) = array_map ( 'trim' , explode ( '=' , $ val , 2 ) ) ; switch ( $ attr ) { case 'i' : $ this -> _iterations = intval ( $ aval ) ; $ i = true ; break ; case 'r' : if ( str... | Process the initial server message response . |
30,813 | public function getClientFinalMessage ( ) { $ final_msg = 'c=biws,r=' . $ this -> _nonce ; $ s_pass = strval ( new Horde_Crypt_Blowfish_Pbkdf2 ( $ this -> _pass , strlen ( hash ( $ this -> _hash , '' , true ) ) , array ( 'algo' => $ this -> _hash , 'i_count' => $ this -> _iterations , 'salt' => $ this -> _salt ) ) ) ; ... | Return the final client message . |
30,814 | public function parseServerFinalMessage ( $ msg ) { foreach ( explode ( ',' , $ msg ) as $ val ) { list ( $ attr , $ aval ) = array_map ( 'trim' , explode ( '=' , $ val , 2 ) ) ; switch ( $ attr ) { case 'e' : return false ; case 'v' : return ( base64_decode ( $ aval ) === $ this -> _serversig ) ; } } return false ; } | Process the final server message response . |
30,815 | public static function stepsdefinitions ( $ type , $ component , $ filter ) { behat_command :: behat_setup_problem ( ) ; behat_config_manager :: update_config_file ( $ component , false ) ; if ( $ type ) { $ filter .= '&&' . $ type ; } if ( $ filter ) { $ filteroption = ' -d "' . $ filter . '"' ; } else { $ filteroptio... | Lists the available steps definitions |
30,816 | public static function checkString ( $ pValue = null ) { if ( $ pValue instanceof PHPExcel_RichText ) { return $ pValue ; } $ pValue = PHPExcel_Shared_String :: Substring ( $ pValue , 0 , 32767 ) ; $ pValue = str_replace ( array ( "\r\n" , "\r" ) , "\n" , $ pValue ) ; return $ pValue ; } | Check a string that it satisfies Excel requirements |
30,817 | function get_userinfo ( $ username ) { global $ CFG ; if ( empty ( $ _SERVER [ $ this -> config -> user_attribute ] ) ) { print_error ( 'shib_not_all_attributes_error' , 'auth_shibboleth' , '' , "'" . $ this -> config -> user_attribute . "' ('" . $ _SERVER [ $ this -> config -> user_attribute ] . "'), '" . $ this -> co... | Returns the user information for external users . In this case the attributes provided by Shibboleth |
30,818 | function get_attributes ( ) { $ configarray = ( array ) $ this -> config ; $ moodleattributes = array ( ) ; $ userfields = array_merge ( $ this -> userfields , $ this -> get_custom_user_profile_fields ( ) ) ; foreach ( $ userfields as $ field ) { if ( isset ( $ configarray [ "field_map_$field" ] ) ) { $ moodleattribute... | Returns array containg attribute mappings between Moodle and Shibboleth . |
30,819 | public function can_manage ( ) { if ( $ this -> is_draft ( ) ) { return self :: can_manage_user_draft ( $ this -> get ( 'userid' ) ) ; } return self :: can_manage_user ( $ this -> get ( 'userid' ) ) ; } | Whether the current user can manage the plan . |
30,820 | public function can_read ( ) { if ( $ this -> is_draft ( ) ) { return self :: can_read_user_draft ( $ this -> get ( 'userid' ) ) ; } return self :: can_read_user ( $ this -> get ( 'userid' ) ) ; } | Whether the current user can read the plan . |
30,821 | public function get_comment_object ( ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/comment/lib.php' ) ; if ( ! $ this -> get ( 'id' ) ) { throw new \ coding_exception ( 'The plan must exist.' ) ; } $ comment = new comment ( ( object ) array ( 'client_id' => 'plancommentarea' . $ this -> get ( 'id' ) , 'context... | Get the comment object . |
30,822 | public function get_competencies ( ) { $ competencies = array ( ) ; if ( $ this -> get ( 'status' ) == self :: STATUS_COMPLETE ) { $ competencies = user_competency_plan :: list_competencies ( $ this -> get ( 'id' ) , $ this -> get ( 'userid' ) ) ; } else if ( $ this -> is_based_on_template ( ) ) { $ competencies = temp... | Get the competencies in this plan . |
30,823 | public function get_competency ( $ competencyid ) { $ competency = null ; if ( $ this -> get ( 'status' ) == self :: STATUS_COMPLETE ) { $ competency = user_competency_plan :: get_competency_by_planid ( $ this -> get ( 'id' ) , $ competencyid ) ; } else if ( $ this -> is_based_on_template ( ) ) { $ competency = templat... | Get a single competency from this plan . |
30,824 | protected function validate_userid ( $ value ) { global $ DB ; if ( ! $ this -> get ( 'id' ) ) { if ( ! $ DB -> record_exists ( 'user' , array ( 'id' => $ value ) ) ) { return new lang_string ( 'invaliddata' , 'error' ) ; } } return true ; } | Validate the user ID . |
30,825 | public static function can_comment_user ( $ planuserid ) { global $ USER ; $ capabilities = array ( 'moodle/competency:plancomment' ) ; if ( $ USER -> id == $ planuserid ) { $ capabilities [ ] = 'moodle/competency:plancommentown' ; } return has_any_capability ( $ capabilities , context_user :: instance ( $ planuserid )... | Can the current user comment on a user s plan? |
30,826 | public static function can_manage_user ( $ planuserid ) { global $ USER ; $ context = context_user :: instance ( $ planuserid ) ; $ capabilities = array ( 'moodle/competency:planmanage' ) ; if ( $ context -> instanceid == $ USER -> id ) { $ capabilities [ ] = 'moodle/competency:planmanageown' ; } return has_any_capabil... | Can the current user manage a user s plan? |
30,827 | public static function can_request_review_user ( $ planuserid ) { global $ USER ; $ capabilities = array ( 'moodle/competency:planrequestreview' ) ; if ( $ USER -> id == $ planuserid ) { $ capabilities [ ] = 'moodle/competency:planrequestreviewown' ; } return has_any_capability ( $ capabilities , context_user :: instan... | Can the current user request the draft to be reviewed . |
30,828 | public static function get_by_user_and_competency ( $ userid , $ competencyid ) { global $ DB ; $ sql = 'SELECT p.* FROM {' . self :: TABLE . '} p LEFT JOIN {' . plan_competency :: TABLE . '} pc ON pc.planid = p.id AND pc.competencyid = :competencyid1 ... | Get the plans of a user containing a specific competency . |
30,829 | public static function get_recordset_for_due_and_incomplete ( ) { global $ DB ; $ sql = "duedate > 0 AND duedate < :now AND status = :status" ; $ params = array ( 'now' => time ( ) , 'status' => self :: STATUS_ACTIVE ) ; return $ DB -> get_recordset_select ( self :: TABLE , $ sql , $ params ) ; } | Get the recordset of the plans that are due incomplete and not draft . |
30,830 | public static function get_status_list ( $ userid ) { $ status = array ( ) ; if ( self :: can_manage_user_draft ( $ userid ) ) { $ status [ self :: STATUS_DRAFT ] = get_string ( 'planstatusdraft' , 'core_competency' ) ; } if ( self :: can_manage_user ( $ userid ) ) { $ status [ self :: STATUS_ACTIVE ] = get_string ( 'p... | Return a list of status depending on capabilities . |
30,831 | public static function update_multiple_from_template ( template $ template ) { global $ DB ; if ( ! $ template -> is_valid ( ) ) { throw new \ coding_exception ( 'The template must be validated before updating plans.' ) ; } $ params = array ( 'templateid' => $ template -> get ( 'id' ) , 'status' => self :: STATUS_COMPL... | Update from template . |
30,832 | protected function validate_duedate ( $ value ) { if ( $ this -> is_based_on_template ( ) || $ this -> is_draft ( ) || $ this -> get ( 'status' ) == self :: STATUS_COMPLETE || empty ( $ value ) ) { return true ; } if ( $ this -> get ( 'id' ) ) { $ before = $ this -> beforeupdate -> get ( 'duedate' ) ; $ beforestatus = ... | Validate the due date . When setting a due date it must not exceed the DUEDATE_THRESHOLD . |
30,833 | public static function count_records_for_template ( $ templateid , $ status ) { $ filters = array ( 'templateid' => $ templateid ) ; if ( $ status > 0 ) { $ filters [ 'status' ] = $ status ; } return self :: count_records ( $ filters ) ; } | Count the number of plans for a template optionally filtering by status . |
30,834 | public static function get_records_for_template ( $ templateid , $ status = 0 , $ skip = 0 , $ limit = 100 ) { $ filters = array ( 'templateid' => $ templateid ) ; if ( $ status > 0 ) { $ filters [ 'status' ] = $ status ; } return self :: get_records ( $ filters , $ skip , $ limit ) ; } | Get the plans for a template optionally filtering by status . |
30,835 | protected static function export_glossary_data_for_user ( array $ glossarydata , \ context_module $ context , array $ subcontext , \ stdClass $ user ) { $ contextdata = helper :: get_context_data ( $ context , $ user ) ; $ contextdata = ( object ) array_merge ( ( array ) $ contextdata , $ glossarydata ) ; writer :: wit... | Export the supplied personal data for a single glossary activity along with any generic data or area files . |
30,836 | public static function create_from_user ( \ stdClass $ user , $ forgottenreset = false ) { $ data = array ( 'context' => \ context_user :: instance ( $ user -> id ) , 'relateduserid' => $ user -> id , 'other' => array ( 'forgottenreset' => $ forgottenreset ) , ) ; $ event = self :: create ( $ data ) ; $ event -> add_re... | Create event for user password changing and resetting . |
30,837 | protected function get_local_path_from_storedfile ( stored_file $ file , $ fetchifnotfound = false ) { $ filepath = $ this -> get_local_path_from_hash ( $ file -> get_contenthash ( ) , $ fetchifnotfound ) ; if ( $ fetchifnotfound && ! is_readable ( $ filepath ) ) { $ this -> recover_file ( $ file ) ; } return $ filepat... | Get a remote filepath for the specified stored file . |
30,838 | public function copy_content_from_storedfile ( stored_file $ file , $ target ) { $ source = $ this -> get_local_path_from_storedfile ( $ file , true ) ; return copy ( $ source , $ target ) ; } | Copy content of file to given pathname . |
30,839 | protected function recover_file ( stored_file $ file ) { $ contentfile = $ this -> get_local_path_from_storedfile ( $ file , false ) ; if ( file_exists ( $ contentfile ) ) { return true ; } $ contenthash = $ file -> get_contenthash ( ) ; $ contentdir = $ this -> get_fulldir_from_storedfile ( $ file ) ; $ trashfile = $ ... | Tries to recover missing content of file from trash . |
30,840 | public function remove_file ( $ contenthash ) { if ( ! self :: is_file_removable ( $ contenthash ) ) { return ; } if ( ! $ this -> is_file_readable_remotely_by_hash ( $ contenthash ) ) { return ; } $ trashpath = $ this -> get_trash_fulldir_from_hash ( $ contenthash ) ; $ trashfile = $ this -> get_trash_fullpath_from_ha... | Marks pool file as candidate for deleting . |
30,841 | public function add_file_from_path ( $ pathname , $ contenthash = null ) { list ( $ contenthash , $ filesize ) = $ this -> validate_hash_and_file_size ( $ contenthash , $ pathname ) ; $ hashpath = $ this -> get_fulldir_from_hash ( $ contenthash ) ; $ hashfile = $ this -> get_local_path_from_hash ( $ contenthash , false... | Add the supplied file to the file system . |
30,842 | public function add_file_from_string ( $ content ) { global $ CFG ; $ contenthash = file_storage :: hash_from_string ( $ content ) ; $ filesize = strlen ( $ content ) ; $ hashpath = $ this -> get_fulldir_from_hash ( $ contenthash ) ; $ hashfile = $ this -> get_local_path_from_hash ( $ contenthash , false ) ; $ newfile ... | Add a file with the supplied content to the file system . |
30,843 | public function set_theme_suite_to_include_core_features ( $ themetoset ) { if ( ! empty ( $ themetoset ) ) { if ( is_number ( $ themetoset ) || is_bool ( $ themetoset ) || ( self :: ALL_THEMES_TO_RUN === strtoupper ( $ themetoset ) ) ) { $ this -> themesuitewithallfeatures = self :: ALL_THEMES_TO_RUN ; } else { $ this... | Set value for theme suite to include all core features . This should be used if your want all core features to be run with theme . |
30,844 | public function set_parallel_run ( $ parallelruns , $ currentrun ) { if ( $ parallelruns < $ currentrun ) { behat_error ( BEHAT_EXITCODE_REQUIREMENT , 'Parallel runs(' . $ parallelruns . ') should be more then current run(' . $ currentrun . ')' ) ; } $ this -> parallelruns = $ parallelruns ; $ this -> currentrun = $ cu... | Set parallel run to be used for generating config . |
30,845 | public function get_number_of_parallel_run ( ) { if ( empty ( $ this -> parallelruns ) && ( $ this -> parallelruns !== false ) ) { $ this -> parallelruns = behat_config_manager :: get_behat_run_config_value ( 'parallel' ) ; } return $ this -> parallelruns ; } | Return parallel runs |
30,846 | public function get_current_run ( ) { global $ CFG ; if ( empty ( $ this -> currentrun ) && ( $ this -> currentrun !== false ) && ! empty ( $ CFG -> behatrunprocess ) ) { $ this -> currentrun = $ CFG -> behatrunprocess ; } return $ this -> currentrun ; } | Return current run |
30,847 | public function get_components_features ( $ tags = '' ) { global $ CFG ; if ( ! empty ( $ this -> features ) && empty ( $ tags ) ) { return $ this -> features ; } $ features = array ( ) ; $ featurespaths = array ( ) ; $ components = $ this -> get_components_with_tests ( ) ; if ( $ components ) { foreach ( $ components ... | Return list of features . |
30,848 | public function get_clean_feature_key_and_path ( $ featurepath ) { global $ CFG ; $ featurepath = testing_cli_fix_directory_separator ( $ featurepath ) ; $ dirroot = testing_cli_fix_directory_separator ( $ CFG -> dirroot . DIRECTORY_SEPARATOR ) ; $ key = basename ( $ featurepath , '.feature' ) ; $ featuredirname = str_... | Return feature key for featurepath |
30,849 | private function get_component_contexts ( $ component ) { if ( empty ( $ component ) ) { return $ this -> contexts ; } $ componentcontexts = array ( ) ; foreach ( $ this -> contexts as $ key => $ path ) { if ( $ component == '' || $ component === $ key ) { $ componentcontexts [ $ key ] = $ path ; } } return $ component... | Get component contexts . |
30,850 | public function get_components_contexts ( $ component = '' ) { if ( ! empty ( $ this -> contexts ) ) { return $ this -> get_component_contexts ( $ component ) ; } $ components = $ this -> get_components_with_tests ( ) ; $ this -> contexts = array ( ) ; foreach ( $ components as $ componentname => $ componentpath ) { if... | Gets the list of Moodle behat contexts |
30,851 | public function get_config_file_contents ( $ features = '' , $ contexts = '' , $ tags = '' , $ parallelruns = 0 , $ currentrun = 0 ) { global $ CFG ; if ( ! empty ( $ parallelruns ) && ! empty ( $ currentrun ) ) { $ this -> set_parallel_run ( $ parallelruns , $ currentrun ) ; } if ( ! empty ( $ tags ) ) { $ this -> set... | Behat config file specifing the main context class the required Behat extensions and Moodle test wwwroot . |
30,852 | public function filtered_features_with_tags ( $ features = '' , $ tags = '' ) { if ( empty ( $ features ) ) { $ features = $ this -> features ; } if ( empty ( $ tags ) && empty ( $ this -> tags ) ) { return $ features ; } if ( empty ( $ tags ) ) { $ tags = $ this -> tags ; } $ newfeaturelist = array ( ) ; $ tags = expl... | Search feature files for set of tags . |
30,853 | protected function build_config ( $ parallelruns = 0 , $ currentrun = 0 ) { global $ CFG ; if ( ! empty ( $ parallelruns ) && ! empty ( $ currentrun ) ) { $ this -> set_parallel_run ( $ parallelruns , $ currentrun ) ; } else { $ currentrun = $ this -> get_current_run ( ) ; $ parallelruns = $ this -> get_number_of_paral... | Build config for behat . yml . |
30,854 | protected function get_features_for_the_run ( $ features , $ parallelruns , $ currentrun ) { if ( empty ( $ features ) ) { return $ features ; } $ allocatedfeatures = $ features ; if ( ! empty ( $ currentrun ) && ! empty ( $ parallelruns ) ) { $ featurestodivide [ 'withtags' ] = $ features ; $ allocatedfeatures = array... | Divide features between the runs and return list . |
30,855 | protected function get_mobile_version_tags ( $ verbose = true ) : string { global $ CFG ; if ( ! empty ( $ CFG -> behat_ionic_dirroot ) ) { $ jsonpath = $ CFG -> behat_ionic_dirroot . '/package.json' ; $ json = @ file_get_contents ( $ jsonpath ) ; if ( ! $ json ) { throw new coding_exception ( 'Unable to load app versi... | Gets version tags to use for the mobile app . |
30,856 | public function merge_config ( $ config , $ localconfig ) { if ( ! is_array ( $ config ) && ! is_array ( $ localconfig ) ) { return $ localconfig ; } if ( is_array ( $ config ) && ! is_array ( $ localconfig ) ) { return $ localconfig ; } foreach ( $ localconfig as $ key => $ value ) { if ( ! is_array ( $ config ) ) { u... | Overrides default config with local config values |
30,857 | public static final function get_behat_theme_selector_override_classname ( $ themename , $ selectortype , $ includeclass = false ) { global $ CFG ; if ( $ selectortype !== 'named_partial' && $ selectortype !== 'named_exact' ) { throw new coding_exception ( "Unknown selector override type '{$selectortype}'" ) ; } $ over... | Return context name of behat_theme selector to use . |
30,858 | protected function remove_blacklisted_features_from_list ( $ features , $ blacklist ) { if ( empty ( $ blacklist ) ) { return $ features ; } if ( empty ( $ features ) ) { return $ features ; } if ( ! is_array ( $ blacklist ) ) { $ blacklist = array ( $ blacklist ) ; } foreach ( $ blacklist as $ blacklistpath ) { list (... | Remove list of blacklisted features from the feature list . |
30,859 | protected function get_list_of_themes ( ) { $ selectablethemes = array ( ) ; $ themes = core_component :: get_plugin_list ( 'theme' ) ; ksort ( $ themes ) ; foreach ( $ themes as $ themename => $ themedir ) { try { $ theme = $ this -> get_theme_config ( $ themename ) ; } catch ( Exception $ e ) { continue ; } if ( $ th... | Return list of themes which can be set in moodle . |
30,860 | protected function get_behat_features_for_theme ( $ theme ) { global $ CFG ; $ themefeatures = $ this -> get_tests_for_theme ( $ theme , 'features' ) ; $ themeblacklistfeatures = $ this -> get_blacklisted_tests_for_theme ( $ theme , 'features' ) ; $ themeblacklisttags = $ this -> get_blacklisted_tests_for_theme ( $ the... | Return list of blacklisted behat features for theme and features defined by theme only . |
30,861 | public function definition ( ) { $ mform = $ this -> _form ; $ instance = $ this -> _customdata ; $ mform -> addElement ( 'html' , $ instance [ 'gradingtable' ] ) ; $ mform -> addElement ( 'hidden' , 'id' , $ instance [ 'cm' ] ) ; $ mform -> setType ( 'id' , PARAM_INT ) ; $ mform -> addElement ( 'hidden' , 'action' , '... | Define this form - called from the parent constructor |
30,862 | protected function get_fieldlist ( ) : array { global $ DB ; if ( null === $ this -> fields ) { $ fields = [ ] ; foreach ( array_keys ( $ DB -> get_columns ( $ this -> tablename ) ) as $ fieldname ) { $ fields [ "{$this->fieldprefix}{$fieldname}" ] = $ fieldname ; } $ this -> fields = $ fields ; } return $ this -> fiel... | Get the list of fields in a table for use in preloading fields . |
30,863 | public function get_field_select ( ) : string { $ fieldlist = $ this -> get_fieldlist ( ) ; return implode ( ', ' , array_map ( function ( $ fieldname , $ fieldalias ) { return "{$this->tablealias}.{$fieldname} AS {$fieldalias}" ; } , $ fieldlist , array_keys ( $ fieldlist ) ) ) ; } | Get the SELECT SQL to select a set of columns for this table . |
30,864 | public function extract_from_result ( stdClass $ result ) : stdClass { $ record = new stdClass ( ) ; $ fieldlist = $ this -> get_fieldlist ( ) ; foreach ( $ fieldlist as $ fieldalias => $ fieldname ) { if ( property_exists ( $ result , $ fieldalias ) ) { $ record -> $ fieldname = $ result -> $ fieldalias ; unset ( $ re... | Extract fields from the specified result . The fields are removed from the original object . |
30,865 | public static function raise ( $ newlimit = 0 ) { global $ CFG ; if ( PHPUNIT_TEST ) { self :: $ unittestdata [ ] = $ newlimit ; } if ( self :: $ currentend === 0 || CLI_SCRIPT ) { return ; } if ( ! empty ( $ CFG -> maxtimelimit ) ) { $ realtimeout = max ( 1 , $ CFG -> maxtimelimit ) ; if ( $ newlimit === 0 ) { $ newli... | Sets the PHP time limit to a number of seconds from now . |
30,866 | private function writeGradientFill ( PHPExcel_Shared_XMLWriter $ objWriter = null , PHPExcel_Style_Fill $ pFill = null ) { $ objWriter -> startElement ( 'fill' ) ; $ objWriter -> startElement ( 'gradientFill' ) ; $ objWriter -> writeAttribute ( 'type' , $ pFill -> getFillType ( ) ) ; $ objWriter -> writeAttribute ( 'de... | Write Gradient Fill |
30,867 | private function writePatternFill ( PHPExcel_Shared_XMLWriter $ objWriter = null , PHPExcel_Style_Fill $ pFill = null ) { $ objWriter -> startElement ( 'fill' ) ; $ objWriter -> startElement ( 'patternFill' ) ; $ objWriter -> writeAttribute ( 'patternType' , $ pFill -> getFillType ( ) ) ; if ( $ pFill -> getFillType ( ... | Write Pattern Fill |
30,868 | public function allConditionalStyles ( PHPExcel $ pPHPExcel = null ) { $ aStyles = array ( ) ; $ sheetCount = $ pPHPExcel -> getSheetCount ( ) ; for ( $ i = 0 ; $ i < $ sheetCount ; ++ $ i ) { foreach ( $ pPHPExcel -> getSheet ( $ i ) -> getConditionalStylesCollection ( ) as $ conditionalStyles ) { foreach ( $ conditio... | Get an array of all conditional styles |
30,869 | public function allFills ( PHPExcel $ pPHPExcel = null ) { $ aFills = array ( ) ; $ fill0 = new PHPExcel_Style_Fill ( ) ; $ fill0 -> setFillType ( PHPExcel_Style_Fill :: FILL_NONE ) ; $ aFills [ ] = $ fill0 ; $ fill1 = new PHPExcel_Style_Fill ( ) ; $ fill1 -> setFillType ( PHPExcel_Style_Fill :: FILL_PATTERN_GRAY125 ) ... | Get an array of all fills |
30,870 | public function allFonts ( PHPExcel $ pPHPExcel = null ) { $ aFonts = array ( ) ; $ aStyles = $ this -> allStyles ( $ pPHPExcel ) ; foreach ( $ aStyles as $ style ) { if ( ! array_key_exists ( $ style -> getFont ( ) -> getHashCode ( ) , $ aFonts ) ) { $ aFonts [ $ style -> getFont ( ) -> getHashCode ( ) ] = $ style -> ... | Get an array of all fonts |
30,871 | public function allBorders ( PHPExcel $ pPHPExcel = null ) { $ aBorders = array ( ) ; $ aStyles = $ this -> allStyles ( $ pPHPExcel ) ; foreach ( $ aStyles as $ style ) { if ( ! array_key_exists ( $ style -> getBorders ( ) -> getHashCode ( ) , $ aBorders ) ) { $ aBorders [ $ style -> getBorders ( ) -> getHashCode ( ) ]... | Get an array of all borders |
30,872 | public function allNumberFormats ( PHPExcel $ pPHPExcel = null ) { $ aNumFmts = array ( ) ; $ aStyles = $ this -> allStyles ( $ pPHPExcel ) ; foreach ( $ aStyles as $ style ) { if ( $ style -> getNumberFormat ( ) -> getBuiltInFormatCode ( ) === false && ! array_key_exists ( $ style -> getNumberFormat ( ) -> getHashCode... | Get an array of all number formats |
30,873 | public function validation ( $ data , $ files ) { $ errors = parent :: validation ( $ data , $ files ) ; if ( $ data [ 'issueremail' ] && ! validate_email ( $ data [ 'issueremail' ] ) ) { $ errors [ 'issueremail' ] = get_string ( 'invalidemail' ) ; } if ( $ data [ 'issuerurl' ] && ! preg_match ( '@^https?://.+@' , $ da... | Validates form data . |
30,874 | public function execute ( ) { if ( $ this -> progress >= self :: PROGRESS_EXECUTED ) { throw new backup_ui_exception ( 'backupuialreadyexecuted' ) ; } if ( $ this -> stage -> get_stage ( ) < self :: STAGE_FINAL ) { throw new backup_ui_exception ( 'backupuifinalisedbeforeexecute' ) ; } $ this -> progress = self :: PROGR... | Executes the backup plan |
30,875 | final public static function load_controller ( $ backupid = false ) { if ( $ backupid ) { try { $ controller = backup_controller :: load_controller ( $ backupid ) ; return $ controller ; } catch ( Exception $ e ) { return false ; } } return $ backupid ; } | Loads the backup controller if we are tracking one |
30,876 | public function get_progress_bar ( ) { global $ PAGE ; $ stage = self :: STAGE_COMPLETE ; $ currentstage = $ this -> stage -> get_stage ( ) ; $ items = array ( ) ; while ( $ stage > 0 ) { $ classes = array ( 'backup_stage' ) ; if ( floor ( $ stage / 2 ) == $ currentstage ) { $ classes [ ] = 'backup_stage_next' ; } else... | Gets an array of progress bar items that can be displayed through the backup renderer . |
30,877 | protected function substrCount ( $ haystack , $ needle , $ offset , $ length ) { static $ oldVersion ; if ( $ oldVersion === null ) { $ oldVersion = version_compare ( PHP_VERSION , '5.1' , '<' ) ; } if ( $ oldVersion ) { $ haystack = substr ( $ haystack , $ offset , $ length ) ; return substr_count ( $ haystack , $ nee... | PHP 5 . 0 . x compatible substr_count that implements offset and length |
30,878 | public function update_overdue_attempts ( $ timenow , $ processto ) { global $ DB ; $ attemptstoprocess = $ this -> get_list_of_overdue_attempts ( $ processto ) ; $ course = null ; $ quiz = null ; $ cm = null ; $ count = 0 ; $ quizcount = 0 ; foreach ( $ attemptstoprocess as $ attempt ) { try { if ( ! $ quiz || $ attem... | Do the processing required . |
30,879 | public function files_read_only ( question_attempt $ qa , question_display_options $ options ) { $ files = $ qa -> get_last_qt_files ( 'attachments' , $ options -> context -> id ) ; $ output = array ( ) ; foreach ( $ files as $ file ) { $ output [ ] = html_writer :: tag ( 'p' , html_writer :: link ( $ qa -> get_respons... | Displays any attached files when the question is in read - only mode . |
30,880 | public function files_input ( question_attempt $ qa , $ numallowed , question_display_options $ options ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/lib/form/filemanager.php' ) ; $ pickeroptions = new stdClass ( ) ; $ pickeroptions -> mainfile = null ; $ pickeroptions -> maxfiles = $ numallowed ; $ pickeropti... | Displays the input control for when the student should upload a single file . |
30,881 | protected function specific_filepicker_options ( $ acceptedtypes , $ draftitemid , $ context ) { debugging ( 'qtype_essay_format_editorfilepicker_renderer::specific_filepicker_options() is deprecated, ' . 'use question_utils::specific_filepicker_options() instead.' , DEBUG_DEVELOPER ) ; $ filepickeroptions = new stdCla... | Get the options required to configure the filepicker for one of the editor toolbar buttons . |
30,882 | protected function get_name ( $ name , $ urls ) { if ( $ name ) { return $ name ; } $ url = reset ( $ urls ) ; $ name = core_media_manager :: instance ( ) -> get_filename ( $ url ) ; if ( count ( $ urls ) > 1 ) { $ name = preg_replace ( '~\.[^.]*$~' , '' , $ name ) ; } return $ name ; } | Obtains suitable name for media . Uses specified name if there is one otherwise makes one up . |
30,883 | public function get_caption ( $ key = 0 ) { $ captions = $ this -> get_captions ( ) ; if ( isset ( $ captions [ $ key ] ) ) { return $ captions [ $ key ] ; } else { return null ; } } | Get a single caption |
30,884 | public function get_credit ( $ key = 0 ) { $ credits = $ this -> get_credits ( ) ; if ( isset ( $ credits [ $ key ] ) ) { return $ credits [ $ key ] ; } else { return null ; } } | Get a single credit |
30,885 | public function get_duration ( $ convert = false ) { if ( $ this -> duration !== null ) { if ( $ convert ) { $ time = SimplePie_Misc :: time_hms ( $ this -> duration ) ; return $ time ; } else { return $ this -> duration ; } } else { return null ; } } | Get the duration of the enclosure |
30,886 | public function get_extension ( ) { if ( $ this -> link !== null ) { $ url = SimplePie_Misc :: parse_url ( $ this -> link ) ; if ( $ url [ 'path' ] !== '' ) { return pathinfo ( $ url [ 'path' ] , PATHINFO_EXTENSION ) ; } } return null ; } | Get the file extension |
30,887 | public static function update_token_lastaccess ( $ token , int $ time = 0 ) { global $ DB ; if ( ! $ time ) { $ time = time ( ) ; } if ( $ time >= $ token -> lastaccess + self :: TOKEN_LASTACCESS_UPDATE_SECS ) { $ DB -> set_field ( 'external_tokens' , 'lastaccess' , $ time , array ( 'id' => $ token -> id ) ) ; } } | Updates the last access time for a token . |
30,888 | public function generate_user_ws_tokens ( $ userid ) { global $ CFG , $ DB ; if ( ! is_siteadmin ( ) && has_capability ( 'moodle/webservice:createtoken' , context_system :: instance ( ) , $ userid ) && ! empty ( $ CFG -> enablewebservices ) ) { $ norestrictedservices = $ DB -> get_records ( 'external_services' , array ... | Generate all tokens of a specific user |
30,889 | public function get_token_by_id_with_details ( $ tokenid ) { global $ DB ; $ sql = "SELECT t.id, t.token, u.id AS userid, u.firstname, u.lastname, s.name, t.creatorid FROM {external_tokens} t, {user} u, {external_services} s WHERE t.id=? AND t.tokentype = ? AND s.id = t.externalserviceid A... | Return a token of an arbitrary user by tokenid including details of the associated user and the service name . If no tokens exist an exception is thrown |
30,890 | public function delete_service ( $ serviceid ) { global $ DB ; $ DB -> delete_records ( 'external_services_users' , array ( 'externalserviceid' => $ serviceid ) ) ; $ DB -> delete_records ( 'external_services_functions' , array ( 'externalserviceid' => $ serviceid ) ) ; $ DB -> delete_records ( 'external_tokens' , arra... | Delete a service Also delete function references and authorised user references . |
30,891 | public function get_not_associated_external_functions ( $ serviceid ) { global $ DB ; $ select = "name NOT IN (SELECT s.functionname FROM {external_services_functions} s WHERE s.externalserviceid = :sid )" ; $ functions = $ D... | Get functions not included in a service |
30,892 | public function get_external_service_by_id ( $ serviceid , $ strictness = IGNORE_MISSING ) { global $ DB ; $ service = $ DB -> get_record ( 'external_services' , array ( 'id' => $ serviceid ) , '*' , $ strictness ) ; return $ service ; } | Get an external service for a given service id |
30,893 | public function get_external_service_by_shortname ( $ shortname , $ strictness = IGNORE_MISSING ) { global $ DB ; $ service = $ DB -> get_record ( 'external_services' , array ( 'shortname' => $ shortname ) , '*' , $ strictness ) ; return $ service ; } | Get an external service for a given shortname |
30,894 | public function add_external_function_to_service ( $ functionname , $ serviceid ) { global $ DB ; $ addedfunction = new stdClass ( ) ; $ addedfunction -> externalserviceid = $ serviceid ; $ addedfunction -> functionname = $ functionname ; $ DB -> insert_record ( 'external_services_functions' , $ addedfunction ) ; } | Add a function to a service |
30,895 | public function add_external_service ( $ service ) { global $ DB ; $ service -> timecreated = time ( ) ; $ serviceid = $ DB -> insert_record ( 'external_services' , $ service ) ; return $ serviceid ; } | Add a service It generates the timecreated field automatically . |
30,896 | public static function get_active_tokens ( $ userid ) { global $ DB ; $ sql = 'SELECT t.*, s.name as servicename FROM {external_tokens} t JOIN {external_services} s ON t.externalserviceid = s.id WHERE t.userid = :userid AND (t.validuntil IS NULL OR t.validuntil > :now)' ; $ params = array ... | Return a list with all the valid user tokens for the given user it only excludes expired tokens . |
30,897 | protected function authenticate_by_token ( $ tokentype ) { global $ DB ; $ loginfaileddefaultparams = array ( 'other' => array ( 'method' => $ this -> authmethod , 'reason' => null ) ) ; if ( ! $ token = $ DB -> get_record ( 'external_tokens' , array ( 'token' => $ this -> token , 'tokentype' => $ tokentype ) ) ) { $ p... | User authentication by token |
30,898 | public function run ( ) { global $ CFG , $ SESSION ; raise_memory_limit ( MEMORY_EXTRA ) ; external_api :: set_timeout ( ) ; set_exception_handler ( array ( $ this , 'exception_handler' ) ) ; $ this -> parse_request ( ) ; $ this -> authenticate_user ( ) ; $ this -> load_function_info ( ) ; $ params = array ( 'other' =>... | Process request from client . |
30,899 | public function exception_handler ( $ ex ) { abort_all_db_transactions ( ) ; $ this -> session_cleanup ( $ ex ) ; $ this -> send_error ( $ ex ) ; exit ( 1 ) ; } | Specialised exception handler we can not use the standard one because it can not just print html to output . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.