idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
28,500 | public function get_stores_for_definition ( cache_definition $ definition ) { $ factory = cache_factory :: instance ( ) ; if ( $ factory -> stores_disabled ( ) ) { return array ( ) ; } $ availablestores = $ this -> get_stores ( $ definition -> get_mode ( ) , $ definition -> get_requirements_bin ( ) ) ; $ stores = array... | Gets all of the stores that are to be used for the given definition . |
28,501 | public function get_lock_for_store ( $ storename ) { if ( array_key_exists ( $ storename , $ this -> configstores ) ) { if ( array_key_exists ( $ this -> configstores [ $ storename ] [ 'lock' ] , $ this -> configlocks ) ) { $ lock = $ this -> configstores [ $ storename ] [ 'lock' ] ; return $ this -> configlocks [ $ lo... | Returns the lock store configuration to use with a given store . |
28,502 | public function send_message ( $ eventdata ) { global $ DB ; if ( $ eventdata -> userfrom -> id != $ eventdata -> userto -> id && $ eventdata -> notification ) { if ( ! $ DB -> record_exists ( 'message_popup_notifications' , [ 'notificationid' => $ eventdata -> savedmessageid ] ) ) { $ record = new stdClass ( ) ; $ rec... | Adds notifications to the message_popup_notifications table if applicable . |
28,503 | public function log ( $ msg , $ runlevel = self :: LEVEL_INFO ) { $ time = time ( ) ; if ( $ this -> printout and $ runlevel <= $ this -> runlevel ) { $ this -> writeLine ( $ msg , $ runlevel , $ time ) ; } } | Add a message to the log data array If printout in this instance is set to true directly output the message |
28,504 | public function addCookie ( $ name , $ value ) { if ( $ this -> _sent ) { throw new CAS_OutOfSequenceException ( 'Request has already been sent cannot ' . __METHOD__ ) ; } $ this -> cookies [ $ name ] = $ value ; } | Add a cookie to the request . |
28,505 | public function addHeaders ( array $ headers ) { if ( $ this -> _sent ) { throw new CAS_OutOfSequenceException ( 'Request has already been sent cannot ' . __METHOD__ ) ; } $ this -> headers = array_merge ( $ this -> headers , $ headers ) ; } | Add an array of header strings to the request . |
28,506 | public function setPostBody ( $ body ) { if ( $ this -> _sent ) { throw new CAS_OutOfSequenceException ( 'Request has already been sent cannot ' . __METHOD__ ) ; } if ( ! $ this -> isPost ) { throw new CAS_OutOfSequenceException ( 'Cannot add a POST body to a GET request, use makePost() first.' ) ; } $ this -> postBody... | Add a POST body to the request |
28,507 | public function setSslCaCert ( $ caCertPath , $ validate_cn = true ) { if ( $ this -> _sent ) { throw new CAS_OutOfSequenceException ( 'Request has already been sent cannot ' . __METHOD__ ) ; } $ this -> caCertPath = $ caCertPath ; $ this -> validateCN = $ validate_cn ; } | Specify the path to an SSL CA certificate to validate the server with . |
28,508 | public function getResponseStatusCode ( ) { if ( ! $ this -> _sent ) { throw new CAS_OutOfSequenceException ( 'Request has not been sent yet. Cannot ' . __METHOD__ ) ; } if ( ! preg_match ( '/HTTP\/[0-9.]+\s+([0-9]+)\s*(.*)/' , $ this -> _responseHeaders [ 0 ] , $ matches ) ) { throw new CAS_Request_Exception ( 'Bad re... | Answer HTTP status code of the response |
28,509 | public static function user_enrolment_created ( \ core \ event \ user_enrolment_created $ event ) { if ( ! enrol_is_enabled ( 'meta' ) ) { return true ; } if ( $ event -> other [ 'enrol' ] === 'meta' ) { return true ; } self :: sync_course_instances ( $ event -> courseid , $ event -> relateduserid ) ; return true ; } | Triggered via user_enrolment_created event . |
28,510 | public static function role_unassigned ( \ core \ event \ role_unassigned $ event ) { if ( ! enrol_is_enabled ( 'meta' ) ) { return true ; } if ( $ event -> other [ 'component' ] === 'enrol_meta' ) { return true ; } if ( ! $ parentcontext = context :: instance_by_id ( $ event -> contextid , IGNORE_MISSING ) ) { return ... | Triggered via role_unassigned event . |
28,511 | public static function course_deleted ( \ core \ event \ course_deleted $ event ) { global $ DB ; if ( ! enrol_is_enabled ( 'meta' ) ) { return true ; } if ( ! $ enrols = $ DB -> get_records ( 'enrol' , array ( 'customint1' => $ event -> objectid , 'enrol' => 'meta' ) , 'courseid ASC, id ASC' ) ) { return true ; } $ pl... | Triggered via course_deleted event . |
28,512 | public static function enrol_instance_updated ( \ core \ event \ enrol_instance_updated $ event ) { global $ DB ; if ( ! enrol_is_enabled ( 'meta' ) ) { return true ; } $ affectedcourses = $ DB -> get_fieldset_sql ( 'SELECT DISTINCT courseid FROM {enrol} ' . 'WHERE customint1 = ? AND enrol = ?' , array ( $ event -> cou... | Triggered via enrol_instance_updated event . |
28,513 | public function review ( $ userid , $ filtered = false ) { global $ DB ; $ sql = "SELECT bc.*, bcm.critid, bcm.userid, bcm.datemet FROM {badge_criteria} bc LEFT JOIN {badge_criteria_met} bcm ON bc.id = bcm.critid AND bcm.userid = :userid WHERE bc.badgeid =... | Review this criteria and decide if it has been completed Overall criteria review should be called only from other criteria handlers . |
28,514 | public function save ( $ params = array ( ) ) { global $ DB ; $ description = '' ; $ descriptionformat = FORMAT_HTML ; if ( isset ( $ params [ 'description' ] [ 'text' ] ) ) { $ description = $ params [ 'description' ] [ 'text' ] ; $ descriptionformat = $ params [ 'description' ] [ 'format' ] ; } else if ( isset ( $ pa... | Saves overall badge criteria description . |
28,515 | final protected function get_format_parameters ( $ property ) { $ parameters = [ 'component' => null , 'filearea' => null , 'itemid' => null , 'options' => [ ] , 'striplinks' => true , ] ; $ candidate = 'get_format_parameters_for_' . $ property ; if ( method_exists ( $ this , $ candidate ) ) { $ parameters = array_merg... | Get the format parameters . |
28,516 | final public static function format_properties ( $ properties ) { foreach ( $ properties as $ property => $ definition ) { if ( ! isset ( $ definition [ 'null' ] ) ) { $ properties [ $ property ] [ 'null' ] = NULL_NOT_ALLOWED ; } if ( ! isset ( $ definition [ 'description' ] ) ) { $ properties [ $ property ] [ 'descrip... | Recursively formats a given property definition with the default fields required . |
28,517 | final protected static function get_context_structure ( ) { return array ( 'contextid' => new external_value ( PARAM_INT , 'The context id' , VALUE_OPTIONAL ) , 'contextlevel' => new external_value ( PARAM_ALPHA , 'The context level' , VALUE_OPTIONAL ) , 'instanceid' => new external_value ( PARAM_INT , 'The Instance id... | Get the context structure . |
28,518 | final protected static function get_format_field ( $ definitions , $ property ) { $ formatproperty = $ property . 'format' ; if ( ( $ definitions [ $ property ] [ 'type' ] == PARAM_RAW || $ definitions [ $ property ] [ 'type' ] == PARAM_CLEANHTML ) && isset ( $ definitions [ $ formatproperty ] ) && $ definitions [ $ fo... | Get the format field name . |
28,519 | final protected static function get_format_structure ( $ property , $ definition , $ required = VALUE_REQUIRED ) { if ( array_key_exists ( 'default' , $ definition ) ) { $ required = VALUE_DEFAULT ; } return new external_format_value ( $ property , $ required ) ; } | Get the format structure . |
28,520 | final public static function get_create_structure ( ) { $ properties = self :: properties_definition ( ) ; $ returns = array ( ) ; foreach ( $ properties as $ property => $ definition ) { if ( $ property == 'id' ) { continue ; } else if ( isset ( $ returns [ $ property ] ) && substr ( $ property , - 6 ) === 'format' ) ... | Returns the create structure . |
28,521 | final public static function get_update_structure ( ) { $ properties = self :: properties_definition ( ) ; $ returns = array ( ) ; foreach ( $ properties as $ property => $ definition ) { if ( isset ( $ returns [ $ property ] ) && substr ( $ property , - 6 ) === 'format' ) { continue ; } $ default = null ; $ required =... | Returns the update structure . |
28,522 | protected function get_data ( $ scoid , $ allowedlist = [ ] ) { global $ DB ; $ data = array_fill ( 0 , self :: BANDS , 0 ) ; if ( empty ( $ allowedlist ) ) { return $ data ; } list ( $ usql , $ params ) = $ DB -> get_in_or_equal ( $ allowedlist ) ; $ params [ ] = $ scoid ; $ sql = "SELECT DISTINCT " . $ DB -> sql_conc... | Get the data for the report . |
28,523 | public function display ( $ scorm , $ cm , $ course , $ download ) { global $ DB , $ OUTPUT , $ PAGE ; $ contextmodule = context_module :: instance ( $ cm -> id ) ; if ( $ groupmode = groups_get_activity_groupmode ( $ cm ) ) { groups_print_activity_menu ( $ cm , new moodle_url ( $ PAGE -> url ) ) ; } $ group = groups_g... | Displays the full report . |
28,524 | public static function get_groups ( $ groupids ) { $ params = self :: validate_parameters ( self :: get_groups_parameters ( ) , array ( 'groupids' => $ groupids ) ) ; $ groups = array ( ) ; foreach ( $ params [ 'groupids' ] as $ groupid ) { $ group = groups_get_group ( $ groupid , 'id, courseid, name, idnumber, descrip... | Get groups definition specified by ids |
28,525 | public static function get_course_groups ( $ courseid ) { $ params = self :: validate_parameters ( self :: get_course_groups_parameters ( ) , array ( 'courseid' => $ courseid ) ) ; $ context = context_course :: instance ( $ params [ 'courseid' ] , IGNORE_MISSING ) ; try { self :: validate_context ( $ context ) ; } catc... | Get all groups in the specified course |
28,526 | public static function get_group_members ( $ groupids ) { $ members = array ( ) ; $ params = self :: validate_parameters ( self :: get_group_members_parameters ( ) , array ( 'groupids' => $ groupids ) ) ; foreach ( $ params [ 'groupids' ] as $ groupid ) { $ group = groups_get_group ( $ groupid , 'id, courseid, name, en... | Return all members for a group |
28,527 | public static function add_group_members ( $ members ) { global $ CFG , $ DB ; require_once ( "$CFG->dirroot/group/lib.php" ) ; $ params = self :: validate_parameters ( self :: add_group_members_parameters ( ) , array ( 'members' => $ members ) ) ; $ transaction = $ DB -> start_delegated_transaction ( ) ; foreach ( $ p... | Add group members |
28,528 | public static function delete_group_members ( $ members ) { global $ CFG , $ DB ; require_once ( "$CFG->dirroot/group/lib.php" ) ; $ params = self :: validate_parameters ( self :: delete_group_members_parameters ( ) , array ( 'members' => $ members ) ) ; $ transaction = $ DB -> start_delegated_transaction ( ) ; foreach... | Delete group members |
28,529 | public static function get_groupings ( $ groupingids , $ returngroups = false ) { global $ CFG , $ DB ; require_once ( "$CFG->dirroot/group/lib.php" ) ; require_once ( "$CFG->libdir/filelib.php" ) ; $ params = self :: validate_parameters ( self :: get_groupings_parameters ( ) , array ( 'groupingids' => $ groupingids , ... | Get groupings definition specified by ids |
28,530 | public static function get_course_groupings ( $ courseid ) { global $ CFG ; require_once ( "$CFG->dirroot/group/lib.php" ) ; require_once ( "$CFG->libdir/filelib.php" ) ; $ params = self :: validate_parameters ( self :: get_course_groupings_parameters ( ) , array ( 'courseid' => $ courseid ) ) ; $ context = context_cou... | Get all groupings in the specified course |
28,531 | public static function assign_grouping ( $ assignments ) { global $ CFG , $ DB ; require_once ( "$CFG->dirroot/group/lib.php" ) ; $ params = self :: validate_parameters ( self :: assign_grouping_parameters ( ) , array ( 'assignments' => $ assignments ) ) ; $ transaction = $ DB -> start_delegated_transaction ( ) ; forea... | Assign a group to a grouping |
28,532 | public static function unassign_grouping ( $ unassignments ) { global $ CFG , $ DB ; require_once ( "$CFG->dirroot/group/lib.php" ) ; $ params = self :: validate_parameters ( self :: unassign_grouping_parameters ( ) , array ( 'unassignments' => $ unassignments ) ) ; $ transaction = $ DB -> start_delegated_transaction (... | Unassign a group from a grouping |
28,533 | public static function get_course_user_groups ( $ courseid = 0 , $ userid = 0 , $ groupingid = 0 ) { global $ USER ; $ warnings = array ( ) ; $ params = array ( 'courseid' => $ courseid , 'userid' => $ userid , 'groupingid' => $ groupingid ) ; $ params = self :: validate_parameters ( self :: get_course_user_groups_para... | Get all groups in the specified course for the specified user . |
28,534 | public static function group_description ( ) { return new external_single_structure ( array ( 'id' => new external_value ( PARAM_INT , 'group record id' ) , 'name' => new external_value ( PARAM_TEXT , 'multilang compatible name, course unique' ) , 'description' => new external_value ( PARAM_RAW , 'group description tex... | Create group return value description . |
28,535 | public static function get_activity_allowed_groups ( $ cmid , $ userid = 0 ) { global $ USER ; $ warnings = array ( ) ; $ params = array ( 'cmid' => $ cmid , 'userid' => $ userid ) ; $ params = self :: validate_parameters ( self :: get_activity_allowed_groups_parameters ( ) , $ params ) ; $ cmid = $ params [ 'cmid' ] ;... | Gets a list of groups that the user is allowed to access within the specified activity . |
28,536 | public static function get_activity_groupmode ( $ cmid ) { global $ USER ; $ warnings = array ( ) ; $ params = array ( 'cmid' => $ cmid ) ; $ params = self :: validate_parameters ( self :: get_activity_groupmode_parameters ( ) , $ params ) ; $ cmid = $ params [ 'cmid' ] ; $ cm = get_coursemodule_from_id ( null , $ cmid... | Returns effective groupmode used in a given activity . |
28,537 | protected function _createFromThrowable ( $ e ) { $ this -> backtrace = $ e -> getTrace ( ) ; if ( $ previous = $ e -> getPrevious ( ) ) { $ backtrace = new self ( $ previous ) ; $ this -> backtrace = array_merge ( $ backtrace -> backtrace , $ this -> backtrace ) ; } } | Wraps an error object s backtrace . |
28,538 | public function getContext ( $ nestingLevel ) { if ( ! isset ( $ this -> backtrace [ $ nestingLevel ] ) ) { throw new Horde_Exception ( 'Unknown nesting level' ) ; } return $ this -> backtrace [ $ nestingLevel ] ; } | Returns the context at a specific nesting level . |
28,539 | protected function get_user_fullname ( $ userid ) { global $ DB ; if ( empty ( $ userid ) ) { return false ; } if ( ! empty ( $ this -> userfullnames [ $ userid ] ) ) { return $ this -> userfullnames [ $ userid ] ; } if ( $ this -> userfullnames [ $ userid ] === false ) { return false ; } list ( $ usql , $ uparams ) = ... | Gets the user full name . |
28,540 | public function col_time ( $ event ) { if ( empty ( $ this -> download ) ) { $ dateformat = get_string ( 'strftimedatetime' , 'core_langconfig' ) ; } else { $ dateformat = get_string ( 'strftimedatetimeshort' , 'core_langconfig' ) ; } return userdate ( $ event -> timecreated , $ dateformat ) ; } | Generate the time column . |
28,541 | public function col_component ( $ event ) { $ componentname = $ event -> component ; if ( ( $ event -> component === 'core' ) || ( $ event -> component === 'legacy' ) ) { return get_string ( 'coresystem' ) ; } else if ( get_string_manager ( ) -> string_exists ( 'pluginname' , $ event -> component ) ) { return get_strin... | Generate the component column . |
28,542 | protected function action_link ( moodle_url $ url , $ text , $ name = 'popup' ) { global $ OUTPUT ; $ link = new action_link ( $ url , $ text , new popup_action ( 'click' , $ url , $ name , array ( 'height' => 440 , 'width' => 700 ) ) ) ; return $ OUTPUT -> render ( $ link ) ; } | Method to create a link with popup action . |
28,543 | public function get_action_sql ( ) { global $ DB ; if ( $ this -> filterparams -> logreader instanceof logstore_legacy \ log \ store ) { $ action = $ this -> get_legacy_crud_action ( $ this -> filterparams -> action ) ; $ firstletter = substr ( $ action , 0 , 1 ) ; if ( $ firstletter == '-' ) { $ sql = $ DB -> sql_like... | Helper function which is used by build logs to get action sql and param . |
28,544 | public function get_cm_sql ( ) { $ joins = array ( ) ; $ params = array ( ) ; if ( $ this -> filterparams -> logreader instanceof logstore_legacy \ log \ store ) { $ joins [ ] = "cmid = :cmid" ; $ params [ 'cmid' ] = $ this -> filterparams -> modid ; } else { $ joins [ ] = "contextinstanceid = :contextinstanceid" ; $ j... | Helper function which is used by build logs to get course module sql and param . |
28,545 | protected function update_users_used ( ) { global $ DB ; $ this -> userfullnames = array ( ) ; $ userids = array ( ) ; foreach ( $ this -> rawdata as $ event ) { $ logextra = $ event -> get_logextra ( ) ; if ( ! empty ( $ event -> userid ) && empty ( $ userids [ $ event -> userid ] ) ) { $ userids [ $ event -> userid ]... | Helper function to create list of user fullnames shown in log report . |
28,546 | public function post ( $ url , $ params = '' , $ options = array ( ) ) { return parent :: post ( $ url , format_postdata_for_curlcall ( $ params ) , $ options ) ; } | Post request . |
28,547 | public function download_file ( $ id , $ path ) { $ url = self :: API . "/${id}/content" ; $ this -> setopt ( array ( 'CURLOPT_FOLLOWLOCATION' => true , 'CURLOPT_MAXREDIRS' => 3 ) ) ; $ content = $ this -> get ( $ url ) ; file_put_contents ( $ path , $ content ) ; return array ( 'path' => $ path , 'url' => $ url ) ; } | Downloads a file to a file from skydrive using authenticated request |
28,548 | public function get_folder_name ( $ folderid ) { if ( empty ( $ folderid ) ) { throw new coding_exception ( 'Empty folderid passed to get_folder_name' ) ; } $ cachekey = $ this -> folder_cache_key ( $ folderid ) ; if ( $ foldername = $ this -> foldernamecache -> get ( $ cachekey ) ) { return $ foldername ; } $ url = se... | Returns a folder name property for a given folderid . |
28,549 | public static function get_context_for_userid_within_submission ( int $ userid , contextlist $ contextlist ) { $ sql = "SELECT contextid FROM {comments} WHERE component = :component AND commentarea = :commentarea AND userid = :userid" ; $ para... | It is possible to make a comment as a teacher without creating an entry in the submission table so this is required to find those entries . |
28,550 | public static function get_student_user_ids ( \ mod_assign \ privacy \ useridlist $ useridlist ) { $ params = [ 'assignid' => $ useridlist -> get_assignid ( ) , 'commentuserid' => $ useridlist -> get_teacherid ( ) , 'commentuserid2' => $ useridlist -> get_teacherid ( ) ] ; $ sql = "SELECT DISTINCT c.userid AS id ... | Due to the fact that we can t rely on the queries in the mod_assign provider we have to add some additional sql . |
28,551 | public static function get_userids_from_context ( \ core_privacy \ local \ request \ userlist $ userlist ) { $ context = $ userlist -> get_context ( ) ; if ( $ context -> contextlevel != CONTEXT_MODULE ) { return ; } comments_provider :: get_users_in_context_from_sql ( $ userlist , 'c' , 'assignsubmission_comments' , '... | If you have tables that contain userids and you can generate entries in your tables without creating an entry in the assign_submission table then please fill in this method . |
28,552 | public function get_document_recordset ( $ modifiedfrom = 0 , \ context $ context = null ) { global $ DB ; list ( $ contextjoin , $ contextparams ) = $ this -> get_course_level_context_restriction_sql ( $ context , 'c' , SQL_PARAMS_NAMED ) ; if ( $ contextjoin === null ) { return null ; } $ fields = course_handler :: c... | Returns recordset containing required data for indexing course custom fields . |
28,553 | public static function include_all_javascript ( $ course , \ cm_info $ cm = null , \ section_info $ section = null ) { global $ PAGE ; $ modules = array ( 'moodle-core_availability-form' , 'base' , 'node' , 'panel' , 'moodle-core-notification-dialogue' , 'json' ) ; $ pluginmanager = \ core_plugin_manager :: instance ( ... | Includes JavaScript for the main system and all plugins . |
28,554 | public static function report_validation_errors ( array $ data , array & $ errors ) { if ( $ data [ 'availabilityconditionsjson' ] === '' ) { return ; } $ decoded = json_decode ( $ data [ 'availabilityconditionsjson' ] ) ; if ( ! $ decoded ) { throw new \ coding_exception ( 'Invalid JSON from availabilityconditionsjson... | For use within forms reports any validation errors from the availability field . |
28,555 | protected static function convert_associative_array_for_js ( array $ inarray , $ keyname , $ valuename ) { $ result = array ( ) ; foreach ( $ inarray as $ key => $ value ) { $ result [ ] = ( object ) array ( $ keyname => $ key , $ valuename => $ value ) ; } return $ result ; } | Converts an associative array into an array of objects with two fields . |
28,556 | public function combine_pdfs ( $ pdflist , $ outfilename ) { raise_memory_limit ( MEMORY_EXTRA ) ; $ olddebug = error_reporting ( 0 ) ; $ this -> setPageUnit ( 'pt' ) ; $ this -> setPrintHeader ( false ) ; $ this -> setPrintFooter ( false ) ; $ this -> scale = 72.0 / 100.0 ; $ this -> SetFont ( $ this -> get_export_fon... | Combine the given PDF files into a single PDF . Optionally add a coversheet and coversheet fields . |
28,557 | public function load_pdf ( $ filename ) { raise_memory_limit ( MEMORY_EXTRA ) ; $ olddebug = error_reporting ( 0 ) ; $ this -> setPageUnit ( 'pt' ) ; $ this -> scale = 72.0 / 100.0 ; $ this -> SetFont ( $ this -> get_export_font_name ( ) , '' , 16.0 * $ this -> scale , '' , true ) ; $ this -> SetFillColor ( 255 , 255 ,... | Load the specified PDF and set the initial output configuration Used when processing comments and outputting a new PDF |
28,558 | public function copy_page ( ) { if ( ! $ this -> filename ) { return false ; } if ( $ this -> currentpage >= $ this -> pagecount ) { return false ; } $ this -> currentpage ++ ; $ this -> create_page_from_source ( $ this -> currentpage ) ; return true ; } | Copy the next page from the source file and set it as the current page |
28,559 | protected function create_page_from_source ( $ pageno ) { $ template = $ this -> importPage ( $ pageno ) ; $ size = $ this -> getTemplateSize ( $ template ) ; $ orientation = 'P' ; if ( $ size [ 'w' ] > $ size [ 'h' ] ) { $ orientation = 'L' ; } $ this -> AddPage ( $ orientation , array ( $ size [ 'w' ] , $ size [ 'h' ... | Create a page from a source PDF . |
28,560 | public function append_comments ( $ allcomments ) { if ( ! $ this -> filename ) { return false ; } $ this -> SetFontSize ( 12 * $ this -> scale ) ; $ this -> SetMargins ( 100 * $ this -> scale , 120 * $ this -> scale , - 1 , true ) ; $ this -> SetAutoPageBreak ( true , 100 * $ this -> scale ) ; $ this -> setHeaderFont ... | Append all comments to the end of the document . |
28,561 | public function add_comment_marker ( $ pageno , $ index , $ x , $ y , $ link , $ colour = 'yellow' ) { if ( ! $ this -> filename ) { return false ; } $ fill = '' ; $ fillopacity = 0.9 ; switch ( $ colour ) { case 'red' : $ fill = 'rgb(249, 181, 179)' ; break ; case 'green' : $ fill = 'rgb(214, 234, 178)' ; break ; case... | Add a comment marker to the specified page . |
28,562 | public function add_comment ( $ text , $ x , $ y , $ width , $ colour = 'yellow' ) { if ( ! $ this -> filename ) { return false ; } $ this -> SetDrawColor ( 51 , 51 , 51 ) ; switch ( $ colour ) { case 'red' : $ this -> SetFillColor ( 249 , 181 , 179 ) ; break ; case 'green' : $ this -> SetFillColor ( 214 , 234 , 178 ) ... | Add a comment to the current page |
28,563 | public function get_image ( $ pageno ) { global $ CFG ; if ( ! $ this -> filename ) { throw new \ coding_exception ( 'Attempting to generate a page image without first setting the PDF filename' ) ; } if ( ! $ this -> imagefolder ) { throw new \ coding_exception ( 'Attempting to generate a page image without first speci... | Generate an image of the specified page in the PDF |
28,564 | public static function get_error_image ( $ errorimagefolder , $ pageno ) { global $ CFG ; $ errorfile = $ CFG -> dirroot . self :: BLANK_PDF ; if ( ! file_exists ( $ errorfile ) ) { throw new \ coding_exception ( "Blank PDF not found" , "File path" . $ errorfile ) ; } $ tmperrorimagefolder = make_request_directory ( ) ... | Generate an localised error image for the given pagenumber . |
28,565 | public function add_image_page ( $ imagestoredfile ) { $ imageinfo = $ imagestoredfile -> get_imageinfo ( ) ; $ imagecontent = $ imagestoredfile -> get_content ( ) ; $ this -> currentpage ++ ; $ template = $ this -> importPage ( $ this -> currentpage ) ; $ size = $ this -> getTemplateSize ( $ template ) ; if ( $ imagei... | This function add an image file to PDF page . |
28,566 | public function validation ( $ data , $ files ) { $ errors = parent :: validation ( $ data , $ files ) ; if ( empty ( $ data [ 'fulldelete' ] ) && empty ( $ data [ 'newparent' ] ) ) { $ errors [ 'newparent' ] = get_string ( 'required' ) ; } if ( $ data [ 'sure' ] !== md5 ( serialize ( $ this -> coursecat ) ) ) { $ erro... | Perform some extra moodle validation . |
28,567 | function definition ( ) { global $ USER ; $ mform = $ this -> _form ; $ mform -> setDisableShortforms ( true ) ; $ mform -> addElement ( 'header' , 'searchbyusername' , get_string ( 'searchbyusername' ) , '' ) ; $ purpose = user_edit_map_field_purpose ( $ USER -> id , 'username' ) ; $ mform -> addElement ( 'text' , 'us... | Define the forgot password form . |
28,568 | function validation ( $ data , $ files ) { $ errors = parent :: validation ( $ data , $ files ) ; $ errors += core_login_validate_forgot_password_data ( $ data ) ; return $ errors ; } | Validate user input from the forgot password form . |
28,569 | public function get_units ( ) { if ( is_null ( $ this -> _units ) ) { $ this -> _units = array ( 604800 => get_string ( 'weeks' ) , 86400 => get_string ( 'days' ) , 3600 => get_string ( 'hours' ) , 60 => get_string ( 'minutes' ) , 1 => get_string ( 'seconds' ) , ) ; } return $ this -> _units ; } | Returns time associative array of unit length . |
28,570 | function _createElements ( ) { $ attributes = $ this -> getAttributes ( ) ; if ( is_null ( $ attributes ) ) { $ attributes = array ( ) ; } if ( ! isset ( $ attributes [ 'size' ] ) ) { $ attributes [ 'size' ] = 3 ; } $ this -> _elements = array ( ) ; $ number = $ this -> createFormElement ( 'text' , 'number' , get_strin... | Override of standard quickforms method to create this element . |
28,571 | function toHtml ( ) { include_once ( 'HTML/QuickForm/Renderer/Default.php' ) ; $ renderer = new HTML_QuickForm_Renderer_Default ( ) ; $ renderer -> setElementTemplate ( '{element}' ) ; parent :: accept ( $ renderer ) ; return $ renderer -> toHtml ( ) ; } | Returns HTML for advchecbox form element . |
28,572 | function exportValue ( & $ submitValues , $ notused = false ) { $ valuearray = array ( ) ; foreach ( $ this -> _elements as $ element ) { $ thisexport = $ element -> exportValue ( $ submitValues [ $ this -> getName ( ) ] , true ) ; if ( ! is_null ( $ thisexport ) ) { $ valuearray += $ thisexport ; } } if ( empty ( $ va... | Output a timestamp . Give it the name of the group . Override of standard quickforms method . |
28,573 | static public function extract_useranswer ( $ useranswer ) { $ essayinfo = unserialize ( $ useranswer ) ; if ( ! isset ( $ essayinfo -> responseformat ) ) { $ essayinfo -> response = text_to_html ( $ essayinfo -> response , false , false ) ; $ essayinfo -> responseformat = FORMAT_HTML ; } return $ essayinfo ; } | Unserialize attempt useranswer and add missing responseformat if needed for compatibility with old records . |
28,574 | public function format_answer ( $ answer , $ context , $ answerformat , $ options = [ ] ) { $ answer = file_rewrite_pluginfile_urls ( $ answer , 'pluginfile.php' , $ context -> id , 'mod_lesson' , 'essay_answers' , $ options -> attemptid ) ; return parent :: format_answer ( $ answer , $ context , $ answerformat , $ opt... | Custom formats the answer to display |
28,575 | public function addHeaders ( $ headers = array ( ) ) { foreach ( $ headers as $ header => $ value ) { $ this -> addHeader ( $ header , $ value ) ; } } | Adds several message headers at once . |
28,576 | public function addHeader ( $ header , $ value , $ overwrite = null ) { $ lc_header = Horde_String :: lower ( $ header ) ; if ( is_null ( $ overwrite ) && in_array ( $ lc_header , $ this -> _headers -> singleFields ( true ) ) ) { $ overwrite = true ; } if ( $ overwrite ) { $ this -> _headers -> removeHeader ( $ header ... | Adds a message header . |
28,577 | public function removeHeader ( $ header ) { if ( Horde_String :: lower ( $ header ) === 'bcc' ) { unset ( $ this -> _bcc ) ; } else { $ this -> _headers -> removeHeader ( $ header ) ; } } | Removes a message header . |
28,578 | public function setBody ( $ body , $ charset = null , $ wrap = false ) { if ( ! $ charset ) { $ charset = $ this -> _charset ; } $ body = Horde_String :: convertCharset ( $ body , 'UTF-8' , $ charset ) ; if ( $ wrap ) { $ body = Horde_String :: wrap ( $ body , $ wrap === true ? 76 : $ wrap ) ; } $ this -> _body = new H... | Sets the message body text . |
28,579 | public function setHtmlBody ( $ body , $ charset = null , $ alternative = true ) { if ( ! $ charset ) { $ charset = $ this -> _charset ; } $ this -> _htmlBody = new Horde_Mime_Part ( ) ; $ this -> _htmlBody -> setType ( 'text/html' ) ; $ this -> _htmlBody -> setCharset ( $ charset ) ; $ this -> _htmlBody -> setContents... | Sets the HTML message body text . |
28,580 | public function addPart ( $ mime_type , $ content , $ charset = 'us-ascii' , $ disposition = null ) { $ part = new Horde_Mime_Part ( ) ; $ part -> setType ( $ mime_type ) ; $ part -> setCharset ( $ charset ) ; $ part -> setDisposition ( $ disposition ) ; $ part -> setContents ( $ content ) ; return $ this -> addMimePar... | Adds a message part . |
28,581 | public function addAttachment ( $ file , $ name = null , $ type = null , $ charset = 'us-ascii' ) { if ( empty ( $ name ) ) { $ name = basename ( $ file ) ; } if ( empty ( $ type ) ) { $ type = Horde_Mime_Magic :: filenameToMime ( $ file , false ) ; } $ num = $ this -> addPart ( $ type , file_get_contents ( $ file ) , ... | Adds an attachment . |
28,582 | public function getRaw ( $ stream = true ) { if ( $ stream ) { $ hdr = new Horde_Stream ( ) ; $ hdr -> add ( $ this -> _headers -> toString ( ) , true ) ; return Horde_Stream_Wrapper_Combine :: getStream ( array ( $ hdr -> stream , $ this -> getBasePart ( ) -> toString ( array ( 'stream' => true , 'encode' => Horde_Mim... | Get the raw email data sent by this object . |
28,583 | protected function col_actions ( $ row ) { global $ OUTPUT ; $ action = new \ confirm_action ( get_string ( 'areyousure' ) ) ; $ url = new moodle_url ( $ this -> baseurl ) ; $ url -> params ( array ( 'removecohort' => $ row -> id , 'sesskey' => sesskey ( ) ) ) ; $ actionlink = $ OUTPUT -> action_link ( $ url , '' , $ a... | Column actions . |
28,584 | protected function define_table_columns ( ) { $ cols = array ( 'name' => get_string ( 'name' , 'cohort' ) , 'idnumber' => get_string ( 'idnumber' , 'cohort' ) , ) ; if ( $ this -> template -> can_manage ( ) ) { $ cols [ 'actions' ] = get_string ( 'actions' ) ; } $ this -> define_columns ( array_keys ( $ cols ) ) ; $ th... | Setup the headers for the table . |
28,585 | public function query_db ( $ pagesize , $ useinitialsbar = true ) { global $ DB ; list ( $ countsql , $ countparams ) = $ this -> get_sql_and_params ( true ) ; list ( $ sql , $ params ) = $ this -> get_sql_and_params ( ) ; $ total = $ DB -> count_records_sql ( $ countsql , $ countparams ) ; $ this -> pagesize ( $ pages... | Query the DB . |
28,586 | protected function _write ( $ msg , $ pre = null ) { if ( ! $ this -> debug || ! $ this -> _stream ) { return ; } if ( ! is_null ( $ pre ) ) { $ new_time = microtime ( true ) ; if ( is_null ( $ this -> _time ) ) { fwrite ( $ this -> _stream , str_repeat ( '-' , 30 ) . "\n" . '>> ' . date ( 'r' ) . "\n" ) ; } elseif ( (... | Write debug information to the output stream . |
28,587 | public function print_login ( ) { $ url = $ this -> skydrive -> get_login_url ( ) ; if ( $ this -> options [ 'ajax' ] ) { $ popup = new stdClass ( ) ; $ popup -> type = 'popup' ; $ popup -> url = $ url -> out ( false ) ; return array ( 'login' => array ( $ popup ) ) ; } else { echo '<a target="_blank" href="' . $ url -... | Print the login form if required |
28,588 | public function get_listing ( $ path = '' , $ page = '' ) { $ ret = array ( ) ; $ ret [ 'dynload' ] = true ; $ ret [ 'nosearch' ] = true ; $ ret [ 'manage' ] = 'https://skydrive.live.com/' ; $ fileslist = $ this -> skydrive -> get_file_list ( $ path ) ; $ fileslist = array_filter ( $ fileslist , array ( $ this , 'filte... | Given a path and perhaps a search get a list of files . |
28,589 | public static function type_config_form ( $ mform , $ classname = 'repository' ) { global $ OUTPUT ; $ a = new stdClass ; $ a -> callbackurl = microsoft_skydrive :: callback_url ( ) -> out ( false ) ; $ mform -> addElement ( 'static' , null , '' , get_string ( 'oauthinfo' , 'repository_skydrive' , $ a ) ) ; $ mform -> ... | Setup repistory form . |
28,590 | public function print_badge_table_actions ( $ badge , $ context ) { $ actions = "" ; if ( has_capability ( 'moodle/badges:configuredetails' , $ context ) && $ badge -> has_criteria ( ) ) { if ( $ badge -> status == BADGE_STATUS_INACTIVE || $ badge -> status == BADGE_STATUS_INACTIVE_LOCKED ) { $ url = new moodle_url ( '... | Prints action icons for the badge . |
28,591 | protected function render_badge_collection ( badge_collection $ badges ) { $ paging = new paging_bar ( $ badges -> totalcount , $ badges -> page , $ badges -> perpage , $ this -> page -> url , 'page' ) ; $ htmlpagingbar = $ this -> render ( $ paging ) ; $ table = new html_table ( ) ; $ table -> attributes [ 'class' ] =... | Displays the available badges . |
28,592 | protected function render_badge_management ( badge_management $ badges ) { $ paging = new paging_bar ( $ badges -> totalcount , $ badges -> page , $ badges -> perpage , $ this -> page -> url , 'page' ) ; $ htmlnew = '' ; if ( has_capability ( 'moodle/badges:createbadge' , $ this -> page -> context ) ) { $ n [ 'type' ] ... | Outputs table of badges with actions available . |
28,593 | public function print_badge_status_box ( badge $ badge ) { if ( has_capability ( 'moodle/badges:configurecriteria' , $ badge -> get_context ( ) ) ) { if ( ! $ badge -> has_criteria ( ) ) { $ criteriaurl = new moodle_url ( '/badges/criteria.php' , array ( 'id' => $ badge -> id ) ) ; $ status = get_string ( 'nocriteria' ... | Prints badge status box . |
28,594 | public function print_criteria_actions ( badge $ badge ) { $ output = '' ; if ( ! $ badge -> is_active ( ) && ! $ badge -> is_locked ( ) ) { $ accepted = $ badge -> get_accepted_criteria ( ) ; $ potential = array_diff ( $ accepted , array_keys ( $ badge -> criteria ) ) ; if ( ! empty ( $ potential ) ) { foreach ( $ pot... | Prints criteria actions for badge editing . |
28,595 | protected function render_badge_recipients ( badge_recipients $ recipients ) { $ paging = new paging_bar ( $ recipients -> totalcount , $ recipients -> page , $ recipients -> perpage , $ this -> page -> url , 'page' ) ; $ htmlpagingbar = $ this -> render ( $ paging ) ; $ table = new html_table ( ) ; $ table -> attribut... | Based on stamps collection plugin . |
28,596 | protected function helper_sortable_heading ( $ text , $ sortid = null , $ sortby = null , $ sorthow = null ) { $ out = html_writer :: tag ( 'span' , $ text , array ( 'class' => 'text' ) ) ; if ( ! is_null ( $ sortid ) ) { if ( $ sortby !== $ sortid || $ sorthow !== 'ASC' ) { $ url = new moodle_url ( $ this -> page -> u... | Renders a text with icons to sort by the given column |
28,597 | protected function helper_search_form ( $ search ) { global $ CFG ; require_once ( $ CFG -> libdir . '/formslib.php' ) ; $ mform = new MoodleQuickForm ( 'searchform' , 'POST' , $ this -> page -> url ) ; $ mform -> addElement ( 'hidden' , 'sesskey' , sesskey ( ) ) ; $ el [ ] = $ mform -> createElement ( 'text' , 'search... | Renders a search form |
28,598 | protected function definition_list ( array $ items , array $ attributes = array ( ) ) { $ output = html_writer :: start_tag ( 'dl' , $ attributes ) ; foreach ( $ items as $ label => $ value ) { $ output .= html_writer :: tag ( 'dt' , $ label ) ; $ output .= html_writer :: tag ( 'dd' , $ value ) ; } $ output .= html_wri... | Renders a definition list |
28,599 | protected function print_badge_endorsement ( badge $ badge ) { $ output = '' ; $ endorsement = $ badge -> get_endorsement ( ) ; $ dl = array ( ) ; $ output .= $ this -> heading ( get_string ( 'endorsement' , 'badges' ) , 3 ) ; if ( ! empty ( $ endorsement ) ) { $ dl [ get_string ( 'issuername' , 'badges' ) ] = $ endors... | Outputs list en badges . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.