Commit fac56b68 authored by Robert Lyon's avatar Robert Lyon

Bug 1635503: Code tidying up - indentation / comments

behatnotneeded

Change-Id: Ie11eca7384a9bda6d23de13f3b29a7c334ba378b
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent a5e3533f
......@@ -144,10 +144,10 @@ else {
$content->evidencestatuses = array();
$count = 0;
foreach ($evidencestatuses as $key => $es) {
$obj = new stdClass;
$obj = new stdClass;
$obj->$key = $es;
$content->evidencestatuses[$count] = $obj;
$count ++;
$content->evidencestatuses[$count] = $obj;
$count ++;
}
if (empty($content->name) || empty($content->standards)) {
$ok['error'] = true;
......@@ -182,9 +182,9 @@ else {
if ($fw_to_edit) {
$framework = new Framework($fw_to_edit, $content);
if ($ses_to_delete) {
foreach ($ses_to_delete as $se) {
delete_records('framework_standard_element', 'id', $se);
}
foreach ($ses_to_delete as $se) {
delete_records('framework_standard_element', 'id', $se);
}
}
if ($stds_to_delete) {
foreach ($stds_to_delete as $std) {
......
......@@ -53,8 +53,8 @@ $form['elements']['save'] = array(
'type' => 'submitcancel',
'class' => 'btn-primary',
'value' => array(
get_string('save'),
get_string('cancel')
get_string('save'),
get_string('cancel')
),
'goto' => get_config('wwwroot') . 'module/framework/frameworks.php',
);
......@@ -95,5 +95,4 @@ function frameworkconfig_submit(Pieform $form, $values) {
else {
$form->json_reply(PIEFORM_ERR, array('message' => get_string('settingssavefailed')));
}
}
......@@ -50,7 +50,6 @@ if ($uploadmatrix) {
$smarty->display('module:framework:uploadframework.tpl');
exit;
}
else if ($upload) {
//jsoneditor page:
//get existing frameworks.
......@@ -75,15 +74,15 @@ else if ($upload) {
$fw_edit[$framework->get('id')] = $framework->get('name');
}
}
if (count($fw_edit)<2) {
$edit_desc = get_string('editdescription1', 'module.framework');
}
else {
$edit_desc = get_string('editdescription2', 'module.framework');
}
}
//add strings needed to var strings on editor.js
$jsoneditor_strings = array(
if (count($fw_edit) < 2) {
$edit_desc = get_string('editdescription1', 'module.framework');
}
else {
$edit_desc = get_string('editdescription2', 'module.framework');
}
}
//add strings needed to var strings on editor.js
$jsoneditor_strings = array(
'institution' => 'mahara',
'instdescription' => 'module.framework',
'titledesc' => 'module.framework',
......@@ -162,64 +161,43 @@ else if ($upload) {
$smarty->display('module:framework:jsoneditor.tpl');
exit;
}
//for overview page
else {
//for overview page
$active_tab = 'overview';
}
$frameworks = Framework::get_frameworks('any');
if ($frameworks) {
foreach ($frameworks as $framework) {
$fk = new Framework($framework->id);
if ($fk->get('active')) {
$framework->active = array(
'title' => 'Enabled',
'classes' => 'icon icon-lg icon-check text-success displayicon'
);
}
else {
$framework->active = array(
'title' => 'Disabled',
'classes' => 'icon icon-lg icon-times text-danger displayicon'
);
}
$framework->collections = count($fk->get_collectionids());
$framework->delete = false;
if (empty($framework->collections)) {
$framework->delete = pieform(
array(
'name' => 'framework_delete_' . $framework->id,
'successcallback' => 'framework_delete_submit',
'renderer' => 'div',
'class' => 'btn-group-last',
'elements' => array(
'submit' => array(
'type' => 'button',
'class' => 'btn-secondary btn-sm button',
'usebuttontag' => true,
'value' => '<span class="icon icon-trash icon-lg text-danger" role="presentation" aria-hidden="true"></span><span class="sr-only">'. get_string('delete') . '</span>',
'confirm' => get_string('confirmdeletemenuitem', 'admin'),
),
'framework' => array(
'type' => 'hidden',
'value' => $framework->id,
)
),
)
);
}
$framework->config = pieform(
$frameworks = Framework::get_frameworks('any');
if ($frameworks) {
foreach ($frameworks as $framework) {
$fk = new Framework($framework->id);
if ($fk->get('active')) {
$framework->active = array(
'title' => 'Enabled',
'classes' => 'icon icon-lg icon-check text-success displayicon'
);
}
else {
$framework->active = array(
'title' => 'Disabled',
'classes' => 'icon icon-lg icon-times text-danger displayicon'
);
}
$framework->collections = count($fk->get_collectionids());
$framework->delete = false;
if (empty($framework->collections)) {
$framework->delete = pieform(
array(
'name' => 'framework_config_' . $framework->id,
'successcallback' => 'framework_config_submit',
'name' => 'framework_delete_' . $framework->id,
'successcallback' => 'framework_delete_submit',
'renderer' => 'div',
'class' => (empty($framework->collections) ? 'btn-group-first' : 'btn-group-first btn-group-last'),
'class' => 'btn-group-last',
'elements' => array(
'submit' => array(
'type' => 'button',
'class' => 'btn-secondary btn-sm button',
'usebuttontag' => true,
'value' => '<span class="icon icon-cog icon-lg" role="presentation" aria-hidden="true"></span><span class="sr-only">'. get_string('edit') . '</span>',
'value' => '<span class="icon icon-trash icon-lg text-danger" role="presentation" aria-hidden="true"></span><span class="sr-only">'. get_string('delete') . '</span>',
'confirm' => get_string('confirmdeletemenuitem', 'admin'),
),
'framework' => array(
'type' => 'hidden',
......@@ -229,31 +207,53 @@ else {
)
);
}
$framework->config = pieform(
array(
'name' => 'framework_config_' . $framework->id,
'successcallback' => 'framework_config_submit',
'renderer' => 'div',
'class' => (empty($framework->collections) ? 'btn-group-first' : 'btn-group-first btn-group-last'),
'elements' => array(
'submit' => array(
'type' => 'button',
'class' => 'btn-secondary btn-sm button',
'usebuttontag' => true,
'value' => '<span class="icon icon-cog icon-lg" role="presentation" aria-hidden="true"></span><span class="sr-only">'. get_string('edit') . '</span>',
),
'framework' => array(
'type' => 'hidden',
'value' => $framework->id,
)
),
)
);
}
}
//on frameworks page (rubbish bin icon)
function framework_delete_submit(Pieform $form, $values) {
global $SESSION;
//on frameworks page (rubbish bin icon)
function framework_delete_submit(Pieform $form, $values) {
global $SESSION;
$framework = new Framework($values['framework']);
if (!$framework->is_in_collections()) {
$framework->delete();
$SESSION->add_ok_msg(get_string('itemdeleted'));
}
else {
$SESSION->add_error_msg(get_string('deletefailed', 'admin'));
}
redirect('/module/framework/frameworks.php');
$framework = new Framework($values['framework']);
if (!$framework->is_in_collections()) {
$framework->delete();
$SESSION->add_ok_msg(get_string('itemdeleted'));
}
//edit framework on main page
function framework_config_submit(Pieform $form, $values) {
redirect(get_config('wwwroot') . 'module/framework/frameworkmanager.php?id=' . $values['framework']);
else {
$SESSION->add_error_msg(get_string('deletefailed', 'admin'));
}
$smarty = smarty();
setpageicon($smarty, 'icon-th');
$smarty->assign('frameworks', $frameworks);
$smarty->assign('SUBPAGENAV', PluginModuleFramework::submenu_items($active_tab));
$smarty->assign('wwwroot', get_config('wwwroot'));
$smarty->display('module:framework:frameworks.tpl');
redirect('/module/framework/frameworks.php');
}
//edit framework on main page
function framework_config_submit(Pieform $form, $values) {
redirect(get_config('wwwroot') . 'module/framework/frameworkmanager.php?id=' . $values['framework']);
}
$smarty = smarty();
setpageicon($smarty, 'icon-th');
$smarty->assign('frameworks', $frameworks);
$smarty->assign('SUBPAGENAV', PluginModuleFramework::submenu_items($active_tab));
$smarty->assign('wwwroot', get_config('wwwroot'));
$smarty->display('module:framework:frameworks.tpl');
This diff is collapsed.
......@@ -401,13 +401,11 @@ class Framework {
if (!empty($option->elementid)) {
$uniqueids[$inserted] = $option->elementid;
}
}
}
}
}
}
}
db_commit();
}
......@@ -1119,9 +1117,9 @@ class Framework {
$warning = array();
if ($disabled) {
$warning['plugin_warning'] = array(
'type' => 'markup',
'value' => '<div class="admin-warning alert alert-warning">' .
'<p>' . get_string('upgradeplugin', 'module.framework') . '</p></div>',
'type' => 'markup',
'value' => '<div class="admin-warning alert alert-warning">' .
'<p>' . get_string('upgradeplugin', 'module.framework') . '</p></div>',
);
}
......@@ -1134,77 +1132,77 @@ class Framework {
'defaultvalue' => $this->config_option_enabled('active_framework'),
),
'statusestitle' => array(
'type' => 'html',
'type' => 'html',
'value' => "<h4>" . get_string('displaystatusestitle','module.framework') . "</h4>" .
"<p>" . get_string('displaystatusestitledetail','module.framework') . "</p>",
"<p>" . get_string('displaystatusestitledetail','module.framework') . "</p>",
),
'readyforassesment_container' => array(
'type' => 'fieldset',
'class' => 'form-inline',
'elements' => array(
'label' => array(
'type'=> 'html',
'value' => '<div class="pseudolabel statusheader"><span>' . $choices[Framework::EVIDENCE_BEGUN] . '</span>' .
'<span class="' . $this->get_state_array(Framework::EVIDENCE_BEGUN)['begun']['classes'] . '"></span></div>',
),
'readyforassesment_field_enabled' => array(
'type' => 'switchbox',
'title' => '',
'defaultvalue' => $this->config_option_enabled('readyforassesment_field_enabled'),
'disabled' => $disabled,
),
),
'type' => 'fieldset',
'class' => 'form-inline',
'elements' => array(
'label' => array(
'type'=> 'html',
'value' => '<div class="pseudolabel statusheader"><span>' . $choices[Framework::EVIDENCE_BEGUN] . '</span>' .
'<span class="' . $this->get_state_array(Framework::EVIDENCE_BEGUN)['begun']['classes'] . '"></span></div>',
),
'readyforassesment_field_enabled' => array(
'type' => 'switchbox',
'title' => '',
'defaultvalue' => $this->config_option_enabled('readyforassesment_field_enabled'),
'disabled' => $disabled,
),
),
),
'dontmatch_container' => array(
'type' => 'fieldset',
'class' => 'form-inline',
'elements' => array(
'label' => array(
'type'=> 'html',
'value' => '<div class="pseudolabel statusheader"><span>' . $choices[Framework::EVIDENCE_INCOMPLETE] . '</span>' .
'<span class="' . $this->get_state_array(Framework::EVIDENCE_INCOMPLETE)['incomplete']['classes'] . '"></span></div>',
),
'dontmatch_field_enabled' => array(
'type' => 'switchbox',
'title' => '',
'defaultvalue' => $this->config_option_enabled('dontmatch_field_enabled'),
'disabled' => $disabled,
),
),
'type' => 'fieldset',
'class' => 'form-inline',
'elements' => array(
'label' => array(
'type'=> 'html',
'value' => '<div class="pseudolabel statusheader"><span>' . $choices[Framework::EVIDENCE_INCOMPLETE] . '</span>' .
'<span class="' . $this->get_state_array(Framework::EVIDENCE_INCOMPLETE)['incomplete']['classes'] . '"></span></div>',
),
'dontmatch_field_enabled' => array(
'type' => 'switchbox',
'title' => '',
'defaultvalue' => $this->config_option_enabled('dontmatch_field_enabled'),
'disabled' => $disabled,
),
),
),
'partiallycomplete_container' => array(
'type' => 'fieldset',
'class' => 'form-inline',
'elements' => array(
'label' => array(
'type'=> 'html',
'value' => '<div class="pseudolabel statusheader"><span>' . $choices[Framework::EVIDENCE_PARTIALCOMPLETE] . '</span>' .
'<span class="' . $this->get_state_array(Framework::EVIDENCE_PARTIALCOMPLETE)['partialcomplete']['classes'] . '"></span></div>',
),
'partiallycomplete_field_enabled' => array(
'type' => 'switchbox',
'title' => '',
'defaultvalue' => $this->config_option_enabled('partiallycomplete_field_enabled'),
'disabled' => $disabled,
),
),
'type' => 'fieldset',
'class' => 'form-inline',
'elements' => array(
'label' => array(
'type'=> 'html',
'value' => '<div class="pseudolabel statusheader"><span>' . $choices[Framework::EVIDENCE_PARTIALCOMPLETE] . '</span>' .
'<span class="' . $this->get_state_array(Framework::EVIDENCE_PARTIALCOMPLETE)['partialcomplete']['classes'] . '"></span></div>',
),
'partiallycomplete_field_enabled' => array(
'type' => 'switchbox',
'title' => '',
'defaultvalue' => $this->config_option_enabled('partiallycomplete_field_enabled'),
'disabled' => $disabled,
),
),
),
'completed_container' => array(
'type' => 'fieldset',
'class' => 'form-inline',
'elements' => array(
'label' => array(
'type'=> 'html',
'value' => '<div class="pseudolabel statusheader"><span>' . $choices[Framework::EVIDENCE_COMPLETED] . '</span>' .
'<span class="' . $this->get_state_array(Framework::EVIDENCE_COMPLETED)['completed']['classes'] . '"></span></div>',
),
'completed_field_enabled' => array(
'type' => 'switchbox',
'title' => '',
'value' => $disabled || $this->config_option_enabled('completed_field_enabled'),
'disabled' => true,
),
),
'type' => 'fieldset',
'class' => 'form-inline',
'elements' => array(
'label' => array(
'type'=> 'html',
'value' => '<div class="pseudolabel statusheader"><span>' . $choices[Framework::EVIDENCE_COMPLETED] . '</span>' .
'<span class="' . $this->get_state_array(Framework::EVIDENCE_COMPLETED)['completed']['classes'] . '"></span></div>',
),
'completed_field_enabled' => array(
'type' => 'switchbox',
'title' => '',
'value' => $disabled || $this->config_option_enabled('completed_field_enabled'),
'disabled' => true,
),
),
),
);
......
......@@ -104,7 +104,8 @@ $smarty = smarty(
$javascript,
$headers,
array('View' => 'view',
'Collection' => 'collection'),
'Collection' => 'collection'
),
array(
'sidebars' => false,
'skin' => $skin
......
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