echo "</div>"; $userpreferences = block_exabis_eportfolio_get_user_preferences(); if (!$sort && $userpreferences && isset($userpreferences->viewsort)) { $sort = $userpreferences->viewsort; } // check sorting $parsedsort = block_exabis_eportfolio_parse_view_sort($sort); $sort = $parsedsort[0] . '.' . $parsedsort[1]; $sortkey = $parsedsort[0]; if ($parsedsort[1] == "desc") { $newsort = $sortkey . ".asc"; } else { $newsort = $sortkey . ".desc"; } $sorticon = $parsedsort[1] . '.gif'; block_exabis_eportfolio_set_user_preferences(array('viewsort' => $sort)); $query = "select v.*" . " from {$CFG->prefix}block_exabeporview v" . " where v.userid = {$USER->id}" . block_exabis_eportfolio_view_sort_to_sql($parsedsort); $views = get_records_sql($query); if (!$views) { echo get_string("noviews", "block_exabis_eportfolio"); } else { $table = new stdClass(); $table->width = "100%"; $table->head = array(); $table->size = array(); $table->head['name'] = '<a href="' . $_SERVER['PHP_SELF'] . '?courseid=' . $courseid . '&sort=' . ($sortkey == 'name' ? $newsort : 'name') . '">' . get_string("name", "block_exabis_eportfolio") . "</a>"; $table->size['name'] = "30"; $table->head['timemodified'] = '<a href="' . $_SERVER['PHP_SELF'] . '?courseid=' . $courseid . '&sort=' . ($sortkey == 'timemodified' ? $newsort : 'timemodified.desc') . '">' . get_string("date", "block_exabis_eportfolio") . "</a>"; $table->size['timemodified'] = "20"; $table->head['accessoptions'] = get_string("accessoptions", "block_exabis_eportfolio"); $table->size['accessoptions'] = "30";
function block_exabis_eportfolio_get_user_preferences($userid = null) { if (is_null($userid)) { global $USER; $userid = $USER->id; } $userpreferences = block_exabis_eportfolio_get_user_preferences_record($userid); if (!$userpreferences || !$userpreferences->user_hash) { do { $hash = substr(md5(uniqid(rand(), true)), 3, 8); } while (record_exists("block_exabeporuser", "user_hash", $hash)); block_exabis_eportfolio_set_user_preferences($userid, array('user_hash' => $hash)); $userpreferences = block_exabis_eportfolio_get_user_preferences_record($userid); } return $userpreferences; }
echo '<input type="hidden" name="courseid" value="' . $courseid . '" />'; echo '<input type="submit" value="' . get_string("update") . '" />'; echo '</form>'; echo "<div class='block_eportfolio_center'>"; print_simple_box(text_to_html(get_string("explainpersonal", "block_exabis_eportfolio")), 'center'); echo "</div>"; if ($edit) { if (!confirm_sesskey()) { print_error("badsessionkey", "block_exabis_eportfolio"); } $informationform = new block_exabis_eportfolio_personal_information_form(); if ($informationform->is_cancelled()) { } else { if ($fromform = $informationform->get_data()) { trusttext_after_edit($newentry->description, $context); block_exabis_eportfolio_set_user_preferences(array('description' => $fromform->description, 'persinfo_timemodified' => time())); // read new data from the database $userpreferences = block_exabis_eportfolio_get_user_preferences(); $description = $userpreferences->description; print_simple_box(get_string("descriptionsaved", "block_exabis_eportfolio"), 'center', '40%', '#ccffbb'); } else { $show_information = false; $informationform->set_data(array('courseid' => $courseid, 'description' => $description, 'cataction' => 'save', 'edit' => 1)); $informationform->display(); } } } if ($show_information) { echo '<table cellspacing="0" class="forumpost blogpost blog" width="100%">'; echo '<tr class="header"><td class="picture left">'; print_user_picture($USER->id, $courseid, $USER->picture);