- Fixed Fallback if Vorlage doesnt exist

- Added Additional Parameters to Message
This commit is contained in:
oesi
2016-08-19 11:31:30 +02:00
parent b46692913c
commit edb60ef17b
2 changed files with 50 additions and 29 deletions
+21 -21
View File
@@ -1,4 +1,4 @@
<?php
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
@@ -10,19 +10,19 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
class VorlageLib
{
private $recipients = array();
public function __construct()
{
require_once APPPATH.'config/message.php';
$this->ci =& get_instance();
$this->ci->load->library('parser');
$this->ci->load->library('OrganisationseinheitLib');
$this->ci->load->model('system/Vorlage_model', 'VorlageModel');
$this->ci->load->model('system/Vorlagestudiengang_model', 'VorlageStudiengangModel');
$this->ci->load->helper('language');
//$this->ci->lang->load('fhcomplete');
}
@@ -37,7 +37,7 @@ class VorlageLib
{
if (empty($vorlage_kurzbz))
return $this->_error(MSG_ERR_INVALID_MSG_ID);
$vorlage = $this->ci->VorlageModel->load($vorlage_kurzbz);
return $vorlage;
}
@@ -53,7 +53,7 @@ class VorlageLib
$vorlage = $this->ci->VorlageModel->loadWhere(array('mimetype' => $mimetype));
return $vorlage;
}
/**
* saveVorlage() - will save a spezific Template.
@@ -65,7 +65,7 @@ class VorlageLib
{
if (empty($data))
return $this->_error(MSG_ERR_INVALID_MSG_ID);
$vorlage = $this->ci->VorlageModel->update($vorlage_kurzbz, $data);
return $vorlage;
}
@@ -81,7 +81,7 @@ class VorlageLib
{
if (empty($vorlage_kurzbz))
return $this->_error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
$vorlage = $this->ci->VorlageStudiengangModel->loadWhere(array('vorlage_kurzbz' =>$vorlage_kurzbz));
return $vorlage;
}
@@ -99,20 +99,20 @@ class VorlageLib
{
if (empty($vorlage_kurzbz))
return $this->_error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
// Builds where clause
$where = "";
$where = "vorlage_kurzbz=".$this->ci->VorlageModel->escape($vorlage_kurzbz);
if (is_null($orgform_kurzbz))
{
$where .= "orgform_kurzbz IS NULL";
$where .= "AND orgform_kurzbz IS NULL";
}
else
{
$where .= "orgform_kurzbz = " . $this->ci->VorlageModel->escape($orgform_kurzbz);
$where .= "AND orgform_kurzbz = " . $this->ci->VorlageModel->escape($orgform_kurzbz);
}
$where .= " AND ";
if (is_null($sprache))
{
$where .= "sprache IS NULL";
@@ -121,7 +121,7 @@ class VorlageLib
{
$where .= "sprache = " . $this->ci->VorlageModel->escape($sprache);
}
// Try to search the template with the given vorlage_kurzbz and other parameters if present
$queryParameters = array("vorlage_kurzbz" => $vorlage_kurzbz);
@@ -137,7 +137,7 @@ class VorlageLib
{
$queryParameters["sprache"] = $sprache;
}
$vorlage = $this->ci->VorlageStudiengangModel->loadWhere($queryParameters);
// If the searched template was not found
if (is_object($vorlage) && $vorlage->error == EXIT_SUCCESS && is_array($vorlage->retval) && count($vorlage->retval) == 0)
@@ -146,14 +146,14 @@ class VorlageLib
'public',
'tbl_vorlagestudiengang',
array("vorlage_kurzbz", "studiengang_kz", "version", "text", "oe_kurzbz",
"vorlagestudiengang_id", "style", "berechtigung", "anmerkung_vorlagestudiengang",
"vorlagestudiengang_id", "style", "berechtigung", "anmerkung_vorlagestudiengang",
"aktiv", "sprache", "subject", "orgform_kurzbz"),
$where,
"version DESC",
$oe_kurzbz
);
}
return $vorlage;
}
@@ -207,7 +207,7 @@ class VorlageLib
$text = $this->ci->parser->parse_string($text, $data, TRUE);
return $text;
}
/** ---------------------------------------------------------------
* Success
*
@@ -223,7 +223,7 @@ class VorlageLib
$return->retval = $retval;
return $return;
}
/** ---------------------------------------------------------------
* General Error
*