Commit 095ded61 authored by Nigel McNie's avatar Nigel McNie Committed by Richard Mansfield
Browse files

More fleshed-out profile pages - dump the profile view and the basic profile data.

parent 234e9077
......@@ -29,7 +29,34 @@ defined('INTERNAL') || die();
class HtmlExportInternal extends HtmlExportArtefactPlugin {
public function dump_export_data() {
// This space intentionally left blank
// Profile page
$smarty = $this->exporter->get_smarty('../../');
$view = $this->exporter->get('user')->get_profile_view();
$smarty->assign('view', $view->build_columns());
$content = $smarty->fetch('export:html/internal:profilepage.tpl');
if (!file_put_contents($this->fileroot . 'profilepage.html', $content)) {
throw new SystemException("Unable to write profile page");
}
// Generic profile information
$sections = array();
$elementlist = call_static_method('ArtefactTypeProfile', 'get_all_fields');
$profilefields = get_column_sql('SELECT id FROM {artefact} WHERE owner=? AND artefacttype IN ('
. join(",",array_map(create_function('$a','return db_quote($a);'),array_keys($elementlist)))
. ")", array($this->exporter->get('user')->get('id')));
foreach ($profilefields as $id) {
$artefact = artefact_instance_from_id($id);
$rendered = $artefact->render_self(array());
$sections[$this->get_category_for_artefacttype($artefact->get('artefacttype'))][$artefact->get('artefacttype')] = $rendered['html'];
}
$smarty->assign('sections', $sections);
$content = $smarty->fetch('export:html/internal:profileinfo.tpl');
if (!file_put_contents($this->fileroot . 'profileinfo.html', $content)) {
throw new SystemException("Unable to write profile information page");
}
}
public function get_summary() {
......@@ -51,6 +78,18 @@ class HtmlExportInternal extends HtmlExportArtefactPlugin {
return 0;
}
private function get_category_for_artefacttype($artefacttype) {
switch ($artefacttype) {
case 'firstname':
case 'lastname':
return 'basic';
case 'email':
return 'contact';
default:
return 'unclassified';
}
}
}
?>
{include file="export:html:header.tpl"}
{foreach from=$sections key=sectionname item=section}
<div>
<h3>{$sectionname|escape}</h3>
<dl>
{foreach from=$section key=title item=value}
<dt>{$title|escape}</dt>
<dd>{$value}</dd>
{/foreach}
</dl>
{/foreach}
{include file="export:html:footer.tpl"}
{include file="export:html:header.tpl"}
{$view}
{include file="export:html:footer.tpl"}
<div id="profile-introduction">{$introduction}</div>
<div id="profile-icon">{$icon}</div>
<ul>
<li><a href="">View profile page</a></li>
<li><a href="">View all profile information</a></li>
<li><a href="files/internal/profilepage.html">View profile page</a></li>
<li><a href="files/internal/profileinfo.html">View all profile information</a></li>
</ul>
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