Commit ca3553c6 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files
parents e040ec35 38b0946b
......@@ -62,6 +62,7 @@ $string['occupation'] = 'Occupation';
$string['industry'] = 'Industry';
// Field names for view user and search user display
$string['profile'] = 'Profile';
$string['name'] = 'Name';
$string['principalemailaddress'] = 'Principal email';
$string['emailaddress'] = 'Alternative email';
......
......@@ -255,23 +255,25 @@ class ArtefactTypeProfile extends ArtefactType {
'type' => 'html',
'value' => ' ',
);
$currentwidth = get_config_plugin('artefact', 'internal', 'profileiconwidth');
$form['elements']['profileiconwidth'] = array(
'type' => 'text',
'size' => 4,
'suffix' => get_string('widthshort'),
'title' => get_string('profileiconsize', 'artefact.internal'),
'defaultvalue' => get_config_plugin('artefact', 'internal', 'profileiconwidth'),
'defaultvalue' => ((!empty($currentwidth)) ? $currentwidth : 100),
'rules' => array(
'required' => true,
'integer' => true,
)
);
$currentheight = get_config_plugin('artefact', 'internal', 'profileiconheight');
$form['elements']['profileiconheight'] = array(
'type' => 'text',
'suffix' => get_string('heightshort'),
'size' => 4,
'title' => get_string('profileiconsize', 'artefact.internal'),
'defaultvalue' => get_config_plugin('artefact', 'internal', 'profileiconheight'),
'defaultvalue' => ((!empty($currentheight)) ? $currentheight : 100),
'rules' => array(
'required' => true,
'integer' => true,
......
......@@ -30,9 +30,9 @@ define('PUBLIC', 1);
require('init.php');
require_once('pieforms/pieform.php');
if ($SESSION->is_logged_in()) {
$name = display_name($USER);
$email = $USER->email;
if ($USER->is_logged_in()) {
$name = display_name($USER->get('id'));
$email = $USER->get('email');
}
else {
$name = '';
......
......@@ -212,6 +212,10 @@ $string['myviews'] = 'My Views';
$string['submitview'] = 'Submit View';
$string['viewdeleted'] = 'View deleted';
// view user
$string['fullname'] = 'Full name';
$string['studentid'] = 'ID number';
$string['emailname'] = 'Mahara System'; // robot!
$string['config'] = 'Config';
......
......@@ -581,7 +581,7 @@
<FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
<FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
<FIELD NAME="atime" TYPE="datetime" NOTNULL="true" />
<FIELD NAME="submitted" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="submittedto" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="public" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="loggedin" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="friendsonly" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
......@@ -590,6 +590,7 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
<KEY NAME="ownerfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
<KEY NAME="templatefk" TYPE="foreign" FIELDS="template" REFTABLE="template" REFFIELDS="id" />
<KEY NAME="submittedtofk" TYPE="foreign" FIELDS="submittedto" REFTABLE="community" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="view_artefact">
......
......@@ -3,12 +3,25 @@
{include file="adminmenu.tpl"}
<div class="content">
<h3>{$NAME}</h3>
<table><tbody>
{foreach from=$PROFILE item=item}
<tr><td>{str section=artefact.internal tag=$item.name}</td><td>{$item.value}</td></tr>
{foreach from=$USERFIELDS key=key item=item}
<tr><td>{str section=mahara tag=$key}</td><td>{$item}</td></tr>
{/foreach}
</tbody></table>
{foreach from=$PROFILE key=key item=item name=profile}
{if $smarty.foreach.profile.first}
<h4>{str section=artefact.internal tag=profile}</h4>
<table><tbody>
{/if}
<tr><td>{str section=artefact.internal tag=$key}</td><td>{$item}</td></tr>
{if $smarty.foreach.profile.last}
</tbody></table>
{/if}
{/foreach}
</div>
{include file="footer.tpl"}
......@@ -30,11 +30,22 @@ require(dirname(dirname(__FILE__)).'/init.php');
$userid = param_integer('id','');
$profile = array();
$userfields = array();
if (!$user = get_record('usr', 'id', $userid)) {
$name = get_string('usernotfound');
}
else {
$name = display_name($user);
// If the logged in user is on staff, get full name, institution, id number, email address
if ($USER->get('staff')) {
$userfields['fullname'] = $user->firstname . ' ' . $user->lastname;
$userfields['institution'] = $user->institution;
$userfields['studentid'] = $user->studentid;
$userfields['emailaddress'] = $user->email;
}
// Get public profile fields:
safe_require('artefact', 'internal');
$publicfields = call_static_method(generate_artefact_class_name('profile'),'get_public_fields');
foreach (array_keys($publicfields) as $field) {
......@@ -43,14 +54,14 @@ else {
if ($emails = get_records_array('artefact_internal_profile_email', 'owner', $userid)) {
foreach ($emails as $email) {
$fieldname = $email->principal ? 'principalemailaddress' : 'emailaddress';
$profile[] = array('name' => $fieldname, 'value' => $email->email);
$profile[$fieldname] = $email->email;
}
}
}
else {
$c = new $classname(0, array('owner' => $userid)); // email is different
if ($value = $c->render(ARTEFACT_FORMAT_LISTITEM, null)) {
$profile[] = array('name' => $field, 'value' => $value);
$profile[$field] = $value;
}
}
}
......@@ -59,6 +70,7 @@ else {
$smarty = smarty();
$smarty->assign('searchform',searchform());
$smarty->assign('NAME',$name);
$smarty->assign('USERFIELDS',$userfields);
$smarty->assign('PROFILE',$profile);
$smarty->display('user/view.tpl');
......
......@@ -31,7 +31,7 @@ $wwwroot = get_config('wwwroot');
$strings = array('accessstartdate', 'accessenddate', 'artefacts', 'delete', 'description',
'editaccess', 'editview', 'editviewinformation',
'submitted', 'submitview', 'unknownerror');
'submitted', 'submittedto', 'submitview', 'unknownerror');
$getstring = array();
foreach ($strings as $string) {
$getstring[$string] = "'" . get_string($string) . "'";
......@@ -64,8 +64,8 @@ function title(r, c) {
editaccess.onclick = function () { submitform(r.id, 'editaccess'); };
var del = INPUT({'type':'button','value':{$getstring['delete']}});
del.onclick = function () { submitform(r.id, 'delete'); };
if (r.submitted) {
var assess = {$getstring['submitted']};
if (r.submittedto) {
var assess = {$getstring['submittedto']} + ': ' + r.submittedto;
}
else {
var assess = assessselect(r.id,c);
......
......@@ -39,12 +39,17 @@ $count = count_records('view', 'owner', $userid);
/* Do this in one query sometime */
$viewdata = get_records_array('view', 'owner', $userid, '',
'id,title,startdate,enddate,description,submitted', $offset, $limit);
$prefix = get_config('dbprefix');
$viewdata = get_records_sql_array('SELECT v.id,v.title,v.startdate,v.enddate,v.description,c.name
FROM ' . $prefix . 'view v
LEFT OUTER JOIN ' . $prefix . 'community c ON v.submittedto = c.id
WHERE v.owner = ' . $userid, '');
//'view', 'owner', $userid, '',
// 'id,title,startdate,enddate,description,submittedto', $offset, $limit);
$viewidlist = implode(', ', array_map(create_function('$a', 'return $a->id;'), $viewdata));
$prefix = get_config('dbprefix');
$artefacts = get_records_sql_array('SELECT va.view, va.artefact, a.title
FROM ' . $prefix . 'view_artefact va
JOIN ' . $prefix . 'artefact a ON va.artefact = a.id
......@@ -63,7 +68,7 @@ if ($viewdata) {
$data[$i]['startdate'] = strftime(get_string('strftimedate'),strtotime($viewdata[$i]->startdate));
$data[$i]['enddate'] = strftime(get_string('strftimedate'),strtotime($viewdata[$i]->enddate));
$data[$i]['description'] = $viewdata[$i]->description;
$data[$i]['submitted'] = $viewdata[$i]->submitted;
$data[$i]['submittedto'] = $viewdata[$i]->name;
$data[$i]['artefacts'] = array();
}
// Go through all the artefact records and put them in with the
......@@ -80,13 +85,17 @@ if ($viewdata) {
a tutor member. This is the list of communities that the user is
able to submit views to. */
$communitydata = get_column('community_member', 'community', 'member', $userid);
$communityidlist = implode(', ', $communitydata);
$tutorcommunitydata = get_records_sql_array('SELECT c.id, c.name
if ($communitydata = @get_column('community_member', 'community', 'member', $userid)) {
$communityidlist = implode(', ', $communitydata);
$tutorcommunitydata = get_records_sql_array('SELECT c.id, c.name
FROM ' . $prefix . 'community c
JOIN ' . $prefix . 'community_member cm ON c.id = cm.community
WHERE cm.community IN (' . $communityidlist . ')
AND cm.tutor = 1', '');
}
if (empty($tutorcommunitydata)) {
$tutorcommunitydata = array();
}
$result = array(
'count' => $count,
......
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