Commit c8cbc224 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge changes from topic 'WR 299768'

* changes:
  Bug 1635503:  JSON editor - saving a copy only once
  Bug 1635503: Set standard id when selecting parent id for an element
  Bug 1635503: DB ids when saving framework
  Bug 1635503: Duplicated elements when fetching framework
  Bug 1635503: Setting description style after adding elements
  Bug 1635503: Removing standard_count variable
  Bug 1635503: Fix some issues on saving SmartEvidence framework via editor
  Bug 1635503: Small fixes to SmartEvidence editor
parents 2f117fec a5e3533f
......@@ -195,12 +195,17 @@ if ($fw_to_edit) {
}
}
else {
$content->active = false;
$framework = new Framework(null, $content);
}
$framework->commit();
$framework->set_config_fields();
$data = $form_data['institution'];
$data['id'] = $framework->get('id');
$data['institution'] = $form_data['institution'];
$data['name'] = $framework->get('name');
$message = get_string('successmessage', 'module.framework');
json_reply(false, (object) array('message' => $message, 'data' => $data));
......@@ -50,19 +50,16 @@ function get_framework($table, $select, $se_depth=0) {
$standard_data = get_records_array('framework_standard', 'framework', $fw_data->id, 'priority');
$data['standards'] = $standard_data;
$se_data = array();
foreach ($standard_data as $sk => $se) {
if (record_exists_select('framework_standard_element', "standard='$se->id'")) {
$se_data = get_records_array('framework_standard_element', 'standard', $se->id, 'priority');
}
$se_depth = 0;
foreach($se_data as $se) {
$se->depth = add_depth_to_ses($se, $se_data, $se_depth);
}
$data['standards']['element'][$sk] = $se_data;
if ($se_data = get_records_array('framework_standard_element', 'standard', $se->id, 'priority')) {
$se_depth = 0;
foreach($se_data as $se) {
$se->depth = add_depth_to_ses($se, $se_data, $se_depth);
}
$data['standards']['element'][$sk] = $se_data;
}
}
}
return $data;
}
......
This diff is collapsed.
......@@ -107,9 +107,8 @@ $string['standardelements'] = 'Standard elements';
$string['standardelement'] = 'Standard element';
$string['standardelementdesc'] = 'This description appears when you hover over this standard element on the SmartEvidence page. It is also displayed when you select this standard in the "Annotations" block. You can use simple HTML.';
$string['standardelementdefault'] = 'Description of the standard element';
$string['standardiddesc1'] = 'This needs to match the ID of the standard category under which you are creating this standard element.';
$string['elementid'] = 'Element ID';
$string['elementiddesc'] = 'This is the ID for this standard element. This can be a number or a short word. A sequence of numbers is easiest to indicate hierarchy.';
$string['elementiddesc'] = 'This is the ID for this standard element. A sequence of numbers is used to indicate hierarchy.';
$string['invalidjsonineditor'] = 'The current form has invalid json. Please scroll down the page to see the specific error.';
$string['validjson'] = 'The current form contents are valid and ok to submit';
$string['moveright'] = 'Move right';
......@@ -120,7 +119,7 @@ $string['selfassesseddescription'] = 'Decide whether a staff member can perform
$string['standardsdescription'] = 'Create the categories in which your framework is divided. Later on, you can assign individual standard elements and sub-elements to a standard category. You must have at least one category.';
$string['standardelementsdescription'] = 'Create the individual standard elements, i.e. descriptors, to which content can be aligned. The standard elements can be put into a hierarchical order if needed by using the "Parent ID" option.';
$string['parentelementid'] = 'Parent element ID';
$string['parentelementdesc'] = 'This is the ID of the standard element that serves as parent to this one here, i.e. the one that sits one level higher in the hierarchy.';
$string['parentelementdesc'] = 'The dropdown shows the current standard elements. If you want to make a sub-element of one of these, select it as the parent.';
$string['jsondatanotsubmitted'] = 'Your form data was not submitted to the database, please make sure you save the information you have entered in a separate file, refresh the form and try again or upload the json directly using the "Upload" tab';
$string['editor'] = 'Editor';
$string['Management'] = 'Management';
......
......@@ -337,7 +337,9 @@ class Framework {
}
}
$standardsvars = array('shortname','name','description');
if (isset($this->standards) && is_array($this->standards)) {
$uniqueids = array();
foreach ($this->standards['standards'] as $key => $standard) {
$sfordb = new stdClass();
$sfordb->framework = $this->id;
......@@ -363,7 +365,7 @@ class Framework {
$standard->options = $standard->standardelement;
}
if ($sid && isset($standard->options) && is_array($standard->options)) {
$uniqueids = array();
$priority = 0;
foreach ($standard->options as $option) {
$priority++;
......@@ -390,6 +392,9 @@ class Framework {
if (isset($option->parentelementid) && ($index = array_search($option->parentelementid, $uniqueids)) !== false) {
$option->parentelementid = $index;//db id for the parent
}
else if (isset($option->parentelementid) && $option->parentelementid == 'undefined') {
$option->parentelementid = null;
}
$sofordb->parent = !empty($option->parentelementid) ? $option->parentelementid : null;
//where se record goes in
$inserted = insert_record('framework_standard_element', $sofordb, 'id', true);
......
......@@ -829,6 +829,10 @@ div.form-group .form-control-label {
border-bottom-right-radius: 0.25rem;
}
.errormsg {
color: $state-danger-text;
}
// table cells that need to be fixed 70px width
.width-70 {
width: 70px;
......
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