Commit 92566c6b authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files
parents afc3cf78 75d02139
......@@ -3,7 +3,7 @@
DocumentRoot /var/www/mahara
CustomLog __APACHELOGDIR__/mahara.access.log full
CustomLog __APACHELOGDIR__/mahara.access.log combined
ErrorLog __APACHELOGDIR__/mahara.error.log
php_value upload_max_filesize 5M
......
config.php
/config.php
tests
......@@ -90,7 +90,7 @@ function installtemplate(name) {
else {
message = '{$failurestring}';
}
$(name).innerHTML = '<img src="{$failureicon}" alt=":(" /> ' + message;
$(name + '.message').innerHTML = '<img src="{$failureicon}" alt=":(" /> ' + message;
}
},
function () {
......
......@@ -27,11 +27,17 @@
define('INTERNAL', 1);
define('JSON', 1);
if (isset($_POST['view'])) {
define('PUBLIC', 1);
}
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require('artefact', 'resume');
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$type = param_alpha('type');
$view = param_integer('view', 0);
$data = array();
$count = 0;
......@@ -39,14 +45,30 @@ $count = 0;
$prefix = get_config('dbprefix');
$othertable = 'artefact_resume_' . $type;
$owner = $USER->get('id');
$sql = 'SELECT ar.*, a.owner
FROM ' . $prefix . 'artefact a
JOIN ' . $prefix . $othertable . ' ar ON ar.artefact = a.id
WHERE a.owner = ? AND a.artefacttype = ?
ORDER BY ' . call_static_method(generate_artefact_class_name($type), 'get_order_field') . ' DESC
LIMIT ' . $limit . ' OFFSET ' . $offset;
if (!$data = get_records_sql_array($sql, array($USER->get('id'), $type))) {
if (!empty($view)) {
if (!can_view_view($view)) {
throw new AccessDeniedException();
}
require_once('view.php');
$v = new View($view);
$owner = $v->get('owner');
}
if (!$data = get_records_sql_array($sql, array($owner, $type))) {
$data = array();
}
$count = count_records('artefact', 'owner', $owner, 'artefacttype', $type);
foreach ($data as &$row) {
foreach (array('date', 'startdate', 'enddate') as $key) {
if (array_key_exists($key, $row)) {
......@@ -54,7 +76,6 @@ foreach ($data as &$row) {
}
}
}
$count = count_records('artefact', 'owner', $USER->get('id'), 'artefacttype', $type);
echo json_encode(array(
'data' => $data,
'limit' => $limit,
......
......@@ -133,7 +133,7 @@ class ArtefactTypeCoverletter extends ArtefactTypeResume {
}
public function render_full($options) {
return array('html' => $this->title);
return array('html' => $this->description);
}
}
......@@ -362,6 +362,10 @@ abstract class ArtefactTypeResumeComposite extends ArtefactTypeResume {
);
}
public static function get_order_field() {
return 'startdate';
}
/**
* This function should return a snippet of javascript
* to be plugged into a table renderer instantiation
......@@ -505,6 +509,12 @@ abstract class ArtefactTypeResumeComposite extends ArtefactTypeResume {
{$type}list.type = '{$type}';
{$type}list.statevars.push('type');
" .
(( array_key_exists('viewid', $options))
? "{$type}list.view = " . $options['viewid'] . ";
{$type}list.statevars.push('view');"
: ""
) . "
{$type}list.updateOnLoad();
");
return $content;
......@@ -738,6 +748,10 @@ class ArtefactTypeCertification extends ArtefactTypeResumeComposite {
return "r.description";
}
public static function get_order_field() {
return 'date';
}
public static function get_addform_elements() {
return array(
'date' => array(
......@@ -795,6 +809,10 @@ class ArtefactTypeBook extends ArtefactTypeResumeComposite {
return "r.description";
}
public static function get_order_field() {
return 'date';
}
public static function get_addform_elements() {
return array(
'date' => array(
......
<h3>{str tag='book' section='artefact.resume'}
{contextualhelp plugintype='artefact' pluginname='resume' section='addbook'}</h3>
{if $controls}
{contextualhelp plugintype='artefact' pluginname='resume' section='addbook'}
{/if}
</h3>
<table id="booklist" class="tablerenderer hidden resumefour">
<thead>
<tr>
......
<h3>{str tag='certification' section='artefact.resume'}
{contextualhelp plugintype='artefact' pluginname='resume' section='addcertification'}</h3>
{if $controls}
{contextualhelp plugintype='artefact' pluginname='resume' section='addcertification'}
{/if}
</h3>
<table id="certificationlist" class="tablerenderer hidden resumefour">
<thead>
<tr>
......
<h3>{str tag='educationhistory' section='artefact.resume'}
{contextualhelp plugintype='artefact' pluginname='resume' section='addeducationhistory'}</h3>
{if $controls}
{contextualhelp plugintype='artefact' pluginname='resume' section='addeducationhistory'}
{/if}
</h3>
<table id="educationhistorylist" class="tablerenderer hidden resumefive">
<thead>
<tr>
......
<h3>{str tag='employmenthistory' section='artefact.resume'}
{contextualhelp plugintype='artefact' pluginname='resume' section='addemploymenthistory'}</h3>
{if $controls}
{contextualhelp plugintype='artefact' pluginname='resume' section='addemploymenthistory'}
{/if}
</h3>
<table id="employmenthistorylist" class="tablerenderer hidden resumefive">
<thead>
<tr>
......
<h3>{str tag='membership' section='artefact.resume'}
{contextualhelp plugintype='artefact' pluginname='resume' section='addmembership'}</h3>
{if $controls}
{contextualhelp plugintype='artefact' pluginname='resume' section='addmembership'}
{/if}
</h3>
<table id="membershiplist" class="tablerenderer hidden resumefive">
<thead>
<tr>
......
......@@ -71,7 +71,7 @@ switch ($type) {
}
$count = count_records_sql('
SELECT COUNT(id)
SELECT COUNT(DISTINCT id)
FROM ' . $prefix . 'view v
LEFT OUTER JOIN ' . $prefix . 'view_access_community a ON a.view=v.id
' . $where,
......@@ -79,7 +79,7 @@ switch ($type) {
);
$data = get_records_sql_array('
SELECT v.*, u.username, u.firstname, u.lastname, u.preferredname, u.id AS usr
SELECT DISTINCT v.*, u.username, u.firstname, u.lastname, u.preferredname, u.id AS usr
FROM ' . $prefix . 'view v
LEFT OUTER JOIN ' . $prefix . 'view_access_community a ON a.view=v.id
INNER JOIN ' . $prefix.'usr u ON v.owner = u.id ' . $where,
......
......@@ -68,7 +68,7 @@ if (empty($pending)) {
if (!$data = get_records_sql_assoc($sql, array($userid, $userid, $userid), $offset, $limit)) {
$data = array();
}
if (!$views = get_views(array_keys($data))) {
if (!$views = get_views(array_keys($data), null, null)) {
$views = array();
}
$data = array_values($data);
......@@ -92,13 +92,20 @@ foreach ($data as $d) {
}
json_headers();
$viewcount = array_map('count', $views);
// since php is so special and inconsistent, we can't use array_map for this because it breaks the top level indexes.
$cleanviews = array();
foreach ($views as $userindex => $viewarray) {
$cleanviews[$userindex] = array_slice($viewarray, 0, 5);
}
print json_encode(array(
'count' => $count,
'limit' => $limit,
'offset' => $offset,
'data' => $data,
'pending' => $pending,
'views' => array_map('array_values', $views),
'views' => $cleanviews,
'numviews' => $viewcount,
));
exit;
......
......@@ -74,8 +74,8 @@ var friendslist = new TableRenderer(
}
else {
var viewcol;
if (typeof(d.views) == 'object' && d.views[r.id] && countKeys(d.views[r.id]) > 0) {
var len = countKeys(d.views[r.id]);
if (typeof(d.views) == 'object' && d.views[r.id] && d.numviews[r.id] > 0) {
var len = d.numviews[r.id];
var views = '';
if (len == 1) {
views = len + ' {$viewavailable}';
......
......@@ -875,7 +875,7 @@
<SENTENCE TEXT="(name) VALUES ('academic')" />
<SENTENCE TEXT="(name) VALUES ('professionaldevelopment')" />
<SENTENCE TEXT="(name) VALUES ('personaldevelopment')" />
</SENTANCES>
</SENTENCES>
</STATEMENT>
</STATEMENTS>
</XMLDB>
......@@ -77,6 +77,7 @@ function pieform_element_tags_get_value(Pieform $form, $element) {
}
$value = preg_split("/\s*,\s*/", trim($global[$name]));
$value = array_unique(array_filter($value, create_function('$v', 'return !empty($v);')));
return $value;
}
......
......@@ -1517,6 +1517,9 @@ function get_performance_info() {
if (!empty($server_load)) {
$info['serverload'] = $server_load;
}
else {
$info['serverload'] = 'unknown';
}
return $info;
}
......
<?php
/**
* This program is part of Mahara
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage core
* @author Meredith Henson <m.j.henson@massey.ac.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$template = new StdClass;
$template->title = 'Teaching Programme Planning, Evaluation and Assessment Template';
$template->description = 'This View template is designed for teachers and teacher trainees to present a programme for review.';
$template->category = 'academic';
?>
<?php
/**
* This program is part of Mahara
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage core
* @author Meredith Henson <m.j.henson@massey.ac.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$template = new StdClass;
$template->title = 'Blog Reflections Template';
$template->description = 'This View template is designed to present a number of different Blogs for assessment. It is ideal for students presenting their reflective journals for tutor feedback';
$template->category = 'academic';
?>
<?php
/**
* This program is part of Mahara
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage core
* @author Meredith Henson <m.j.henson@massey.ac.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$template = new StdClass;
$template->title = 'General Template';
$template->description = 'This View template is for general use and is designed to provide a flexible and varied display. It is ideal for showcasing a variety of different artefacts types within a single View.';
$template->category = 'academic';
?>
\ No newline at end of file
<?php
/**
* This program is part of Mahara
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage core
* @author Meredith Henson <m.j.henson@massey.ac.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$template = new StdClass;
$template->title = 'Professional Profile Template';
$template->description = 'This View template allows users to create a professional profile or web presence. It is ideal for users wishing to showcase their work and experience to a wide variety of audiences ';
$template->category = 'professionaldevelopment';
?>
Supports Markdown
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