idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
28,400
public final function add_record_snapshot ( $ tablename , $ record ) { global $ DB , $ CFG ; if ( $ this -> triggered ) { throw new \ coding_exception ( 'It is not possible to add snapshots after triggering of events' ) ; } if ( $ tablename === 'course_modules' && $ record instanceof \ cm_info ) { $ record = $ record -...
Add cached data that will be most probably used in event observers .
28,401
public final function get_record_snapshot ( $ tablename , $ id ) { global $ DB ; if ( $ this -> restored ) { throw new \ coding_exception ( 'It is not possible to get snapshots from restored events' ) ; } if ( isset ( $ this -> recordsnapshots [ $ tablename ] [ $ id ] ) ) { return clone ( $ this -> recordsnapshots [ $ ...
Returns cached record or fetches data from database if not cached .
28,402
public function __isset ( $ name ) { if ( $ name === 'level' ) { debugging ( 'level property is deprecated, use edulevel property instead' , DEBUG_DEVELOPER ) ; return isset ( $ this -> data [ 'edulevel' ] ) ; } return isset ( $ this -> data [ $ name ] ) ; }
Is data property set?
28,403
protected function openReader ( $ filePath ) { $ this -> zip = new \ ZipArchive ( ) ; if ( $ this -> zip -> open ( $ filePath ) === true ) { $ this -> sheetIterator = new SheetIterator ( $ filePath , $ this -> getOptions ( ) ) ; } else { throw new IOException ( "Could not open $filePath for reading." ) ; } }
Opens the file at the given file path to make it ready to be read .
28,404
function registerShutdownFunc ( $ func , $ args = array ( ) ) { if ( ! isset ( $ GLOBALS [ '_PEAR_SHUTDOWN_REGISTERED' ] ) ) { register_shutdown_function ( "_PEAR_call_destructors" ) ; $ GLOBALS [ '_PEAR_SHUTDOWN_REGISTERED' ] = true ; } $ GLOBALS [ '_PEAR_shutdown_funcs' ] [ ] = array ( $ func , $ args ) ; }
Use this function to register a shutdown method for static classes .
28,405
function isError ( $ data , $ code = null ) { if ( ! is_a ( $ data , 'PEAR_Error' ) ) { return false ; } if ( is_null ( $ code ) ) { return true ; } elseif ( is_string ( $ code ) ) { return $ data -> getMessage ( ) == $ code ; } return $ data -> getCode ( ) == $ code ; }
Tell whether a value is a PEAR error .
28,406
function setErrorHandling ( $ mode = null , $ options = null ) { if ( isset ( $ this ) && is_a ( $ this , 'PEAR' ) ) { $ setmode = & $ this -> _default_error_mode ; $ setoptions = & $ this -> _default_error_options ; } else { $ setmode = & $ GLOBALS [ '_PEAR_default_error_mode' ] ; $ setoptions = & $ GLOBALS [ '_PEAR_d...
Sets how errors generated by this object should be handled . Can be invoked both in objects and statically . If called statically setErrorHandling sets the default behaviour for all PEAR objects . If called in an object setErrorHandling sets the default behaviour for that object .
28,407
function _checkDelExpect ( $ error_code ) { $ deleted = false ; foreach ( $ this -> _expected_errors as $ key => $ error_array ) { if ( in_array ( $ error_code , $ error_array ) ) { unset ( $ this -> _expected_errors [ $ key ] [ array_search ( $ error_code , $ error_array ) ] ) ; $ deleted = true ; } if ( 0 == count ( ...
This method checks unsets an error code if available
28,408
function delExpect ( $ error_code ) { $ deleted = false ; if ( ( is_array ( $ error_code ) && ( 0 != count ( $ error_code ) ) ) ) { foreach ( $ error_code as $ key => $ error ) { $ deleted = $ this -> _checkDelExpect ( $ error ) ? true : false ; } return $ deleted ? true : PEAR :: raiseError ( "The expected error you s...
This method deletes all occurences of the specified element from the expected error codes stack .
28,409
function & throwError ( $ message = null , $ code = null , $ userinfo = null ) { if ( isset ( $ this ) && is_a ( $ this , 'PEAR' ) ) { $ a = & $ this -> raiseError ( $ message , $ code , null , null , $ userinfo ) ; return $ a ; } $ a = & PEAR :: raiseError ( $ message , $ code , null , null , $ userinfo ) ; return $ a...
Simpler form of raiseError with fewer options . In most cases message code and userinfo are enough .
28,410
function pushErrorHandling ( $ mode , $ options = null ) { $ stack = & $ GLOBALS [ '_PEAR_error_handler_stack' ] ; if ( isset ( $ this ) && is_a ( $ this , 'PEAR' ) ) { $ def_mode = & $ this -> _default_error_mode ; $ def_options = & $ this -> _default_error_options ; } else { $ def_mode = & $ GLOBALS [ '_PEAR_default_...
Push a new error handler on top of the error handler options stack . With this you can easily override the actual error handler for some code and restore it later with popErrorHandling .
28,411
function popErrorHandling ( ) { $ stack = & $ GLOBALS [ '_PEAR_error_handler_stack' ] ; array_pop ( $ stack ) ; list ( $ mode , $ options ) = $ stack [ sizeof ( $ stack ) - 1 ] ; array_pop ( $ stack ) ; if ( isset ( $ this ) && is_a ( $ this , 'PEAR' ) ) { $ this -> setErrorHandling ( $ mode , $ options ) ; } else { PE...
Pop the last error handler used
28,412
function loadExtension ( $ ext ) { if ( extension_loaded ( $ ext ) ) { return true ; } if ( function_exists ( 'dl' ) === false || ini_get ( 'enable_dl' ) != 1 || ini_get ( 'safe_mode' ) == 1 ) { return false ; } if ( OS_WINDOWS ) { $ suffix = '.dll' ; } elseif ( PHP_OS == 'HP-UX' ) { $ suffix = '.sl' ; } elseif ( PHP_O...
OS independant PHP extension load . Remember to take care on the correct extension name for case sensitive OSes .
28,413
public function PEAR_Error ( $ message = 'unknown error' , $ code = null , $ mode = null , $ options = null , $ userinfo = null ) { self :: __construct ( $ message , $ code , $ mode , $ options , $ userinfo ) ; }
Old syntax of class constructor for backward compatibility .
28,414
function getBacktrace ( $ frame = null ) { if ( defined ( 'PEAR_IGNORE_BACKTRACE' ) ) { return null ; } if ( $ frame === null ) { return $ this -> backtrace ; } return $ this -> backtrace [ $ frame ] ; }
Get the call backtrace from where the error was generated . Supported with PHP 4 . 3 . 0 or newer .
28,415
function toString ( ) { $ modes = array ( ) ; $ levels = array ( E_USER_NOTICE => 'notice' , E_USER_WARNING => 'warning' , E_USER_ERROR => 'error' ) ; if ( $ this -> mode & PEAR_ERROR_CALLBACK ) { if ( is_array ( $ this -> callback ) ) { $ callback = ( is_object ( $ this -> callback [ 0 ] ) ? strtolower ( get_class ( $...
Make a string representation of this object .
28,416
public function quote ( $ text , \ Mustache_LambdaHelper $ helper ) { $ content = trim ( $ text ) ; $ content = $ helper -> render ( $ content ) ; $ content = str_replace ( '"' , '\\"' , $ content ) ; $ content = preg_replace ( '([{}]{2,3})' , '{{=<% %>=}}${0}<%={{ }}=%>' , $ content ) ; return '"' . $ content . '"' ; ...
Wrap content in quotes and escape all quotes used .
28,417
protected function init ( ) { $ this -> context = \ context_system :: instance ( ) ; $ this -> data [ 'objecttable' ] = 'post' ; $ this -> data [ 'crud' ] = 'd' ; $ this -> data [ 'edulevel' ] = self :: LEVEL_PARTICIPATING ; }
Set basic event properties .
28,418
public function addField ( $ field , $ after = null ) { if ( $ this -> getField ( $ field -> getName ( ) ) ) { throw new coding_exception ( 'Duplicate field ' . $ field -> getName ( ) . ' specified in table ' . $ this -> getName ( ) ) ; } $ prevfield = null ; $ nextfield = null ; if ( ! $ after ) { $ allfields = $ this...
Add one field to the table allowing to specify the desired order If it s not specified then the field is added at the end
28,419
public function addKey ( $ key , $ after = null ) { if ( $ this -> getKey ( $ key -> getName ( ) ) ) { throw new coding_exception ( 'Duplicate key ' . $ key -> getName ( ) . ' specified in table ' . $ this -> getName ( ) ) ; } $ newfields = $ key -> getFields ( ) ; $ allindexes = $ this -> getIndexes ( ) ; foreach ( $ ...
Add one key to the table allowing to specify the desired order If it s not specified then the key is added at the end
28,420
public function addIndex ( $ index , $ after = null ) { if ( $ this -> getIndex ( $ index -> getName ( ) ) ) { throw new coding_exception ( 'Duplicate index ' . $ index -> getName ( ) . ' specified in table ' . $ this -> getName ( ) ) ; } $ newfields = $ index -> getFields ( ) ; $ allkeys = $ this -> getKeys ( ) ; fore...
Add one index to the table allowing to specify the desired order If it s not specified then the index is added at the end
28,421
public function getField ( $ fieldname ) { $ i = $ this -> findFieldInArray ( $ fieldname ) ; if ( $ i !== null ) { return $ this -> fields [ $ i ] ; } return null ; }
Returns one xmldb_field
28,422
public function findFieldInArray ( $ fieldname ) { foreach ( $ this -> fields as $ i => $ field ) { if ( $ fieldname == $ field -> getName ( ) ) { return $ i ; } } return null ; }
Returns the position of one field in the array .
28,423
public function orderFields ( ) { $ result = $ this -> orderElements ( $ this -> fields ) ; if ( $ result ) { $ this -> setFields ( $ result ) ; return true ; } else { return false ; } }
This function will reorder the array of fields
28,424
public function getKey ( $ keyname ) { $ i = $ this -> findKeyInArray ( $ keyname ) ; if ( $ i !== null ) { return $ this -> keys [ $ i ] ; } return null ; }
Returns one xmldb_key
28,425
public function findKeyInArray ( $ keyname ) { foreach ( $ this -> keys as $ i => $ key ) { if ( $ keyname == $ key -> getName ( ) ) { return $ i ; } } return null ; }
Returns the position of one key in the array .
28,426
public function orderKeys ( ) { $ result = $ this -> orderElements ( $ this -> keys ) ; if ( $ result ) { $ this -> setKeys ( $ result ) ; return true ; } else { return false ; } }
This function will reorder the array of keys
28,427
public function getIndex ( $ indexname ) { $ i = $ this -> findIndexInArray ( $ indexname ) ; if ( $ i !== null ) { return $ this -> indexes [ $ i ] ; } return null ; }
Returns one xmldb_index
28,428
public function findIndexInArray ( $ indexname ) { foreach ( $ this -> indexes as $ i => $ index ) { if ( $ indexname == $ index -> getName ( ) ) { return $ i ; } } return null ; }
Returns the position of one index in the array .
28,429
public function orderIndexes ( ) { $ result = $ this -> orderElements ( $ this -> indexes ) ; if ( $ result ) { $ this -> setIndexes ( $ result ) ; return true ; } else { return false ; } }
This function will reorder the array of indexes
28,430
public function deleteField ( $ fieldname ) { $ field = $ this -> getField ( $ fieldname ) ; if ( $ field ) { $ i = $ this -> findFieldInArray ( $ fieldname ) ; $ prevfield = $ this -> getField ( $ field -> getPrevious ( ) ) ; $ nextfield = $ this -> getField ( $ field -> getNext ( ) ) ; if ( $ prevfield ) { $ prevfiel...
Delete one field from the table
28,431
public function deleteKey ( $ keyname ) { $ key = $ this -> getKey ( $ keyname ) ; if ( $ key ) { $ i = $ this -> findKeyInArray ( $ keyname ) ; $ prevkey = $ this -> getKey ( $ key -> getPrevious ( ) ) ; $ nextkey = $ this -> getKey ( $ key -> getNext ( ) ) ; if ( $ prevkey ) { $ prevkey -> setNext ( $ key -> getNext ...
Delete one key from the table
28,432
public function deleteIndex ( $ indexname ) { $ index = $ this -> getIndex ( $ indexname ) ; if ( $ index ) { $ i = $ this -> findIndexInArray ( $ indexname ) ; $ previndex = $ this -> getIndex ( $ index -> getPrevious ( ) ) ; $ nextindex = $ this -> getIndex ( $ index -> getNext ( ) ) ; if ( $ previndex ) { $ previnde...
Delete one index from the table
28,433
public function calculateHash ( $ recursive = false ) { if ( ! $ this -> loaded ) { $ this -> hash = null ; } else { $ key = $ this -> name . $ this -> comment ; if ( $ this -> fields ) { foreach ( $ this -> fields as $ fie ) { $ field = $ this -> getField ( $ fie -> getName ( ) ) ; if ( $ recursive ) { $ field -> calc...
This function calculate and set the hash of one xmldb_table
28,434
public function xmlOutput ( ) { $ o = '' ; $ o .= ' <TABLE NAME="' . $ this -> name . '"' ; if ( $ this -> comment ) { $ o .= ' COMMENT="' . htmlspecialchars ( $ this -> comment ) . '"' ; } $ o .= '>' . "\n" ; if ( $ this -> fields ) { $ o .= ' <FIELDS>' . "\n" ; foreach ( $ this -> fields as $ field ) { $ o .=...
This function will output the XML text for one table
28,435
public function add_field ( $ name , $ type , $ precision = null , $ unsigned = null , $ notnull = null , $ sequence = null , $ default = null , $ previous = null ) { $ field = new xmldb_field ( $ name , $ type , $ precision , $ unsigned , $ notnull , $ sequence , $ default ) ; $ this -> addField ( $ field , $ previous...
This function will add one new field to the table with all its attributes defined
28,436
public function add_key ( $ name , $ type , $ fields , $ reftable = null , $ reffields = null ) { $ key = new xmldb_key ( $ name , $ type , $ fields , $ reftable , $ reffields ) ; $ this -> addKey ( $ key ) ; }
This function will add one new key to the table with all its attributes defined
28,437
public function add_index ( $ name , $ type , $ fields , $ hints = array ( ) ) { $ index = new xmldb_index ( $ name , $ type , $ fields , $ hints ) ; $ this -> addIndex ( $ index ) ; }
This function will add one new index to the table with all its attributes defined
28,438
public function process_common ( $ quest ) { $ question = $ this -> defaultquestion ( ) ; $ text = $ quest -> QUESTION_BLOCK -> text ; $ questiontext = $ this -> cleaned_text_field ( $ text ) ; $ question -> questiontext = $ questiontext [ 'text' ] ; $ question -> questiontextformat = $ questiontext [ 'format' ] ; if (...
Create common parts of question
28,439
protected function process_fblank ( $ quest , & $ questions ) { $ question = $ this -> process_common ( $ quest ) ; $ question -> qtype = 'shortanswer' ; $ question -> usecase = 0 ; $ answers = array ( ) ; $ fractions = array ( ) ; $ feedbacks = array ( ) ; $ feedback = array ( ) ; foreach ( $ quest -> feedback as $ fb...
Process Fill in the Blank Questions Parse a fillintheblank rawquestion and add the result to the array of questions already parsed .
28,440
public function process_ma ( $ quest , & $ questions ) { $ question = $ this -> process_common ( $ quest ) ; $ question -> qtype = 'multichoice' ; $ question = $ this -> add_blank_combined_feedback ( $ question ) ; $ question -> single = 0 ; $ answers = $ quest -> responses ; $ correctanswers = array ( ) ; foreach ( $ ...
Process Multiple Choice Questions With Multiple Answers . Parse a multichoice multianswer rawquestion and add the result to the array of questions already parsed .
28,441
public function process_essay ( $ quest , & $ questions ) { $ question = $ this -> process_common ( $ quest ) ; $ question -> qtype = 'essay' ; $ question -> feedback = array ( ) ; foreach ( $ quest -> feedback as $ feedback ) { if ( $ feedback -> ident == 'solution' ) { $ question -> graderinfo = $ this -> cleaned_tex...
Process Essay Questions Parse an essay rawquestion and add the result to the array of questions already parsed .
28,442
public function process_matching ( $ quest , & $ questions ) { $ ddmatchisinstalled = question_bank :: is_qtype_installed ( 'ddmatch' ) ; $ question = $ this -> process_common ( $ quest ) ; $ question = $ this -> add_blank_combined_feedback ( $ question ) ; $ question -> valid = true ; if ( $ ddmatchisinstalled ) { $ q...
Process Matching Questions Parse a matching rawquestion and add the result to the array of questions already parsed .
28,443
public function process_category ( $ xml , & $ questions ) { $ title = $ this -> getpath ( $ xml , array ( 'questestinterop' , '#' , 'assessment' , 0 , '@' , 'title' ) , '' , true ) ; $ dummyquestion = new stdClass ( ) ; $ dummyquestion -> qtype = 'category' ; $ dummyquestion -> category = $ this -> cleaninput ( $ this...
Add a category question entry based on the assessment title
28,444
public function strip_applet_tags_get_mathml ( $ string ) { if ( stristr ( $ string , '</APPLET>' ) === false ) { return $ string ; } else { while ( stristr ( $ string , '</APPLET>' ) !== false ) { preg_match ( "/(.*)\<applet.*value=\"(\<math\>.*\<\/math\>)\".*\<\/applet\>(.*)/i" , $ string , $ mathmls ) ; $ string = $...
Strip the applet tag used by Blackboard to render mathml formulas keeping the mathml tag .
28,445
public function set_assign ( \ assign $ assign ) { if ( $ this -> is_triggered ( ) ) { throw new \ coding_exception ( 'set_assign() must be done before triggerring of event' ) ; } if ( $ assign -> get_context ( ) -> id != $ this -> get_context ( ) -> id ) { throw new \ coding_exception ( 'Invalid assign isntance suppli...
Set assign instance for this event .
28,446
public function get_assign ( ) { if ( $ this -> is_restored ( ) ) { throw new \ coding_exception ( 'get_assign() is intended for event observers only' ) ; } if ( ! isset ( $ this -> assign ) ) { debugging ( 'assign property should be initialised in each event' , DEBUG_DEVELOPER ) ; global $ CFG ; require_once ( $ CFG -...
Get assign instance .
28,447
public function set_legacy_logdata ( $ action = '' , $ info = '' , $ url = '' ) { $ fullurl = 'view.php?id=' . $ this -> contextinstanceid ; if ( $ url != '' ) { $ fullurl .= '&' . $ url ; } $ this -> legacylogdata = array ( $ this -> courseid , 'assign' , $ action , $ fullurl , $ info , $ this -> contextinstanceid ) ;...
Sets the legacy event log data .
28,448
public static function update_flag ( $ qubaid , $ questionid , $ qaid , $ slot , $ checksum , $ newstate ) { global $ CFG , $ DB ; $ params = self :: validate_parameters ( self :: update_flag_parameters ( ) , array ( 'qubaid' => $ qubaid , 'questionid' => $ questionid , 'qaid' => $ qaid , 'slot' => $ slot , 'checksum' ...
Update the flag state of a question attempt .
28,449
public static function submit_tags_form ( $ questionid , $ contextid , $ formdata ) { global $ DB , $ CFG ; $ data = [ ] ; $ result = [ 'status' => false ] ; $ params = self :: validate_parameters ( self :: submit_tags_form_parameters ( ) , [ 'questionid' => $ questionid , 'contextid' => $ contextid , 'formdata' => $ f...
Handles the tags form submission .
28,450
public static function get_random_question_summaries ( $ categoryid , $ includesubcategories , $ tagids , $ contextid , $ limit = 0 , $ offset = 0 ) { global $ DB , $ PAGE ; $ params = self :: validate_parameters ( self :: get_random_question_summaries_parameters ( ) , [ 'categoryid' => $ categoryid , 'includesubcatego...
Gets the list of random questions for the given criteria . The questions will be exported in a summaries format and won t include all of the question data .
28,451
public static function doSendEncode ( $ alist , array $ opts = array ( ) ) { $ out = array ( ) ; foreach ( $ alist as $ ob ) { if ( ! empty ( $ opts [ 'defserver' ] ) ) { foreach ( $ ob -> raw_addresses as $ ob2 ) { if ( is_null ( $ ob2 -> host ) ) { $ ob2 -> host = $ opts [ 'defserver' ] ; } } } $ out [ ] = $ ob -> wr...
Do send encoding for addresses .
28,452
protected function createOrGetZip ( ) { if ( ! isset ( $ this -> zip ) ) { $ this -> zip = new \ ZipArchive ( ) ; $ zipFilePath = $ this -> getZipFilePath ( ) ; $ this -> zip -> open ( $ zipFilePath , \ ZipArchive :: CREATE | \ ZipArchive :: OVERWRITE ) ; } return $ this -> zip ; }
Returns the already created ZipArchive instance or creates one if none exists .
28,453
public function addFileToArchive ( $ rootFolderPath , $ localFilePath , $ existingFileMode = self :: EXISTING_FILES_OVERWRITE ) { $ this -> addFileToArchiveWithCompressionMethod ( $ rootFolderPath , $ localFilePath , $ existingFileMode , \ ZipArchive :: CM_DEFAULT ) ; }
Adds the given file located under the given root folder to the archive . The file will be compressed .
28,454
public function closeArchiveAndCopyToStream ( $ streamPointer ) { $ zip = $ this -> createOrGetZip ( ) ; $ zip -> close ( ) ; unset ( $ this -> zip ) ; $ this -> copyZipToStream ( $ streamPointer ) ; }
Closes the archive and copies it into the given stream
28,455
protected function copyZipToStream ( $ pointer ) { $ zipFilePointer = fopen ( $ this -> getZipFilePath ( ) , 'r' ) ; stream_copy_to_stream ( $ zipFilePointer , $ pointer ) ; fclose ( $ zipFilePointer ) ; }
Streams the contents of the zip file into the given stream
28,456
protected function get_course_options ( $ instance , $ coursecontext ) { global $ DB ; if ( $ instance -> id ) { $ where = 'WHERE c.id = :courseid' ; $ params = array ( 'courseid' => $ instance -> customint1 ) ; $ existing = array ( ) ; } else { $ where = '' ; $ params = array ( ) ; $ instanceparams = array ( 'enrol' =...
Return an array of valid options for the courses .
28,457
protected static function define_other_properties ( ) { return [ 'foruser' => [ 'type' => user_summary_exporter :: read_properties_definition ( ) , ] , 'requestedbyuser' => [ 'type' => user_summary_exporter :: read_properties_definition ( ) , 'optional' => true ] , 'dpouser' => [ 'type' => user_summary_exporter :: read...
Other properties definition .
28,458
public function setAxisOptionsProperties ( $ axis_labels , $ horizontal_crosses_value = null , $ horizontal_crosses = null , $ axis_orientation = null , $ major_tmt = null , $ minor_tmt = null , $ minimum = null , $ maximum = null , $ major_unit = null , $ minor_unit = null ) { $ this -> axisOptions [ 'axis_labels' ] =...
Set Axis Options Properties
28,459
public function setFillParameters ( $ color , $ alpha = 0 , $ type = self :: EXCEL_COLOR_TYPE_ARGB ) { $ this -> fillProperties = $ this -> setColorProperties ( $ color , $ alpha , $ type ) ; }
Set Fill Property
28,460
public function setLineParameters ( $ color , $ alpha = 0 , $ type = self :: EXCEL_COLOR_TYPE_ARGB ) { $ this -> lineProperties = $ this -> setColorProperties ( $ color , $ alpha , $ type ) ; }
Set Line Property
28,461
private function setShadowProperiesMapValues ( array $ properties_map , & $ reference = null ) { $ base_reference = $ reference ; foreach ( $ properties_map as $ property_key => $ property_val ) { if ( is_array ( $ property_val ) ) { if ( $ reference === null ) { $ reference = & $ this -> shadowProperties [ $ property_...
Set Shadow Properties from Maped Values
28,462
private function setShadowBlur ( $ blur ) { if ( $ blur !== null ) { $ this -> shadowProperties [ 'blur' ] = ( string ) $ this -> getExcelPointsWidth ( $ blur ) ; } return $ this ; }
Set Shadow Blur
28,463
private function setShadowAngle ( $ angle ) { if ( $ angle !== null ) { $ this -> shadowProperties [ 'direction' ] = ( string ) $ this -> getExcelPointsAngle ( $ angle ) ; } return $ this ; }
Set Shadow Angle
28,464
private function setShadowDistance ( $ distance ) { if ( $ distance !== null ) { $ this -> shadowProperties [ 'distance' ] = ( string ) $ this -> getExcelPointsWidth ( $ distance ) ; } return $ this ; }
Set Shadow Distance
28,465
public function add_analysable_results ( array $ results ) : bool { $ any = false ; foreach ( $ results as $ timesplittingid => $ result ) { if ( ! empty ( $ result -> result ) ) { $ this -> filesbytimesplitting [ $ timesplittingid ] [ ] = $ result -> result ; $ any = true ; } } if ( empty ( $ any ) ) { return false ; ...
Stores the analysis results .
28,466
private function add_model_metadata ( array & $ data , \ core_analytics \ local \ time_splitting \ base $ timesplitting , \ core_analytics \ local \ target \ base $ target ) { global $ CFG ; $ metadata = array ( 'timesplitting' => $ timesplitting -> get_id ( ) , 'nfeatures' => count ( current ( $ data ) ) - 1 , 'moodle...
Adds target metadata to the dataset .
28,467
protected function _removeSubjLeader ( & $ str , $ keepblob = false ) { $ ret = false ; if ( ! strlen ( $ str ) ) { return $ ret ; } if ( $ len = strspn ( $ str , " \t" ) ) { $ str = substr ( $ str , $ len ) ; $ ret = true ; } $ i = 0 ; if ( ! $ keepblob ) { while ( isset ( $ str [ $ i ] ) && ( $ str [ $ i ] === '[' ) ...
Remove all prefix text of the subject that matches the subj - leader ABNF .
28,468
public static function get_comments ( $ gradeid , $ pageno , $ draft ) { global $ DB ; $ comments = array ( ) ; $ params = array ( 'gradeid' => $ gradeid , 'pageno' => $ pageno , 'draft' => 1 ) ; if ( ! $ draft ) { $ params [ 'draft' ] = 0 ; } $ records = $ DB -> get_records ( 'assignfeedback_editpdf_cmnt' , $ params ,...
Get all comments for a page .
28,469
public static function set_comments ( $ gradeid , $ pageno , $ comments ) { global $ DB ; $ DB -> delete_records ( 'assignfeedback_editpdf_cmnt' , array ( 'gradeid' => $ gradeid , 'pageno' => $ pageno , 'draft' => 1 ) ) ; $ added = 0 ; foreach ( $ comments as $ record ) { if ( ! ( $ record instanceof comment ) ) { $ co...
Set all comments for a page .
28,470
public static function get_comment ( $ commentid ) { $ record = $ DB -> get_record ( 'assignfeedback_editpdf_cmnt' , array ( 'id' => $ commentid ) , '*' , IGNORE_MISSING ) ; if ( $ record ) { return new comment ( $ record ) ; } return false ; }
Get a single comment by id .
28,471
public static function add_comment ( comment $ comment ) { global $ DB ; $ comment -> id = null ; return $ DB -> insert_record ( 'assignfeedback_editpdf_cmnt' , $ comment ) ; }
Add a comment to a page .
28,472
public static function get_annotations ( $ gradeid , $ pageno , $ draft ) { global $ DB ; $ params = array ( 'gradeid' => $ gradeid , 'pageno' => $ pageno , 'draft' => 1 ) ; if ( ! $ draft ) { $ params [ 'draft' ] = 0 ; } $ annotations = array ( ) ; $ records = $ DB -> get_records ( 'assignfeedback_editpdf_annot' , $ p...
Get all annotations for a page .
28,473
public static function set_annotations ( $ gradeid , $ pageno , $ annotations ) { global $ DB ; $ DB -> delete_records ( 'assignfeedback_editpdf_annot' , array ( 'gradeid' => $ gradeid , 'pageno' => $ pageno , 'draft' => 1 ) ) ; $ added = 0 ; foreach ( $ annotations as $ record ) { if ( ! ( $ record instanceof annotati...
Set all annotations for a page .
28,474
public static function get_annotation ( $ annotationid ) { global $ DB ; $ record = $ DB -> get_record ( 'assignfeedback_editpdf_annot' , array ( 'id' => $ annotationid ) , '*' , IGNORE_MISSING ) ; if ( $ record ) { return new annotation ( $ record ) ; } return false ; }
Get a single annotation by id .
28,475
public static function release_drafts ( $ gradeid ) { global $ DB ; $ DB -> delete_records ( 'assignfeedback_editpdf_cmnt' , array ( 'gradeid' => $ gradeid , 'draft' => 0 ) ) ; $ DB -> delete_records ( 'assignfeedback_editpdf_annot' , array ( 'gradeid' => $ gradeid , 'draft' => 0 ) ) ; $ records = $ DB -> get_records (...
Release the draft comments and annotations to students .
28,476
public static function has_annotations_or_comments ( $ gradeid , $ includedraft ) { global $ DB ; $ params = array ( 'gradeid' => $ gradeid ) ; if ( ! $ includedraft ) { $ params [ 'draft' ] = 0 ; } if ( $ DB -> count_records ( 'assignfeedback_editpdf_cmnt' , $ params ) ) { return true ; } if ( $ DB -> count_records ( ...
Has annotations or comments .
28,477
public static function add_annotation ( annotation $ annotation ) { global $ DB ; $ annotation -> id = null ; return $ DB -> insert_record ( 'assignfeedback_editpdf_annot' , $ annotation ) ; }
Add a annotation to a page .
28,478
public static function copy_drafts_from_to ( $ assignment , $ grade , $ sourceuserid ) { global $ DB ; $ DB -> delete_records ( 'assignfeedback_editpdf_annot' , array ( 'gradeid' => $ grade -> id ) ) ; $ DB -> delete_records ( 'assignfeedback_editpdf_cmnt' , array ( 'gradeid' => $ grade -> id ) ) ; $ sourceusergrade = ...
Copy annotations comments pages and other required content from the source user to the current group member being procssed when using applytoall .
28,479
public static function replace_files_from_to ( $ fs , $ contextid , $ sourceitemid , $ itemid , $ area , $ includesubdirs = false ) { $ component = 'assignfeedback_editpdf' ; $ fs -> delete_area_files ( $ contextid , $ component , $ area , $ itemid ) ; if ( $ files = $ fs -> get_area_files ( $ contextid , $ component ,...
Replace the area files in the specified area with those in the source item id .
28,480
public static function delete_draft_content ( $ gradeid ) { global $ DB ; $ conditions = array ( 'gradeid' => $ gradeid , 'draft' => 1 ) ; $ result = $ DB -> delete_records ( 'assignfeedback_editpdf_annot' , $ conditions ) ; $ result = $ result && $ DB -> delete_records ( 'assignfeedback_editpdf_cmnt' , $ conditions ) ...
Delete the draft annotations and comments .
28,481
public static function set_page_rotation ( $ gradeid , $ pageno , $ isrotated , $ pathnamehash , $ degree = 0 ) { global $ DB ; $ oldrecord = self :: get_page_rotation ( $ gradeid , $ pageno ) ; if ( $ oldrecord == null ) { $ record = new \ stdClass ( ) ; $ record -> gradeid = $ gradeid ; $ record -> pageno = $ pageno ...
Set page rotation value .
28,482
public static function get_page_rotation ( $ gradeid , $ pageno ) { global $ DB ; $ result = $ DB -> get_record ( 'assignfeedback_editpdf_rot' , array ( 'gradeid' => $ gradeid , 'pageno' => $ pageno ) ) ; return $ result ; }
Get Page Rotation Value .
28,483
public function get_static_data ( ) { $ result = new \ core_analytics \ local \ analysis \ result_array ( $ this -> get_modelid ( ) , false , $ this -> get_options ( ) ) ; $ analysis = new \ core_analytics \ analysis ( $ this , false , $ result ) ; $ analysis -> run ( ) ; return $ result -> get ( ) ; }
Returns indicator calculations as an array .
28,484
protected function check_indicators_requirements ( ) { foreach ( $ this -> indicators as $ indicator ) { $ missingrequired = $ this -> check_indicator_requirements ( $ indicator ) ; if ( $ missingrequired !== true ) { throw new \ core_analytics \ requirements_exception ( get_class ( $ indicator ) . ' indicator requires...
Checks if the analyser satisfies all the model indicators requirements .
28,485
public function check_indicator_requirements ( \ core_analytics \ local \ indicator \ base $ indicator ) { $ providedsampledata = $ this -> provided_sample_data ( ) ; $ requiredsampledata = $ indicator :: required_sample_data ( ) ; if ( empty ( $ requiredsampledata ) ) { return true ; } $ missingrequired = array_diff (...
Checks that this analyser satisfies the provided indicator requirements .
28,486
protected function get_iterator_sql ( string $ tablename , int $ contextlevel , ? string $ action = null , ? string $ tablealias = null ) { if ( ! $ tablealias ) { $ tablealias = 'analysable' ; } $ params = [ 'contextlevel' => $ contextlevel , 'modelid' => $ this -> get_modelid ( ) ] ; $ select = $ tablealias . '.*, ' ...
Get the sql of a default implementation of the iterator .
28,487
protected function order_sql ( ? string $ fieldname = null , string $ order = 'ASC' , ? string $ tablealias = null ) { if ( ! $ tablealias ) { $ tablealias = 'analysable' ; } if ( $ order != 'ASC' && $ order != 'DESC' ) { throw new \ coding_exception ( 'The order can only be ASC or DESC' ) ; } $ ordersql = ' ORDER BY (...
Returns the order by clause .
28,488
protected function calculate_sample ( $ sampleid , \ core_analytics \ analysable $ analysable , $ starttime = false , $ endtime = false ) { $ activitiesdueindicator = $ this -> retrieve ( '\core_course\analytics\indicator\activities_due' , $ sampleid ) ; if ( $ activitiesdueindicator == \ core_course \ analytics \ indi...
Calculation based on activities due indicator .
28,489
public function prediction_actions ( \ core_analytics \ prediction $ prediction , $ includedetailsaction = false , $ isinsightuser = false ) { global $ CFG , $ USER ; $ parentactions = parent :: prediction_actions ( $ prediction , $ includedetailsaction ) ; if ( ! $ isinsightuser && $ USER -> id != $ prediction -> get_...
Adds a view upcoming events action .
28,490
public static function get_course_image ( $ course ) { global $ CFG ; $ courseinlist = new \ core_course_list_element ( $ course ) ; foreach ( $ courseinlist -> get_course_overviewfiles ( ) as $ file ) { if ( $ file -> is_valid_image ( ) ) { $ pathcomponents = [ '/pluginfile.php' , $ file -> get_contextid ( ) , $ file ...
Get the course image if added to course .
28,491
public static function get_course_pattern ( $ course ) { $ color = self :: coursecolor ( $ course -> id ) ; $ pattern = new \ core_geopattern ( ) ; $ pattern -> setColor ( $ color ) ; $ pattern -> patternbyid ( $ course -> id ) ; return $ pattern -> datauri ( ) ; }
Get the course pattern datauri .
28,492
protected function list_questions_url ( $ includeauto = null ) { $ url = $ this -> base_url ( ) ; $ url -> params ( $ this -> viewoptions ) ; if ( ! is_null ( $ includeauto ) ) { $ url -> param ( 'includeauto' , $ includeauto ) ; } return $ url ; }
Get the URL of the front page of the report that lists all the questions .
28,493
protected function get_question_heading ( $ attempt , $ shownames , $ showidnumbers ) { $ a = new stdClass ( ) ; $ a -> attempt = $ attempt -> attempt ; $ a -> fullname = fullname ( $ attempt ) ; $ a -> idnumber = $ attempt -> idnumber ; $ showidnumbers = $ showidnumbers && ! empty ( $ attempt -> idnumber ) ; if ( $ sh...
Get question heading .
28,494
function getFrozenHtml ( ) { $ attributes = array ( 'readonly' => 'readonly' ) ; $ this -> updateAttributes ( $ attributes ) ; return $ this -> _getTabs ( ) . '<input' . $ this -> _getAttrString ( $ this -> _attributes ) . ' />' . $ this -> _getPersistantData ( ) ; }
Returns the html to be used when the element is frozen
28,495
protected static function get_config_file_path ( ) { global $ CFG ; if ( ! empty ( $ CFG -> altcacheconfigpath ) ) { $ path = $ CFG -> altcacheconfigpath ; if ( is_dir ( $ path ) && is_writable ( $ path ) ) { return $ path . '/cacheconfig.php' ; } else if ( is_writable ( dirname ( $ path ) ) && ( ! file_exists ( $ path...
Returns the expected path to the configuration file .
28,496
protected function include_configuration ( ) { $ configuration = array ( ) ; $ cachefile = static :: get_config_file_path ( ) ; if ( ! file_exists ( $ cachefile ) ) { throw new cache_exception ( 'Default cache config could not be found. It should have already been created by now.' ) ; } if ( ! include ( $ cachefile ) )...
Includes the configuration file and makes sure it contains the expected bits .
28,497
public function get_definition_by_id ( $ id ) { if ( array_key_exists ( $ id , $ this -> configdefinitions ) ) { return $ this -> configdefinitions [ $ id ] ; } return false ; }
Gets a definition from the config given its name .
28,498
public function get_definitions_by_store ( $ storename ) { $ definitions = array ( ) ; if ( ! isset ( $ this ) ) { $ config = cache_config :: instance ( ) ; } else { $ config = $ this ; } $ stores = $ config -> get_all_stores ( ) ; if ( ! array_key_exists ( $ storename , $ stores ) ) { return false ; } $ defmappings = ...
Returns the definitions mapped into the given store name .
28,499
public function get_stores ( $ mode , $ requirements = 0 ) { $ stores = array ( ) ; foreach ( $ this -> configstores as $ name => $ store ) { if ( ( $ store [ 'modes' ] & $ mode ) && ( $ store [ 'features' ] & $ requirements ) === $ requirements ) { $ stores [ $ name ] = $ store ; } } return $ stores ; }
Returns all of the stores that are suitable for the given mode and requirements .