Commit eb396d02 authored by Robert Lyon's avatar Robert Lyon

Bug 1522659: Centeralising the require to pieform file

behatnotneeded - existing tests should suffice

Change-Id: I69a59b5f70bc6e5e3379106faf975f9c99af07b0
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 96c5d641
......@@ -16,7 +16,6 @@ define('SECTION_PLUGINNAME', 'account');
define('SECTION_PAGE', 'activity');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
define('TITLE', get_string('inbox'));
// Make sure the unread message count is up to date whenever the
......
......@@ -17,7 +17,6 @@ define('SECTION_PAGE', 'notifications');
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
define('TITLE', get_string('notifications'));
require_once('pieforms/pieform.php');
require_once(get_config('libroot') . 'activity.php');
$elements = get_notification_settings_elements($USER);
......
......@@ -14,7 +14,6 @@ define('MENUITEM', 'settings/preferences');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('deleteaccount', 'account'));
require_once('pieforms/pieform.php');
if (!$USER->can_delete_self()) {
throw new AccessDeniedException(get_string('accessdenied', 'error'));
......
......@@ -17,7 +17,6 @@ define('SECTION_PAGE', 'preferences');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('account'));
require_once('pieforms/pieform.php');
// load up user preferences
$prefs = (object) load_account_preferences($USER->id);
......
......@@ -16,7 +16,6 @@ define('SECTION_PLUGINNAME', 'account');
define('SECTION_PAGE', 'institutions');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('institutionmembership'));
require_once('pieforms/pieform.php');
$institutions = get_records_assoc('institution', '', '', '', 'name,displayname,registerallowed');
......
......@@ -14,7 +14,6 @@ define('ADMIN', 1);
define('MENUITEM', 'configextensions/cleanurls');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
define('TITLE', get_string('cleanurls', 'admin'));
$regenerateform = pieform(array(
......
......@@ -14,7 +14,6 @@ define('ADMIN', 1);
define('MENUITEM', 'configextensions/filters');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
define('TITLE', get_string('htmlfilters', 'admin'));
if ($filters = get_config('filters')) {
......
......@@ -17,7 +17,6 @@ define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'iframesites');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
require_once('upgrade.php');
define('TITLE', get_string('allowediframesites', 'admin'));
......
......@@ -14,7 +14,6 @@ define('ADMIN', 1);
define('MENUITEM', 'configextensions/pluginadmin');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('pluginadmin', 'admin'));
require_once('pieforms/pieform.php');
$plugintype = param_alpha('plugintype');
$pluginname = param_variable('pluginname');
......
......@@ -14,8 +14,6 @@ define('ADMIN', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('MENUITEM', 'managegroups/groups');
require_once('pieforms/pieform.php');
$groupid = param_integer('id');
$group = get_record_sql("SELECT g.name FROM {group} g WHERE g.id = ? AND g.deleted = 0", array($groupid));
......
......@@ -14,8 +14,6 @@ define('ADMIN', 1);
define('MENUITEM', 'managegroups/groups');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
$group = get_record_select('group', 'id = ? AND deleted = 0', array(param_integer('id')));
define('TITLE', get_string('administergroups', 'admin'));
......
......@@ -14,7 +14,6 @@ define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'managegroups/uploadcsv');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('uploadgroupcsv', 'admin'));
require_once('pieforms/pieform.php');
require_once(get_config('libroot') . 'group.php');
require_once(get_config('libroot') . 'institution.php');
safe_require('artefact', 'internal');
......
......@@ -14,7 +14,6 @@ define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'managegroups/uploadmemberscsv');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('uploadgroupmemberscsv', 'admin'));
require_once('pieforms/pieform.php');
require_once(get_config('libroot') . 'group.php');
require_once(get_config('libroot') . 'institution.php');
safe_require('artefact', 'internal');
......
......@@ -25,7 +25,6 @@ if (get_config('installed')) {
else {
define('TITLE', get_string('installation', 'admin'));
}
require_once('pieforms/pieform.php');
require(get_config('libroot') . 'upgrade.php');
require_once(get_config('libroot') . 'registration.php');
......
......@@ -17,8 +17,6 @@ define('SECTION_PLUGINNAME', 'admin');
require(dirname(dirname(__FILE__)).'/init.php');
require_once('pieforms/pieform.php');
require(get_config('libroot') . 'registration.php');
define('TITLE', get_string('Register', 'admin'));
......
......@@ -18,7 +18,6 @@ define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'cookieconsent');
require(dirname(dirname(dirname(__FILE__))).'/init.php');
require_once('pieforms/pieform.php');
define('TITLE', get_string('cookieconsent', 'cookieconsent'));
define('DEFAULTPAGE', 'home');
......
......@@ -18,7 +18,6 @@ define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'cookieconsent2');
require(dirname(dirname(dirname(__FILE__))).'/init.php');
require_once('pieforms/pieform.php');
define('TITLE', get_string('cookieconsent2', 'cookieconsent'));
define('DEFAULTPAGE', 'home');
......
......@@ -18,7 +18,6 @@ define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'addfontvariant');
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
require_once('pieforms/pieform.php');
require_once(get_config('libroot') . 'skin.php');
define('TITLE', get_string('addfontvariant', 'skin'));
......
......@@ -18,7 +18,6 @@ define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'deletefont');
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
require_once('pieforms/pieform.php');
if (!get_config('skins')) {
throw new FeatureNotEnabledException();
......
......@@ -18,7 +18,6 @@ define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'editfont');
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
require_once('pieforms/pieform.php');
define('TITLE', get_string('editfont', 'skin'));
if (!get_config('skins')) {
......
......@@ -18,7 +18,6 @@ define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'install');
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
require_once('pieforms/pieform.php');
require_once(get_config('libroot') . 'skin.php');
define('TITLE', get_string('installfont', 'skin'));
......
......@@ -22,7 +22,6 @@ define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'installgwf');
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
require_once('pieforms/pieform.php');
require_once(get_config('libroot') . 'skin.php');
define('TITLE', get_string('installgwfont', 'skin'));
......
......@@ -15,7 +15,6 @@ define('ADMIN', 1);
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
require_once(get_config('libroot') . 'skin.php');
require_once('pieforms/pieform.php');
define('TITLE', get_string('sitefonts', 'skin'));
if (!get_config('skins')) {
......
......@@ -16,7 +16,6 @@ define('JSON', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once(get_config('libroot') . 'skin.php');
require_once('pieforms/pieform.php');
if (!get_config('skins')) {
json_reply('local', get_string('accessdenied', 'error'));
......
......@@ -19,7 +19,6 @@ define('SECTION_PAGE', 'sitefonts');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once(get_config('libroot') . 'skin.php');
require_once('pieforms/pieform.php');
define('TITLE', get_string('sitefonts', 'skin'));
if (!get_config('skins')) {
......
......@@ -18,7 +18,6 @@ define('SECTION_PAGE', 'sitepages');
require(dirname(dirname(dirname(__FILE__))).'/init.php');
require_once('license.php');
require_once('pieforms/pieform.php');
define('DEFAULTPAGE', 'home');
$extralicensessql = "
......
......@@ -18,7 +18,6 @@ define('SECTION_PAGE', 'licenses');
require(dirname(dirname(dirname(__FILE__))).'/init.php');
require_once('license.php');
require_once('pieforms/pieform.php');
define('TITLE', get_string('sitelicenses', 'admin'));
define('DEFAULTPAGE', 'home');
......
......@@ -17,7 +17,6 @@ define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'sitemenu');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
define('TITLE', get_string('menus', 'admin'));
$strings = array('edit','delete','update','cancel','add','name','unknownerror');
......
......@@ -18,7 +18,6 @@ define('SECTION_PAGE', 'networking');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once(get_config('docroot') . 'api/xmlrpc/lib.php');
require_once('pieforms/pieform.php');
require_once('searchlib.php');
define('TITLE', get_string('networking', 'admin'));
......
......@@ -17,7 +17,6 @@ define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'siteoptions');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
require_once('searchlib.php');
require_once('antispam.php');
require_once(get_config('libroot') . 'activity.php');
......
......@@ -17,7 +17,6 @@ define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'sitepages');
require(dirname(dirname(dirname(__FILE__))).'/init.php');
require_once('pieforms/pieform.php');
define('TITLE', get_string('staticpages', 'admin'));
define('DEFAULTPAGE', 'home');
......
......@@ -19,7 +19,6 @@ define('SECTION_PAGE', 'siteskins');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once(get_config('libroot') . 'skin.php');
require_once('pieforms/pieform.php');
define('TITLE', get_string('siteskins', 'skin'));
if (!get_config('skins')) {
......
......@@ -18,7 +18,6 @@ define('SECTION_PAGE', 'siteviews');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once(get_config('libroot') . 'view.php');
require_once('pieforms/pieform.php');
$title = get_string('siteviews', 'admin');
define('TITLE', $title);
......
......@@ -15,7 +15,6 @@ require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'actionregistration');
require_once('pieforms/pieform.php');
require_once('institution.php');
$id = param_integer('r');
......
......@@ -16,7 +16,6 @@ require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('adduser', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
require_once('pieforms/pieform.php');
require_once('institution.php');
$TRANSPORTER = null;
......
......@@ -12,7 +12,6 @@ define('INTERNAL', 1);
define('ADMIN', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('institutions', 'admin'));
require_once('pieforms/pieform.php');
require_once(get_config('docroot') . '/lib/htmloutput.php');
// CHECK FOR CANCEL BEFORE THE 'REQUIRED' PARAMS:
......
......@@ -19,7 +19,6 @@ define('TITLE', get_string('adminusers', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'adminusers');
require_once('pieforms/pieform.php');
require_once('activity.php');
// Get users who are currently administrators
......
......@@ -12,7 +12,6 @@
define('INTERNAL', 1);
define('ADMIN', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
define('TITLE', get_string('bulkexporttitle', 'admin'));
......
......@@ -12,7 +12,6 @@
define('INTERNAL', 1);
define('ADMIN', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
require_once('institution.php');
require_once(get_config('docroot') . '/lib/htmloutput.php');
safe_require('artefact', 'internal');
......
......@@ -65,8 +65,6 @@ if (!get_config('masqueradingreasonrequired')) {
do_masquerade();
}
require_once('pieforms/pieform.php');
$form = array(
'name' => 'masqueradereason',
'plugintype' => 'core',
......
......@@ -16,7 +16,6 @@ require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('accountsettings', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
require_once('pieforms/pieform.php');
require_once('activity.php');
require_once(get_config('docroot') . 'lib/antispam.php');
......
......@@ -15,7 +15,6 @@ define('INTERNAL', 1);
define('INSTITUTIONALADMIN', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('institutionadmins', 'admin'));
require_once('pieforms/pieform.php');
define('MENUITEM', 'manageinstitutions/institutionadmins');
require_once('institution.php');
......
......@@ -18,7 +18,6 @@ define('SECTION_PAGE', 'institutionstaticpages');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('institutionstaticpages', 'admin'));
require_once('pieforms/pieform.php');
require_once('license.php');
define('DEFAULTPAGE', 'home');
require_once('institution.php');
......
......@@ -15,7 +15,6 @@ define('TITLE', get_string('Institutions', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'institutions');
require_once('pieforms/pieform.php');
require_once('license.php');
define('MENUITEM', 'manageinstitutions/institutions');
......
......@@ -15,7 +15,6 @@ define('INTERNAL', 1);
define('INSTITUTIONALADMIN', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('institutionstaff', 'admin'));
require_once('pieforms/pieform.php');
define('MENUITEM', 'manageinstitutions/institutionstaff');
require_once('institution.php');
......
......@@ -19,7 +19,6 @@ define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'institutionusers');
define('MENUITEM', 'manageinstitutions/institutionusers');
require_once('pieforms/pieform.php');
require_once('institution.php');
$institutionelement = get_institution_selector(false);
......
......@@ -16,7 +16,6 @@ define('TITLE', get_string('adminnotifications', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'notifications');
require_once('pieforms/pieform.php');
define('MENUITEM', 'manageinstitutions/adminnotifications');
$sql = '
......
......@@ -17,7 +17,6 @@ define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'pendingregistrations');
define('MENUITEM', 'manageinstitutions/pendingregistrations');
require_once('pieforms/pieform.php');
require_once('institution.php');
if (!is_logged_in()) {
......
......@@ -18,7 +18,6 @@ define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'progressbar');
require(dirname(dirname(dirname(__FILE__))).'/init.php');
require_once('pieforms/pieform.php');
require_once('institution.php');
define('TITLE', get_string('progressbar', 'admin'));
define('DEFAULTPAGE', 'home');
......
......@@ -67,7 +67,7 @@ $calendar = array(
'showsTime' => true,
),
);
$calendarform = new Pieform(array(
$calendarform = pieform_instance(array(
'name' => 'loggedinform',
'elements' => array(
'loggedindate' => $calendar,
......
......@@ -19,7 +19,6 @@ define('TITLE', get_string('staffusers', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'staffusers');
require_once('pieforms/pieform.php');
require_once('activity.php');
// Get users who are currently staff
......
......@@ -14,7 +14,6 @@ define('INSTITUTIONALADMIN', 1);
define('JSON', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
......
......@@ -17,7 +17,6 @@ define('TITLE', get_string('suspendeduserstitle', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'suspendedusers');
require_once('pieforms/pieform.php');
$type = param_alpha('type', 'suspended');
$enc_type = json_encode($type);
......@@ -162,7 +161,7 @@ jQuery(window).on('pageupdated', {}, function(e, data) {
EOF
);
$form = new Pieform(array(
$form = pieform_instance(array(
'name' => 'buttons',
'renderer' => 'div',
'autofocus' => false,
......
......@@ -14,7 +14,6 @@ define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'configusers/uploadcsv');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('uploadcsv', 'admin'));
require_once('pieforms/pieform.php');
require_once('institution.php');
require_once('phpmailer/class.phpmailer.php');
safe_require('artefact', 'internal');
......
......@@ -15,7 +15,6 @@ define('JSON', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once(get_config('libroot') . 'view.php');
require_once(get_config('libroot') . 'pieforms/pieform.php');
safe_require('artefact', 'annotation');
// Pagination is not really working here so extradata won't
......
......@@ -33,7 +33,6 @@ defined('INTERNAL') || die();
require_once('activity.php');
require_once('license.php');
require_once('pieforms/pieform.php');
class PluginArtefactAnnotation extends PluginArtefact {
......
......@@ -13,7 +13,6 @@ define('INTERNAL', 1);
define('JSON', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once(get_config('libroot') . 'pieforms/pieform.php');
safe_require('artefact', 'blog');
$blogs = (object) array(
......
......@@ -16,7 +16,6 @@ define('SECTION_PAGE', 'new');
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
require_once('license.php');
require_once('pieforms/pieform.php');
safe_require('artefact', 'blog');
$subsectionheading = false;
$institutionname = $groupid = null;
......
......@@ -15,7 +15,6 @@ define('SECTION_PLUGINNAME', 'blog');
define('SECTION_PAGE', 'post');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('pieforms/pieform.php');
require_once('license.php');
safe_require('artefact', 'blog');
......
......@@ -16,7 +16,6 @@ define('SECTION_PAGE', 'settings');
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
define('TITLE', get_string('blogsettings','artefact.blog'));
require_once('pieforms/pieform.php');
require_once('license.php');
safe_require('artefact', 'blog');
if (!PluginArtefactBlog::is_active()) {
......
......@@ -14,7 +14,6 @@ define('JSON', 1);
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
safe_require('artefact', 'blog');
require_once(get_config('libroot') . 'pieforms/pieform.php');
$id = param_integer('id');
$limit = param_integer('limit', 5);
......
......@@ -18,7 +18,6 @@ define('SECTION_PAGE', 'view');
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php');
safe_require('artefact', 'blog');
require_once(get_config('libroot') . 'pieforms/pieform.php');
if (!PluginArtefactBlog::is_active()) {
throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('Blog','artefact.blog')));
}
......
......@@ -15,7 +15,6 @@ define('JSON', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once(get_config('libroot') . 'view.php');
require_once(get_config('libroot') . 'pieforms/pieform.php');
safe_require('artefact', 'comment');
$extradata = json_decode(param_variable('extradata'));
......
......@@ -721,7 +721,6 @@ class ArtefactTypeComment extends ArtefactType {
public static function build_html(&$data, $onview) {
global $USER, $THEME;
require_once('pieforms/pieform.php');