Commit 5bd281e5 authored by Penny Leach's avatar Penny Leach Committed by Penny Leach
Browse files

beginning of profile views: database tables and contracts for blocktypes. no upgrade path yet

parent 598e9495
......@@ -457,6 +457,7 @@ function upgrade_plugin($upgrade) {
// install blocktype categories.
if ($plugintype == 'blocktype' && get_config('installed')) {
install_blocktype_categories_for_plugin($pluginname);
install_blocktype_viewtypes_for_plugin($pluginname);
}
$prevversion = (empty($upgrade->install)) ? $upgrade->from : 0;
......@@ -607,8 +608,7 @@ function core_install_lastcoredata_defaults() {
// if we're upgrading this happens somewhere else. This is because of dependency issues around
// the order of installation stuff.
install_blocktype_categories();
install_blocktype_extras();
}
function core_install_firstcoredata_defaults() {
......@@ -706,6 +706,12 @@ function core_install_firstcoredata_defaults() {
// install the view column widths
install_view_column_widths();
$viewtypes = array('portfolio', 'profile');
foreach ($viewtypes as $vt) {
insert_record('view_type', (object)array(
'type' => $vt,
));
}
db_commit();
}
......@@ -833,7 +839,23 @@ function install_blocktype_categories_for_plugin($blocktype) {
db_commit();
}
function install_blocktype_categories() {
function install_blocktype_viewtypes_for_plugin($blocktype) {
safe_require('blocktype', $blocktype);
$blocktype = blocktype_namespaced_to_single($blocktype);
db_begin();
delete_records('blocktype_installed_viewtype', 'blocktype', $blocktype);
if ($viewtypes = call_static_method(generate_class_name('blocktype', $blocktype), 'get_viewtypes')) {
foreach($viewtypes as $vt) {
insert_record('blocktype_installed_viewtype', (object)array(
'blocktype' => $blocktype,
'viewtype' => $vt,
));
}
}
db_commit();
}
function install_blocktype_extras() {
db_begin();
$categories = get_blocktype_categories();
......@@ -852,6 +874,7 @@ function install_blocktype_categories() {
if ($blocktypes = plugins_installed('blocktype')) {
foreach ($blocktypes as $bt) {
install_blocktype_categories_for_plugin(blocktype_single_to_namespaced($bt->name, $bt->artefactplugin));
install_blocktype_viewtypes_for_plugin(blocktype_single_to_namespaced($bt->name, $bt->artefactplugin));
}
}
}
......
......@@ -1658,6 +1658,18 @@ function main_nav() {
'title' => get_string('myviews'),
'weight' => 10
),
array(
'path' => 'profile/view',
'url' => 'user/view.php',
'title' => get_string('viewmyprofilepage'),
'weight' => 9
),
array(
'path' => 'profile/editprofilepage',
'url' => 'user/editprofile.php',
'title' => get_string('editmyprofilepage'),
'weight' => 9
),
array(
'path' => 'groups',
'url' => 'group/mygroups.php',
......
......@@ -28,8 +28,16 @@ require(dirname(dirname(__FILE__)).'/init.php');
require_once('group.php');
require_once('pieforms/pieform.php');
$userid = param_integer('id','');
$loggedinid = $USER->get('id');
if (!empty($loggedinid)) {
$userid = param_integer('id', $loggedinid);
}
else {
$userid = param_integer('id');
}
if ($userid == $loggedinid) {
define('MENUITEM', 'profile/view');
}
// Get the user's details
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment