- Renamed TemplateLib to WidgetLib

- Updated controllers and views to use WidgetLib
- Removed TempleteLib from autoload config file
- Removed loading of session library from FHC_Controller (already
present in the autoload configuration file)
This commit is contained in:
Paolo
2017-03-23 12:25:58 +01:00
parent 2c4595005b
commit 2711430eb9
15 changed files with 63 additions and 48 deletions
+1 -3
View File
@@ -58,9 +58,7 @@ $autoload['packages'] = array();
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
//$autoload['libraries'] = array();
$autoload['libraries'] = array('Session', 'FHC_Auth', 'TemplateLib');
$autoload['libraries'] = array('Session', 'FHC_Auth');
/*
| -------------------------------------------------------------------
@@ -7,7 +7,13 @@ class Messages extends VileSci_Controller
public function __construct()
{
parent::__construct();
// Loads the message library
$this->load->library('MessageLib');
// Loads the widget library
$this->load->library('WidgetLib');
$this->load->model('person/Person_model', 'PersonModel');
}
@@ -7,8 +7,13 @@ class Phrases extends FHC_Controller
public function __construct()
{
parent::__construct();
// Loads the phrases library
$this->load->library('PhrasesLib');
// Loads the widget library
$this->load->library('WidgetLib');
// Loads helper message to manage returning messages
$this->load->helper('message');
}
@@ -7,7 +7,12 @@ class Templates extends FHC_Controller
public function __construct()
{
parent::__construct();
// Loads the vorlage library
$this->load->library('VorlageLib');
// Loads the widget library
$this->load->library('WidgetLib');
}
public function index()
+1 -1
View File
@@ -9,6 +9,6 @@ class APIv1_Controller extends REST_Controller
parent::__construct();
// Loads return messages
$this->load->helper('Message');
$this->load->helper('message');
}
}
+1 -1
View File
@@ -7,7 +7,7 @@ class FHC_Controller extends CI_Controller
public function __construct()
{
parent::__construct();
$this->load->library('session');
$this->load->helper('fhcauth');
}
}
@@ -24,12 +24,10 @@
* THE SOFTWARE.
*/
if (!defined("BASEPATH"))
exit("No direct script access allowed");
if (!defined("BASEPATH")) exit("No direct script access allowed");
class TemplateLib
class WidgetLib
{
/* default values */
private $_template = 'template';
private $_parser = FALSE;
@@ -604,26 +602,29 @@ class Partial
class Widget extends Partial
{
/* (non-PHPdoc)
* @see Partial::content()
*/
public function content() {
if (!$this->_cached) {
if (method_exists($this, 'display')) {
// capture output
ob_start();
$this->display($this->_args);
$buffer = ob_get_clean();
// if no content is produced but there was direct ouput we set
// that output as content
if (!$this->_content && $buffer) {
$this->set($buffer);
}
}
}
return parent::content();
}
}
/* (non-PHPdoc)
* @see Partial::content()
*/
public function content()
{
if (!$this->_cached)
{
if (method_exists($this, 'display'))
{
// capture output
ob_start();
$this->display($this->_args);
$buffer = ob_get_clean();
// if no content is produced but there was direct ouput we set
// that output as content
if (!$this->_content && $buffer)
{
$this->set($buffer);
}
}
}
return parent::content();
}
}
+1 -1
View File
@@ -18,7 +18,7 @@
<div class="span4">
<button type="submit">Send</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php echo $this->templatelib->widget("Vorlage_widget", array("title" => "Vorlage")); ?>
<?php echo $this->widgetlib->widget("Vorlage_widget", array("title" => "Vorlage")); ?>
</div>
</div>
+1 -1
View File
@@ -72,7 +72,7 @@
<table>
<tr>
<td>
<?php echo $this->templatelib->widget("Vorlage_widget", array("title" => "Vorlage")); ?>
<?php echo $this->widgetlib->widget("Vorlage_widget", array("title" => "Vorlage")); ?>
</td>
<td>
&nbsp;
@@ -11,11 +11,11 @@
<table>
<tr>
<td>OE</td>
<td><?php echo $this->templatelib->widget("organisationseinheit_widget", array('oe_kurzbz' => $orgeinheit_kurzbz)); ?></td>
<td><?php echo $this->widgetlib->widget("organisationseinheit_widget", array('oe_kurzbz' => $orgeinheit_kurzbz)); ?></td>
<td>Preview</td>
</tr>
<tr><td>Orgform</td><td><?php echo $this->templatelib->widget("orgform_widget", array('orgform_kurzbz' => $orgform_kurzbz)); ?></td><td></td></tr>
<tr><td>Sprache</td><td><?php echo $this->templatelib->widget("sprache_widget", array('sprache' => $sprache)); ?></td><td></td></tr>
<tr><td>Orgform</td><td><?php echo $this->widgetlib->widget("orgform_widget", array('orgform_kurzbz' => $orgform_kurzbz)); ?></td><td></td></tr>
<tr><td>Sprache</td><td><?php echo $this->widgetlib->widget("sprache_widget", array('sprache' => $sprache)); ?></td><td></td></tr>
<tr><td>Text</td><td><textarea name="text" style="width:500px; height:300px;" id="markitup"><?php echo $text ?></textarea></td>
<td valign="top">
<div id="textile-preview" style="width:500px; height:300px; border: 1px solid gray; overflow: auto;"></div>
@@ -35,7 +35,7 @@
</td></tr>
<?php
// This is an example to show that you can load stuff from inside the template file
//echo $this->templatelib->widget("tinymce_widget", array('name' => 'text', 'text' => $text));
//echo $this->widgetlib->widget("tinymce_widget", array('name' => 'text', 'text' => $text));
?>
<tr><td colspan="2" align="right"><button type="submit">Save</button></td></tr>
</table>
+1 -1
View File
@@ -9,7 +9,7 @@
App: aufnahme
<?php
// This is an example to show that you can load stuff from inside the template file
//echo $this->templatelib->widget("mimetype_widget", array('mimetype' => $mimetype));
//echo $this->widgetlib->widget("mimetype_widget", array('mimetype' => $mimetype));
?>
<button type="submit">Filter</button>
</form>
+2 -2
View File
@@ -8,9 +8,9 @@
Bezeichnung: <input type="text" name="bezeichnung" value="<?php echo $vorlage->bezeichnung; ?>" />
Anmerkung: <input type="text" name="anmerkung" value="<?php echo $vorlage->anmerkung; ?>" /><br/>
MimeType:<?php echo $this->templatelib->widget("mimetype_widget", array('mimetype' => $vorlage->mimetype)); ?>
MimeType:<?php echo $this->widgetlib->widget("mimetype_widget", array('mimetype' => $vorlage->mimetype)); ?>
Attribute: <?php echo $this->templatelib->widget("jsoneditor_widget", array('json' => $vorlage->attribute)); ?>
Attribute: <?php echo $this->widgetlib->widget("jsoneditor_widget", array('json' => $vorlage->attribute)); ?>
<input type="hidden" name="attribute" id="attribute" value="<?=$vorlage->attribute?>" />
<input type="hidden" name="vorlage_kurzbz" value="<?php echo $vorlage->vorlage_kurzbz; ?>" />
+1 -1
View File
@@ -8,7 +8,7 @@
MimeType
<?php
// This is an example to show that you can load stuff from inside the template file
echo $this->templatelib->widget("mimetype_widget", array('mimetype' => $mimetype));
echo $this->widgetlib->widget("mimetype_widget", array('mimetype' => $mimetype));
?>
<button type="submit">Filter</button>
</form>
@@ -7,22 +7,22 @@
<h2>Vorlagetext: <?=$vorlagestudiengang_id?></h2>
<!--StudiengangKZ: <?=$studiengang_kz?>-->
<form method="post" action="../saveText/<?=$vorlagestudiengang_id?>">
OE:<?php echo $this->templatelib->widget("organisationseinheit_widget", array('oe_kurzbz' => $oe_kurzbz, 'typ' => "'Erhalter','Studienzentrum','Studiengang','Lehrgang'")); ?>
Sprache:<?php echo $this->templatelib->widget("sprache_widget", array('sprache' => $sprache)); ?>
OrgForm:<?php echo $this->templatelib->widget("orgform_widget", array('orgform' => $orgform_kurzbz)); ?>
OE:<?php echo $this->widgetlib->widget("organisationseinheit_widget", array('oe_kurzbz' => $oe_kurzbz, 'typ' => "'Erhalter','Studienzentrum','Studiengang','Lehrgang'")); ?>
Sprache:<?php echo $this->widgetlib->widget("sprache_widget", array('sprache' => $sprache)); ?>
OrgForm:<?php echo $this->widgetlib->widget("orgform_widget", array('orgform' => $orgform_kurzbz)); ?>
Version: <input type="text" name="version" value="<?php echo $version; ?>" size="1" />
Aktiv: <input type="text" name="aktiv" value="<?php echo $aktiv; ?>" size="1" />
<input type="hidden" name="vorlagestudiengang_id" value="<?php echo $vorlagestudiengang_id; ?>" />
<input type="hidden" name="studiengang_kz" value="<?php echo $studiengang_kz; ?>" />
<?php
// This is an example to show that you can load stuff from inside the template file
echo $this->templatelib->widget("tinymce_widget", array('name' => 'text', 'text' => $text));
echo $this->widgetlib->widget("tinymce_widget", array('name' => 'text', 'text' => $text));
?>
<button type="submit">Save</button>
</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', 'schema' => $schema)); ?>
<?php echo $this->widgetlib->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>
+1 -1
View File
@@ -4,7 +4,7 @@
<div>
<form id="usersFiltersForm" action="" method="post">
<?php
echo $this->templatelib->widget(
echo $this->widgetlib->widget(
'Usersfilters_widget',
array(
'studiengang' => $studiengang,