public function toArray() { $course_list_array = $this->getParameters(); $course_list_array['end_index'] = $this->end_index; $courses_array = array(); $count = 0; foreach ($this->course_list as $key => $course) { $count++; $course_array = array(); $mdl_course = $course->getObject(); $course_list_item = new GcrCourseListItem($course); $mdl_course = $course->getObject(); $eschool = $course->getApp(); $course_array['id'] = $mdl_course->id; $course_array['shortname'] = $mdl_course->shortname; $course_array['eschool'] = $eschool->getShortName(); $course_array['fullname'] = $mdl_course->fullname; $course_array['course_icon_url'] = $course_list_item->getCourseIconUrl(); $course_array['course_url'] = $course->getUrl(); $course_array['is_representative'] = $course_list_item->getCourseCollection(); $courses_array[$key] = $course_array; } $course_list_array['course_list'] = $courses_array; $course_list_array['course_count'] = $count; return $course_list_array; }
echo $ctlg_crse_list_key; ?> " width="100%" align="left"> <thead> <tr> <th width="20%">Course Title</th> <th width="15%">Price</th> <th width="40%">Description</th> <th width="25%"></th> </tr> </thead> <tbody> <?php foreach ($ctlg_courses_list as $course_list) { $mdl_course = $course_list->getObject(); $course_list_item = new GcrCourseListItem($course_list); $eschool = $course_list->getApp(); $id = 'gcr_course_' . $eschool->getShortName() . '_' . $mdl_course->id; $img_src = $course_list_item->getCourseIconUrl(); $mdl_user = $course_list_item->getInstructor(); $summary = $course_list_item->getSummary(); $enrol_count = $course_list_item->getActiveUserCount(); $shortsummary = GcrInstitutionTable::formatStringSize($summary, 250, 21); if ($mdl_user) { $teacher_text = GcrEschoolTable::getInstructorProfileHtml($mdl_user); } else { $teacher_text = 'None'; } $fullname = GcrInstitutionTable::formatStringSize($mdl_course->fullname, 60, 30); $cost = $course_list->getCost(); $cost_text = '';
$new_file = $mform->save_stored_file('userfile', $context->id, 'block_course_profile', 'courseicon', 0, '/', $courseid); } $courseicon = ''; if ($new_file || $old_file) { $courseicon = $courseid; } $instructorid = isset($formdata->instructorid) ? $formdata->instructorid : 0; $data_to_save = array('instructorid' => $instructorid, 'courseid' => $courseid, 'courseicon' => $courseicon); $CFG->current_app->upsertIntoMdlTable('block_course_profile', $data_to_save, array('courseid' => $courseid)); rebuild_course_cache($courseid); redirect(new moodle_url('/course/view.php?id=' . $courseid)); } } echo $OUTPUT->box_start('generalbox'); // display current course icon $course_list_item = new GcrCourseListItem($mdl_course); $img_src = $course_list_item->getCourseIconUrl(); ?> <div class="gc_course_list_item_icon" style="float:left;"><img src="<?php print $img_src; ?> " /></div> <div style="float:left;width:65%;margin-left:40px"> <h2>Course Profile Information</h2> <p>Improve the visibility of your course by uploading a custom image (120px by 120px). This image will be displayed in the course catalog, and inside the course. If you do not wish to add a custom image at this time, a default course image will be used.</p> </div> <div style="clear:both"></div> <?php $mform->display();