echo $OUTPUT->heading(get_string('pluginname', 'local_cobaltcourses')); try { if (is_siteadmin($USER->id)) { $schoollist = $DB->get_records('local_school', array('visible' => 1)); } else { $schoollist = $hierarchy->get_assignedschools(); } $count = count($schoollist); /* ---Count of schools to which registrar is assigned--- */ if ($count < 1) { throw new Exception(get_string('notassignedschool', 'local_collegestructure')); } /* --- Current tab--- */ $currenttab = 'create'; /* ---adding tabs--- */ createtabview($currenttab, $id); if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) { if ($id < 0) echo $OUTPUT->box(get_string('coursecreatepage', 'local_cobaltcourses')); else echo $OUTPUT->box(get_string('courseeditpage', 'local_cobaltcourses')); } /* ---display the form--- */ $course->display(); } catch (Exception $e) { echo $e->getMessage(); } echo $OUTPUT->footer();
'coursetype' => 'coursetype', 'credithours' => 'credithours', 'coursecost' => 'coursecost' ); switch ($format) { case 'csv' : user_download_csv($fields); } die; } echo $OUTPUT->header(); /* ---Current tab--- */ $currenttab = 'download'; /* ---adding tabs--- */ createtabview($currenttab); echo $OUTPUT->heading(get_string('dd', 'local_cobaltcourses')); echo $OUTPUT->footer(); function user_download_csv($fields) { global $CFG; require_once($CFG->libdir . '/csvlib.class.php'); $filename = clean_filename(get_string('course', 'local_cobaltcourses')); $csvexport = new csv_export_writer(); $csvexport->set_filename($filename); $csvexport->add_data($fields); $userprofiledata = array(); $csvexport->add_data($userprofiledata); $csvexport->download_file(); die;