BugFix PhraseLib

This commit is contained in:
Paminger
2016-06-30 07:22:18 +02:00
parent 73c36d8520
commit 09787cca65
5 changed files with 58 additions and 19 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ class PhrasesLib
$this->ci->load->library('parser');
$this->ci->load->model('system/Phrase_model', 'PhraseModel');
$this->ci->load->model('system/Phrasetext_model', 'PhrasentextModel');
$this->ci->load->model('system/Phrasentext_model', 'PhrasentextModel');
$this->ci->load->helper('language');
$this->ci->load->helper('Message');
+7 -16
View File
@@ -8,21 +8,20 @@ class Migration_Vorlage extends CI_Migration {
{
if (! @$this->db->simple_query('SELECT attribute FROM public.tbl_vorlage'))
{
$query= "ALTER TABLE public.tbl_vorlage
$query = "ALTER TABLE public.tbl_vorlage
ADD COLUMN attribute json;
";
if ($this->db->simple_query($query))
{
echo 'Column public.tbl_vorlage.attribute added!';
// Insert Demo Data
$query= "INSERT INTO public.tbl_vorlage VALUES ('MailRegistration', 'eMail zur Registrierung', NULL, 'text/html', '{ \"\$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\" }, \"code\": { \"type\": \"string\", \"description\": \"Accesscode\", \"minLength\": 6, \"default\": \"1q2w3e4r5t6z7u8i9o0\" }, \"link\": { \"type\": \"string\", \"description\": \"LoginURL\", \"minLength\": 6, \"default\": \"https://cis.fhcomplete.org/addon/aufnahme/cis/login/\" } }}');
";
$this->db->simple_query($query);
}
else
echo "Error adding public.tbl_vorlage.attribute!";
}
// OEen ohne Eltern holen
$query = 'SELECT oe_kurzbz FROM public.tbl_organisationseinheit WHERE oe_parent_kurzbz IS NULL;';
$oe = $this->db->query($query)->result();
// tbl_vorlagestudiengang->Subject
if (! @$this->db->simple_query('SELECT subject FROM public.tbl_vorlagestudiengang'))
{
@@ -46,13 +45,7 @@ class Migration_Vorlage extends CI_Migration {
echo 'Column public.tbl_vorlagestudiengang.orgform_kurzbz added!';
// Insert Demo Data
$query = "SELECT setval('seq_vorlagestudiengang_vorlagestudiengang_id', (SELECT MAX(vorlagestudiengang_id) FROM public.tbl_vorlagestudiengang));";
$query .= "INSERT INTO public.tbl_vorlagestudiengang VALUES ('MailRegistration', 0, 1, '<p>Sehr geehrte/r {anrede} <strong>{vorname} {nachname}</strong>,</p>
<p>vielen Dank für Ihre Registrierung an unserer Hochschule. Im Anhang senden wir ihnen den Zugangscode.</p>
<p>Code: <code>{code}</code></p>
<p>Unter folgenden Link können sie sich direkt für unser Service einloggen: <a title=\"LoginLink\" href=\"{link}{code}\">{link}{code}</a></p>
<p>Mit freundlichen Grüßen,<br>FH Technikum Wien</p>', 'etw');
";
$this->db->simple_query($query);
$this->db->simple_query($query);
}
else
echo "Error adding public.tbl_vorlagestudiengang.orgform_kurzbz!";
@@ -63,8 +56,6 @@ class Migration_Vorlage extends CI_Migration {
{
try
{
$this->db->delete('public.tbl_vorlagestudiengang', array('vorlage_kurzbz' => 'MailRegistration'));
$this->db->delete('public.tbl_vorlage', array('vorlage_kurzbz' => 'MailRegistration'));
$this->dbforge->drop_column('public.tbl_vorlage', 'attribute');
$this->dbforge->drop_column('public.tbl_vorlagestudiengang', 'subject');
$this->dbforge->drop_column('public.tbl_vorlagestudiengang', 'orgform_kurzbz');
+48
View File
@@ -0,0 +1,48 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Seed_Vorlage
{
public function __construct()
{
$this->fhc =& get_instance();
}
public function seed()
{
echo "Seeding Standard templates (Vorlage) ";
// OEen ohne Eltern holen
$query = 'SELECT oe_kurzbz FROM public.tbl_organisationseinheit WHERE oe_parent_kurzbz IS NULL;';
$oe = $this->db->query($query)->result();
// Insert Template MailRegistration
$query= "INSERT INTO public.tbl_vorlage VALUES ('MailRegistration', 'eMail zur Registrierung', NULL, 'text/html', '{ \"\$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\" }, \"code\": { \"type\": \"string\", \"description\": \"Accesscode\", \"minLength\": 6, \"default\": \"1q2w3e4r5t6z7u8i9o0\" }, \"link\": { \"type\": \"string\", \"description\": \"LoginURL\", \"minLength\": 6, \"default\": \"https://cis.fhcomplete.org/addon/aufnahme/cis/login/\" } }}');
";
if (! $this->db->simple_query($query)
echo "Error adding Template MailRegistration!";
// Insert Vorlagetext
foreach ($oe as $o)
{
$query = "INSERT INTO public.tbl_vorlagestudiengang VALUES ('MailRegistration', 0, 1, '<p>Sehr geehrte/r {anrede} <strong>{vorname} {nachname}</strong>,</p>
<p>vielen Dank für Ihre Registrierung an unserer Hochschule. Im Anhang senden wir ihnen den Zugangscode.</p>
<p>Code: <code>{code}</code></p>
<p>Unter folgenden Link können sie sich direkt für unser Service einloggen: <a title=\"LoginLink\" href=\"{link}{code}\">{link}{code}</a></p>
<p>Mit freundlichen Grüßen,<br>FH Technikum Wien</p>', '$o->oe_kurzbz');
";
if ($this->db->simple_query($query))
echo 'Added Tamplate MailRegistration for OE:'.$o->oe_kurzbz.' ';
}
echo PHP_EOL;
}
public function truncate()
{
//$this->fhc->db->query('DELETE FROM public.tbl_vorlage;');
}
}
+1 -1
View File
@@ -43,7 +43,7 @@ $rechte->getBerechtigungen($uid);
if(!$rechte->isBerechtigt('admin'))
{
exit('Sie haben keine Berechtigung');
exit('Sie ('.$uid.') haben keine Berechtigung');
}
echo '<H2>Check and set roles!</H2>';
+1 -1
View File
@@ -43,7 +43,7 @@ $rechte->getBerechtigungen($uid);
if(!$rechte->isBerechtigt('admin'))
{
exit('Sie haben keine Berechtigung');
exit('Sie ('.$uid.') haben keine Berechtigung');
}
echo '<H1>Systemcheck!</H1>';