function get_content() { global $USER, $CFG; if ($this->content !== NULL) { return $this->content; } if (empty($this->instance)) { return ''; } $this->content = new stdClass(); $courses = tao_get_authored_learning_paths($USER); $html = '<table id="authored_learning_paths" width="100%" border="0" cellspacing="0" cellpadding="0">'; if (!empty($courses)) { foreach ($courses as $course) { $html .= '<tr><td><a href="' . $CFG->wwwroot . '/course/view.php?id=' . $course->id . '">' . $course->shortname . '</a></td><td align="right">' . $course->status . '</td></tr>'; } } else { $html .= '<tr><td>' . get_string('nolearningpaths', 'block_tao_authored_learning_paths') . '</td></tr>'; } $html .= '</table>'; $this->content->text = $html; $this->content->footer = '<br/><a href="/course/addlearningpath.php?category=' . $CFG->lpdefaultcategory . '">' . get_string('createnew', 'block_tao_authored_learning_paths') . '...</a>'; return $this->content; }
function tao_print_my_authoring() { global $CFG, $USER; $courses = tao_get_authored_learning_paths($USER); echo '<h2>' . get_string('authoredlearningpaths', 'local') . '</h2>'; if (!empty($courses)) { $html = '<table id="unpublished_learning_paths" width="100%" border="0" cellspacing="0" cellpadding="0">'; $html .= '<tr><th align="left">' . get_string('course') . '</th><th align="left">' . get_string('status') . '</th><th></th>'; foreach ($courses as $course) { $html .= '<tr>'; $html .= '<td><a href="' . $CFG->wwwroot . '/course/view.php?id=' . $course->id . '">' . $course->fullname . '</a></td>'; $html .= '<td>' . $course->status . '</td>'; $html .= '<td align="right"> </td>'; $html .= '</tr>'; } $html .= '</table>'; } else { $html = '<p>' . get_string('nolearningpaths', 'local') . '</p>'; } echo $html; echo '<p><a href="' . $CFG->wwwroot . '/course/addlearningpath.php?category=' . $CFG->lpdefaultcategory . '">' . get_string('addnewlearningpath', 'local') . '...</a></p>'; }
function tao_print_my_learning_paths_raflmode() { global $USER, $CFG; if (isguest()) { //don't print anything if this is a guest user. return; } echo '<h2>' . get_string('mylearningpaths', 'local') . '</h2>'; echo '<p>' . get_string('mylearningpathsdescription', 'local') . '</p>'; echo '<table id="my_learning_paths_raflmode" border=0><tr>'; echo '<td>'; echo '<h4>' . get_string('myownlearningpaths', 'local') . '</h4>'; // print learning paths i created $courses = tao_get_authored_learning_paths($USER); tao_print_mylearningpath_list($courses); echo '<p><a href="' . $CFG->wwwroot . '/course/addlearningpath.php?category=' . $CFG->lpdefaultcategory . '">' . get_string('addnewlearningpath', 'local') . '...</a></p>'; echo '</td>'; echo '<td>'; // print learning paths I am contributing to echo '<h4>' . get_string('mylearningpathcontributions', 'local') . '</h4>'; $courses = tao_get_learning_paths_by_role_of_user($USER, ROLE_LPCONTRIBUTOR); tao_print_mylearningpath_list($courses); echo '</td>'; echo '<td>'; // print the learning paths i am enrolled in echo '<h4>' . get_string('mylearningpathbookmarks', 'local') . '</h4>'; $courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', '*', false, 21); tao_print_mylearningpath_list($courses); echo '</td>'; echo '</tr></table>'; }