Processor class.  
 More...
|  | 
| const | MODE_CREATE_ALL = 2 | 
|  | Create all courses, appending a suffix to the shortname if the course exists. 
 | 
|  | 
| const | MODE_CREATE_NEW = 1 | 
|  | Create courses that do not exist yet. 
 | 
|  | 
| const | MODE_CREATE_OR_UPDATE = 3 | 
|  | Create courses, and update the ones that already exist. 
 | 
|  | 
| const | MODE_UPDATE_ONLY = 4 | 
|  | Only update existing courses. 
 | 
|  | 
| const | UPDATE_ALL_WITH_DATA_ONLY = 1 | 
|  | During update, only use data passed from the CSV. 
 | 
|  | 
| const | UPDATE_ALL_WITH_DATA_OR_DEFAUTLS = 2 | 
|  | During update, use either data from the CSV, or defaults. 
 | 
|  | 
| const | UPDATE_MISSING_WITH_DATA_OR_DEFAUTLS = 3 | 
|  | During update, update missing values from either data from the CSV, or defaults. 
 | 
|  | 
| const | UPDATE_NOTHING = 0 | 
|  | During update, do not update anything... O_o Huh?! 
 | 
|  | 
|  | 
| bool | $allowdeletes = false | 
|  | are deletes allowed. 
 | 
|  | 
| bool | $allowrenames = false | 
|  | are renames allowed. 
 | 
|  | 
| bool | $allowresets = false | 
|  | are resets allowed. 
 | 
|  | 
| csv_import_reader | $cir | 
|  | 
| array | $columns = array() | 
|  | CSV columns. 
 | 
|  | 
| array | $defaults = array() | 
|  | default values. 
 | 
|  | 
| array | $errors = array() | 
|  | of errors where the key is the line number. 
 | 
|  | 
| int | $linenb = 0 | 
|  | line number. 
 | 
|  | 
| int | $mode | 
|  | processor mode. 
 | 
|  | 
| bool | $processstarted = false | 
|  | whether the process has been started or not. 
 | 
|  | 
| string | $reset | 
|  | reset courses after processing them. 
 | 
|  | 
| string | $restorefile | 
|  | path to a restore file. 
 | 
|  | 
| string | $shortnametemplate | 
|  | template to generate a course shortname. 
 | 
|  | 
| string | $templatecourse | 
|  | shortname of the course to be restored. 
 | 
|  | 
| int | $updatemode | 
|  | upload mode. 
 | 
|  | 
Processor class. 
- Copyright
- 2013 Frédéric Massart 
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
◆ __construct()
      
        
          | tool_uploadcourse_processor::__construct | ( | csv_import_reader | $cir, | 
        
          |  |  | array | $options, | 
        
          |  |  | array | $defaults = array() ) | 
      
 
Constructor. 
- Parameters
- 
  
    | csv_import_reader | $cir | import reader object |  | array | $options | options of the process |  | array | $defaults | default data value |  
 
 
 
◆ execute()
      
        
          | tool_uploadcourse_processor::execute | ( |  | $tracker = null | ) |  | 
      
 
Execute the process. 
- Parameters
- 
  
    | object | $tracker | the output tracker to use. |  
 
- Return values
- 
  
  
 
 
◆ get_course()
  
  | 
        
          | tool_uploadcourse_processor::get_course | ( |  | $data | ) |  |  | protected | 
 
Return a course import object. 
- Parameters
- 
  
    | array | $data | data to import the course with. |  
 
- Return values
- 
  
  
 
 
◆ get_errors()
      
        
          | tool_uploadcourse_processor::get_errors | ( |  | ) |  | 
      
 
Return the errors. 
- Return values
- 
  
  
 
 
◆ get_restore_content_dir()
  
  | 
        
          | tool_uploadcourse_processor::get_restore_content_dir | ( |  | ) |  |  | protected | 
 
Get the directory of the object to restore. 
- Return values
- 
  
    | string | subdirectory in $CFG->backuptempdir/... |  
 
 
 
◆ log_error()
  
  | 
        
          | tool_uploadcourse_processor::log_error | ( |  | $errors | ) |  |  | protected | 
 
Log errors on the current line. 
- Parameters
- 
  
    | array | $errors | array of errors |  
 
- Return values
- 
  
  
 
 
◆ parse_line()
  
  | 
        
          | tool_uploadcourse_processor::parse_line | ( |  | $line | ) |  |  | protected | 
 
Parse a line to return an array(column => value) 
- Parameters
- 
  
  
- Return values
- 
  
  
 
 
◆ preview()
      
        
          | tool_uploadcourse_processor::preview | ( |  | $rows = 10, | 
        
          |  |  |  | $tracker = null ) | 
      
 
Return a preview of the import. 
This only returns passed data, along with the errors.
- Parameters
- 
  
    | integer | $rows | number of rows to preview. |  | object | $tracker | the output tracker to use. |  
 
- Return values
- 
  
  
 
 
◆ reset()
      
        
          | tool_uploadcourse_processor::reset | ( |  | ) |  | 
      
 
Reset the current process. 
- Return values
- 
  
  
 
 
◆ validate()
  
  | 
        
          | tool_uploadcourse_processor::validate | ( |  | ) |  |  | protected | 
 
Validation. 
- Return values
- 
  
  
 
 
The documentation for this class was generated from the following file: