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
......@@ -119,6 +119,14 @@ $siteoptionform = pieform(array(
'options' => $yesno,
'help' => true,
),
'allowpublicprofiles' => array(
'type' => 'select',
'title' => get_string('allowpublicprofiles', 'admin'),
'description' => get_string('allowpublicprofilesdescription', 'admin'),
'defaultvalue' => get_config('allowpublicprofiles'),
'options' => $yesno,
'help' => true,
),
'defaultaccountlifetime' => array(
'type' => 'expiry',
'title' => get_string('defaultaccountlifetime', 'admin'),
......
......@@ -55,6 +55,10 @@ class PluginBlocktypeBlog extends PluginBlocktype {
return array('blog');
}
public static function get_viewtypes() {
return array('portfolio', 'profile');
}
public static function render_instance(BlockInstance $instance) {
$configdata = $instance->get('configdata');
......
......@@ -55,6 +55,10 @@ class PluginBlocktypeBlogpost extends PluginBlocktype {
return array('blog');
}
public static function get_viewtypes() {
return array('portfolio', 'profile');
}
public static function render_instance(BlockInstance $instance) {
$configdata = $instance->get('configdata');
......
......@@ -41,6 +41,10 @@ class PluginBlocktypeRecentposts extends PluginBlocktype {
return array('blog');
}
public static function get_viewtypes() {
return array('portfolio', 'profile');
}
public static function render_instance(BlockInstance $instance) {
$configdata = $instance->get('configdata');
......
......@@ -40,6 +40,10 @@ class PluginBlocktypeFiledownload extends PluginBlocktype {
return array('fileimagevideo');
}
public static function get_viewtypes() {
return array('portfolio');
}
public static function render_instance(BlockInstance $instance) {
require_once(get_config('docroot') . 'artefact/lib.php');
$configdata = $instance->get('configdata');
......
......@@ -55,6 +55,10 @@ class PluginBlocktypeFolder extends PluginBlocktype {
return array('fileimagevideo');
}
public static function get_viewtypes() {
return array('portfolio');
}
public static function render_instance(BlockInstance $instance) {
require_once(get_config('docroot') . 'artefact/lib.php');
$configdata = $instance->get('configdata');
......
......@@ -40,6 +40,10 @@ class PluginBlocktypeImage extends PluginBlocktype {
return array('fileimagevideo');
}
public static function get_viewtypes() {
return array('portfolio', 'profile');
}
public static function render_instance(BlockInstance $instance) {
$configdata = $instance->get('configdata'); // this will make sure to unserialize it for us
$configdata['viewid'] = $instance->get('view');
......
......@@ -40,6 +40,10 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
return array('fileimagevideo');
}
public static function get_viewtypes() {
return array('portfolio', 'profile');
}
public static function has_config() {
return true;
}
......
......@@ -40,6 +40,10 @@ class PluginBlocktypeContactinfo extends PluginBlocktype {
return array('internal');
}
public static function get_viewtypes() {
return array('portfolio', 'profile');
}
public static function render_instance(BlockInstance $instance) {
require_once(get_config('docroot') . 'artefact/lib.php');
$smarty = smarty_core();
......
......@@ -40,6 +40,10 @@ class PluginBlocktypeProfileinfo extends PluginBlocktype {
return array('internal');
}
public static function get_viewtypes() {
return array('portfolio', 'profile');
}
public static function render_instance(BlockInstance $instance) {
require_once(get_config('docroot') . 'artefact/lib.php');
$smarty = smarty_core();
......
......@@ -40,6 +40,10 @@ class PluginBlocktypeEntireresume extends PluginBlocktype {
return array('resume');
}
public static function get_viewtypes() {
return array('portfolio');
}
public static function render_instance(BlockInstance $instance) {
require_once(get_config('docroot') . 'artefact/lib.php');
$smarty = smarty_core();
......
......@@ -40,6 +40,10 @@ class PluginBlocktypeResumefield extends PluginBlocktype {
return array('resume');
}
public static function get_viewtypes() {
return array('portfolio');
}
/**
* Optional method. If exists, allows this class to decide the title for
* all blockinstances of this type
......
......@@ -40,6 +40,10 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
return array('feeds');
}
public static function get_viewtypes() {
return array('portfolio', 'profile');
}
public static function render_instance(BlockInstance $instance) {
$configdata = $instance->get('configdata');
if ($configdata['feedid']) {
......
......@@ -54,6 +54,10 @@ class PluginBlocktypeExternalvideo extends SystemBlocktype {
return array('fileimagevideo');
}
public static function get_viewtypes() {
return array('portfolio');
}
public static function render_instance(BlockInstance $instance) {
$configdata = $instance->get('configdata');
$result = '';
......
......@@ -51,6 +51,8 @@ abstract class PluginBlocktype extends Plugin {
public static abstract function get_categories();
public static abstract function get_viewtypes();
public static abstract function render_instance(BlockInstance $instance);
/**
......
......@@ -40,6 +40,10 @@ class PluginBlocktypeTextbox extends SystemBlocktype {
return array('general');
}
public static function get_viewtypes() {
return array('portfolio', 'profile');
}
public static function render_instance(BlockInstance $instance) {
$configdata = $instance->get('configdata');
$text = (isset($configdata['text'])) ? $configdata['text'] : '';
......
......@@ -106,7 +106,9 @@ $string['pluginadmindescription'] = 'Install and configure plugins';
// Site options
$string['allowpublicviews'] = 'Allow public views';
$string['allowpublicviewsdescription'] = 'If set to yes, users will be able to create Views that are accessable to the public rather than only to logged in users';
$string['allowpublicviewsdescription'] = 'If set to yes, users will be able to create portfolio Views that are accessable to the public rather than only to logged in users';
$string['allowpublicprofiles'] = 'Allow public profiles';
$string['allowpublicprofilesdescription'] = 'If set to yes, users will be able to set their profile Views to be accessable to the public rather than only to logged in users';
$string['defaultaccountinactiveexpire'] = 'Default account inactivity time';
$string['defaultaccountinactiveexpiredescription'] = 'How long a user account will remain active without the user logging in';
$string['defaultaccountinactivewarn'] = 'Warning time for inactivity/expiry';
......
......@@ -398,6 +398,8 @@ $string['findgroups'] = 'Find Groups';
$string['returntosite'] = 'Return to Site';
$string['siteadministration'] = 'Site Administration';
$string['useradministration'] = 'User Administration';
$string['viewmyprofilepage'] = 'View profile page';
$string['editmyprofilepage'] = 'Edit profile page';
$string['unreadmessages'] = 'unread messages';
$string['unreadmessage'] = 'unread message';
......
......@@ -511,6 +511,25 @@
<KEY NAME="columnwidthuk" TYPE="unique" FIELDS="columns,widths"/>
</KEYS>
</TABLE>
<TABLE NAME="view_type">
<FIELDS>
<FIELD NAME="type" TYPE="char" LENGTH="50" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="type" />
</KEYS>
</TABLE>
<!-- this should really be with the rest of the blocktype plugin subsystem but can't because of ordering -->
<TABLE NAME="blocktype_installed_viewtype">
<FIELDS>
<FIELD NAME="blocktype" TYPE="char" LENGTH="50" NOTNULL="true" />
<FIELD NAME="viewtype" TYPE="char" LENGTH="50" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="blocktypefk" TYPE="foreign" FIELDS="blocktype" REFTABLE="blocktype_installed" REFFIELDS="name" />
<KEY NAME="viewtypefk" TYPE="foreign" FIELDS="viewtype" REFTABLE="view_type" REFFIELDS="type" />
</KEYS>
</TABLE>
<TABLE NAME="view">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
......@@ -530,6 +549,7 @@
<FIELD NAME="layout" TYPE="int" LENGTH="10"/>
<FIELD NAME="template" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true" />
<FIELD NAME="copynewuser" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true" />
<FIELD NAME="type" TYPE="char" LENGTH="50" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
......@@ -538,6 +558,7 @@
<KEY NAME="layoutfk" TYPE="foreign" FIELDS="layout" REFTABLE="view_layout" REFFIELDS="id"/>
<KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
<KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" />
<KEY NAME="typefk" TYPE="foreign" FIELDS="type" REFTABLE="view_type" REFFIELDS="type" />
</KEYS>
</TABLE>
<TABLE NAME="view_tag">
......
......@@ -345,7 +345,7 @@ function xmldb_core_upgrade($oldversion=0) {
// Install all the blocktypes and their categories now, as they'll be
// needed for the template migration
install_blocktype_categories();
install_blocktype_extras();
foreach(array(
'textbox', 'externalfeed', 'externalvideo',
'file/image', 'file/filedownload', 'file/folder', 'file/internalmedia',
......@@ -831,7 +831,7 @@ function xmldb_core_upgrade($oldversion=0) {
);
// Force the install of the new 'fileimagevideo' blocktype
install_blocktype_categories();
install_blocktype_extras();
}
if ($oldversion < 2008012401) {
......
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