function display_stations()
    {
        global $CFG, $USER;
        $courseid = $this->instance->pageid;
        $pages = tao_get_learning_path_stations($courseid);
        $stations = '';
        if (tao_is_my_learning_path($courseid)) {
            // get list of viewed pages
            $viewed = tao_get_viewed_learning_path_stations($courseid, $USER->id);
        } else {
            // just say we've viewed none
            $viewed = array();
        }
        foreach ($pages as $page) {
            // have we viewed this one?
            if (in_array($page->id, $viewed)) {
                $icon = "tick";
            } else {
                $icon = "caret_single_rtl";
                // (nadavkav)
            }
            $stations .= '<p><img border="0" align="right" src="' . $CFG->wwwroot . '/theme/intel/pix/path/' . $icon . '.gif"/><a href="';
            $stations .= $CFG->wwwroot . '/course/view.php?id=' . $courseid . '&page=' . $page->id . '" class="library"><span class="stations">';
            $stations .= format_string($page->nameone) . '</span></a></p>';
            // (nadavkav)
        }
        $html = '<h2>' . get_string('learningstations', 'block_tao_learning_path_summary') . '</h2>';
        $html .= '
<table cellspacing="0" cellpadding="0" border="0" width="100%"> <tbody> <!-- (nadavkav)-->
  <tr>
    <td width="10"> <br />
    </td>
    <td width="100%">
      <p style="text-align: center;">
        <table cellspacing="0" cellpadding="0" border="0" id="lp-stations" width="100%"> <tbody> <!-- (nadavkav)-->
          <tr>
		  <td class="lp-stations-list" valign="top">' . $stations . '</td>
            <td class="lp-stations-image" valign="top"> <img border="0" align="left" src="' . $CFG->wwwroot . '/theme/intel/pix/path/stufe01.gif" /><br />
            </td>
            
          </tr> </tbody>
        </table> </p>
    </td>
  </tr></tbody>
</table>
        ';
        return $html;
    }
示例#2
0
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once $CFG->dirroot . '/course/format/page/lib.php';
require_once $CFG->dirroot . '/course/format/learning/lib.php';
require_once $CFG->dirroot . '/local/forms.php';
require_login();
$courseid = required_param('id', PARAM_INT);
$context = get_context_instance(CONTEXT_COURSE, $courseid);
$strtitle = get_string('lpcompletionchecklist', 'local');
print_header($strtitle, $strtitle);
echo '<h2>' . $strtitle . '</h2>';
// check whether in 'my learning paths'
if (!tao_is_my_learning_path($courseid)) {
    notify(get_string('cannotcompletelearningpath', 'local'));
} else {
    // get list of all pages (stations)
    $stations = tao_get_learning_path_stations($courseid);
    // get list of viewed pages
    $viewed = tao_get_viewed_learning_path_stations($courseid, $USER->id);
    $mform = new tao_stationcompletion_form('', array('courseid' => $courseid, 'stations' => $stations, 'viewed' => $viewed));
    if ($data = $mform->get_data()) {
        $selected = array_keys(get_object_vars($data));
        foreach ($stations as $station) {
            $str = 'page_' . $station->id;
            // if selected
            if (in_array($str, $selected)) {
                // check whether we have it recorded already
                if (!in_array($station->id, $viewed)) {
                    // no - so insert
                    $record = new object();
                    $record->format_page_id = $station->id;
                    $record->userid = $USER->id;