idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
31,500 | public function rename ( string $ name ) { global $ DB , $ USER ; $ this -> model -> name = $ name ; $ this -> model -> timemodified = time ( ) ; $ this -> model -> usermodified = $ USER -> id ; $ DB -> update_record ( 'analytics_models' , $ this -> model ) ; } | Renames the model to the given name . |
31,501 | public function inplace_editable_name ( ) { $ displayname = format_string ( $ this -> get_name ( ) ) ; return new \ core \ output \ inplace_editable ( 'core_analytics' , 'modelname' , $ this -> model -> id , has_capability ( 'moodle/analytics:managemodels' , \ context_system :: instance ( ) ) , $ displayname , $ this -... | Returns an inplace editable element with the model s name . |
31,502 | public function set_data ( $ defaultvalues ) { $ defaultvalues = ( array ) $ defaultvalues ; if ( isset ( $ defaultvalues [ 'scormtype' ] ) and isset ( $ defaultvalues [ 'reference' ] ) ) { switch ( $ defaultvalues [ 'scormtype' ] ) { case SCORM_TYPE_LOCALSYNC : case SCORM_TYPE_EXTERNAL : case SCORM_TYPE_AICCURL : $ de... | Need to translate the options and reference field . |
31,503 | function setDatasource ( & $ datasource , $ defaultsFilter = null , $ constantsFilter = null ) { if ( is_object ( $ datasource ) ) { $ this -> _datasource = & $ datasource ; if ( is_callable ( array ( $ datasource , 'defaultValues' ) ) ) { $ this -> setDefaults ( $ datasource -> defaultValues ( $ this ) , $ defaultsFil... | Sets a datasource object for this form object |
31,504 | function setDefaults ( $ defaultValues = null , $ filter = null ) { if ( is_array ( $ defaultValues ) ) { if ( isset ( $ filter ) ) { if ( is_array ( $ filter ) && ( 2 != count ( $ filter ) || ! is_callable ( $ filter ) ) ) { foreach ( $ filter as $ val ) { if ( ! is_callable ( $ val ) ) { return self :: raiseError ( n... | Initializes default form values |
31,505 | function setConstants ( $ constantValues = null , $ filter = null ) { if ( is_array ( $ constantValues ) ) { if ( isset ( $ filter ) ) { if ( is_array ( $ filter ) && ( 2 != count ( $ filter ) || ! is_callable ( $ filter ) ) ) { foreach ( $ filter as $ val ) { if ( ! is_callable ( $ val ) ) { return self :: raiseError ... | Initializes constant form values . These values won t get overridden by POST or GET vars |
31,506 | function setMaxFileSize ( $ bytes = 0 ) { if ( $ bytes > 0 ) { $ this -> _maxFileSize = $ bytes ; } if ( ! $ this -> elementExists ( 'MAX_FILE_SIZE' ) ) { $ this -> addElement ( 'hidden' , 'MAX_FILE_SIZE' , $ this -> _maxFileSize ) ; } else { $ el = & $ this -> getElement ( 'MAX_FILE_SIZE' ) ; $ el -> updateAttributes ... | Sets the value of MAX_FILE_SIZE hidden element |
31,507 | function & createElement ( $ elementType ) { if ( ! isset ( $ this ) || ! ( $ this instanceof HTML_QuickForm ) ) { debugging ( 'Function createElement() can not be called statically, ' . 'this will no longer work in PHP 7.1' , DEBUG_DEVELOPER ) ; } $ args = func_get_args ( ) ; $ element = self :: _loadElement ( 'create... | Creates a new form element of the given type . |
31,508 | function & _loadElement ( $ event , $ type , $ args ) { $ type = strtolower ( $ type ) ; if ( ! self :: isTypeRegistered ( $ type ) ) { $ error = self :: raiseError ( null , QUICKFORM_UNREGISTERED_ELEMENT , null , E_USER_WARNING , "Element '$type' does not exist in HTML_QuickForm::_loadElement()" , 'HTML_QuickForm_Erro... | Returns a form element of the given type |
31,509 | function & addElement ( $ element ) { if ( is_object ( $ element ) && is_subclass_of ( $ element , 'html_quickform_element' ) ) { $ elementObject = & $ element ; $ elementObject -> onQuickFormEvent ( 'updateValue' , null , $ this ) ; } else { $ args = func_get_args ( ) ; $ elementObject = & $ this -> _loadElement ( 'ad... | Adds an element into the form |
31,510 | function & insertElementBefore ( & $ element , $ nameAfter ) { if ( ! empty ( $ this -> _duplicateIndex [ $ nameAfter ] ) ) { $ error = self :: raiseError ( null , QUICKFORM_INVALID_ELEMENT_NAME , null , E_USER_WARNING , 'Several elements named "' . $ nameAfter . '" exist in HTML_QuickForm::insertElementBefore().' , 'H... | Inserts a new element right before the other element |
31,511 | function & addGroup ( $ elements , $ name = null , $ groupLabel = '' , $ separator = null , $ appendName = true ) { static $ anonGroups = 1 ; if ( 0 == strlen ( $ name ) ) { $ name = 'qf_group_' . $ anonGroups ++ ; $ appendName = false ; } $ group = & $ this -> addElement ( 'group' , $ name , $ groupLabel , $ elements ... | Adds an element group |
31,512 | function & getElement ( $ element ) { if ( isset ( $ this -> _elementIndex [ $ element ] ) ) { return $ this -> _elements [ $ this -> _elementIndex [ $ element ] ] ; } else { $ error = self :: raiseError ( null , QUICKFORM_NONEXIST_ELEMENT , null , E_USER_WARNING , "Element '$element' does not exist in HTML_QuickForm::... | Returns a reference to the element |
31,513 | function & getElementValue ( $ element ) { if ( ! isset ( $ this -> _elementIndex [ $ element ] ) ) { $ error = self :: raiseError ( null , QUICKFORM_NONEXIST_ELEMENT , null , E_USER_WARNING , "Element '$element' does not exist in HTML_QuickForm::getElementValue()" , 'HTML_QuickForm_Error' , true ) ; return $ error ; }... | Returns the element s raw value |
31,514 | function setElementError ( $ element , $ message = null ) { if ( ! empty ( $ message ) ) { $ this -> _errors [ $ element ] = $ message ; } else { unset ( $ this -> _errors [ $ element ] ) ; } } | Set error message for a form element |
31,515 | function getElementType ( $ element ) { if ( isset ( $ this -> _elementIndex [ $ element ] ) ) { return $ this -> _elements [ $ this -> _elementIndex [ $ element ] ] -> getType ( ) ; } return false ; } | Returns the type of the given element |
31,516 | function updateElementAttr ( $ elements , $ attrs ) { if ( is_string ( $ elements ) ) { $ elements = preg_split ( '/[ ]?,[ ]?/' , $ elements ) ; } foreach ( array_keys ( $ elements ) as $ key ) { if ( is_object ( $ elements [ $ key ] ) && is_a ( $ elements [ $ key ] , 'HTML_QuickForm_element' ) ) { $ elements [ $ key ]... | Updates Attributes for one or more elements |
31,517 | function addFormRule ( $ rule ) { if ( ! is_callable ( $ rule ) ) { return self :: raiseError ( null , QUICKFORM_INVALID_RULE , null , E_USER_WARNING , 'Callback function does not exist in HTML_QuickForm::addFormRule()' , 'HTML_QuickForm_Error' , true ) ; } $ this -> _formRules [ ] = $ rule ; } | Adds a global validation rule |
31,518 | function _recursiveFilter ( $ filter , $ value ) { if ( is_array ( $ value ) ) { $ cleanValues = array ( ) ; foreach ( $ value as $ k => $ v ) { $ cleanValues [ $ k ] = $ this -> _recursiveFilter ( $ filter , $ v ) ; } return $ cleanValues ; } else { return call_user_func ( $ filter , $ value ) ; } } | Recursively apply a filter function |
31,519 | function isRuleRegistered ( $ name , $ autoRegister = false ) { if ( is_scalar ( $ name ) && isset ( $ GLOBALS [ '_HTML_QuickForm_registered_rules' ] [ $ name ] ) ) { return true ; } elseif ( ! $ autoRegister ) { return false ; } include_once 'HTML/QuickForm/RuleRegistry.php' ; $ ruleName = false ; if ( is_object ( $ n... | Returns whether or not the given rule is supported |
31,520 | function isElementFrozen ( $ element ) { if ( isset ( $ this -> _elementIndex [ $ element ] ) ) { return $ this -> _elements [ $ this -> _elementIndex [ $ element ] ] -> isFrozen ( ) ; } return false ; } | Returns whether or not the form element is frozen |
31,521 | function freeze ( $ elementList = null ) { if ( ! isset ( $ elementList ) ) { $ this -> _freezeAll = true ; $ elementList = array ( ) ; } else { if ( ! is_array ( $ elementList ) ) { $ elementList = preg_split ( '/[ ]*,[ ]*/' , $ elementList ) ; } $ elementList = array_flip ( $ elementList ) ; } foreach ( array_keys ( ... | Displays elements without HTML input tags |
31,522 | function process ( $ callback , $ mergeFiles = true ) { if ( ! is_callable ( $ callback ) ) { return self :: raiseError ( null , QUICKFORM_INVALID_PROCESS , null , E_USER_WARNING , "Callback function does not exist in QuickForm::process()" , 'HTML_QuickForm_Error' , true ) ; } $ values = ( $ mergeFiles === true ) ? HTM... | Performs the form data processing |
31,523 | function toHtml ( $ in_data = null ) { if ( ! is_null ( $ in_data ) ) { $ this -> addElement ( 'html' , $ in_data ) ; } $ renderer = & $ this -> defaultRenderer ( ) ; $ this -> accept ( $ renderer ) ; return $ renderer -> toHtml ( ) ; } | Returns an HTML version of the form |
31,524 | function getSubmitValues ( $ mergeFiles = false ) { return $ mergeFiles ? HTML_QuickForm :: arrayMerge ( $ this -> _submitValues , $ this -> _submitFiles ) : $ this -> _submitValues ; } | Returns the values submitted by the form |
31,525 | function toArray ( $ collectHidden = false ) { include_once 'HTML/QuickForm/Renderer/Array.php' ; $ renderer = new HTML_QuickForm_Renderer_Array ( $ collectHidden ) ; $ this -> accept ( $ renderer ) ; return $ renderer -> toArray ( ) ; } | Returns the form s contents in an array . |
31,526 | function exportValues ( $ elementList = null ) { $ values = array ( ) ; if ( null === $ elementList ) { foreach ( array_keys ( $ this -> _elements ) as $ key ) { $ value = $ this -> _elements [ $ key ] -> exportValue ( $ this -> _submitValues , true ) ; if ( is_array ( $ value ) ) { $ values = HTML_QuickForm :: arrayMe... | Returns safe elements values |
31,527 | static function errorMessage ( $ value ) { static $ errorMessages ; if ( ! isset ( $ errorMessages ) ) { $ errorMessages = array ( QUICKFORM_OK => 'no error' , QUICKFORM_ERROR => 'unknown error' , QUICKFORM_INVALID_RULE => 'the rule does not exist as a registered rule' , QUICKFORM_NONEXIST_ELEMENT => 'nonexistent html ... | Return a textual error message for an QuickForm error code |
31,528 | public function print_next_wizard_page ( $ question , $ form , $ course ) { global $ CFG , $ SESSION , $ COURSE ; if ( empty ( $ question -> id ) && empty ( $ SESSION -> calculated ) ) { redirect ( 'edit.php?courseid=' . $ COURSE -> id , 'The page you are loading has expired.' , 3 ) ; } switch ( $ form -> wizardpage ) ... | This gets called by editquestion . php after the standard question is saved . |
31,529 | public function & next_wizard_form ( $ submiturl , $ question , $ wizardnow ) { global $ CFG , $ SESSION , $ COURSE ; if ( empty ( $ question -> id ) && empty ( $ SESSION -> calculated ) ) { redirect ( 'edit.php?courseid=' . $ COURSE -> id , 'The page you are loading has expired. Cannot get next wizard form.' , 3 ) ; }... | This gets called by question2 . php after the standard question is saved . |
31,530 | protected function validate_question_data ( $ question ) { $ this -> validate_text ( $ question -> questiontext ) ; if ( isset ( $ question -> generalfeedback [ 'text' ] ) ) { $ this -> validate_text ( $ question -> generalfeedback [ 'text' ] ) ; } else if ( isset ( $ question -> generalfeedback ) ) { $ this -> validat... | Validate data before save . |
31,531 | public function get_database_dataset_items ( $ definition ) { global $ CFG , $ DB ; $ databasedataitems = $ DB -> get_records_sql ( " SELECT id , itemnumber, definition, value FROM {question_dataset_items} WHERE definition = $definition order by id DESC " , array ( $ definition ) ) ; $ dataitems ... | This function get the dataset items using id as unique parameter and return an array with itemnumber as index sorted ascendant If the multiple records with the same itemnumber exist only the newest one i . e with the greatest id is used the others are ignored but not deleted . MDL - 19210 |
31,532 | public function pick_question_dataset ( $ question , $ datasetitem ) { global $ CFG , $ DB ; if ( ! $ dataitems = $ DB -> get_records_sql ( "SELECT i.id, d.name, i.value FROM {question_dataset_definitions} d, {question_dataset_items} i, {question_datasets}... | Dataset functionality . |
31,533 | public function find_dataset_names ( $ text ) { preg_match_all ( self :: PLACEHODLER_REGEX , $ text , $ matches ) ; return array_combine ( $ matches [ 1 ] , $ matches [ 1 ] ) ; } | Find the names of all datasets mentioned in a piece of question content like the question text . |
31,534 | public function find_formulas ( $ text ) { preg_match_all ( self :: FORMULAS_IN_TEXT_REGEX , $ text , $ matches ) ; return array_combine ( $ matches [ 1 ] , $ matches [ 1 ] ) ; } | Find all the formulas in a bit of text . |
31,535 | public function get_dataset_definitions_category ( $ form ) { global $ CFG , $ DB ; $ datasetdefs = array ( ) ; $ lnamemax = 30 ; if ( ! empty ( $ form -> category ) ) { $ sql = "SELECT i.*, d.* FROM {question_datasets} d, {question_dataset_definitions} i WHERE i.id = d.datasetd... | This function retrieve the item count of the available category shareable wild cards that is added as a comment displayed when a wild card with the same name is displayed in datasetdefinitions_form . php |
31,536 | public function get_short_question_name ( $ stringtoshorten , $ characterlimit ) { if ( ! empty ( $ stringtoshorten ) ) { $ returnstring = format_string ( $ stringtoshorten ) ; if ( strlen ( $ returnstring ) > $ characterlimit ) { $ returnstring = shorten_text ( $ returnstring , $ characterlimit , true ) ; } return $ r... | This function shortens a question name if it exceeds the character limit . |
31,537 | public function execute ( array $ records ) : array { return array_map ( function ( $ record ) { $ contextid = $ record -> ctxid ; context_helper :: preload_from_record ( $ record ) ; $ context = context :: instance_by_id ( $ contextid ) ; return $ context ; } , $ records ) ; } | Extract the contexts from a list of records . |
31,538 | public function col_course ( $ event ) { if ( empty ( $ event -> courseid ) || empty ( $ this -> courseshortnames [ $ event -> courseid ] ) ) { return '-' ; } else { return $ this -> courseshortnames [ $ event -> courseid ] ; } } | Generate the course column . |
31,539 | public function col_eventname ( $ event ) { if ( $ this -> filterparams -> logreader instanceof logstore_legacy \ log \ store ) { $ eventname = $ event -> eventname ; } else { $ eventname = $ event -> get_name ( ) ; } if ( $ url = $ event -> get_url ( ) ) { $ eventname = $ this -> action_link ( $ url , $ eventname , 'a... | Generate the event name column . |
31,540 | protected function domain_swap ( $ table , $ column , $ domain , $ search ) { global $ DB ; $ renames = json_decode ( get_config ( 'tool_httpsreplace' , 'renames' ) , true ) ; if ( isset ( $ renames [ $ domain ] ) ) { $ replace = preg_replace ( '|http://' . preg_quote ( $ domain ) . '|i' , 'https://' . $ renames [ $ do... | Replace http domains with https equivalent with two types of exceptions for less straightforward swaps . |
31,541 | protected function get_select_search_in_column ( $ columnname ) { global $ DB ; if ( $ DB -> sql_regex_supported ( ) ) { $ select = $ columnname . ' ' . $ DB -> sql_regex ( ) . ' ?' ; $ params = [ "(src|data)\ *=\ *[\\\"\']http://" ] ; } else { $ select = $ DB -> sql_like ( $ columnname , '?' , false ) ; $ params = [ '... | Returns SQL to be used to match embedded http links in the given column |
31,542 | public function clear_wrong ( question_attempt $ qa ) { $ response = $ qa -> get_last_qt_data ( ) ; if ( ! $ response ) { return '' ; } $ cleanresponse = $ qa -> get_question ( ) -> clear_wrong_from_response ( $ response ) ; $ output = '' ; foreach ( $ cleanresponse as $ name => $ value ) { $ attr = array ( 'type' => '... | Output hidden form fields to clear any wrong parts of the student s response . |
31,543 | public function feedback ( question_attempt $ qa , question_display_options $ options ) { $ output = '' ; $ hint = null ; if ( $ options -> feedback ) { $ output .= html_writer :: nonempty_tag ( 'div' , $ this -> specific_feedback ( $ qa ) , array ( 'class' => 'specificfeedback' ) ) ; $ hint = $ qa -> get_applicable_hi... | Generate the display of the outcome part of the question . This is the area that contains the various forms of feedback . This function generates the content of this area belonging to the question type . |
31,544 | protected function num_parts_correct ( question_attempt $ qa ) { $ a = new stdClass ( ) ; list ( $ a -> num , $ a -> outof ) = $ qa -> get_question ( ) -> get_num_parts_right ( $ qa -> get_last_qt_data ( ) ) ; if ( is_null ( $ a -> outof ) ) { return '' ; } else { return get_string ( 'yougotnright' , 'question' , $ a )... | Gereate a brief statement of how many sub - parts of this question the student got right . |
31,545 | protected function hint ( question_attempt $ qa , question_hint $ hint ) { return html_writer :: nonempty_tag ( 'div' , $ qa -> get_question ( ) -> format_hint ( $ hint , $ qa ) , array ( 'class' => 'hint' ) ) ; } | Gereate the specific feedback . This is feedback that varies according to the response the student gave . |
31,546 | public function isFullRank ( ) { for ( $ j = 0 ; $ j < $ this -> n ; ++ $ j ) { if ( $ this -> Rdiag [ $ j ] == 0 ) { return false ; } } return true ; } | Is the matrix full rank? |
31,547 | public function getH ( ) { for ( $ i = 0 ; $ i < $ this -> m ; ++ $ i ) { for ( $ j = 0 ; $ j < $ this -> n ; ++ $ j ) { if ( $ i >= $ j ) { $ H [ $ i ] [ $ j ] = $ this -> QR [ $ i ] [ $ j ] ; } else { $ H [ $ i ] [ $ j ] = 0.0 ; } } } return new PHPExcel_Shared_JAMA_Matrix ( $ H ) ; } | Return the Householder vectors |
31,548 | public function getR ( ) { for ( $ i = 0 ; $ i < $ this -> n ; ++ $ i ) { for ( $ j = 0 ; $ j < $ this -> n ; ++ $ j ) { if ( $ i < $ j ) { $ R [ $ i ] [ $ j ] = $ this -> QR [ $ i ] [ $ j ] ; } elseif ( $ i == $ j ) { $ R [ $ i ] [ $ j ] = $ this -> Rdiag [ $ i ] ; } else { $ R [ $ i ] [ $ j ] = 0.0 ; } } } return new... | Return the upper triangular factor |
31,549 | public function mark_complete ( ) { $ this -> timecompleted = time ( ) ; if ( $ this -> id ) { $ this -> update ( ) ; } else { $ this -> insert ( ) ; } $ cc = array ( 'course' => $ this -> course , 'userid' => $ this -> userid ) ; $ ccompletion = new completion_completion ( $ cc ) ; $ ccompletion -> mark_inprogress ( $... | Mark this criteria complete for the associated user |
31,550 | public function get_criteria ( ) { if ( ! $ this -> _criteria ) { global $ DB ; $ params = array ( 'id' => $ this -> criteriaid ) ; $ record = $ DB -> get_record ( 'course_completion_criteria' , $ params ) ; $ this -> attach_criteria ( completion_criteria :: factory ( ( array ) $ record ) ) ; } return $ this -> _criter... | Return the associated criteria with this completion If nothing attached load from the db |
31,551 | public static function load_template ( $ component , $ template , $ themename , $ includecomments = false ) { global $ DB , $ CFG , $ PAGE ; $ params = self :: validate_parameters ( self :: load_template_parameters ( ) , array ( 'component' => $ component , 'template' => $ template , 'themename' => $ themename , 'inclu... | Return a mustache template and all the strings it requires . |
31,552 | public static function load_template_with_dependencies ( string $ component , string $ template , string $ themename , bool $ includecomments = false , string $ lang = null ) { global $ DB , $ CFG , $ PAGE ; $ params = self :: validate_parameters ( self :: load_template_with_dependencies_parameters ( ) , [ 'component' ... | Return a mustache template and all the child templates and strings it requires . |
31,553 | public static function load_fontawesome_icon_map ( ) { $ instance = icon_system :: instance ( icon_system :: FONTAWESOME ) ; $ map = $ instance -> get_icon_name_map ( ) ; $ result = [ ] ; foreach ( $ map as $ from => $ to ) { list ( $ component , $ pix ) = explode ( ':' , $ from ) ; $ one = [ ] ; $ one [ 'component' ] ... | Return a mapping of icon names to icons . |
31,554 | function MetaTables ( $ ttype = false , $ showSchema = false , $ mask = false ) { $ false = false ; if ( $ this -> metaTablesSQL ) { if ( $ ttype == 'VIEWS' ) { $ sql = str_replace ( 'U' , 'V' , $ this -> metaTablesSQL ) ; } elseif ( false === $ ttype ) { $ sql = str_replace ( 'U' , "U' OR type='V" , $ this -> metaTabl... | split the Views Tables and procedures . |
31,555 | function MetaColumns ( $ table , $ upper = false ) { $ false = false ; if ( ! empty ( $ this -> metaColumnsSQL ) ) { $ rs = $ this -> Execute ( sprintf ( $ this -> metaColumnsSQL , $ table ) ) ; if ( $ rs === false ) return $ false ; $ retarr = array ( ) ; while ( ! $ rs -> EOF ) { $ fld = new ADOFieldObject ( ) ; $ fl... | fix a bug which prevent the metaColumns query to be executed for Sybase ASE |
31,556 | public function execute_precheck ( $ droptemptablesafter = false ) { if ( is_array ( $ this -> precheck ) ) { throw new restore_controller_exception ( 'precheck_alredy_executed' , $ this -> status ) ; } if ( $ this -> status != backup :: STATUS_NEED_PRECHECK ) { throw new restore_controller_exception ( 'cannot_precheck... | Execute the restore prechecks to detect any problem before proceed with restore |
31,557 | public function save_controller ( $ includeobj = true , $ cleanobj = false ) { $ this -> log ( 'saving controller to db' , backup :: LOG_DEBUG ) ; if ( $ includeobj ) { $ this -> checksum = $ this -> calculate_checksum ( ) ; } restore_controller_dbops :: save_controller ( $ this , $ this -> checksum , $ includeobj , $ ... | Save controller information |
31,558 | protected function apply_defaults ( ) { $ this -> log ( 'applying restore defaults' , backup :: LOG_DEBUG ) ; restore_controller_dbops :: apply_config_defaults ( $ this ) ; $ this -> set_status ( backup :: STATUS_CONFIGURED ) ; } | Apply defaults from the global admin settings |
31,559 | public function determine_format ( ) { $ decimals = $ this -> item -> get_decimals ( ) ; $ min = format_float ( $ this -> item -> grademin , $ decimals ) ; $ max = format_float ( $ this -> item -> grademax , $ decimals ) ; return new empty_element ( "$min - $max" ) ; } | Build this UI element . |
31,560 | public static function create ( Horde_Imap_Client_Tokenize $ t ) { $ t -> rewind ( ) ; $ tag = $ t -> next ( ) ; $ t -> next ( ) ; switch ( $ tag ) { case '+' : return new Horde_Imap_Client_Interaction_Server_Continuation ( $ t ) ; case '*' : return new Horde_Imap_Client_Interaction_Server_Untagged ( $ t ) ; default : ... | Auto - scan an incoming line to determine the response type . |
31,561 | function MetaPrimaryKeys ( $ table , $ owner = false ) { global $ ADODB_FETCH_MODE ; $ schema = '' ; $ this -> _findschema ( $ table , $ schema ) ; if ( ! $ schema ) $ schema = $ this -> database ; if ( $ schema ) $ schema = "and k.table_catalog like '$schema%'" ; $ sql = "select distinct k.column_name,ordinal_position... | tested with MSSQL 2000 |
31,562 | function _connect ( $ argHostname , $ argUsername , $ argPassword , $ argDatabasename , $ newconnect = false ) { if ( ! function_exists ( 'mssql_pconnect' ) ) return null ; $ this -> _connectionID = mssql_connect ( $ argHostname , $ argUsername , $ argPassword , $ newconnect ) ; if ( $ this -> _connectionID === false )... | returns true or false newconnect supported since php 5 . 1 . 0 . |
31,563 | public function add_param ( $ name , $ value , $ id = null ) { if ( ! $ id ) { $ id = $ name ; } $ this -> params [ ] = [ 'name' => $ name , 'value' => $ value , 'id' => $ id ] ; } | Add a parameter to submit with the form . |
31,564 | protected function get_role_risks_info ( ) { global $ OUTPUT ; if ( empty ( $ this -> roleid ) ) { return '' ; } $ risks = array ( ) ; $ allrisks = get_all_risks ( ) ; foreach ( $ this -> capabilities as $ capability ) { $ perm = $ this -> permissions [ $ capability -> name ] ; if ( $ perm != CAP_ALLOW ) { continue ; }... | Returns HTML risk icons . |
31,565 | protected function skip_row ( $ capability ) { $ perm = $ this -> permissions [ $ capability -> name ] ; if ( $ perm == CAP_INHERIT ) { return true ; } parent :: skip_row ( $ capability ) ; } | Returns true if the row should be skipped . |
31,566 | public function definition ( ) { $ ui = $ this -> uistage -> get_ui ( ) ; $ mform = $ this -> _form ; $ mform -> setDisableShortforms ( ) ; $ stage = $ mform -> addElement ( 'hidden' , 'stage' , $ this -> uistage -> get_stage ( ) ) ; $ mform -> setType ( 'stage' , PARAM_INT ) ; $ stage = $ mform -> addElement ( 'hidden... | The standard form definition ... obviously not much here |
31,567 | public function definition_after_data ( ) { $ buttonarray = array ( ) ; if ( ! $ this -> uistage -> is_first_stage ( ) ) { $ buttonarray [ ] = $ this -> _form -> createElement ( 'submit' , 'previous' , get_string ( 'previousstage' , 'backup' ) ) ; } else if ( $ this -> uistage instanceof backup_ui_stage ) { $ buttonarr... | Definition applied after the data is organised .. why s it here? because I want to add elements on the fly . |
31,568 | public function close_task_divs ( ) { if ( $ this -> activitydiv ) { $ this -> _form -> addElement ( 'html' , html_writer :: end_tag ( 'div' ) ) ; $ this -> activitydiv = false ; } if ( $ this -> sectiondiv ) { $ this -> _form -> addElement ( 'html' , html_writer :: end_tag ( 'div' ) ) ; $ this -> sectiondiv = false ; ... | Closes any open divs |
31,569 | public function add_setting ( backup_setting $ setting , base_task $ task = null ) { return $ this -> add_settings ( array ( array ( $ setting , $ task ) ) ) ; } | Adds the backup_setting as a element to the form |
31,570 | public function add_settings ( array $ settingstasks ) { global $ OUTPUT ; $ highestlevel = backup_setting :: ACTIVITY_LEVEL ; foreach ( $ settingstasks as $ st ) { list ( $ setting , $ task ) = $ st ; if ( $ setting -> get_level ( ) < $ highestlevel ) { $ highestlevel = $ setting -> get_level ( ) ; } } $ defaults = ar... | Adds multiple backup_settings as elements to the form |
31,571 | public function add_fixed_setting ( backup_setting $ setting , base_task $ task ) { global $ OUTPUT ; $ settingui = $ setting -> get_ui ( ) ; if ( $ setting -> get_visibility ( ) == backup_setting :: VISIBLE ) { $ this -> add_html_formatting ( $ setting ) ; switch ( $ setting -> get_status ( ) ) { case backup_setting :... | Adds a fixed or static setting to the form |
31,572 | public function add_dependencies ( backup_setting $ setting ) { $ mform = $ this -> _form ; foreach ( $ setting -> get_my_dependency_properties ( ) as $ key => $ dependency ) { call_user_func_array ( array ( $ this -> _form , 'disabledIf' ) , $ dependency ) ; } } | Adds dependencies to the form recursively |
31,573 | public function remove_element ( $ elementname ) { if ( $ this -> _form -> elementExists ( $ elementname ) ) { return $ this -> _form -> removeElement ( $ elementname ) ; } else { return false ; } } | Removes an element from the form if it exists |
31,574 | public function get_element ( $ elementname ) { if ( $ this -> _form -> elementExists ( $ elementname ) ) { return $ this -> _form -> getElement ( $ elementname ) ; } else { return false ; } } | Gets an element from the form if it exists |
31,575 | public static function get_books_by_courses ( $ courseids = array ( ) ) { global $ CFG ; $ returnedbooks = array ( ) ; $ warnings = array ( ) ; $ params = self :: validate_parameters ( self :: get_books_by_courses_parameters ( ) , array ( 'courseids' => $ courseids ) ) ; $ courses = array ( ) ; if ( empty ( $ params [ ... | Returns a list of books in a provided list of courses if no list is provided all books that the user can view will be returned . |
31,576 | public function generate ( ) { $ elts = array ( uniqid ( ) , mt_rand ( ) , getmypid ( ) , spl_object_hash ( $ this ) ) ; if ( function_exists ( 'zend_thread_id' ) ) { $ elts [ ] = zend_thread_id ( ) ; } if ( function_exists ( 'sys_getloadavg' ) && ( $ loadavg = sys_getloadavg ( ) ) ) { $ elts = array_merge ( $ elts , $... | Generate a random ID . |
31,577 | public function execute ( ) { if ( ! $ this -> get_setting_value ( 'included' ) ) { $ this -> log ( 'section skipped by _included setting' , backup :: LOG_DEBUG , $ this -> name ) ; } else { parent :: execute ( ) ; } } | Exceptionally override the execute method so based in the section_included setting we are able to skip the execution of one task completely |
31,578 | public function get_setting ( $ name ) { $ namewithprefix = 'section_' . $ this -> sectionid . '_' . $ name ; $ result = null ; foreach ( $ this -> settings as $ key => $ setting ) { if ( $ setting -> get_name ( ) == $ namewithprefix ) { if ( $ result != null ) { throw new base_task_exception ( 'multiple_settings_by_na... | Specialisation that first of all looks for the setting within the task with the the prefix added and later delegates to parent without adding anything |
31,579 | protected function define_settings ( ) { global $ DB ; $ settingprefix = 'section_' . $ this -> sectionid . '_' ; $ section = $ DB -> get_record ( 'course_sections' , array ( 'id' => $ this -> sectionid ) , '*' , MUST_EXIST ) ; $ course = $ DB -> get_record ( 'course' , array ( 'id' => $ section -> course ) , '*' , MUS... | Define the common setting that any backup section will have |
31,580 | protected function fetch_cursor_block ( ) { if ( $ this -> result ) { throw new coding_exception ( 'Unexpected non-empty result when fetching from cursor' ) ; } list ( $ this -> result , $ this -> lastbatch ) = $ this -> db -> fetch_from_cursor ( $ this -> cursorname ) ; if ( ! $ this -> result ) { throw new coding_exc... | Fetches the next block of data when using cursors . |
31,581 | public function section_title ( $ section , $ course ) { $ title = get_section_name ( $ course , $ section ) ; $ url = course_get_url ( $ course , $ section -> section , array ( 'navigation' => true ) ) ; if ( $ url ) { $ title = html_writer :: link ( $ url , $ title ) ; } return $ title ; } | Generate the section title wraps it in a link to the section page if page is to be displayed on a separate page |
31,582 | protected function section_edit_control_menu ( $ controls , $ course , $ section ) { $ o = "" ; if ( ! empty ( $ controls ) ) { $ menu = new action_menu ( ) ; $ menu -> set_menu_trigger ( get_string ( 'edit' ) ) ; $ menu -> attributes [ 'class' ] .= ' section-actions' ; foreach ( $ controls as $ value ) { $ url = empty... | Generate the edit control action menu |
31,583 | protected function section_right_content ( $ section , $ course , $ onsectionpage ) { $ o = $ this -> output -> spacer ( ) ; $ controls = $ this -> section_edit_control_items ( $ course , $ section , $ onsectionpage ) ; $ o .= $ this -> section_edit_control_menu ( $ controls , $ course , $ section ) ; return $ o ; } | Generate the content to displayed on the right part of a section before course modules are included |
31,584 | protected function section_left_content ( $ section , $ course , $ onsectionpage ) { $ o = '' ; if ( $ section -> section != 0 ) { if ( course_get_format ( $ course ) -> is_section_current ( $ section ) ) { $ o = get_accesshide ( get_string ( 'currentsection' , 'format_' . $ course -> format ) ) ; } } return $ o ; } | Generate the content to displayed on the left part of a section before course modules are included |
31,585 | protected function section_header ( $ section , $ course , $ onsectionpage , $ sectionreturn = null ) { global $ PAGE ; $ o = '' ; $ currenttext = '' ; $ sectionstyle = '' ; if ( $ section -> section != 0 ) { if ( ! $ section -> visible ) { $ sectionstyle = ' hidden' ; } if ( course_get_format ( $ course ) -> is_sectio... | Generate the display of the header part of a section before course modules are included |
31,586 | protected function section_edit_controls ( $ course , $ section , $ onsectionpage = false ) { global $ PAGE ; if ( ! $ PAGE -> user_is_editing ( ) ) { return array ( ) ; } $ controls = array ( ) ; $ items = $ this -> section_edit_control_items ( $ course , $ section , $ onsectionpage ) ; foreach ( $ items as $ key => $... | Generate the edit controls of a section |
31,587 | protected function section_summary ( $ section , $ course , $ mods ) { $ classattr = 'section main section-summary clearfix' ; $ linkclasses = '' ; if ( ! $ section -> visible ) { $ classattr .= ' hidden' ; $ linkclasses .= ' dimmed_text' ; } else if ( course_get_format ( $ course ) -> is_section_current ( $ section ) ... | Generate a summary of a section for display on the course index page |
31,588 | protected function section_activity_summary ( $ section , $ course , $ mods ) { $ modinfo = get_fast_modinfo ( $ course ) ; if ( empty ( $ modinfo -> sections [ $ section -> section ] ) ) { return '' ; } $ sectionmods = array ( ) ; $ total = 0 ; $ complete = 0 ; $ cancomplete = isloggedin ( ) && ! isguestuser ( ) ; $ c... | Generate a summary of the activites in a section |
31,589 | protected function stealth_section_header ( $ sectionno ) { $ o = '' ; $ o .= html_writer :: start_tag ( 'li' , array ( 'id' => 'section-' . $ sectionno , 'class' => 'section main clearfix orphaned hidden' ) ) ; $ o .= html_writer :: tag ( 'div' , '' , array ( 'class' => 'left side' ) ) ; $ course = course_get_format (... | Generate the header html of a stealth section |
31,590 | protected function section_hidden ( $ sectionno , $ courseorid = null ) { if ( $ courseorid ) { $ sectionname = get_section_name ( $ courseorid , $ sectionno ) ; $ strnotavailable = get_string ( 'notavailablecourse' , '' , $ sectionname ) ; } else { $ strnotavailable = get_string ( 'notavailable' ) ; } $ o = '' ; $ o .... | Generate the html for a hidden section |
31,591 | protected function section_nav_selection ( $ course , $ sections , $ displaysection ) { global $ CFG ; $ o = '' ; $ sectionmenu = array ( ) ; $ sectionmenu [ course_get_url ( $ course ) -> out ( false ) ] = get_string ( 'maincoursepage' ) ; $ modinfo = get_fast_modinfo ( $ course ) ; $ section = 1 ; $ numsections = cou... | Generate the html for the Jump to menu on a single section page . |
31,592 | protected function format_summary_text ( $ section ) { $ context = context_course :: instance ( $ section -> course ) ; $ summarytext = file_rewrite_pluginfile_urls ( $ section -> summary , 'pluginfile.php' , $ context -> id , 'course' , 'section' , $ section -> id ) ; $ options = new stdClass ( ) ; $ options -> noclea... | Generate html for a section summary text |
31,593 | protected function reverseJsonInContext ( array & $ context ) { if ( ! $ context ) { return ; } foreach ( $ context as $ key => $ val ) { if ( ! $ val || ! is_string ( $ val ) || ! ( $ val [ 0 ] == '{' || $ val [ 0 ] == '[' ) ) { continue ; } $ json = @ json_decode ( $ val ) ; if ( is_object ( $ json ) || is_array ( $ ... | Reverses JSON encoded PHP arrays and objects so that they log better . |
31,594 | protected function load_config ( ) { if ( ! isset ( $ this -> config ) ) { $ name = $ this -> get_name ( ) ; $ this -> config = get_config ( "enrol_$name" ) ; } } | Makes sure config is loaded and cached . |
31,595 | public function get_config ( $ name , $ default = NULL ) { $ this -> load_config ( ) ; return isset ( $ this -> config -> $ name ) ? $ this -> config -> $ name : $ default ; } | Returns plugin config value |
31,596 | public function set_config ( $ name , $ value ) { $ pluginname = $ this -> get_name ( ) ; $ this -> load_config ( ) ; if ( $ value === NULL ) { unset ( $ this -> config -> $ name ) ; } else { $ this -> config -> $ name = $ value ; } set_config ( $ name , $ value , "enrol_$pluginname" ) ; } | Sets plugin config value |
31,597 | public function update_user_enrol ( stdClass $ instance , $ userid , $ status = NULL , $ timestart = NULL , $ timeend = NULL ) { global $ DB , $ USER , $ CFG ; $ name = $ this -> get_name ( ) ; if ( $ instance -> enrol !== $ name ) { throw new coding_exception ( 'invalid enrol instance!' ) ; } if ( ! $ ue = $ DB -> get... | Store user_enrolments changes and trigger event . |
31,598 | public function can_edit_instance ( $ instance ) { $ context = context_course :: instance ( $ instance -> courseid ) ; return has_capability ( 'enrol/' . $ instance -> enrol . ':config' , $ context ) ; } | Return whether or not given the current state it is possible to edit an instance of this enrolment plugin in the course . Used by the standard editing UI to generate a link to the edit instance form if editing is allowed . |
31,599 | public function get_unenrolself_link ( $ instance ) { global $ USER , $ CFG , $ DB ; $ name = $ this -> get_name ( ) ; if ( $ instance -> enrol !== $ name ) { throw new coding_exception ( 'invalid enrol instance!' ) ; } if ( $ instance -> courseid == SITEID ) { return NULL ; } if ( ! enrol_is_enabled ( $ name ) ) { ret... | Returns list of unenrol links for all enrol instances in course . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.