idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
33,600 | public static function remove_related_competency ( $ competencyid , $ relatedcompetencyid ) { $ params = self :: validate_parameters ( self :: remove_related_competency_parameters ( ) , array ( 'competencyid' => $ competencyid , 'relatedcompetencyid' => $ relatedcompetencyid ) ) ; $ competency = api :: read_competency ... | Removes a related competency . |
33,601 | public static function set_course_competency_ruleoutcome ( $ coursecompetencyid , $ ruleoutcome ) { $ params = self :: validate_parameters ( self :: set_course_competency_ruleoutcome_parameters ( ) , array ( 'coursecompetencyid' => $ coursecompetencyid , 'ruleoutcome' => $ ruleoutcome , ) ) ; $ coursecompetency = new c... | Change the ruleoutcome of a course competency . |
33,602 | public static function grade_competency_parameters ( ) { $ userid = new external_value ( PARAM_INT , 'User ID' , VALUE_REQUIRED ) ; $ competencyid = new external_value ( PARAM_INT , 'Competency ID' , VALUE_REQUIRED ) ; $ grade = new external_value ( PARAM_INT , 'New grade' , VALUE_REQUIRED ) ; $ note = new external_val... | Returns description of external function parameters . |
33,603 | public static function grade_competency ( $ userid , $ competencyid , $ grade , $ note = null ) { global $ USER , $ PAGE ; $ params = self :: validate_parameters ( self :: grade_competency_parameters ( ) , array ( 'userid' => $ userid , 'competencyid' => $ competencyid , 'grade' => $ grade , 'note' => $ note ) ) ; $ uc... | Grade a competency . |
33,604 | public static function grade_competency_in_plan ( $ planid , $ competencyid , $ grade , $ note = null ) { global $ USER , $ PAGE ; $ params = self :: validate_parameters ( self :: grade_competency_in_plan_parameters ( ) , array ( 'planid' => $ planid , 'competencyid' => $ competencyid , 'grade' => $ grade , 'note' => $... | Grade a competency in a plan . |
33,605 | public static function grade_competency_in_course ( $ courseid , $ userid , $ competencyid , $ grade , $ note = null ) { global $ USER , $ PAGE , $ DB ; $ params = self :: validate_parameters ( self :: grade_competency_in_course_parameters ( ) , array ( 'courseid' => $ courseid , 'userid' => $ userid , 'competencyid' =... | Grade a competency in a course . |
33,606 | public static function unlink_plan_from_template ( $ planid ) { $ params = self :: validate_parameters ( self :: unlink_plan_from_template_parameters ( ) , array ( 'planid' => $ planid , ) ) ; $ plan = new plan ( $ params [ 'planid' ] ) ; self :: validate_context ( $ plan -> get_context ( ) ) ; return api :: unlink_pla... | Unlink the plan from the template . |
33,607 | public static function template_viewed ( $ id ) { $ params = self :: validate_parameters ( self :: view_book_parameters ( ) , array ( 'id' => $ id ) ) ; $ template = api :: read_template ( $ params [ 'id' ] ) ; self :: validate_context ( $ template -> get_context ( ) ) ; return api :: template_viewed ( $ params [ 'id' ... | Log the template viewed event . |
33,608 | public static function update_course_competency_settings ( $ courseid , $ settings ) { $ params = self :: validate_parameters ( self :: update_course_competency_settings_parameters ( ) , array ( 'courseid' => $ courseid , 'settings' => $ settings ) ) ; $ context = context_course :: instance ( $ params [ 'courseid' ] ) ... | Update the course competency settings |
33,609 | public static function delete_evidence ( $ id ) { $ params = self :: validate_parameters ( self :: delete_evidence_parameters ( ) , array ( 'id' => $ id ) ) ; $ evidence = api :: read_evidence ( $ params [ 'id' ] ) ; $ uc = api :: get_user_competency_by_id ( $ evidence -> get ( 'usercompetencyid' ) ) ; self :: validate... | External function delete_evidence . |
33,610 | public function write ( $ data , $ eol = false ) { if ( $ eol ) { $ buffer = $ this -> _buffer ; $ debug = $ this -> client_debug ; $ this -> _buffer = '' ; $ this -> client_debug = true ; if ( fwrite ( $ this -> _stream , $ buffer . $ data . ( $ eol ? "\r\n" : '' ) ) === false ) { throw new Horde_Imap_Client_Exception... | Writes data to the IMAP output stream . |
33,611 | public function writeLiteral ( $ data , $ length , $ binary = false ) { $ this -> _buffer = '' ; $ success = false ; if ( $ data instanceof Horde_Stream ) { $ data = $ data -> stream ; } if ( rewind ( $ data ) ) { $ success = true ; while ( ! feof ( $ data ) ) { if ( ( ( $ read_data = fread ( $ data , 8192 ) ) === fals... | Writes literal data to the IMAP output stream . |
33,612 | public function read ( $ size = null ) { $ got_data = false ; $ literal_len = null ; $ token = new Horde_Imap_Client_Tokenize ( ) ; do { if ( feof ( $ this -> _stream ) ) { $ this -> close ( ) ; $ this -> _params [ 'debug' ] -> info ( 'ERROR: Server closed the connection.' ) ; throw new Horde_Imap_Client_Exception ( Ho... | Read data from incoming IMAP stream . |
33,613 | public function definition ( ) { $ mform = $ this -> _form ; $ data = $ this -> _customdata [ 'data' ] ; $ options = $ this -> _customdata [ 'options' ] ; $ mform -> addElement ( 'filemanager' , 'files_filemanager' , get_string ( 'files' ) , null , $ options ) ; $ mform -> addElement ( 'hidden' , 'returnurl' , $ data -... | Add elements to this form . |
33,614 | public function validation ( $ data , $ files ) { $ errors = array ( ) ; $ draftitemid = $ data [ 'files_filemanager' ] ; if ( file_is_draft_area_limit_reached ( $ draftitemid , $ this -> _customdata [ 'options' ] [ 'areamaxbytes' ] ) ) { $ errors [ 'files_filemanager' ] = get_string ( 'userquotalimit' , 'error' ) ; } ... | Validate incoming data . |
33,615 | protected function _initOb ( ) { register_shutdown_function ( array ( $ this , 'shutdown' ) ) ; $ this -> _alerts = new Horde_Imap_Client_Base_Alerts ( ) ; $ this -> _alerts -> attach ( $ this ) ; $ this -> _debug = ( $ debug = $ this -> getParam ( 'debug' ) ) ? new Horde_Imap_Client_Base_Debug ( $ debug ) : new Horde_... | Do initialization tasks . |
33,616 | public function _setInit ( $ key = null , $ val = null ) { if ( is_null ( $ key ) ) { $ this -> _init = array ( ) ; } elseif ( is_null ( $ val ) ) { unset ( $ this -> _init [ $ key ] ) ; } else { switch ( $ key ) { case 'capability' : if ( $ ci = $ this -> getParam ( 'capability_ignore' ) ) { $ ignored = array ( ) ; fo... | Set an initialization value . |
33,617 | protected function _initCache ( $ current = false ) { $ c = $ this -> getParam ( 'cache' ) ; if ( empty ( $ c [ 'fields' ] ) ) { return false ; } if ( is_null ( $ this -> _cache ) ) { if ( isset ( $ c [ 'backend' ] ) ) { $ backend = $ c [ 'backend' ] ; } elseif ( isset ( $ c [ 'cacheob' ] ) ) { $ backend = new Horde_Im... | Initialize the Horde_Imap_Client_Cache object if necessary . |
33,618 | public function getParam ( $ key ) { switch ( $ key ) { case 'password' : if ( isset ( $ this -> _params [ $ key ] ) && ( $ this -> _params [ $ key ] instanceof Horde_Imap_Client_Base_Password ) ) { return $ this -> _params [ $ key ] -> getPassword ( ) ; } if ( ! empty ( $ this -> _params [ '_passencrypt' ] ) ) { try {... | Returns a value from the internal params array . |
33,619 | public function setParam ( $ key , $ val ) { switch ( $ key ) { case 'password' : if ( $ val instanceof Horde_Imap_Client_Base_Password ) { break ; } try { $ encrypt_key = $ this -> _getEncryptKey ( ) ; if ( strlen ( $ encrypt_key ) ) { $ secret = new Horde_Secret ( ) ; $ val = $ secret -> write ( $ encrypt_key , $ val... | Sets a configuration parameter value . |
33,620 | protected function _capability ( ) { if ( ! isset ( $ this -> _init [ 'capability' ] ) ) { $ this -> _initCapability ( ) ; } return ( $ args = func_num_args ( ) ) ? $ this -> _init [ 'capability' ] -> query ( func_get_arg ( 0 ) , ( $ args > 1 ) ? func_get_arg ( 1 ) : null ) : $ this -> _init [ 'capability' ] ; } | Query server capability . |
33,621 | public function login ( ) { if ( ! $ this -> _isAuthenticated && $ this -> _login ( ) ) { if ( $ this -> getParam ( 'id' ) ) { try { $ this -> sendID ( ) ; $ this -> _sendCmd ( $ this -> _pipeline ( ) ) ; } catch ( Horde_Imap_Client_Exception_NoSupportExtension $ e ) { } } if ( $ this -> getParam ( 'comparator' ) ) { t... | Login to the IMAP server . |
33,622 | public function openMailbox ( $ mailbox , $ mode = Horde_Imap_Client :: OPEN_AUTO ) { $ this -> login ( ) ; $ change = false ; $ mailbox = Horde_Imap_Client_Mailbox :: get ( $ mailbox ) ; if ( $ mode == Horde_Imap_Client :: OPEN_AUTO ) { if ( is_null ( $ this -> _selected ) || ! $ mailbox -> equals ( $ this -> _selecte... | Open a mailbox . |
33,623 | protected function _changeSelected ( $ mailbox = null , $ mode = null ) { $ this -> _mode = $ mode ; if ( is_null ( $ mailbox ) ) { $ this -> _selected = null ; } else { $ this -> _selected = clone $ mailbox ; $ this -> _mailboxOb ( ) -> reset ( ) ; } } | Called when the selected mailbox is changed . |
33,624 | protected function _mailboxOb ( $ mailbox = null ) { $ name = is_null ( $ mailbox ) ? strval ( $ this -> _selected ) : strval ( $ mailbox ) ; if ( ! isset ( $ this -> _temp [ 'mailbox_ob' ] [ $ name ] ) ) { $ this -> _temp [ 'mailbox_ob' ] [ $ name ] = new Horde_Imap_Client_Base_Mailbox ( ) ; } return $ this -> _temp [... | Return the Horde_Imap_Client_Base_Mailbox object . |
33,625 | public function createMailbox ( $ mailbox , array $ opts = array ( ) ) { $ this -> login ( ) ; if ( ! $ this -> _capability ( 'CREATE-SPECIAL-USE' ) ) { unset ( $ opts [ 'special_use' ] ) ; } $ this -> _createMailbox ( Horde_Imap_Client_Mailbox :: get ( $ mailbox ) , $ opts ) ; } | Create a mailbox . |
33,626 | public function deleteMailbox ( $ mailbox ) { $ this -> login ( ) ; $ mailbox = Horde_Imap_Client_Mailbox :: get ( $ mailbox ) ; $ this -> _deleteMailbox ( $ mailbox ) ; $ this -> _deleteMailboxPost ( $ mailbox ) ; } | Delete a mailbox . |
33,627 | protected function _deleteMailboxPost ( Horde_Imap_Client_Mailbox $ mailbox ) { if ( $ this -> _initCache ( ) ) { $ this -> _cache -> deleteMailbox ( $ mailbox ) ; } unset ( $ this -> _temp [ 'mailbox_ob' ] [ strval ( $ mailbox ) ] ) ; try { $ this -> subscribeMailbox ( $ mailbox , false ) ; } catch ( Horde_Imap_Client... | Actions to perform after a mailbox delete . |
33,628 | public function renameMailbox ( $ old , $ new ) { $ old = Horde_Imap_Client_Mailbox :: get ( $ old ) ; $ new = Horde_Imap_Client_Mailbox :: get ( $ new ) ; $ base = $ this -> listMailboxes ( $ old , Horde_Imap_Client :: MBOX_SUBSCRIBED , array ( 'delimiter' => true ) ) ; if ( empty ( $ base ) ) { $ base = $ this -> lis... | Rename a mailbox . |
33,629 | public function subscribeMailbox ( $ mailbox , $ subscribe = true ) { $ this -> login ( ) ; $ this -> _subscribeMailbox ( Horde_Imap_Client_Mailbox :: get ( $ mailbox ) , ( bool ) $ subscribe ) ; } | Manage subscription status for a mailbox . |
33,630 | public function listMailboxes ( $ pattern , $ mode = Horde_Imap_Client :: MBOX_ALL , array $ options = array ( ) ) { $ this -> login ( ) ; $ pattern = is_array ( $ pattern ) ? array_unique ( $ pattern ) : array ( $ pattern ) ; $ plist = array ( ) ; foreach ( $ pattern as $ val ) { if ( $ val instanceof Horde_Imap_Clien... | Obtain a list of mailboxes matching a pattern . |
33,631 | public function statusMultiple ( $ mailboxes , $ flags = Horde_Imap_Client :: STATUS_ALL , array $ opts = array ( ) ) { return $ this -> status ( $ mailboxes , $ flags , $ opts ) ; } | Perform a STATUS call on multiple mailboxes at the same time . |
33,632 | public function expunge ( $ mailbox , array $ options = array ( ) ) { $ this -> openMailbox ( $ mailbox , Horde_Imap_Client :: OPEN_READWRITE ) ; if ( $ this -> _mode == Horde_Imap_Client :: OPEN_READONLY ) { throw new Horde_Imap_Client_Exception ( Horde_Imap_Client_Translation :: r ( "Cannot expunge read-only mailbox.... | Expunge deleted messages from the given mailbox . |
33,633 | public function copy ( $ source , $ dest , array $ options = array ( ) ) { $ this -> openMailbox ( $ source , empty ( $ options [ 'move' ] ) ? Horde_Imap_Client :: OPEN_AUTO : Horde_Imap_Client :: OPEN_READWRITE ) ; if ( empty ( $ options [ 'ids' ] ) ) { $ options [ 'ids' ] = $ this -> getIdsOb ( Horde_Imap_Client_Ids ... | Copy messages to another mailbox . |
33,634 | public function allAclRights ( ) { $ this -> login ( ) ; $ rights = array ( Horde_Imap_Client :: ACL_LOOKUP , Horde_Imap_Client :: ACL_READ , Horde_Imap_Client :: ACL_SEEN , Horde_Imap_Client :: ACL_WRITE , Horde_Imap_Client :: ACL_INSERT , Horde_Imap_Client :: ACL_POST , Horde_Imap_Client :: ACL_ADMINISTER ) ; if ( $ ... | Return master list of ACL rights available on the server . |
33,635 | public function resolveIds ( Horde_Imap_Client_Mailbox $ mailbox , Horde_Imap_Client_Ids $ ids , $ convert = 0 ) { $ map = $ this -> _mailboxOb ( $ mailbox ) -> map ; if ( $ ids -> special ) { if ( ! $ convert && $ ids -> all && $ ids -> sequence ) { $ res = $ this -> status ( $ mailbox , Horde_Imap_Client :: STATUS_ME... | Resolves an IDs object into a list of IDs . |
33,636 | public function getSyncToken ( $ mailbox ) { $ out = array ( ) ; foreach ( $ this -> _syncStatus ( $ mailbox ) as $ key => $ val ) { $ out [ ] = $ key . $ val ; } return base64_encode ( implode ( ',' , $ out ) ) ; } | Returns a unique token for the current mailbox synchronization status . |
33,637 | public function sync ( $ mailbox , $ token , array $ opts = array ( ) ) { if ( ( $ token = base64_decode ( $ token , true ) ) === false ) { throw new Horde_Imap_Client_Exception_Sync ( 'Bad token.' , Horde_Imap_Client_Exception_Sync :: BAD_TOKEN ) ; } $ sync = array ( ) ; foreach ( explode ( ',' , $ token ) as $ val ) ... | Synchronize a mailbox from a sync token . |
33,638 | protected function _moveCache ( Horde_Imap_Client_Mailbox $ to , $ map , $ uidvalid ) { if ( ! $ this -> _initCache ( ) ) { return ; } $ c = $ this -> getParam ( 'cache' ) ; if ( in_array ( strval ( $ to ) , $ c [ 'fetch_ignore' ] ) ) { $ this -> _debug -> info ( sprintf ( 'CACHE: Ignoring moving FETCH data (%s => %s)'... | Moves cache entries from the current mailbox to another mailbox . |
33,639 | protected function _getSearchCache ( $ type , $ options ) { $ status = $ this -> status ( $ this -> _selected , Horde_Imap_Client :: STATUS_HIGHESTMODSEQ | Horde_Imap_Client :: STATUS_UIDVALIDITY ) ; if ( empty ( $ status [ 'highestmodseq' ] ) ) { return null ; } ksort ( $ options ) ; $ cache = hash ( 'md5' , $ type . ... | Retrieve data from the search cache . |
33,640 | protected function _setSearchCache ( $ data , $ sdata ) { $ sdata [ 'metadata' ] [ self :: CACHE_SEARCH ] [ $ sdata [ 'id' ] ] = $ data ; $ this -> _cache -> setMetaData ( $ this -> _selected , null , $ sdata [ 'metadata' ] ) ; if ( $ this -> _debug -> debug ) { $ this -> _debug -> info ( sprintf ( 'SEARCH: Saved %s to... | Set data in the search cache . |
33,641 | protected function _updateModSeq ( $ modseq ) { if ( ! $ this -> _initCache ( true ) ) { return false ; } $ mbox_ob = $ this -> _mailboxOb ( ) ; $ uidvalid = $ mbox_ob -> getStatus ( Horde_Imap_Client :: STATUS_UIDVALIDITY ) ; $ md = $ this -> _cache -> getMetaData ( $ this -> _selected , $ uidvalid , array ( self :: C... | Updates the cached MODSEQ value . |
33,642 | protected function _cacheFields ( ) { $ c = $ this -> getParam ( 'cache' ) ; $ out = $ c [ 'fields' ] ; if ( ! $ this -> _capability ( ) -> isEnabled ( 'CONDSTORE' ) ) { unset ( $ out [ Horde_Imap_Client :: FETCH_FLAGS ] ) ; } return $ out ; } | Provide the list of available caching fields . |
33,643 | protected function _syncStatus ( $ mailbox ) { $ status = $ this -> status ( $ mailbox , Horde_Imap_Client :: STATUS_HIGHESTMODSEQ | Horde_Imap_Client :: STATUS_MESSAGES | Horde_Imap_Client :: STATUS_UIDNEXT_FORCE | Horde_Imap_Client :: STATUS_UIDVALIDITY ) ; $ fields = array ( 'uidnext' , 'uidvalidity' ) ; if ( empty ... | Return the current mailbox synchronization status . |
33,644 | protected function _getUidByMessageId ( $ mailbox , $ msgid ) { if ( ! $ msgid ) { return null ; } $ query = new Horde_Imap_Client_Search_Query ( ) ; $ query -> headerText ( 'Message-ID' , $ msgid ) ; $ res = $ this -> search ( $ mailbox , $ query , array ( 'results' => array ( Horde_Imap_Client :: SEARCH_RESULTS_MAX )... | Get a message UID by the Message - ID . Returns the last message in a mailbox that matches . |
33,645 | private function _getPearTrace ( PEAR_Error $ error ) { $ pear_error = '' ; $ backtrace = $ error -> getBacktrace ( ) ; if ( ! empty ( $ backtrace ) ) { $ pear_error .= 'PEAR backtrace:' . "\n\n" ; foreach ( $ backtrace as $ frame ) { $ pear_error .= ( isset ( $ frame [ 'class' ] ) ? $ frame [ 'class' ] : '' ) . ( isse... | Return a trace for the PEAR error . |
33,646 | public static function add_userids_for_context ( \ core_privacy \ local \ request \ userlist $ userlist , string $ itemtype = null ) { if ( empty ( $ userlist ) ) { return ; } $ params = [ 'contextid' => $ userlist -> get_context ( ) -> id , 'component' => $ userlist -> get_component ( ) ] ; $ sql = "SELECT userid ... | Add users to a userlist who have favourites within the specified context . |
33,647 | public static function get_favourites_info_for_user ( int $ userid , \ context $ context , string $ component , string $ itemtype , int $ itemid ) { global $ DB ; $ params = [ 'userid' => $ userid , 'component' => $ component , 'itemtype' => $ itemtype , 'itemid' => $ itemid , 'contextid' => $ context -> id ] ; if ( ! ... | Get favourites data for the specified user in the specified component item type and item ID . |
33,648 | public static function delete_favourites_for_all_users ( \ context $ context , string $ component , string $ itemtype , int $ itemid = 0 ) { global $ DB ; $ params = [ 'component' => $ component , 'itemtype' => $ itemtype , 'contextid' => $ context -> id ] ; $ select = "component = :component AND itemtype =:itemtype AN... | Delete all favourites for all users in the specified contexts and component area . |
33,649 | public static function delete_favourites_for_userlist ( \ core_privacy \ local \ request \ approved_userlist $ userlist , string $ itemtype , int $ itemid = 0 ) { global $ DB ; $ userids = $ userlist -> get_userids ( ) ; if ( empty ( $ userids ) ) { return ; } $ context = $ userlist -> get_context ( ) ; list ( $ usersq... | Delete all favourites for the specified users in the specified context component area and item type . |
33,650 | public static function delete_favourites_for_user ( approved_contextlist $ contextlist , string $ component , string $ itemtype , int $ itemid = 0 ) { global $ DB ; $ userid = $ contextlist -> get_user ( ) -> id ; list ( $ insql , $ inparams ) = $ DB -> get_in_or_equal ( $ contextlist -> get_contextids ( ) , SQL_PARAMS... | Delete all favourites for the specified user in the specified contexts . |
33,651 | protected function create_navigation ( \ stdClass $ tree ) { if ( $ this -> firstelement ) { $ html = \ html_writer :: start_tag ( 'ul' , [ 'class' => 'treeview parent block_tree list' , 'id' => 'my-tree' ] ) ; $ this -> firstelement = false ; } else { $ html = \ html_writer :: start_tag ( 'ul' , [ 'class' => 'parent' ... | Creates the navigation list html . Why this and not a template? My attempts at trying to get a recursive template working failed . |
33,652 | protected function process_quiz_slot_tags ( $ data ) { global $ DB ; $ data = ( object ) $ data ; $ data -> slotid = $ this -> get_new_parentid ( 'quiz_question_instance' ) ; if ( $ this -> task -> is_samesite ( ) && $ tag = core_tag_tag :: get ( $ data -> tagid , 'id, name' ) ) { $ data -> tagname = $ tag -> name ; } ... | Process a quiz_slot_tags restore |
33,653 | function SelectLimit ( $ sql , $ nrows = - 1 , $ offset = - 1 , $ inputarr = false , $ secs2cache = 0 ) { if ( $ nrows > 0 ) { if ( $ offset <= 0 ) $ str = " ROWS $nrows " ; else { $ a = $ offset + 1 ; $ b = $ offset + $ nrows ; $ str = " ROWS $a TO $b" ; } } else { $ a = $ offset + 1 ; $ str = " ROWS $a TO 999999999" ... | SELECT FIRST 5 SKIP 2 col1 col2 FROM TABLE |
33,654 | public static function get_user_devices ( $ appid , $ userid = 0 ) { global $ USER ; $ params = self :: validate_parameters ( self :: get_user_devices_parameters ( ) , array ( 'appid' => $ appid , 'userid' => $ userid , ) ) ; $ context = context_system :: instance ( ) ; self :: validate_context ( $ context ) ; if ( emp... | Return the list of mobile devices that are registered in Moodle for the given user . |
33,655 | function factory ( $ type ) { include_once ( ADODB_DIR . "/drivers/adodb-$type.inc.php" ) ; $ obj = NewADOConnection ( $ type ) ; if ( ! is_object ( $ obj ) ) $ obj = new PEAR_Error ( 'Unknown Database Driver: ' . $ dsninfo [ 'phptype' ] , - 1 ) ; return $ obj ; } | Create a new DB object for the specified database type |
33,656 | function connect ( $ dsn , $ options = false ) { if ( is_array ( $ dsn ) ) { $ dsninfo = $ dsn ; } else { $ dsninfo = DB :: parseDSN ( $ dsn ) ; } switch ( $ dsninfo [ "phptype" ] ) { case 'pgsql' : $ type = 'postgres7' ; break ; case 'ifx' : $ type = 'informix9' ; break ; default : $ type = $ dsninfo [ "phptype" ] ; b... | Create a new DB object and connect to the specified database |
33,657 | function isError ( $ value ) { if ( ! is_object ( $ value ) ) return false ; $ class = strtolower ( get_class ( $ value ) ) ; return $ class == 'pear_error' || is_subclass_of ( $ value , 'pear_error' ) || $ class == 'db_error' || is_subclass_of ( $ value , 'db_error' ) ; } | Tell whether a result code from a DB method is an error |
33,658 | function parseDSN ( $ dsn ) { if ( is_array ( $ dsn ) ) { return $ dsn ; } $ parsed = array ( 'phptype' => false , 'dbsyntax' => false , 'protocol' => false , 'hostspec' => false , 'database' => false , 'username' => false , 'password' => false ) ; if ( ( $ pos = strpos ( $ dsn , '://' ) ) !== false ) { $ str = substr ... | Parse a data source name |
33,659 | function assertExtension ( $ name ) { if ( ! extension_loaded ( $ name ) ) { $ dlext = ( strncmp ( PHP_OS , 'WIN' , 3 ) === 0 ) ? '.dll' : '.so' ; @ dl ( $ name . $ dlext ) ; } if ( ! extension_loaded ( $ name ) ) { return false ; } return true ; } | Load a PHP database extension if it is not loaded already . |
33,660 | public static function get_files_parameters ( ) { return new external_function_parameters ( array ( 'contextid' => new external_value ( PARAM_INT , 'context id Set to -1 to use contextlevel and instanceid.' ) , 'component' => new external_value ( PARAM_TEXT , 'component' ) , 'filearea' => new external_value ( PARAM_TEX... | Returns description of get_files parameters |
33,661 | public static function get_files_returns ( ) { return new external_single_structure ( array ( 'parents' => new external_multiple_structure ( new external_single_structure ( array ( 'contextid' => new external_value ( PARAM_INT , '' ) , 'component' => new external_value ( PARAM_COMPONENT , '' ) , 'filearea' => new exter... | Returns description of get_files returns |
33,662 | public static function upload_parameters ( ) { return new external_function_parameters ( array ( 'contextid' => new external_value ( PARAM_INT , 'context id' , VALUE_DEFAULT , null ) , 'component' => new external_value ( PARAM_COMPONENT , 'component' ) , 'filearea' => new external_value ( PARAM_AREA , 'file area' ) , '... | Returns description of upload parameters |
33,663 | public static function upload_returns ( ) { return new external_single_structure ( array ( 'contextid' => new external_value ( PARAM_INT , '' ) , 'component' => new external_value ( PARAM_COMPONENT , '' ) , 'filearea' => new external_value ( PARAM_AREA , '' ) , 'itemid' => new external_value ( PARAM_INT , '' ) , 'filep... | Returns description of upload returns |
33,664 | protected static function get_records ( $ userid ) { global $ DB ; $ sql = "SELECT * FROM {user_info_data} uda JOIN {user_info_field} uif ON uda.fieldid = uif.id WHERE uda.userid = :userid AND uif.datatype = :datatype" ; $ params = [ 'userid' => $ ... | Get records related to this plugin and user . |
33,665 | public function data_preprocessing ( & $ defaultvalues ) { if ( isset ( $ defaultvalues [ 'conditions' ] ) ) { $ conditions = unserialize ( $ defaultvalues [ 'conditions' ] ) ; $ defaultvalues [ 'timespent' ] = $ conditions -> timespent ; $ defaultvalues [ 'completed' ] = $ conditions -> completed ; $ defaultvalues [ '... | Enforce defaults here |
33,666 | public function header ( $ lesson , $ cm , $ currenttab = '' , $ extraeditbuttons = false , $ lessonpageid = null , $ extrapagetitle = null ) { global $ CFG ; $ activityname = format_string ( $ lesson -> name , true , $ lesson -> course ) ; if ( empty ( $ extrapagetitle ) ) { $ title = $ this -> page -> course -> short... | Returns the header for the lesson module |
33,667 | public function lesson_inaccessible ( $ message ) { global $ CFG ; $ output = $ this -> output -> box_start ( 'generalbox boxaligncenter' ) ; $ output .= $ this -> output -> box_start ( 'center' ) ; $ output .= $ message ; $ output .= $ this -> output -> box ( '<a href="' . $ CFG -> wwwroot . '/course/view.php?id=' . $... | Returns HTML for a lesson inaccessible message |
33,668 | public function login_prompt ( lesson $ lesson , $ failedattempt = false ) { global $ CFG ; $ output = $ this -> output -> box_start ( 'password-form' ) ; $ output .= $ this -> output -> box_start ( 'generalbox boxaligncenter' ) ; $ output .= '<form id="password" method="post" action="' . $ CFG -> wwwroot . '/mod/lesso... | Returns HTML to prompt the user to log in |
33,669 | public function dependancy_errors ( $ dependentlesson , $ errors ) { $ output = $ this -> output -> box_start ( 'generalbox boxaligncenter' ) ; $ output .= get_string ( 'completethefollowingconditions' , 'lesson' , $ dependentlesson -> name ) ; $ output .= $ this -> output -> box ( implode ( '<br />' . get_string ( 'an... | Returns HTML to display dependancy errors |
33,670 | public function message ( $ message , single_button $ button = null ) { $ output = $ this -> output -> box_start ( 'generalbox boxaligncenter' ) ; $ output .= $ message ; if ( $ button !== null ) { $ output .= $ this -> output -> box ( $ this -> output -> render ( $ button ) , 'lessonbutton standardbutton' ) ; } $ outp... | Returns HTML to display a message |
33,671 | public function continue_links ( lesson $ lesson , $ lastpageseenid ) { global $ CFG ; $ output = $ this -> output -> box ( get_string ( 'youhaveseen' , 'lesson' ) , 'generalbox boxaligncenter' ) ; $ output .= $ this -> output -> box_start ( 'center' ) ; $ yeslink = html_writer :: link ( new moodle_url ( '/mod/lesson/v... | Returns HTML to display a continue button |
33,672 | public function display_page ( lesson $ lesson , lesson_page $ page , $ attempt ) { ob_start ( ) ; echo $ page -> display ( $ this , $ attempt ) ; $ output = ob_get_contents ( ) ; ob_end_clean ( ) ; return $ output ; } | Returns HTML to display a page to the user |
33,673 | public function display_edit_collapsed ( lesson $ lesson , $ pageid ) { global $ DB , $ CFG ; $ manager = lesson_page_type_manager :: get ( $ lesson ) ; $ qtypes = $ manager -> get_page_type_strings ( ) ; $ npages = count ( $ lesson -> load_all_pages ( ) ) ; $ table = new html_table ( ) ; $ table -> head = array ( get_... | Returns HTML to display a collapsed edit form |
33,674 | public function add_page_links ( lesson $ lesson , $ prevpageid = false ) { global $ CFG ; $ links = array ( ) ; $ importquestionsurl = new moodle_url ( '/mod/lesson/import.php' , array ( 'id' => $ this -> page -> cm -> id , 'pageid' => $ prevpageid ) ) ; $ links [ ] = html_writer :: link ( $ importquestionsurl , get_s... | Returns HTML to display the add page links |
33,675 | public function progress_bar ( lesson $ lesson , $ progress = null ) { $ context = context_module :: instance ( $ this -> page -> cm -> id ) ; if ( ! $ lesson -> progressbar ) { return '' ; } if ( has_capability ( 'mod/lesson:manage' , $ context ) ) { return $ this -> output -> notification ( get_string ( 'progressbart... | Returns HTML to display a progress bar of progression through a lesson |
33,676 | public function slideshow_start ( lesson $ lesson ) { $ attributes = array ( ) ; $ attributes [ 'class' ] = 'slideshow' ; $ attributes [ 'style' ] = 'background-color:' . $ lesson -> properties ( ) -> bgcolor . ';height:' . $ lesson -> properties ( ) -> height . 'px;width:' . $ lesson -> properties ( ) -> width . 'px;'... | Returns HTML to show the start of a slideshow |
33,677 | public function paragraph ( $ contents , $ class = '' ) { $ attributes = array ( ) ; if ( $ class !== '' ) { $ attributes [ 'class' ] = $ class ; } $ output = html_writer :: tag ( 'p' , $ contents , $ attributes ) ; return $ output ; } | Returns a P tag containing contents |
33,678 | protected function col_number ( $ questionstat ) { if ( $ this -> is_calculated_question_summary ( $ questionstat ) ) { return '' ; } if ( ! isset ( $ questionstat -> question -> number ) ) { return '' ; } $ number = $ questionstat -> question -> number ; if ( isset ( $ questionstat -> subqdisplayorder ) ) { $ number =... | The question number . |
33,679 | protected function col_s ( $ questionstat ) { if ( $ this -> is_calculated_question_summary ( $ questionstat ) ) { list ( $ min , $ max ) = $ questionstat -> get_min_max_of ( 's' ) ; $ min = $ min ? : 0 ; $ max = $ max ? : 0 ; return $ this -> format_range ( $ min , $ max ) ; } else if ( ! isset ( $ questionstat -> s )... | The number of attempts at this question . |
33,680 | protected function col_sd ( $ questionstat ) { if ( $ this -> is_calculated_question_summary ( $ questionstat ) ) { list ( $ min , $ max ) = $ questionstat -> get_min_max_of ( 'sd' ) ; return $ this -> format_percentage_range ( $ min , $ max ) ; } else if ( is_null ( $ questionstat -> sd ) || $ questionstat -> maxmark ... | The standard deviation of the fractions . |
33,681 | protected function col_random_guess_score ( $ questionstat ) { if ( $ this -> is_calculated_question_summary ( $ questionstat ) ) { list ( $ min , $ max ) = $ questionstat -> get_min_max_of ( 'randomguessscore' ) ; return $ this -> format_percentage_range ( $ min , $ max ) ; } else if ( is_null ( $ questionstat -> rand... | An estimate of the fraction a student would get by guessing randomly . |
33,682 | protected function col_intended_weight ( $ questionstat ) { if ( $ this -> is_calculated_question_summary ( $ questionstat ) ) { list ( $ min , $ max ) = $ questionstat -> get_min_max_of ( 'maxmark' ) ; if ( is_null ( $ min ) && is_null ( $ max ) ) { return '' ; } else { $ min = quiz_report_scale_summarks_as_percentage... | The intended question weight . Maximum mark for the question as a percentage of maximum mark for the quiz . That is the indended influence this question on the student s overall mark . |
33,683 | protected function col_effective_weight ( $ questionstat ) { global $ OUTPUT ; if ( $ this -> is_calculated_question_summary ( $ questionstat ) ) { list ( $ min , $ max ) = $ questionstat -> get_min_max_of ( 'effectiveweight' ) ; if ( is_null ( $ min ) && is_null ( $ max ) ) { return '' ; } else { list ( , $ negcovar )... | The effective question weight . That is an estimate of the actual influence this question has on the student s overall mark . |
33,684 | protected function col_discrimination_index ( $ questionstat ) { if ( $ this -> is_calculated_question_summary ( $ questionstat ) ) { list ( $ min , $ max ) = $ questionstat -> get_min_max_of ( 'discriminationindex' ) ; if ( isset ( $ max ) ) { $ min = $ min ? : 0 ; } if ( is_numeric ( $ min ) ) { $ min = $ this -> for... | Discrimination index . This is the product moment correlation coefficient between the fraction for this question and the average fraction for the other questions in this quiz . |
33,685 | protected function col_discriminative_efficiency ( $ questionstat ) { if ( $ this -> is_calculated_question_summary ( $ questionstat ) ) { list ( $ min , $ max ) = $ questionstat -> get_min_max_of ( 'discriminativeefficiency' ) ; if ( ! is_numeric ( $ min ) && ! is_numeric ( $ max ) ) { return '' ; } else { return $ th... | Discrimination efficiency similar to but different from the Discrimination index . |
33,686 | protected function is_dubious_question ( $ questionstat ) { if ( $ this -> is_calculated_question_summary ( $ questionstat ) ) { list ( $ discriminativeefficiency ) = $ questionstat -> get_min_max_of ( 'discriminativeefficiency' ) ; } else { $ discriminativeefficiency = $ questionstat -> discriminativeefficiency ; } if... | This method encapsulates the test for wheter a question should be considered dubious . |
33,687 | protected function format_percentage ( float $ number , bool $ fraction = true , int $ decimals = 2 ) { $ coefficient = $ fraction ? 100 : 1 ; return get_string ( 'percents' , 'moodle' , format_float ( $ number * $ coefficient , $ decimals ) ) ; } | Format a number to a localised percentage with specified decimal points . |
33,688 | public function definition ( ) { $ mform = $ this -> _form ; $ mform -> addElement ( 'header' , 'database' , get_string ( 'dbexport' , 'tool_dbtransfer' ) ) ; $ mform -> addElement ( 'textarea' , 'description' , get_string ( 'description' ) , array ( 'rows' => 5 , 'cols' => 60 ) ) ; $ mform -> setType ( 'description' ,... | Define the export form . |
33,689 | public static function build_editor_options ( \ context $ context ) { global $ CFG ; return [ 'context' => $ context , 'maxfiles' => EDITOR_UNLIMITED_FILES , 'maxbytes' => $ CFG -> maxbytes , 'noclean' => true , 'autosave' => false ] ; } | Build the editor options using the given context . |
33,690 | protected function add_default_hidden_elements ( $ mform ) { global $ USER ; $ mform -> addElement ( 'hidden' , 'id' ) ; $ mform -> setType ( 'id' , PARAM_INT ) ; $ mform -> setDefault ( 'id' , 0 ) ; $ mform -> addElement ( 'hidden' , 'userid' ) ; $ mform -> setType ( 'userid' , PARAM_INT ) ; $ mform -> setDefault ( 'u... | Add the list of hidden elements that should appear in this form each time . These elements will never be visible to the user . |
33,691 | protected function add_event_duration_elements ( $ mform ) { $ group = [ ] ; $ group [ ] = $ mform -> createElement ( 'radio' , 'duration' , null , get_string ( 'durationnone' , 'calendar' ) , 0 ) ; $ group [ ] = $ mform -> createElement ( 'radio' , 'duration' , null , get_string ( 'durationuntil' , 'calendar' ) , 1 ) ... | Add the various elements to express the duration options available for an event . |
33,692 | protected function add_event_repeat_elements ( $ mform ) { $ mform -> addElement ( 'checkbox' , 'repeat' , get_string ( 'repeatevent' , 'calendar' ) , null ) ; $ mform -> addElement ( 'text' , 'repeats' , get_string ( 'repeatweeksl' , 'calendar' ) , 'maxlength="10" size="10"' ) ; $ mform -> setType ( 'repeats' , PARAM_... | Add the repeat elements for the form when creating a new event . |
33,693 | public static function check_can_manage_data_registry ( $ contextid = false ) { if ( $ contextid ) { $ context = \ context_helper :: instance_by_id ( $ contextid ) ; } else { $ context = \ context_system :: instance ( ) ; } require_capability ( 'tool/dataprivacy:managedataregistry' , $ context ) ; } | Checks if the current user can manage the data registry at the provided id . |
33,694 | public static function get_assigned_privacy_officer_roles ( ) { $ roleids = [ ] ; $ configroleids = explode ( ',' , str_replace ( ' ' , '' , get_config ( 'tool_dataprivacy' , 'dporoles' ) ) ) ; if ( ! empty ( $ configroleids ) ) { $ capableroles = array_keys ( get_roles_with_capability ( 'tool/dataprivacy:managedatareq... | Fetches the list of configured privacy officer roles . |
33,695 | public static function get_dpo_role_names ( ) : array { global $ DB ; $ dporoleids = self :: get_assigned_privacy_officer_roles ( ) ; $ dponames = array ( ) ; if ( ! empty ( $ dporoleids ) ) { list ( $ insql , $ inparams ) = $ DB -> get_in_or_equal ( $ dporoleids ) ; $ dponames = $ DB -> get_fieldset_select ( 'role' , ... | Fetches the role shortnames of Data Protection Officer roles . |
33,696 | public static function get_site_dpos ( ) { $ dporoles = self :: get_assigned_privacy_officer_roles ( ) ; $ dpos = [ ] ; $ context = context_system :: instance ( ) ; foreach ( $ dporoles as $ roleid ) { $ allnames = get_all_user_name_fields ( true , 'u' ) ; $ fields = 'u.id, u.confirmed, u.username, ' . $ allnames . ', ... | Fetches the list of users with the Privacy Officer role . |
33,697 | public static function get_data_requests_count ( $ userid = 0 , $ statuses = [ ] , $ types = [ ] , $ creationmethods = [ ] ) { global $ DB , $ USER ; $ count = 0 ; $ sqlparams = [ ] ; $ sqlconditions = [ ] ; if ( ! empty ( $ statuses ) ) { list ( $ statusinsql , $ sqlparams ) = $ DB -> get_in_or_equal ( $ statuses , SQ... | Fetches the count of data request records based on the given parameters . |
33,698 | public static function find_ongoing_request_types_for_users ( array $ userids ) : array { global $ DB ; if ( empty ( $ userids ) ) { return [ ] ; } $ nonpendingstatuses = [ self :: DATAREQUEST_STATUS_COMPLETE , self :: DATAREQUEST_STATUS_CANCELLED , self :: DATAREQUEST_STATUS_REJECTED , self :: DATAREQUEST_STATUS_DOWNL... | Find whether any ongoing requests exist for a set of users . |
33,699 | public static function is_active ( $ status ) { $ finalstatuses = [ self :: DATAREQUEST_STATUS_COMPLETE , self :: DATAREQUEST_STATUS_CANCELLED , self :: DATAREQUEST_STATUS_REJECTED , self :: DATAREQUEST_STATUS_DOWNLOAD_READY , self :: DATAREQUEST_STATUS_EXPIRED , self :: DATAREQUEST_STATUS_DELETED , ] ; return ! in_arr... | Determines whether a request is active or not based on its status . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.