This commit is contained in:
Paminger
2016-06-20 08:36:37 +02:00
parent 377b1ecdd0
commit 68963a962a
3 changed files with 38 additions and 44 deletions
+9 -3
View File
@@ -119,7 +119,13 @@ class Templates extends FHC_Controller
$vorlagetext = $this->vorlagelib->getVorlagetextById($vorlagestudiengang_id);
if ($vorlagetext->error)
show_error($vorlagetext->retval);
$this->load->view('system/templatetextEdit', $vorlagetext->retval[0]);
$data = $vorlagetext->retval[0];
// Preview-Data
$schema = $this->vorlagelib->getVorlage($data->vorlage_kurzbz);
$data->schema = $schema->retval[0]->attribute;
$this->load->view('system/templatetextEdit', $data);
}
public function saveText()
@@ -134,8 +140,8 @@ class Templates extends FHC_Controller
if ($vorlagetext->error)
show_error($vorlagetext->retval);
$data['vorlagestudiengang_id'] = $vorlagestudiengang_id;
//redirect('/system/Templates/editText/'.$vorlagestudiengang_id);
$this->load->view('system/templatetextEdit', $data);
redirect('/system/Templates/editText/'.$vorlagestudiengang_id);
//$this->load->view('system/templatetextEdit', $data);
}
public function preview($vorlagestudiengang_id)
@@ -20,7 +20,7 @@ StudiengangKZ: <?=$studiengang_kz?>
</form>
<hr/><h2>Preview-Data</h2>
<form method="post" action="../preview/<?=$vorlagestudiengang_id?>" target="TemplatePreview">
<?php echo $this->templatelib->widget("jsonforms_widget", array('id' => 'dataform')); ?>
<?php echo $this->templatelib->widget("jsonforms_widget", array('id' => 'dataform', 'schema' => $schema)); ?>
<input type="hidden" name="formdata" id="formdata" value="" />
<button type="submit" onclick="getFormdata(this.form);">Preview</button>
</form>
@@ -36,6 +36,6 @@ StudiengangKZ: <?=$studiengang_kz?>
}
</script>
<iframe name="TemplatePreview" width="100%" src="../preview/<?=$vorlagestudiengang_id?>"/>
<iframe name="TemplatePreview" width="100%" src=""/>
</body>
</html>
+27 -39
View File
@@ -13,47 +13,35 @@ class jsonforms_widget extends Widget
if (! isset($data['id']))
$data['id'] = 'jsonforms';
if (! isset($data['style']))
$data['style'] = 'width: 500px; height: 200px;';
$data['style'] = 'width: 50%; ';
if (! isset($data['schema']))
$data['schema'] = '{
"$schema": "http://json-schema.org/draft-03/schema#",
"title": "Person",
"type": "object",
"properties": {
"anrede": {
"type": "string",
"enum": [
"Herr",
"Frau"
],
"default": "Herr"
},
"vorname": {
"type": "string",
"description": "Firstname",
"minLength": 2,
"default": "Vorname"
},
"nachname": {
"type": "string",
"description": "Firstname",
"minLength": 2,
"default": "Nachname"
},
"code": {
"type": "string",
"description": "Accesscode",
"minLength": 6,
"default": "1q2w3e4r5t6z7u8i9o0"
},
"link": {
"type": "string",
"description": "LoginURL",
"minLength": 6,
"default": "https://cis.fhcomplete.org"
}
}
}';
"$schema": "http://json-schema.org/draft-03/schema#",
"title": "Person",
"type": "object",
"properties": {
"anrede": {
"type": "string",
"enum": [
"Herr",
"Frau"
],
"default": "Herr"
},
"vorname": {
"type": "string",
"description": "Firstname",
"minLength": 2,
"default": "Vorname"
},
"nachname": {
"type": "string",
"description": "Surename",
"minLength": 2,
"default": "Nachname"
}
}
}';
$this->view('widgets/jsonforms', $data);
}
}