$dummy = $page; $page = $accessiblityhide . $dummy; } print "\n<tr{$current}>\n <td class='ouw_leftcol'>{$date}</td><td>{$time}</td><td>{$page}</td>\n {$actions}"; if ($ouwiki->enablewordcount) { if (isset($change->previouswordcount)) { $wordcountchanges = ouwiki_wordcount_difference($change->wordcount, $change->previouswordcount, true); } else { // first page $wordcountchanges = ouwiki_wordcount_difference($change->wordcount, 0, false); } print "<td>{$wordcountchanges}</td>"; } if ($overwritten) { if (!empty($change->importversionid)) { $selectedouwiki = ouwiki_get_wiki_details($change->importversionid); print '<td>'; if ($selectedouwiki->courseshortname) { print $selectedouwiki->courseshortname . '<br/>'; } print $selectedouwiki->name; if ($selectedouwiki->group) { print '<br/>'; print '[[' . $selectedouwiki->group . ']]'; } else { if ($selectedouwiki->user) { print '<br/>'; print '[[' . $selectedouwiki->user . ']]'; } } print '</td>';
/** * Render single user participation record for display * * @param object $user * @param array $changes user participation * @param object $cm * @param object $course * @param object $ouwiki * @param object $subwiki * @param string $pagename * @param int $groupid * @param string $download * @param bool $canview level of participation user can view * @param object $context * @param string $fullname * @param bool $cangrade permissions to grade user participation * @param string $groupname */ public function ouwiki_render_user_participation($user, $changes, $cm, $course, $ouwiki, $subwiki, $pagename, $groupid, $download, $canview, $context, $fullname, $cangrade, $groupname) { global $DB, $CFG, $OUTPUT; require_once $CFG->dirroot . '/mod/ouwiki/participation_table.php'; $filename = "{$course->shortname}-" . format_string($ouwiki->name, true); if (!empty($groupname)) { $filename .= '-' . format_string($groupname, true); } $filename .= '-' . format_string($fullname, true); // setup the table $table = new ouwiki_user_participation_table($cm, $course, $ouwiki, $pagename, $groupname, $user, $fullname); $table->setup($download); $table->is_downloading($download, $filename, get_string('participation', 'ouwiki')); // participation doesn't need standard ouwiki tabs so we need to // add this one div in manually if (!$table->is_downloading()) { echo html_writer::start_tag('div', array('id' => 'ouwiki_belowtabs')); if (count($changes) < $table->pagesize) { $table->pagesize(count($changes), count($changes)); } } $previouswordcount = false; $lastdate = null; foreach ($changes as $change) { $date = userdate($change->timecreated, get_string('strftimedate')); $time = userdate($change->timecreated, get_string('strftimetime')); if (!$table->is_downloading()) { if ($date == $lastdate) { $date = null; } else { $lastdate = $date; } $now = time(); $edittime = $time; if ($now - $edittime < 5 * 60) { $category = 'ouw_recenter'; } else { if ($now - $edittime < 4 * 60 * 60) { $category = 'ouw_recent'; } else { $category = 'ouw_recentnot'; } } $time = html_writer::start_tag('span', array('class' => $category)); $time .= $edittime; $time .= html_writer::end_tag('span'); } $page = $change->title ? htmlspecialchars($change->title) : get_string('startpage', 'ouwiki'); $row = array($date, $time, $page); // word counts if ($ouwiki->enablewordcount) { $previouswordcount = false; if ($change->previouswordcount) { $words = ouwiki_wordcount_difference($change->wordcount, $change->previouswordcount, true); } else { $words = ouwiki_wordcount_difference($change->wordcount, 0, false); } if (!$table->is_downloading()) { $row[] = $words; } else { if ($words <= 0) { $row[] = 0; $row[] = $words; } else { $row[] = $words; $row[] = 0; } } } // Allow imports. if ($ouwiki->allowimport) { $imported = ''; if ($change->importversionid) { $wikidetails = ouwiki_get_wiki_details($change->importversionid); $wikiname = $wikidetails->name; if ($wikidetails->courseshortname) { $coursename = $wikidetails->courseshortname . '<br/>'; $imported = $coursename . $wikiname; } else { $imported = $wikiname; } if ($wikidetails->group) { $users = '<br/> [[' . $wikidetails->group . ']]'; $imported = $imported . $users; } else { if ($wikidetails->user) { $users = '<br/>[[' . $wikidetails->user . ']]'; $imported = $imported . $users; } } } $row[] = $imported; } if (!$table->is_downloading()) { $pageparams = ouwiki_display_wiki_parameters($change->title, $subwiki, $cm); $pagestr = $page . ' ' . $lastdate . ' ' . $edittime; if ($change->id != $change->firstversionid) { $accesshidetext = get_string('viewwikichanges', 'ouwiki', $pagestr); $changeurl = new moodle_url("/mod/ouwiki/diff.php?{$pageparams}" . "&v2={$change->id}&v1={$change->previousversionid}"); $changelink = html_writer::start_tag('small'); $changelink .= ' ('; $changelink .= html_writer::link($changeurl, get_string('changes', 'ouwiki')); $changelink .= ')'; $changelink .= html_writer::end_tag('small'); } else { $accesshidetext = get_string('viewwikistartpage', 'ouwiki', $pagestr); $changelink = html_writer::start_tag('small'); $changelink .= ' (' . get_string('newpage', 'ouwiki') . ')'; $changelink .= html_writer::end_tag('small'); } $current = ''; if ($change->id == $change->currentversionid) { $viewurl = new moodle_url("/mod/ouwiki/view.php?{$pageparams}"); } else { $viewurl = new moodle_url("/mod/ouwiki/viewold.php?" . "{$pageparams}&version={$change->id}"); } $actions = html_writer::tag('span', $accesshidetext, array('class' => 'accesshide')); $actions .= html_writer::link($viewurl, get_string('view')); $actions .= $changelink; $row[] = $actions; } // add to the table $table->add_data($row); } $table->finish_output(); if (!$table->is_downloading() && $cangrade && $ouwiki->grade != 0) { $this->ouwiki_render_user_grade($course, $cm, $ouwiki, $user, $pagename, $groupid); } }