mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 16:44:28 +00:00
Compare commits
23
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b42d3d8b4 | ||
|
|
ae83bf36a7 | ||
|
|
2127823af5 | ||
|
|
4bb41746dd | ||
|
|
baaa9ece89 | ||
|
|
dea9c38936 | ||
|
|
4d109c05cb | ||
|
|
7ae8f67fd3 | ||
|
|
242c74e912 | ||
|
|
af9af625d4 | ||
|
|
6bbc09442c | ||
|
|
ff539568c2 | ||
|
|
77a3157c3d | ||
|
|
2252ab1996 | ||
|
|
b2b9846f10 | ||
|
|
977fa5b0f0 | ||
|
|
c27bbc52c0 | ||
|
|
209840e940 | ||
|
|
c9b31b1795 | ||
|
|
8fde7d3268 | ||
|
|
129cf2769c | ||
|
|
c1b80cf9a7 | ||
|
|
07af177cc1 |
+17
-15
@@ -4,31 +4,34 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
// Define configuration parameters
|
||||
$config['email_number_to_sent'] = 1000; // Number of emails to sent each time sendAll is called
|
||||
$config['email_number_per_time_range'] = 882; // Number of emails to sent before pause
|
||||
$config['email_number_per_time_range'] = 1; // Number of emails to sent before pause
|
||||
$config['email_time_range'] = 1; // Length of the pause in seconds
|
||||
$config['email_from_system'] = '[email protected]';
|
||||
$config['alias_from_system'] = 'No Reply';
|
||||
|
||||
// Smtp: if the CI email library has to connect to a smtp server
|
||||
// Mail: if the system is setup to send emails with the standard php mail function
|
||||
// Sendmail: if the system is setup to send email via Sendmail (or similar)
|
||||
$config['protocol'] = ''; // mail, sendmail, or smtp
|
||||
|
||||
// If protocol is set to sendmail
|
||||
$config['mailpath'] = ''; // SThe server path to Sendmail (or similar)
|
||||
|
||||
// If protocol is set to smtp
|
||||
$config['smtp_host'] = 'localhost'; // SMTP Server Address
|
||||
$config['smtp_port'] = 25;
|
||||
$config['smtp_timeout'] = 1; // in seconds
|
||||
$config['smtp_timeout'] = 5; // in seconds
|
||||
$config['smtp_keepalive'] = false; // Enable persistent SMTP connections
|
||||
$config['smtp_auth'] = false;
|
||||
$config['smtp_user'] = '';
|
||||
$config['smtp_pass'] = '';
|
||||
$config['smtp_encryption'] = ''; // '', 'tls' or 'ssl'
|
||||
$config['wordwrap'] = 76;
|
||||
$config['is_html'] = true; // html or text
|
||||
$config['priority'] = 3; // 1 = High, 3 = Normal, 5 = low. When null, the header is not set at all.
|
||||
$config['wordwrap'] = true; // {unwrap}http://example.com/a_long_link_that_should_not_be_wrapped.html{/unwrap}
|
||||
$config['wrapchars'] = 76; // Character count to wrap at.
|
||||
$config['mailtype'] = 'html'; // html or text
|
||||
$config['priority'] = 3; // Email Priority. 1 = highest. 5 = lowest. 3 = normal
|
||||
$config['validate'] = false; // If true then the email address will be validated
|
||||
|
||||
// If enabled will be logged info about emails
|
||||
// 0: Disable debugging (you can also leave this out completely, 0 is the default).
|
||||
// 1: Output messages sent by the client.
|
||||
// 2: as 1, plus responses received from the server (this is the most useful setting).
|
||||
// 3: as 2, plus more information about the initial connection - this level can help diagnose STARTTLS failures.
|
||||
// 4: as 3, plus even lower-level information, very verbose, don't use for debugging SMTP, only low-level problems.
|
||||
$config['enable_debug'] = 0;
|
||||
// If enabled will be logged info about emails in Codeigniter error logs
|
||||
$config['enable_debug'] = false;
|
||||
|
||||
// default sender
|
||||
$config['sancho_mail_default_sender'] = defined('SANCHO_MAIL_DEFAULT_SENDER') ? SANCHO_MAIL_DEFAULT_SENDER : '';
|
||||
@@ -44,4 +47,3 @@ $config['sancho_mail_header_img'] = defined('SANCHO_MAIL_HEADER_IMG') ? SANCHO_M
|
||||
|
||||
// footer image for custom mails
|
||||
$config['sancho_mail_footer_img'] = defined('SANCHO_MAIL_FOOTER_IMG') ? SANCHO_MAIL_FOOTER_IMG : '';
|
||||
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
/* Copyright (C) 2024 fhcomplete.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Modulgrafik extends JOB_Controller
|
||||
{
|
||||
const DEFAULT_XOFFSET = 40;
|
||||
const DEFAULT_YOFFSET = 30;
|
||||
const DEFAULT_WIDTH = 160;
|
||||
const DEFAULT_SEMESTER_LABEL_WIDTH = 80;
|
||||
const DEFAULT_ECTS_WIDTH = 40;
|
||||
const DEFAULT_HEIGHT = 50;
|
||||
const DEFAULT_SPACING = 40;
|
||||
const DEFAULT_FONTSIZE = 8;
|
||||
|
||||
protected $curx;
|
||||
protected $cury;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->model('organisation/Studienplan_model', 'StudienplanModel');
|
||||
|
||||
$this->load->model('CL/Drawio_model', 'DrawioModel');
|
||||
|
||||
$this->load->library('DocsboxLib', null, 'DocsboxLib');
|
||||
}
|
||||
|
||||
public function drawModulGrafik($studienplan_id)
|
||||
{
|
||||
$sql = <<<EOSQL
|
||||
SELECT
|
||||
sl.studienplan_lehrveranstaltung_id,
|
||||
sl.lehrveranstaltung_id,
|
||||
sl.studienplan_lehrveranstaltung_id_parent,
|
||||
COALESCE(sl.studienplan_lehrveranstaltung_id_parent, sl.studienplan_lehrveranstaltung_id) AS lvgrp,
|
||||
sl.semester,
|
||||
lv.bezeichnung,
|
||||
lv.ects,
|
||||
lv.lehrtyp_kurzbz
|
||||
FROM
|
||||
lehre.tbl_studienplan_lehrveranstaltung sl
|
||||
JOIN
|
||||
lehre.tbl_lehrveranstaltung lv USING(lehrveranstaltung_id)
|
||||
WHERE
|
||||
sl.studienplan_id = {$studienplan_id}
|
||||
AND
|
||||
ects > '0.00'
|
||||
ORDER BY
|
||||
sl.semester ASC,
|
||||
lvgrp ASC,
|
||||
lv.lehrtyp_kurzbz DESC
|
||||
EOSQL;
|
||||
|
||||
$result = $this->StudienplanModel->execReadOnlyQuery($sql);
|
||||
$lvs = getData($result);
|
||||
|
||||
$errors = array();
|
||||
$assoclvs = array();
|
||||
$semester = array();
|
||||
if($lvs)
|
||||
{
|
||||
ob_start();
|
||||
|
||||
foreach($lvs as &$lv)
|
||||
{
|
||||
if( !isset($semester[$lv->semester]) ) {
|
||||
$semester[$lv->semester] = array();
|
||||
}
|
||||
$lv->parent = null;
|
||||
$lv->childs = array();
|
||||
$assoclvs[$lv->studienplan_lehrveranstaltung_id] = $lv;
|
||||
}
|
||||
|
||||
foreach($assoclvs as &$assoclv)
|
||||
{
|
||||
if( $assoclv->studienplan_lehrveranstaltung_id_parent === NULL )
|
||||
{
|
||||
$semester[$assoclv->semester][] = $assoclv;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( isset($assoclvs[$assoclv->studienplan_lehrveranstaltung_id_parent]) )
|
||||
{
|
||||
$assoclv->parent = $assoclvs[$assoclv->studienplan_lehrveranstaltung_id_parent];
|
||||
$assoclvs[$assoclv->studienplan_lehrveranstaltung_id_parent]->childs[] = $assoclv;
|
||||
}
|
||||
else
|
||||
{
|
||||
$errors[] = "ERROR: Missing parent lv " . $assoclv->studienplan_lehrveranstaltung_id_parent . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function printchilds($childs, $level) {
|
||||
if( count($childs) < 1 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach($childs as $child)
|
||||
{
|
||||
echo $level . $child->bezeichnung . " (" . $child->ects . ") " . $child->lehrtyp_kurzbz . "\n";
|
||||
printchilds($child->childs, $level . "\t");
|
||||
}
|
||||
}
|
||||
|
||||
echo "<!--\n\n";
|
||||
|
||||
foreach($semester as $sem => $mods)
|
||||
{
|
||||
echo $sem . ". Semester: \n";
|
||||
foreach($mods as $mod)
|
||||
{
|
||||
$level = "\t";
|
||||
echo $level . $mod->bezeichnung . " (" . $mod->ects . ") " . $mod->lehrtyp_kurzbz . "\n";
|
||||
printchilds($mod->childs, $level . "\t");
|
||||
}
|
||||
}
|
||||
echo "-->\n\n";
|
||||
|
||||
if (count($errors) === 0)
|
||||
{
|
||||
$this->DrawioModel->renderFileStart();
|
||||
$this->maxxoffset = self::DEFAULT_XOFFSET;
|
||||
$this->DrawioModel->renderDiagramStart($studienplan_id, 'Modulgrafik');
|
||||
$this->renderSemester($semester);
|
||||
$this->DrawioModel->renderDiagramEnd();
|
||||
$this->DrawioModel->renderFileEnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($errors as $error)
|
||||
{
|
||||
echo $error;
|
||||
}
|
||||
}
|
||||
|
||||
$output = ob_get_clean();
|
||||
file_put_contents(sys_get_temp_dir().'/Modulgrafik.xml', $output);
|
||||
|
||||
$ret = DocsboxLib::convert(sys_get_temp_dir().'/Modulgrafik.xml', sys_get_temp_dir().'/Modulgrafik.png', 'png');
|
||||
|
||||
echo 'File: '.sys_get_temp_dir().'/Modulgrafik.png'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Keine LVs gefunden.\n";
|
||||
}
|
||||
}
|
||||
|
||||
protected function renderSemester($semester)
|
||||
{
|
||||
$cury = self::DEFAULT_YOFFSET;
|
||||
|
||||
foreach($semester as $sem => $mods)
|
||||
{
|
||||
$curx = self::DEFAULT_XOFFSET;
|
||||
$id = uniqid();
|
||||
$ects = 30; //TODO calc
|
||||
$this->DrawioModel->renderSemesterLabel($id, $sem, $ects, self::DEFAULT_XOFFSET, $cury, self::DEFAULT_SEMESTER_LABEL_WIDTH, self::DEFAULT_HEIGHT);
|
||||
$curx += self::DEFAULT_SEMESTER_LABEL_WIDTH + self::DEFAULT_SPACING;
|
||||
$maxmodulheight = 0;
|
||||
foreach($mods as $mod)
|
||||
{
|
||||
$modid = uniqid();
|
||||
$size = $this->DrawioModel->renderModulList($modid, $mod, $curx, $cury, self::DEFAULT_ECTS_WIDTH, self::DEFAULT_HEIGHT);
|
||||
$curx += $size->width + self::DEFAULT_SPACING;
|
||||
if( $size->height > $maxmodulheight)
|
||||
{
|
||||
$maxmodulheight = $size->height;
|
||||
}
|
||||
}
|
||||
$cury += $maxmodulheight + self::DEFAULT_SPACING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,339 @@
|
||||
<?php
|
||||
/* Copyright (C) 2024 fhcomplete.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Organigramm extends JOB_Controller
|
||||
{
|
||||
const DEFAULT_XOFFSET = 40;
|
||||
const DEFAULT_YOFFSET = 30;
|
||||
const DEFAULT_WIDTH = 160;
|
||||
const DEFAULT_HEIGHT = 50;
|
||||
const DEFAULT_SPACING = 40;
|
||||
const DEFAULT_FONTSIZE = 8;
|
||||
const RENDER_CHILDS_HORIZONTAL = 1;
|
||||
const RENDER_CHILDS_VERTICAL = 2;
|
||||
|
||||
protected $maxxoffset;
|
||||
protected $donotrenderchildsoftype;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel');
|
||||
|
||||
$this->load->model('CL/Drawio_model', 'DrawioModel');
|
||||
|
||||
$this->load->library('DocsboxLib', null, 'DocsboxLib');
|
||||
|
||||
$this->maxxoffset = self::DEFAULT_XOFFSET;
|
||||
$this->donotrenderchildsoftype = array();
|
||||
}
|
||||
|
||||
public function getAllActiveOes()
|
||||
{
|
||||
$sql = <<<EOSQL
|
||||
SELECT
|
||||
oe.oe_kurzbz,
|
||||
CASE
|
||||
WHEN oe.oe_parent_kurzbz = 'atw' THEN 'gst'
|
||||
WHEN oe.oe_parent_kurzbz = 'etw' THEN 'gst'
|
||||
ELSE oe.oe_parent_kurzbz
|
||||
END AS oe_parent_kurzbz,
|
||||
oe.bezeichnung,
|
||||
oe.organisationseinheittyp_kurzbz,
|
||||
STRING_AGG(
|
||||
DISTINCT p.vorname || ' ' || p.nachname,
|
||||
', '
|
||||
) AS leitung_uid
|
||||
FROM
|
||||
"public"."tbl_organisationseinheit" oe
|
||||
LEFT JOIN public.tbl_benutzerfunktion bf ON bf.oe_kurzbz = oe.oe_kurzbz
|
||||
AND (
|
||||
bf.datum_bis IS NULL
|
||||
OR bf.datum_bis > NOW() :: date
|
||||
)
|
||||
AND (
|
||||
bf.funktion_kurzbz IS NULL
|
||||
OR bf.funktion_kurzbz = 'Leitung'
|
||||
)
|
||||
LEFT JOIN public.tbl_benutzer b USING(uid)
|
||||
LEFT JOIN public.tbl_person p USING(person_id)
|
||||
WHERE
|
||||
oe.aktiv = true
|
||||
AND oe.oe_kurzbz NOT IN ('betriebsrat', 'oeh', 'FUEWahl', 'atw', 'etw', 'gf20')
|
||||
GROUP BY
|
||||
oe.oe_kurzbz,
|
||||
oe.oe_parent_kurzbz,
|
||||
oe.bezeichnung,
|
||||
oe.organisationseinheittyp_kurzbz
|
||||
ORDER BY
|
||||
oe.oe_parent_kurzbz ASC NULLS FIRST,
|
||||
oe.oe_kurzbz ASC;
|
||||
EOSQL;
|
||||
|
||||
$result = $this->OrganisationseinheitModel->execReadOnlyQuery($sql);
|
||||
$oes = getData($result);
|
||||
|
||||
$errors = array();
|
||||
$assocoes = array();
|
||||
$roots = array();
|
||||
if($oes)
|
||||
{
|
||||
ob_start();
|
||||
|
||||
foreach($oes as &$oe)
|
||||
{
|
||||
$oe->parent = NULL;
|
||||
$oe->childs = array();
|
||||
$oe->renderchilds = self::RENDER_CHILDS_HORIZONTAL;
|
||||
$oe->childstorender = array();
|
||||
$oe->donotrenderchildsoftype = array();
|
||||
$assocoes[$oe->oe_kurzbz] = $oe;
|
||||
}
|
||||
|
||||
foreach($assocoes as &$assocoe)
|
||||
{
|
||||
if( $assocoe->oe_parent_kurzbz === NULL )
|
||||
{
|
||||
$roots[$assocoe->oe_kurzbz] = $assocoe;
|
||||
$assocoe->donotrenderchildsoftype = array(
|
||||
'Team',
|
||||
'Lehrgang',
|
||||
'Studiengang',
|
||||
'Kompetenzfeld',
|
||||
'Forschungsfeld',
|
||||
'Container'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( isset($assocoes[$assocoe->oe_parent_kurzbz]) )
|
||||
{
|
||||
$assocoe->parent = $assocoes[$assocoe->oe_parent_kurzbz];
|
||||
$assocoes[$assocoe->oe_parent_kurzbz]->childs[] = $assocoe;
|
||||
|
||||
if( $assocoe->organisationseinheittyp_kurzbz === 'Fakultaet' )
|
||||
{
|
||||
$roots[$assocoe->oe_kurzbz] = $assocoe;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$errors[] = "ERROR: Missing parent oe " . $assocoe->oe_parent_kurzbz . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(count($errors) === 0)
|
||||
{
|
||||
$pages = count($roots);
|
||||
$this->DrawioModel->renderFileStart($pages);
|
||||
|
||||
foreach($roots AS &$root)
|
||||
{
|
||||
$this->maxxoffset = self::DEFAULT_XOFFSET;
|
||||
$this->donotrenderchildsoftype = $root->donotrenderchildsoftype;
|
||||
$this->prepareChildsToRender($root);
|
||||
$this->DrawioModel->renderDiagramStart($root->oe_kurzbz, $root->bezeichnung);
|
||||
$this->renderOE($root, 0, 0);
|
||||
$this->DrawioModel->renderDiagramEnd();
|
||||
}
|
||||
$this->DrawioModel->renderFileEnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($errors as $error)
|
||||
{
|
||||
echo $error;
|
||||
}
|
||||
}
|
||||
|
||||
$output = ob_get_clean();
|
||||
file_put_contents(sys_get_temp_dir().'/Organigramm.xml', $output);
|
||||
|
||||
$ret = DocsboxLib::convert(sys_get_temp_dir().'/Organigramm.xml', sys_get_temp_dir().'/Organigramm.png', 'png');
|
||||
|
||||
echo 'File: '.sys_get_temp_dir().'//Organigramm.png'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Keine Oes gefunden.\n";
|
||||
}
|
||||
}
|
||||
|
||||
protected function prepareChildsToRender(&$oe)
|
||||
{
|
||||
$oe->childstorender = array();
|
||||
$oe->renderchilds = self::RENDER_CHILDS_HORIZONTAL;
|
||||
if( isset($oe->childsxoffset) )
|
||||
{
|
||||
unset($oe->childsxoffset);
|
||||
}
|
||||
|
||||
foreach($oe->childs AS &$oechild )
|
||||
{
|
||||
$this->prepareChildsToRender($oechild);
|
||||
if( !in_array($oechild->organisationseinheittyp_kurzbz, $this->donotrenderchildsoftype) )
|
||||
{
|
||||
$oe->childstorender[] = $oechild;
|
||||
}
|
||||
}
|
||||
|
||||
$nurLehrgaengeOderStudiengaengeOhneKinder = true;
|
||||
foreach($oe->childstorender AS &$oechildtorender )
|
||||
{
|
||||
if( !(count($oechildtorender->childstorender) === 0) )
|
||||
{
|
||||
$nurLehrgaengeOderStudiengaengeOhneKinder = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( $nurLehrgaengeOderStudiengaengeOhneKinder && $oe->parent !== NULL )
|
||||
{
|
||||
$oe->renderchilds = self::RENDER_CHILDS_VERTICAL;
|
||||
}
|
||||
}
|
||||
|
||||
protected function renderOE($oe, $level, $parentrenderedchildcount)
|
||||
{
|
||||
$width = self::DEFAULT_WIDTH;
|
||||
$height = self::DEFAULT_HEIGHT;
|
||||
$spacing = self::DEFAULT_SPACING;
|
||||
$fontsize = self::DEFAULT_FONTSIZE;
|
||||
$nextlevel = $level + 1;
|
||||
$renderedchildcount = 0;
|
||||
|
||||
$curxoffset = $this->maxxoffset;
|
||||
|
||||
if( count($oe->childstorender) > 0 )
|
||||
{
|
||||
if( !isset($oe->childsxoffset) )
|
||||
{
|
||||
$oe->childsxoffset = (object) array(
|
||||
'min' => $curxoffset,
|
||||
'max' => $curxoffset
|
||||
);
|
||||
}
|
||||
|
||||
foreach($oe->childstorender AS $child)
|
||||
{
|
||||
$ret = $this->renderOE($child, $nextlevel, $renderedchildcount);
|
||||
$renderedchildcount++;
|
||||
if( $renderedchildcount === 1 )
|
||||
{
|
||||
$oe->childsxoffset->min = $ret->minx;
|
||||
}
|
||||
$oe->childsxoffset->max = $ret->maxx;
|
||||
}
|
||||
|
||||
if( count($oe->childstorender) === $renderedchildcount )
|
||||
{
|
||||
$curxoffset = $oe->childsxoffset->min +
|
||||
floor((($oe->childsxoffset->max - $oe->childsxoffset->min) / 2)) -
|
||||
floor((($width + $spacing) / 2));
|
||||
}
|
||||
}
|
||||
|
||||
if( $oe->parent !== null && $oe->parent->renderchilds === self::RENDER_CHILDS_VERTICAL )
|
||||
{
|
||||
$x = $curxoffset;
|
||||
$y = self::DEFAULT_YOFFSET
|
||||
+ (($level - 1) * ($height + $spacing))
|
||||
+ (($parentrenderedchildcount + 1) * ($height + floor($spacing / 2)));
|
||||
}
|
||||
else
|
||||
{
|
||||
$x = $curxoffset;
|
||||
$y = self::DEFAULT_YOFFSET + ($level * ($height + $spacing));
|
||||
}
|
||||
$bezeichnung = htmlspecialchars($oe->bezeichnung);
|
||||
$leitung = ($oe->leitung_uid !== null) ? htmlspecialchars($oe->leitung_uid) : 'N.N.';
|
||||
$fillcolors = array(
|
||||
'Team' => '#ffe6cc',
|
||||
'Abteilung' => '#e6ffcc',
|
||||
'Studiengang' => '#cce6ff',
|
||||
'Lehrgang' => '#e6ccff',
|
||||
'Fakultaet' => '#f8cecc',
|
||||
'Department' => '#fff2cc',
|
||||
'Forschungsfeld' => '#e1d5e7',
|
||||
'Kompetenzfeld' => '#f5f5f5'
|
||||
);
|
||||
$fillcolor = (isset($fillcolors[$oe->organisationseinheittyp_kurzbz])) ? $fillcolors[$oe->organisationseinheittyp_kurzbz] : '#ffffff';
|
||||
$value = <<<EOVAL
|
||||
<font style="font-size: {$fontsize}px;"><div style="">[{$oe->organisationseinheittyp_kurzbz}]</div><b style="">{$bezeichnung}</b><div>({$leitung})</div></font>" style="whiteSpace=wrap;html=1;align=center;verticalAlign=middle;treeFolding=1;treeMoving=1;newEdgeStyle={"edgeStyle":"elbowEdgeStyle","startArrow":"none","endArrow":"none"};fillColor={$fillcolor};
|
||||
EOVAL;
|
||||
|
||||
$this->DrawioModel->renderCell($oe->oe_kurzbz, $value, $x, $y, $width, $height);
|
||||
|
||||
if( $oe->oe_parent_kurzbz !== NULL )
|
||||
{
|
||||
$exitX = '0.5';
|
||||
$exitY = '1';
|
||||
$entryX = '0.5';
|
||||
$entryY = '0';
|
||||
$points = array();
|
||||
if( $oe->parent !== null && $oe->parent->renderchilds === self::RENDER_CHILDS_VERTICAL)
|
||||
{
|
||||
$exitX = '0';
|
||||
$exitY = '0.5';
|
||||
$entryX = '0';
|
||||
$entryY = '0.5';
|
||||
$points = array(
|
||||
(object) array(
|
||||
'x' => ($x - floor($spacing / 2)),
|
||||
'y' => ($y + floor($height / 2))
|
||||
)
|
||||
);
|
||||
}
|
||||
$this->DrawioModel->renderEdge($oe->oe_parent_kurzbz, $oe->oe_kurzbz, $exitX, $exitY, $entryX, $entryY, $points);
|
||||
}
|
||||
|
||||
if( $oe->parent !== null && $oe->parent->renderchilds === self::RENDER_CHILDS_VERTICAL )
|
||||
{
|
||||
if( count($oe->parent->childstorender) === ($parentrenderedchildcount + 1) )
|
||||
{
|
||||
if( $this->maxxoffset < ($x + $width + $spacing) )
|
||||
{
|
||||
$this->maxxoffset = ($x + $width + $spacing);
|
||||
}
|
||||
return (object) array(
|
||||
'minx' => $curxoffset,
|
||||
'maxx' => ($x + $width + $spacing)
|
||||
);
|
||||
}
|
||||
return (object) array(
|
||||
'minx' => $curxoffset,
|
||||
'maxx' => $x
|
||||
);
|
||||
}
|
||||
|
||||
if( $this->maxxoffset < ($x + $width + $spacing) )
|
||||
{
|
||||
$this->maxxoffset = ($x + $width + $spacing);
|
||||
}
|
||||
|
||||
return (object) array(
|
||||
'minx' => $curxoffset,
|
||||
'maxx' => ($x + $width + $spacing)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,20 +35,41 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
* @param string $bcc Sets BCC of mail.
|
||||
* @return void
|
||||
*/
|
||||
function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerImg = '', $footerImg = '', $from = null, $cc = null, $bcc = null)
|
||||
function sendSanchoMail(
|
||||
$vorlage_kurzbz,
|
||||
$vorlage_data,
|
||||
$to,
|
||||
$subject,
|
||||
$headerImg = '',
|
||||
$footerImg = '',
|
||||
$from = null,
|
||||
$cc = null,
|
||||
$bcc = null
|
||||
)
|
||||
{
|
||||
$ci =& get_instance();
|
||||
$ci->load->library('email');
|
||||
$ci->load->library('MailLib');
|
||||
|
||||
$embeddedImages = array();
|
||||
$_from = 'noreply@' . DOMAIN;
|
||||
$sancho_mail_config = $ci->config->item('mail');
|
||||
|
||||
if ($from == null && isset($sancho_mail_config['sancho_mail_default_sender']) && $sancho_mail_config['sancho_mail_default_sender'])
|
||||
|
||||
if ($from == '')
|
||||
{
|
||||
$_from = $sancho_mail_config['sancho_mail_default_sender'] . '@' . DOMAIN;
|
||||
$from = ((isset($sancho_mail_config['sancho_mail_default_sender'])
|
||||
&& $sancho_mail_config['sancho_mail_default_sender'])
|
||||
? $sancho_mail_config['sancho_mail_default_sender']
|
||||
: 'noreply')
|
||||
. '@' . DOMAIN;
|
||||
}
|
||||
|
||||
// Embed sancho header and footer image
|
||||
// reset important to ensure embedding of images when called in a loop
|
||||
$ci->email->clear(true); // clear vars and attachments
|
||||
|
||||
$cid_header = '';
|
||||
$cid_footer = '';
|
||||
|
||||
if (isset($sancho_mail_config['sancho_mail_use_images']) && $sancho_mail_config['sancho_mail_use_images'])
|
||||
{
|
||||
$sanchoHeader_img = '';
|
||||
@@ -90,27 +111,29 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm
|
||||
}
|
||||
}
|
||||
|
||||
// Attach header and footer
|
||||
$embeddedImages[] = array('file_name' => $sanchoHeader_img, 'cid' => 'sancho_header');
|
||||
$embeddedImages[] = array('file_name' => $sanchoFooter_img, 'cid' => 'sancho_footer');
|
||||
// attach header and footer
|
||||
$ci->email->attach($sanchoHeader_img, 'inline');
|
||||
$ci->email->attach($sanchoFooter_img, 'inline');
|
||||
$cid_header = $ci->email->attachment_cid($sanchoHeader_img); // sets unique content id for embedding
|
||||
$cid_footer = $ci->email->attachment_cid($sanchoFooter_img); // sets unique content id for embedding
|
||||
}
|
||||
|
||||
// Set specific mail content into specific content template
|
||||
$content = _parseMailContent($vorlage_kurzbz, $vorlage_data);
|
||||
|
||||
// Set overall main content into the sancho mail template
|
||||
$body = _parseMailContent(
|
||||
'Sancho_Mail_Template',
|
||||
array(
|
||||
'CID_header' => 'sancho_header',
|
||||
'CID_footer' => 'sancho_footer',
|
||||
'content' => $content
|
||||
)
|
||||
// overall main content data array
|
||||
$layout = array(
|
||||
'CID_header' => $cid_header,
|
||||
'CID_footer' => $cid_footer,
|
||||
'content' => $content
|
||||
);
|
||||
|
||||
// Set overall main content into the sancho mail template
|
||||
$body = _parseMailContent('Sancho_Mail_Template', $layout);
|
||||
|
||||
// Send mail
|
||||
return $ci->maillib->send(
|
||||
$_from,
|
||||
$from,
|
||||
$to,
|
||||
$subject,
|
||||
$body,
|
||||
@@ -119,8 +142,7 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm
|
||||
$bcc,
|
||||
'', // altMessage
|
||||
true, // bulk
|
||||
true, // autogenerated
|
||||
$embeddedImages
|
||||
true // autogenerated
|
||||
);
|
||||
}
|
||||
|
||||
@@ -149,4 +171,3 @@ function _parseMailContent($vorlage_kurzbz, $vorlage_data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2022 fhcomplete.net
|
||||
/* Copyright (C) 2024 fhcomplete.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
@@ -32,7 +32,7 @@ class DocsboxLib
|
||||
const STATUS_QUEUED = 'queued'; // Docsbox status when a file has been queued for the conversion
|
||||
const STATUS_STARTED = 'started'; // Docsbox status when a file has started being worked
|
||||
const STATUS_WORKING = 'working'; // Docsbox status when a file is being converted
|
||||
const OUTPUT_FILENAME = 'out.zip.pdf'; // File name used by docsbox to save a converted document
|
||||
const JSON_FORMATS = '{"formats": ["%s"]}'; // JSON object to be sent to docsbox to specify the file format
|
||||
|
||||
const DEFAULT_FORMAT = 'pdf'; // Default supported format
|
||||
|
||||
@@ -50,7 +50,7 @@ class DocsboxLib
|
||||
if (($format == null) || ($format != null && ctype_space($format) === true)) $format = self::DEFAULT_FORMAT;
|
||||
|
||||
// Posts the file to docsbox
|
||||
$queueId = self::_postFile($inputFileName);
|
||||
$queueId = self::_postFile($inputFileName, $format);
|
||||
// If an error occurred
|
||||
if ($queueId == null) return self::ERROR;
|
||||
|
||||
@@ -60,7 +60,7 @@ class DocsboxLib
|
||||
if ($resultUrl == null) return self::ERROR;
|
||||
|
||||
// Download and rename the converted file
|
||||
$downloaded = self::_downloadFile($resultUrl, $outputFileName);
|
||||
$downloaded = self::_downloadFile($inputFileName, $resultUrl, $outputFileName, $format);
|
||||
// If an error occurred
|
||||
if (!$downloaded) return self::ERROR;
|
||||
|
||||
@@ -74,7 +74,7 @@ class DocsboxLib
|
||||
* Posts the given file to a Docsboxserver and checks the response to return a valid queue id
|
||||
* On failure it returns a null value
|
||||
*/
|
||||
private static function _postFile($inputFileName)
|
||||
private static function _postFile($inputFileName, $format)
|
||||
{
|
||||
$queueId = null;
|
||||
|
||||
@@ -82,8 +82,14 @@ class DocsboxLib
|
||||
{
|
||||
// Posts the given file and expects a response in JSON format
|
||||
$postFileResponse = \Httpful\Request::post(DOCSBOX_SERVER.DOCSBOX_PATH_API)
|
||||
->attach(array('file' => $inputFileName))
|
||||
->sendsType(\Httpful\Mime::FORM)
|
||||
->expectsJson()
|
||||
->body(
|
||||
array(
|
||||
'options' => sprintf(self::JSON_FORMATS, $format)
|
||||
)
|
||||
)
|
||||
->attach(array('file' => $inputFileName))
|
||||
->send();
|
||||
|
||||
// Checks that:
|
||||
@@ -221,7 +227,7 @@ class DocsboxLib
|
||||
/**
|
||||
* Download the converted file using the provided URL, unzip it, and renames it into the provided file name
|
||||
*/
|
||||
private static function _downloadFile($resultUrl, $outputFileName)
|
||||
private static function _downloadFile($inputFileName, $resultUrl, $outputFileName, $format)
|
||||
{
|
||||
$downloaded = false; // pessimistic assumption
|
||||
|
||||
@@ -253,7 +259,7 @@ class DocsboxLib
|
||||
// Opened, extracted and closed!
|
||||
|
||||
// Rename the extracted file to the given output file name
|
||||
if (rename($outputDirectory.'/'.self::OUTPUT_FILENAME, $outputFileName))
|
||||
if (@rename($inputFileName.'.'.$format, $outputFileName))
|
||||
{
|
||||
$downloaded = true;
|
||||
}
|
||||
@@ -261,7 +267,7 @@ class DocsboxLib
|
||||
{
|
||||
error_log(
|
||||
'An error occurred while renaming the extracted file: '.
|
||||
$outputDirectory.'/'.self::OUTPUT_FILENAME.' into: '.
|
||||
$inputFileName.'.'.$format.' into: '.
|
||||
$outputFileName
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\SMTP;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
/**
|
||||
* Library to manage the sending of the email
|
||||
*/
|
||||
@@ -13,7 +9,7 @@ class MailLib
|
||||
{
|
||||
const ENABLE_DEBUG = 'enable_debug';
|
||||
|
||||
private $_sended; // Sended email counter
|
||||
private $sended; // Sended email counter
|
||||
|
||||
// Properties for storing the configuration
|
||||
private $email_number_to_sent;
|
||||
@@ -22,7 +18,6 @@ class MailLib
|
||||
private $email_from_system;
|
||||
|
||||
private $_ci; // Codeigniter instance
|
||||
private $_mail; // PHPMailer instance
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
@@ -30,7 +25,7 @@ class MailLib
|
||||
public function __construct()
|
||||
{
|
||||
// Set the counter to 0
|
||||
$this->_sended = 0;
|
||||
$this->sended = 0;
|
||||
|
||||
// Get CI instance
|
||||
$this->_ci =& get_instance();
|
||||
@@ -38,135 +33,97 @@ class MailLib
|
||||
// The second parameter is used to avoiding name collisions in the config array
|
||||
$this->_ci->config->load('mail', true);
|
||||
|
||||
try
|
||||
{
|
||||
// PHPMailer configuration
|
||||
$this->_mail = new PHPMailer(true);
|
||||
$this->_mail->isSMTP(); // Send using SMTP
|
||||
$this->_mail->Host = $this->_getEmailCfgItem('smtp_host'); // Set the SMTP server to send through
|
||||
$this->_mail->Port = $this->_getEmailCfgItem('smtp_port'); // TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
|
||||
$this->_mail->SMTPAuth = $this->_getEmailCfgItem('smtp_auth'); // Enable SMTP authentication
|
||||
$this->_mail->Username = $this->_getEmailCfgItem('smtp_user'); // SMTP username
|
||||
$this->_mail->Password = $this->_getEmailCfgItem('smtp_pass'); // SMTP password
|
||||
$this->_mail->SMTPSecure = $this->_getEmailCfgItem('smtp_encryption'); // Enable implicit TLS encryption
|
||||
$this->_mail->Timeout = $this->_getEmailCfgItem('smtp_timeout'); // set the timeout (seconds)
|
||||
$this->_mail->SMTPKeepAlive = $this->_getEmailCfgItem('smtp_keepalive'); // Persistent SMTP connection
|
||||
$this->_mail->Priority = $this->_getEmailCfgItem('priority'); // 1 = High, 3 = Normal, 5 = low. When null, the header is not set at all.
|
||||
$this->_mail->WordWrap = $this->_getEmailCfgItem('wordwrap');
|
||||
$this->_mail->isHTML($this->_getEmailCfgItem('is_html')); // html or text
|
||||
$this->_mail->SMTPDebug = $this->_getEmailCfgItem('enable_debug');
|
||||
$this->_mail->CharSet = 'UTF-8';
|
||||
// CI Email library
|
||||
$this->_ci->load->library('email');
|
||||
|
||||
// Set the configuration properties with the standard configuration values
|
||||
$this->email_number_to_sent = $this->_getEmailCfgItem('email_number_to_sent');
|
||||
$this->email_number_per_time_range = $this->_getEmailCfgItem('email_number_per_time_range');
|
||||
$this->email_time_range = $this->_getEmailCfgItem('email_time_range');
|
||||
$this->email_from_system = $this->_getEmailCfgItem('email_from_system');
|
||||
$this->alias_from_system = $this->_getEmailCfgItem('alias_from_system');
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
error_log($e->errorMessage());
|
||||
}
|
||||
// Initializing email library with the loaded configurations
|
||||
$this->_ci->email->initialize($this->_ci->config->config['mail']);
|
||||
|
||||
// Set the configuration properties with the standard configuration values
|
||||
$this->email_number_to_sent = $this->getEmailCfgItem('email_number_to_sent');
|
||||
$this->email_number_per_time_range = $this->getEmailCfgItem('email_number_per_time_range');
|
||||
$this->email_time_range = $this->getEmailCfgItem('email_time_range');
|
||||
$this->email_from_system = $this->getEmailCfgItem('email_from_system');
|
||||
$this->alias_from_system = $this->getEmailCfgItem('alias_from_system');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a single email
|
||||
*/
|
||||
public function send($from, $to, $subject, $message, $alias = '', $cc = null, $bcc = null, $altMessage = '', $bulk = false, $autogenerated = false, $embeddedImages = array())
|
||||
public function send($from, $to, $subject, $message, $alias = '', $cc = null, $bcc = null, $altMessage = '', $bulk = false, $autogenerated = false)
|
||||
{
|
||||
$result = false;
|
||||
|
||||
try
|
||||
// If it is configured then log mail info into the CI error logs
|
||||
if ($this->getEmailCfgItem(self::ENABLE_DEBUG) === true)
|
||||
{
|
||||
// If it is configured then log mail info into the CI error logs
|
||||
if ($this->_getEmailCfgItem(self::ENABLE_DEBUG) === true)
|
||||
{
|
||||
$this->_ci->load->library('LogLib'); // Loads logging library
|
||||
$this->_ci->load->library('LogLib'); // Loads logging library
|
||||
|
||||
// Log them all!
|
||||
$this->_ci->loglib->logError('From: '.$from);
|
||||
$this->_ci->loglib->logError('To: '.$to);
|
||||
$this->_ci->loglib->logError('Subject: '.$subject);
|
||||
$this->_ci->loglib->logError('Message: '.$message);
|
||||
$this->_ci->loglib->logError('Alias: '.$alias);
|
||||
$this->_ci->loglib->logError('CC: '.$cc);
|
||||
$this->_ci->loglib->logError('BCC: '.$bcc);
|
||||
$this->_ci->loglib->logError('Alternative message: '.$altMessage);
|
||||
}
|
||||
|
||||
// If from is not specified then use the standard one
|
||||
if (is_null($from) || $from == '')
|
||||
{
|
||||
$from = $this->email_from_system;
|
||||
// If alias is not specified then use the standard one
|
||||
if (is_null($alias) || $alias == '')
|
||||
{
|
||||
$alias = $this->alias_from_system;
|
||||
}
|
||||
}
|
||||
if (defined('MAIL_FROM') && MAIL_FROM != '')
|
||||
{
|
||||
$from = MAIL_FROM;
|
||||
if (is_null($alias) || $alias == '')
|
||||
{
|
||||
$alias = $this->alias_from_system;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_mail->setFrom($from, $alias);
|
||||
|
||||
// Check if the email address of the debug recipient is a valid one
|
||||
$recipient = $to;
|
||||
$recipientCC = $cc;
|
||||
$recipientBCC = $bcc;
|
||||
|
||||
// If we the an email for debugging has been set
|
||||
if (defined('MAIL_DEBUG') && MAIL_DEBUG != '')
|
||||
{
|
||||
// if is it valid use it!!!
|
||||
$recipient = MAIL_DEBUG;
|
||||
if ($recipientCC != '') $recipientCC = MAIL_DEBUG;
|
||||
if ($recipientBCC != '') $recipientBCC = MAIL_DEBUG;
|
||||
}
|
||||
|
||||
// Recipients
|
||||
$this->_mail->addAddress($recipient);
|
||||
if (!is_null($recipientCC)) $this->_mail->addCC($recipientCC);
|
||||
if (!is_null($recipientBCC)) $this->_mail->addBCC($recipientBCC);
|
||||
|
||||
// Subject & body & alternative body
|
||||
$this->_mail->Subject = $subject;
|
||||
$this->_mail->Body = $message;
|
||||
if (!isEmptyString($altMessage)) $this->_mail->AltBody = $altMessage;
|
||||
|
||||
// Custom headers
|
||||
if ($bulk) $this->_mail->addCustomHeader('Precedence', 'bulk');
|
||||
if ($autogenerated) $this->_mail->addCustomHeader('Auto-Submitted', 'auto-generated');
|
||||
|
||||
// Embedded images
|
||||
foreach ($embeddedImages as $embeddedImage)
|
||||
{
|
||||
if (!$this->_mail->addEmbeddedImage($embeddedImage['file_name'], $embeddedImage['cid'])) return false;
|
||||
}
|
||||
|
||||
$result = $this->_mail->send();
|
||||
|
||||
// If the email was succesfully sended then increment the counter and checks if it has to _wait until the sending of the next
|
||||
if ($result != false)
|
||||
{
|
||||
$this->_sended++;
|
||||
$this->_wait();
|
||||
}
|
||||
|
||||
// Clear the properties for the next message
|
||||
$this->_mail->clearAddresses();
|
||||
$this->_mail->clearAllRecipients();
|
||||
$this->_mail->clearAttachments();
|
||||
// Log them all!
|
||||
$this->_ci->loglib->logError('From: '.$from);
|
||||
$this->_ci->loglib->logError('To: '.$to);
|
||||
$this->_ci->loglib->logError('Subject: '.$subject);
|
||||
$this->_ci->loglib->logError('Message: '.$message);
|
||||
$this->_ci->loglib->logError('Alias: '.$alias);
|
||||
$this->_ci->loglib->logError('CC: '.$cc);
|
||||
$this->_ci->loglib->logError('BCC: '.$bcc);
|
||||
$this->_ci->loglib->logError('Alternative message: '.$altMessage);
|
||||
}
|
||||
catch (Exception $e)
|
||||
|
||||
// If from is not specified then use the standard one
|
||||
if (is_null($from) || $from == '')
|
||||
{
|
||||
error_log($e->errorMessage());
|
||||
$from = $this->email_from_system;
|
||||
// If alias is not specified then use the standard one
|
||||
if (is_null($alias) || $alias == '')
|
||||
{
|
||||
$alias = $this->alias_from_system;
|
||||
}
|
||||
}
|
||||
if (defined('MAIL_FROM') && MAIL_FROM != '')
|
||||
{
|
||||
$from = MAIL_FROM;
|
||||
if (is_null($alias) || $alias == '')
|
||||
{
|
||||
$alias = $this->alias_from_system;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_ci->email->from($from, $alias);
|
||||
|
||||
// Check if the email address of the debug recipient is a valid one
|
||||
$recipient = $to;
|
||||
$recipientCC = $cc;
|
||||
$recipientBCC = $bcc;
|
||||
if (defined('MAIL_DEBUG') && MAIL_DEBUG != '')
|
||||
{
|
||||
// if is it valid use it!!!
|
||||
$recipient = MAIL_DEBUG;
|
||||
if ($recipientCC != '')
|
||||
$recipientCC = MAIL_DEBUG;
|
||||
if ($recipientBCC != '')
|
||||
$recipientBCC = MAIL_DEBUG;
|
||||
}
|
||||
|
||||
$this->_ci->email->to($recipient);
|
||||
if (!is_null($recipientCC)) $this->_ci->email->cc($recipientCC);
|
||||
if (!is_null($recipientBCC)) $this->_ci->email->bcc($recipientBCC);
|
||||
$this->_ci->email->subject($subject);
|
||||
$this->_ci->email->message($message);
|
||||
if (!isEmptyString($altMessage)) $this->_ci->email->set_alt_message($altMessage);
|
||||
|
||||
if($bulk)
|
||||
$this->_ci->email->set_header('Precedence', 'bulk');
|
||||
if($autogenerated)
|
||||
$this->_ci->email->set_header('Auto-Submitted', 'auto-generated');
|
||||
|
||||
// Avoid printing on standard output ugly error messages
|
||||
$result = @$this->_ci->email->send();
|
||||
|
||||
// If the email was succesfully sended then increment the counter
|
||||
// and checks if it has to wait until the sending of the next
|
||||
if ($result)
|
||||
{
|
||||
$this->sended++;
|
||||
$this->wait();
|
||||
}
|
||||
|
||||
return $result;
|
||||
@@ -219,13 +176,13 @@ class MailLib
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if it has to _wait until the sending of the next
|
||||
* Checks if it has to wait until the sending of the next
|
||||
*/
|
||||
private function _wait()
|
||||
private function wait()
|
||||
{
|
||||
if ($this->_sended == $this->email_number_per_time_range)
|
||||
if ($this->sended == $this->email_number_per_time_range)
|
||||
{
|
||||
$this->_sended = 0;
|
||||
$this->sended = 0;
|
||||
sleep($this->email_time_range); // Wait!!!
|
||||
}
|
||||
}
|
||||
@@ -233,7 +190,7 @@ class MailLib
|
||||
/**
|
||||
* Gets an item from the email configuration array
|
||||
*/
|
||||
private function _getEmailCfgItem($itemName)
|
||||
private function getEmailCfgItem($itemName)
|
||||
{
|
||||
return $this->_ci->config->item($itemName, EMAIL_CONFIG_INDEX);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
/* Copyright (C) 2024 fhcomplete.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
class Drawio_model extends CI_Model
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function renderFileStart($pages=1, $agent='FH-Complete', $timemodified='now')
|
||||
{
|
||||
$modified = (new DateTime($timemodified, new DateTimeZone('UTC')))->format(DateTime::ATOM);
|
||||
|
||||
echo <<<HEADER
|
||||
<mxfile modified="{$modified}" host="Electron" agent="{$agent}" type="device" pages="{$pages}">
|
||||
HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function renderFileEnd()
|
||||
{
|
||||
echo <<<FOOTER
|
||||
</mxfile>
|
||||
FOOTER;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function renderDiagramStart($diagram_id, $diagram_bezeichnung)
|
||||
{
|
||||
$bezeichnung = htmlspecialchars($diagram_bezeichnung);
|
||||
|
||||
echo <<<STARTDIAGRAMM
|
||||
<diagram id="diagram_{$diagram_id}" name="{$bezeichnung}">
|
||||
<mxGraphModel dx="1177" dy="687" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
STARTDIAGRAMM;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function renderDiagramEnd()
|
||||
{
|
||||
echo <<<ENDDIAGRAMM
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
ENDDIAGRAMM;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function renderCell($id, $value, $x, $y, $width, $height)
|
||||
{
|
||||
echo <<<OE
|
||||
<mxCell id="{$id}" value="{$value}" parent="1" vertex="1">
|
||||
<mxGeometry x="{$x}" y="{$y}" width="{$width}" height="{$height}" as="geometry" />
|
||||
</mxCell>
|
||||
OE;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function renderEdge($source, $target, $exitX, $exitY, $entryX, $entryY, $points=array())
|
||||
{
|
||||
if( count($points) > 0 )
|
||||
{
|
||||
$pointsxml = '';
|
||||
foreach($points as $point)
|
||||
{
|
||||
$pointsxml .= <<<EOPOINT
|
||||
<mxPoint x="{$point->x}" y="{$point->y}" />
|
||||
EOPOINT;
|
||||
}
|
||||
|
||||
$edgegeom = <<<EDGEPOINTS
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
{$pointsxml}
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
EDGEPOINTS;
|
||||
}
|
||||
else
|
||||
{
|
||||
$edgegeom = ' <mxGeometry relative="1" as="geometry" />';
|
||||
}
|
||||
|
||||
echo <<<EDGE
|
||||
<mxCell id="edge_{$source}_{$target}" value="" style="edgeStyle=elbowEdgeStyle;elbow=vertical;sourcePerimeterSpacing=0;targetPerimeterSpacing=0;startArrow=none;endArrow=none;rounded=0;curved=0;exitX={$exitX};exitY={$exitY};exitDx=0;exitDy=0;entryX={$entryX};entryY={$entryY};entryDx=0;entryDy=0;" parent="1" source="{$source}" target="{$target}" edge="1">
|
||||
{$edgegeom}
|
||||
</mxCell>
|
||||
EDGE;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function renderSemesterLabel($id, $sem, $ects, $x, $y, $width, $height)
|
||||
{
|
||||
echo <<<RENDERSEM
|
||||
<mxCell id="{$id}" value="<b>{$sem}. Semester<br></b><div style="text-align: left;"><span style="background-color: initial;">{$ects} ECTS</span></div>" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="{$x}" y="{$y}" width="{$width}" height="{$height}" as="geometry" />
|
||||
</mxCell>
|
||||
RENDERSEM;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function renderModulList($listid, $mod, $x, $y, $ects_width, $lv_height)
|
||||
{
|
||||
$width = ceil($mod->ects * $ects_width);
|
||||
$height = (count($mod->childs) + 1) * $lv_height;
|
||||
$modul_ects = (int) $mod->ects;
|
||||
|
||||
echo <<<RENDERMOD
|
||||
<mxCell id="{$listid}" value="{$mod->bezeichnung} ({$modul_ects})" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize={$lv_height};horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="{$x}" y="{$y}" width="{$width}" height="{$height}" as="geometry">
|
||||
<mxRectangle x="{$x}" y="{$y}" width="{$width}" height="{$height}" as="alternateBounds" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
RENDERMOD;
|
||||
|
||||
$childnumber = 0;
|
||||
|
||||
foreach ($mod->childs as $child)
|
||||
{
|
||||
$childnumber++;
|
||||
$childid = uniqid();
|
||||
$childheight = $childnumber * $lv_height;
|
||||
$child_ects = (int) $child->ects;
|
||||
|
||||
echo <<<RENDERMODFOR
|
||||
<mxCell id="{$childid}" value="{$child->bezeichnung} ({$child_ects})" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="{$listid}">
|
||||
<mxGeometry y="{$childheight}" width="{$width}" height="{$lv_height}" as="geometry" />
|
||||
</mxCell>
|
||||
RENDERMODFOR;
|
||||
}
|
||||
|
||||
return (object) array(
|
||||
'width' => $width,
|
||||
'height' => $height
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -519,8 +519,7 @@
|
||||
"vuejs/vuedatepicker_js": "7.2.0",
|
||||
"vuejs/vuedatepicker_css": "7.2.0",
|
||||
"vuejs/vuedatepicker_js11": "11.0.1",
|
||||
"vuejs/vuedatepicker_css11": "11.0.1",
|
||||
"phpmailer/phpmailer": "^7.0"
|
||||
"vuejs/vuedatepicker_css11": "11.0.1"
|
||||
|
||||
},
|
||||
"config": {
|
||||
|
||||
Generated
+32
-137
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "3ec44005c1f5f810f304ad049a2c5c6b",
|
||||
"content-hash": "869cbc35bd1ba90ab90934fcb41b0f51",
|
||||
"packages": [
|
||||
{
|
||||
"name": "afarkas/html5shiv",
|
||||
@@ -897,12 +897,12 @@
|
||||
"version": "v6.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/googleapis/php-jwt.git",
|
||||
"url": "https://github.com/firebase/php-jwt.git",
|
||||
"reference": "0541cba75ab108ef901985e68055a92646c73534"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/googleapis/php-jwt/zipball/0541cba75ab108ef901985e68055a92646c73534",
|
||||
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/0541cba75ab108ef901985e68055a92646c73534",
|
||||
"reference": "0541cba75ab108ef901985e68055a92646c73534",
|
||||
"shasum": ""
|
||||
},
|
||||
@@ -944,8 +944,8 @@
|
||||
"php"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/googleapis/php-jwt/issues",
|
||||
"source": "https://github.com/googleapis/php-jwt/tree/v6.0.0"
|
||||
"issues": "https://github.com/firebase/php-jwt/issues",
|
||||
"source": "https://github.com/firebase/php-jwt/tree/v6.0.0"
|
||||
},
|
||||
"time": "2022-01-24T15:18:34+00:00"
|
||||
},
|
||||
@@ -1614,100 +1614,18 @@
|
||||
},
|
||||
"type": "library"
|
||||
},
|
||||
{
|
||||
"name": "phpmailer/phpmailer",
|
||||
"version": "v7.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPMailer/PHPMailer.git",
|
||||
"reference": "1bc1716a507a65e039d4ac9d9adebbbd0d346e15"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/1bc1716a507a65e039d4ac9d9adebbbd0d346e15",
|
||||
"reference": "1bc1716a507a65e039d4ac9d9adebbbd0d346e15",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-ctype": "*",
|
||||
"ext-filter": "*",
|
||||
"ext-hash": "*",
|
||||
"php": ">=5.5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
|
||||
"doctrine/annotations": "^1.2.6 || ^1.13.3",
|
||||
"php-parallel-lint/php-console-highlighter": "^1.0.0",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.3.2",
|
||||
"phpcompatibility/php-compatibility": "^10.0.0@dev",
|
||||
"squizlabs/php_codesniffer": "^3.13.5",
|
||||
"yoast/phpunit-polyfills": "^1.0.4"
|
||||
},
|
||||
"suggest": {
|
||||
"decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication",
|
||||
"directorytree/imapengine": "For uploading sent messages via IMAP, see gmail example",
|
||||
"ext-imap": "Needed to support advanced email address parsing according to RFC822",
|
||||
"ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
|
||||
"ext-openssl": "Needed for secure SMTP sending and DKIM signing",
|
||||
"greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication",
|
||||
"hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
|
||||
"league/oauth2-google": "Needed for Google XOAUTH2 authentication",
|
||||
"psr/log": "For optional PSR-3 debug logging",
|
||||
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)",
|
||||
"thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPMailer\\PHPMailer\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-2.1-only"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marcus Bointon",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
{
|
||||
"name": "Jim Jagielski",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
{
|
||||
"name": "Andy Prevost",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
{
|
||||
"name": "Brent R. Matzelle"
|
||||
}
|
||||
],
|
||||
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
||||
"support": {
|
||||
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
|
||||
"source": "https://github.com/PHPMailer/PHPMailer/tree/v7.1.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/Synchro",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-18T08:06:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpseclib/phpseclib",
|
||||
"version": "2.0.55",
|
||||
"version": "2.0.48",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpseclib/phpseclib.git",
|
||||
"reference": "d73c9e019a895be83b18a2ccccfa7e2b0a648743"
|
||||
"reference": "eaa7be704b8b93a6913b69eb7f645a59d7731b61"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/d73c9e019a895be83b18a2ccccfa7e2b0a648743",
|
||||
"reference": "d73c9e019a895be83b18a2ccccfa7e2b0a648743",
|
||||
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/eaa7be704b8b93a6913b69eb7f645a59d7731b61",
|
||||
"reference": "eaa7be704b8b93a6913b69eb7f645a59d7731b61",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1715,7 +1633,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"phing/phing": "~2.7",
|
||||
"phpunit/phpunit": "^4.8.35|^5.7|^6.0|^8.5|^9.4",
|
||||
"phpunit/phpunit": "^4.8.35|^5.7|^6.0|^9.4",
|
||||
"squizlabs/php_codesniffer": "~2.0"
|
||||
},
|
||||
"suggest": {
|
||||
@@ -1788,7 +1706,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpseclib/phpseclib/issues",
|
||||
"source": "https://github.com/phpseclib/phpseclib/tree/2.0.55"
|
||||
"source": "https://github.com/phpseclib/phpseclib/tree/2.0.48"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -1804,7 +1722,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-06-14T19:53:12+00:00"
|
||||
"time": "2024-12-14T21:03:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "rmariuzzo/jquery-checkboxes",
|
||||
@@ -2013,18 +1931,8 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/twigphp/Twig/issues",
|
||||
"source": "https://github.com/twigphp/Twig/tree/v1.42.5"
|
||||
"source": "https://github.com/twigphp/Twig/tree/1.x"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/twig/twig",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-02-11T05:59:23+00:00"
|
||||
},
|
||||
{
|
||||
@@ -2818,29 +2726,33 @@
|
||||
},
|
||||
{
|
||||
"name": "phpmetrics/phpmetrics",
|
||||
"version": "v2.9.1",
|
||||
"version": "v2.8.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpmetrics/PhpMetrics.git",
|
||||
"reference": "e2e68ddd1543bc3f44402c383f7bccb62de1ece3"
|
||||
"reference": "4b77140a11452e63c7a9b98e0648320bf6710090"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpmetrics/PhpMetrics/zipball/e2e68ddd1543bc3f44402c383f7bccb62de1ece3",
|
||||
"reference": "e2e68ddd1543bc3f44402c383f7bccb62de1ece3",
|
||||
"url": "https://api.github.com/repos/phpmetrics/PhpMetrics/zipball/4b77140a11452e63c7a9b98e0648320bf6710090",
|
||||
"reference": "4b77140a11452e63c7a9b98e0648320bf6710090",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
"ext-tokenizer": "*",
|
||||
"nikic/php-parser": "^3|^4|^5"
|
||||
"nikic/php-parser": "^3|^4",
|
||||
"php": ">=5.5"
|
||||
},
|
||||
"replace": {
|
||||
"halleck45/php-metrics": "*",
|
||||
"halleck45/phpmetrics": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "*"
|
||||
"phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14",
|
||||
"sebastian/comparator": ">=1.2.3",
|
||||
"squizlabs/php_codesniffer": "^3.5",
|
||||
"symfony/dom-crawler": "^3.0 || ^4.0 || ^5.0"
|
||||
},
|
||||
"bin": [
|
||||
"bin/phpmetrics"
|
||||
@@ -2876,15 +2788,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PhpMetrics/PhpMetrics/issues",
|
||||
"source": "https://github.com/phpmetrics/PhpMetrics/tree/v2.9.1"
|
||||
"source": "https://github.com/phpmetrics/PhpMetrics/tree/v2.8.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/Halleck45",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2025-09-25T05:21:02+00:00"
|
||||
"time": "2023-03-08T15:03:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpspec/prophecy",
|
||||
@@ -3221,6 +3127,7 @@
|
||||
"issues": "https://github.com/sebastianbergmann/php-token-stream/issues",
|
||||
"source": "https://github.com/sebastianbergmann/php-token-stream/tree/master"
|
||||
},
|
||||
"abandoned": true,
|
||||
"time": "2017-11-27T05:48:46+00:00"
|
||||
},
|
||||
{
|
||||
@@ -4056,16 +3963,16 @@
|
||||
},
|
||||
{
|
||||
"name": "sebastian/recursion-context",
|
||||
"version": "3.0.3",
|
||||
"version": "3.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/recursion-context.git",
|
||||
"reference": "8fe7e75986a9d24b4cceae847314035df7703a5a"
|
||||
"reference": "9bfd3c6f1f08c026f542032dfb42813544f7d64c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/8fe7e75986a9d24b4cceae847314035df7703a5a",
|
||||
"reference": "8fe7e75986a9d24b4cceae847314035df7703a5a",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/9bfd3c6f1f08c026f542032dfb42813544f7d64c",
|
||||
"reference": "9bfd3c6f1f08c026f542032dfb42813544f7d64c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4107,27 +4014,15 @@
|
||||
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/recursion-context/issues",
|
||||
"source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.3"
|
||||
"source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://liberapay.com/sebastianbergmann",
|
||||
"type": "liberapay"
|
||||
},
|
||||
{
|
||||
"url": "https://thanks.dev/u/gh/sebastianbergmann",
|
||||
"type": "thanks_dev"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-08-10T05:25:53+00:00"
|
||||
"time": "2024-03-01T14:07:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/resource-operations",
|
||||
|
||||
@@ -287,6 +287,7 @@ class dokument_export
|
||||
{
|
||||
case 'pdf':
|
||||
case 'doc':
|
||||
case 'docx':
|
||||
$ret = 0;
|
||||
$this->temp_filename = $this->temp_folder . '/out.' . $this->outputformat;
|
||||
|
||||
@@ -369,6 +370,11 @@ class dokument_export
|
||||
header('Content-Disposition: attachment; filename="'.$this->filename.'.doc"');
|
||||
header('Content-Length: '.$fsize);
|
||||
break;
|
||||
case 'docx':
|
||||
header('Content-type: application/vnd.ms-word');
|
||||
header('Content-Disposition: attachment; filename="'.$this->filename.'.docx"');
|
||||
header('Content-Length: '.$fsize);
|
||||
break;
|
||||
|
||||
case 'odt':
|
||||
header('Content-type: application/vnd.oasis.opendocument.text');
|
||||
|
||||
+72
-66
@@ -16,9 +16,9 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Christian Paminger <[email protected]>,
|
||||
* Andreas Oesterreicher <[email protected]>,
|
||||
* Rudolf Hangl <[email protected]> and
|
||||
* Gerald Simane-Sequens <[email protected]>
|
||||
* Andreas Oesterreicher <[email protected]>,
|
||||
* Rudolf Hangl <[email protected]> and
|
||||
* Gerald Simane-Sequens <[email protected]>
|
||||
*/
|
||||
/**
|
||||
* Klasse Mail
|
||||
@@ -28,12 +28,6 @@
|
||||
* Replyto und Attachments
|
||||
*/
|
||||
|
||||
include_once DOC_ROOT . 'vendor/autoload.php';
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\SMTP;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
class mail
|
||||
{
|
||||
public $to;
|
||||
@@ -47,8 +41,6 @@ class mail
|
||||
public $attachments;
|
||||
public $errormsg;
|
||||
|
||||
private $_mail; // PHPMailer instance
|
||||
|
||||
/**
|
||||
* MAIL - Konstruktor
|
||||
* $to Empfaenger
|
||||
@@ -73,30 +65,6 @@ class mail
|
||||
*/
|
||||
public function send()
|
||||
{
|
||||
// PHPMailer configuration
|
||||
try
|
||||
{
|
||||
$this->_mail = new PHPMailer(true);
|
||||
$this->_mail->isSMTP(); // Send using SMTP
|
||||
$this->_mail->Host = 'localhost'; // Set the SMTP server to send through
|
||||
$this->_mail->Port = 25; // TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
|
||||
$this->_mail->SMTPAuth = false; // Enable SMTP authentication
|
||||
$this->_mail->Username = ''; // SMTP username
|
||||
$this->_mail->Password = ''; // SMTP password
|
||||
$this->_mail->SMTPSecure = ''; // Enable implicit TLS encryption
|
||||
$this->_mail->Timeout = 1; // set the timeout (seconds)
|
||||
$this->_mail->SMTPKeepAlive = false; // Persistent SMTP connection
|
||||
$this->_mail->Priority = 3; // 1 = High, 3 = Normal, 5 = low. When null, the header is not set at all.
|
||||
$this->_mail->WordWrap = 76;
|
||||
$this->_mail->isHTML(true); // html or text
|
||||
$this->_mail->SMTPDebug = 0; // Disable debugging
|
||||
$this->_mail->CharSet = 'UTF-8';
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//wenn MAIL_DEBUG gesetzt ist dann alles an diese Adresse schicken
|
||||
if(MAIL_DEBUG!='')
|
||||
{
|
||||
@@ -114,38 +82,68 @@ class mail
|
||||
$this->sender = MAIL_FROM;
|
||||
|
||||
// Header
|
||||
$this->_mail->setFrom($this->sender);
|
||||
$header = '';
|
||||
$header .= "From: {$this->sender}".$eol;
|
||||
|
||||
if (!empty($this->CC_recievers))
|
||||
$this->_mail->addCC($this->CC_recievers);
|
||||
$header .= "CC: {$this->CC_recievers}".$eol;
|
||||
if (!empty($this->BCC_recievers))
|
||||
$this->_mail->addBCC($this->BCC_recievers);
|
||||
$header .= "BCC: {$this->BCC_recievers}".$eol;
|
||||
if (!empty($this->replyTo))
|
||||
$header .= "Reply-To: {$this->replyTo}".$eol;
|
||||
if (!empty($this->replyTo))
|
||||
$header .= "Return-Path: {$this->replyTo}".$eol;
|
||||
|
||||
$header .= 'X-Mailer: FHComplete V1'.$eol;
|
||||
$header .= 'Mime-Version: 1.0'.$eol;
|
||||
$header .= 'Precedence: bulk'.$eol;
|
||||
$header .= 'Auto-Submitted: auto-generated'.$eol;
|
||||
$header .= "Content-Type: multipart/related; boundary=\"$mime_boundary_mixed\"".$eol;
|
||||
$header .= "Content-Transfer-Encoding: 8bit".$eol;
|
||||
|
||||
// Body
|
||||
$mailbody = "";
|
||||
$mailbody .= $eol;
|
||||
$mailbody .= "--$mime_boundary_mixed".$eol;
|
||||
$mailbody .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary_alternative\"".$eol;
|
||||
$mailbody .= $eol;
|
||||
$mailbody .= "--$mime_boundary_alternative".$eol;
|
||||
$mailbody .= "Content-Type: text/plain; charset={$this->textContent[1]}".$eol;
|
||||
$mailbody .= "Content-Transfer-Encoding: {$this->textContent[2]}".$eol;
|
||||
$mailbody .= $eol;
|
||||
$mailbody .= $this->textContent[0];
|
||||
$mailbody .= $eol;
|
||||
$mailbody .= $eol;
|
||||
|
||||
if (!empty($this->htmlContent[0]))
|
||||
{
|
||||
$this->_mail->addReplyTo($this->replyTo);
|
||||
$this->_mail->addCustomHeader('Return-Path', $this->replyTo);
|
||||
$mailbody .= "--$mime_boundary_alternative".$eol;
|
||||
$mailbody .= "Content-Type: text/html; charset={$this->htmlContent[1]}".$eol;
|
||||
$mailbody .= "Content-Transfer-Encoding: {$this->htmlContent[2]}".$eol;
|
||||
$mailbody .= $eol;
|
||||
$mailbody .= $this->htmlContent[0];
|
||||
$mailbody .= $eol;
|
||||
$mailbody .= $eol;
|
||||
}
|
||||
|
||||
$this->_mail->addCustomHeader('X-Mailer', 'FHComplete V1');
|
||||
$this->_mail->addCustomHeader('Mime-Version', '1.0');
|
||||
$this->_mail->addCustomHeader('Precedence', 'bulk');
|
||||
$this->_mail->addCustomHeader('Auto-Submitted', 'auto-generated');
|
||||
|
||||
$this->_mail->Body = $this->htmlContent[0];
|
||||
$this->_mail->AltBody = $this->textContent[0];
|
||||
$mailbody .= "--{$mime_boundary_alternative}--".$eol;
|
||||
$mailbody .= $eol;
|
||||
$mailbody .= "--$mime_boundary_mixed";
|
||||
|
||||
// Attachments Plain
|
||||
if (is_array($this->attachmentsplain) && (count($this->attachmentsplain) > 0))
|
||||
{
|
||||
foreach ($this->attachmentsplain as $attachment)
|
||||
{
|
||||
$this->_mail->addStringAttachment(
|
||||
$attachment[0], // File content
|
||||
$attachment[2], // Name
|
||||
$attachment[3], // Encoding
|
||||
$attachment[1], // Type
|
||||
'attachment' // Disposition
|
||||
);
|
||||
$dispo = 'attachment';
|
||||
$mailbody .= $eol;
|
||||
$mailbody .= "Content-Disposition: $dispo; filename={$attachment[2]}".$eol;
|
||||
$mailbody .= "Content-Type: {$attachment[1]}; name={$attachment[2]}".$eol;
|
||||
|
||||
$mailbody .= 'Content-Transfer-Encoding: '.$attachment[3].$eol;
|
||||
$mailbody .= $eol;
|
||||
$mailbody .= $attachment[0];
|
||||
$mailbody .= $eol;
|
||||
$mailbody .= "--$mime_boundary_mixed";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,23 +152,31 @@ class mail
|
||||
{
|
||||
foreach ($this->attachments as $attachment)
|
||||
{
|
||||
$this->_mail->addStringEmbeddedImage(
|
||||
$attachment[0], // File content
|
||||
$attachment[3], // Content ID
|
||||
$attachment[2], // Content name
|
||||
PHPMailer::ENCODING_BASE64, // Encoding
|
||||
$attachment[1], // Type
|
||||
empty($attachment[3]) ? 'attachment' : 'inline' // Disposition
|
||||
);
|
||||
$dispo = empty($attachment[3]) ? 'attachment' : 'inline';
|
||||
$mailbody .= $eol;
|
||||
$mailbody .= "Content-Disposition: $dispo; filename={$attachment[2]}".$eol;
|
||||
$mailbody .= "Content-Type: {$attachment[1]}; name={$attachment[2]}".$eol;
|
||||
if (!empty($attachment[3]))
|
||||
{
|
||||
$mailbody .= "Content-ID: <{$attachment[3]}>".$eol;
|
||||
}
|
||||
$mailbody .= 'Content-Transfer-Encoding: base64'.$eol;
|
||||
$mailbody .= $eol;
|
||||
$mailbody .= $attachment[0];
|
||||
$mailbody .= $eol;
|
||||
$mailbody .= "--$mime_boundary_mixed";
|
||||
}
|
||||
}
|
||||
$mailbody .= "--".$eol;
|
||||
|
||||
// Subject Encoding setzen
|
||||
$this->_mail->Subject = $this->subject;
|
||||
$this->_mail->addAddress($this->to);
|
||||
$subject = "=?UTF-8?B?".base64_encode($this->subject)."?=";
|
||||
|
||||
// Senden
|
||||
return $this->_mail->send();
|
||||
if(mail($this->to, $subject, $mailbody, $header))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user