Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
grade_export_xls Class Reference
Inheritance diagram for grade_export_xls:
grade_export

Public Member Functions

 __construct ($course, $groupid, $formdata)
 Constructor should set up all the private variables ready to be pulled. More...
 
 display_preview ($require_user_idnumber=false)
 Prints preview of exported grades on screen as a feedback mechanism. More...
 
 format_column_name ($grade_item, $feedback=false, $gradedisplayname=null)
 Returns the name of column in export. More...
 
 format_feedback ($feedback, $grade=null)
 Returns formatted grade feedback. More...
 
 format_grade ($grade, $gradedisplayconst=null)
 Returns string representation of final grade. More...
 
 get_export_params ()
 Returns array of parameters used by dump.php and export.php. More...
 
 get_export_url ()
 Generate the export url. More...
 
 get_grade_publishing_url ()
 Create the html code of the grade publishing feature. More...
 
 print_continue ()
 Either prints a "Export" box, which will redirect the user to the download page, or prints the URL for the published data. More...
 
 print_grades ()
 To be implemented by child classes. More...
 
 process_form ($formdata)
 Init object based using data from form. More...
 
 track_exports ()
 Update exported field in grade_grades table. More...
 

Static Public Member Functions

static convert_flat_displaytypes_to_array ($displaytypes)
 Convert the grade display types parameter into the required array to grade exporting class. More...
 
static convert_flat_itemids_to_array ($itemids)
 Convert the item ids parameter into the required array to grade exporting class. More...
 
static export_bulk_export_data ($id, $itemids, $exportfeedback, $onlyactive, $displaytype, $decimalpoints, $updatedgradesonly=null, $separator=null)
 Create a stdClass object from URL parameters to be used by grade_export class. More...
 

Public Attributes

 $columns
 
 $course
 
 $decimalpoints
 
$displaytype $displaytype
 Grade display type (real, percentages or letter). More...
 
 $export_feedback
 
 $export_letters
 
 $grade_items
 
 $groupid
 
 $onlyactive
 
 $plugin = 'xls'
 
$previewrows $previewrows
 
 $updatedgradesonly
 
 $usercustomfields
 
 $userkey
 

Protected Member Functions

 deprecated_constructor ($course, $groupid=0, $itemlist='', $export_feedback=false, $updatedgradesonly=false, $displaytype=GRADE_DISPLAY_TYPE_REAL, $decimalpoints=2, $onlyactive=false, $usercustomfields=false)
 Old deprecated constructor. More...
 

Constructor & Destructor Documentation

◆ __construct()

grade_export_xls::__construct (   $course,
  $groupid,
  $formdata 
)

Constructor should set up all the private variables ready to be pulled.

This constructor used to accept the individual parameters as separate arguments, in 2.8 this was simplified to just accept the data from the moodle form.

Parameters
object$course
int$groupid
stdClass | null$formdata
Note
Exporting as letters will lead to data loss if that exported set it re-imported.

Reimplemented from grade_export.

Member Function Documentation

◆ convert_flat_displaytypes_to_array()

static grade_export::convert_flat_displaytypes_to_array (   $displaytypes)
staticinherited

Convert the grade display types parameter into the required array to grade exporting class.

In order to export, the array key must be the display type name and the value must be the grade display type constant.

Note: Added support for combined display types constants like the (GRADE_DISPLAY_TYPE_PERCENTAGE_REAL) as the $CFG->grade_export_displaytype config is still used on 2.7 in case of missing displaytype url param. In these cases, the file will be exported with a column for each display type.

Parameters
string$displaytypescan be a single or multiple display type constants comma separated.
Return values
array::$types

◆ convert_flat_itemids_to_array()

static grade_export::convert_flat_itemids_to_array (   $itemids)
staticinherited

Convert the item ids parameter into the required array to grade exporting class.

In order to export, the array key must be the grade item id and all values must be one.

Parameters
string$itemidscan be a single item id or many item ids comma separated.
Return values
array::$itemscorrectly formatted array.

◆ deprecated_constructor()

grade_export::deprecated_constructor (   $course,
  $groupid = 0,
  $itemlist = '',
  $export_feedback = false,
  $updatedgradesonly = false,
  $displaytype = GRADE_DISPLAY_TYPE_REAL,
  $decimalpoints = 2,
  $onlyactive = false,
  $usercustomfields = false 
)
protectedinherited

Old deprecated constructor.

This deprecated constructor accepts the individual parameters as separate arguments, in 2.8 this was simplified to just accept the data from the moodle form.

Deprecated:
since 2.8 MDL-46548. Instead call the shortened constructor which accepts the data directly from the grade_export_form.

◆ display_preview()

grade_export::display_preview (   $require_user_idnumber = false)
inherited

Prints preview of exported grades on screen as a feedback mechanism.

Parameters
bool$require_user_idnumbertrue means skip users without idnumber
Deprecated:
since 2.8 MDL-46548. Previews are not useful on export.

◆ export_bulk_export_data()

static grade_export::export_bulk_export_data (   $id,
  $itemids,
  $exportfeedback,
  $onlyactive,
  $displaytype,
  $decimalpoints,
  $updatedgradesonly = null,
  $separator = null 
)
staticinherited

Create a stdClass object from URL parameters to be used by grade_export class.

Parameters
int$idcourse id.
string$itemidsgrade items comma separated.
bool$exportfeedbackexport feedback option.
bool$onlyactiveonly enrolled active students.
string$displaytypegrade display type constants comma separated.
int$decimalpointsgrade decimal points.
null$updatedgradesonlyrecently updated grades only (Used by XML exporting only).
null$separatorseparator character: tab, comma, colon and semicolon (Used by TXT exporting only).
Return values
stdClass::$formdata

◆ format_column_name()

grade_export::format_column_name (   $grade_item,
  $feedback = false,
  $gradedisplayname = null 
)
inherited

Returns the name of column in export.

Parameters
object$grade_item
boolean$feedbackfeedback colum
string$gradedisplaynamegrade display name.
Return values
string

◆ format_feedback()

grade_export::format_feedback (   $feedback,
  $grade = null 
)
inherited

Returns formatted grade feedback.

Parameters
object$feedbackobject with properties feedback and feedbackformat
object$gradeGrade object with grade properties
Return values
string

◆ format_grade()

grade_export::format_grade (   $grade,
  $gradedisplayconst = null 
)
inherited

Returns string representation of final grade.

Parameters
object$gradeinstance of grade_grade class
integer$gradedisplayconstgrade display type constant.
Return values
string

◆ get_export_params()

grade_export::get_export_params ( )
inherited

Returns array of parameters used by dump.php and export.php.

Return values
array

Reimplemented in grade_export_txt.

◆ get_export_url()

grade_export::get_export_url ( )
inherited

Generate the export url.

Get submitted form data and create the url to be used on the grade publish feature.

Return values
moodle_urlthe url of grade publishing export.

◆ get_grade_publishing_url()

grade_export::get_grade_publishing_url ( )
inherited

Create the html code of the grade publishing feature.

Return values
string::$outputhtml code of the grade publishing.

◆ print_continue()

grade_export::print_continue ( )
inherited

Either prints a "Export" box, which will redirect the user to the download page, or prints the URL for the published data.

Deprecated:
since 2.8 MDL-46548. Call get_export_url and set the action of the grade_export_form instead.
Return values
void

◆ print_grades()

grade_export_xls::print_grades ( )

To be implemented by child classes.

Reimplemented from grade_export.

◆ process_form()

grade_export::process_form (   $formdata)
inherited

Init object based using data from form.

Parameters
object$formdata

◆ track_exports()

grade_export::track_exports ( )
inherited

Update exported field in grade_grades table.

Return values
boolean

Member Data Documentation

◆ $displaytype

$displaytype grade_export::$displaytype
inherited

Grade display type (real, percentages or letter).

This attribute is an integer for XML file export. Otherwise is an array for all other formats (ODS, XLS and TXT).

Grade display type constant (1, 2 or 3) or an array of display types where the key is the name and the value is the grade display type constant or 0 for unchecked display types.

◆ $previewrows

$previewrows grade_export::$previewrows
inherited
Deprecated:
since Moodle 2.8 Number of rows in preview.

The documentation for this class was generated from the following file: