This commit is contained in:
Cris
2023-03-08 12:58:29 +01:00
10 changed files with 494 additions and 90 deletions
+304
View File
@@ -0,0 +1,304 @@
<?php
/* Copyright (C) 2022 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.
*
*/
require_once(dirname(__FILE__).'/../../vendor/nategood/httpful/bootstrap.php');
use \ZipArchive as ZipArchive;
/**
* Simple client to convert documents using Docsbox
*/
class DocsboxLib
{
const ERROR = 1;
const SUCCESS = 0;
const STATUS_FINISHED = 'finished'; // Docsbox status when a document conversion ended
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 DEFAULT_FORMAT = 'pdf'; // Default supported format
// -------------------------------------------------------------------------------------------------
// Public static methods
/**
* Static method used to convert a document using a Docsbox installation (local/remote) over the network
* It return 0 on success and any other integer on error
* NOTE: currently format is not supported
*/
public static function convert($inputFileName, $outputFileName, $format)
{
// If a format has not been given
if (($format == null) || ($format != null && ctype_space($format) === true)) $format = self::DEFAULT_FORMAT;
// Posts the file to docsbox
$queueId = self::_postFile($inputFileName);
// If an error occurred
if ($queueId == null) return self::ERROR;
// Checks and waits if the file has been converted
$resultUrl = self::_checkConvertion($queueId);
// If an error occurred
if ($resultUrl == null) return self::ERROR;
// Download and rename the converted file
$downloaded = self::_downloadFile($resultUrl, $outputFileName);
// If an error occurred
if (!$downloaded) return self::ERROR;
return self::SUCCESS;
}
// -------------------------------------------------------------------------------------------------
// Private static methods
/**
* 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)
{
$queueId = null;
try
{
// Posts the given file and expects a response in JSON format
$postFileResponse = \Httpful\Request::post(DOCSBOX_SERVER.DOCSBOX_PATH_API)
->attach(array('file' => $inputFileName))
->expectsJson()
->send();
// Checks that:
// - the response is not empty
// - the reponse body has the property id
// - the property id is a valid string
// - the reponse body has the property status
// - docsbox queued the conversion of the posted file
if (is_object($postFileResponse)
&& isset($postFileResponse->body)
&& isset($postFileResponse->body->id)
&& $postFileResponse->body->id != '' && $postFileResponse->body->id != null
&& isset($postFileResponse->body->status)
&& $postFileResponse->body->status == self::STATUS_QUEUED)
{
$queueId = $postFileResponse->body->id;
}
else
{
// If docsbox refused to convert the posted file
if (isset($postFileResponse->body->status)
&& $postFileResponse->body->status != self::STATUS_QUEUED)
{
error_log(
'Docsbox did not queue the posted file. Returned status: '.
$postFileResponse->body->status
);
}
else // any other generic error
{
error_log(
'An error occurred while posting to docsbox. Response: '.
print_r($postFileResponse, 1)
);
}
}
}
catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception
{
error_log($cee->getMessage());
}
catch (Exception $e) // any other exception
{
error_log($e->getMessage());
}
return $queueId;
}
/**
* Check the status of the file convertion identified by the given queue element id
* A URL is returned with the path where it is possible to download the converted file
* If an error occurred then a null value is returned
*/
private static function _checkConvertion($queueId)
{
$resultUrl = null;
$startConvertionsTime = time(); // time when the file conversion has started
// Until a timeout has occurred
while (time() - $startConvertionsTime <= DOCSBOX_CONVERSION_TIMEOUT)
{
sleep(DOCSBOX_WAITING_SLEEP_TIME); // takes a nap on every round
try
{
// Calls the docsbox server to check the status of the
// file conversion using the provided queue id
// it expects a response in JSON format
$getStatusResponse = \Httpful\Request::get(DOCSBOX_SERVER.DOCSBOX_PATH_API.$queueId)
->expectsJson()
->send();
// Checks that:
// - the response is not empty
// - the reponse body has the property id
// - the property id is a valid string
// - the reponse body has the property status
// - docsbox is working the conversion of the posted file
if (is_object($getStatusResponse)
&& isset($getStatusResponse->body->id)
&& $getStatusResponse->body->id != '' && $getStatusResponse->body->id != null
&& isset($getStatusResponse->body->status))
{
// Checks that docsbox has finished working on the file conversion
// and that there is a valid resultUrl property
if ($getStatusResponse->body->status == self::STATUS_FINISHED
&& isset($getStatusResponse->body->result_url)
&& $getStatusResponse->body->result_url != ''
&& $getStatusResponse->body->result_url != null)
{
$resultUrl = $getStatusResponse->body->result_url;
break;
}
// Just started or still working on it
elseif ($getStatusResponse->body->status == self::STATUS_WORKING
|| $getStatusResponse->body->status == self::STATUS_STARTED)
{
// go on!
}
else // any other status is abnormal
{
error_log(
'Not valid status for queue element: '.$queueId.'. Response: '.
print_r($getStatusResponse, 1)
);
break; // interrupt the loop on error
}
}
else // if the response from the docsbox server is not valid
{
error_log(
'An error occurred while checking the docsbox activity. Response: '.
print_r($getStatusResponse, 1)
);
break; // interrupt the loop on error
}
}
catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception
{
error_log($cee->getMessage());
break; // interrupt the loop on error
}
catch (Exception $e) // any other exception
{
error_log($e->getMessage());
break; // interrupt the loop on error
}
}
return $resultUrl;
}
/**
* Download the converted file using the provided URL, unzip it, and renames it into the provided file name
*/
private static function _downloadFile($resultUrl, $outputFileName)
{
$downloaded = false; // pessimistic assumption
try
{
// Download the file
$getFileResponse = \Httpful\Request::get(DOCSBOX_SERVER.$resultUrl)->send();
// If the downloaded file content is valid and not empty
if (isset($getFileResponse->body)
&& $getFileResponse->body != null
&& $getFileResponse->body != '')
{
// Output directory where to unzip the downloaded zip file
$outputDirectory = dirname($outputFileName);
// The path and name of the downloaded zip file
$temporaryDownloadedZip = sys_get_temp_dir().'/'.basename($resultUrl);
// Write the file content into a temporary directory and file
if (file_put_contents($temporaryDownloadedZip, $getFileResponse->body) != false)
{
$zipArchive = new ZipArchive;
// Open and extract the dowloaded zip file into the directory of the output file
if ($zipArchive->open($temporaryDownloadedZip) === true
&& $zipArchive->extractTo($outputDirectory) === true
&& $zipArchive->close() === true)
{
// Opened, extracted and closed!
// Rename the extracted file to the given output file name
if (rename($outputDirectory.'/'.self::OUTPUT_FILENAME, $outputFileName))
{
$downloaded = true;
}
else
{
error_log(
'An error occurred while renaming the extracted file: '.
$outputDirectory.'/'.self::OUTPUT_FILENAME.' into: '.
$outputFileName
);
}
}
else
{
error_log(
'An error occurred while working the dowloaded zip file: '.
$temporaryDownloadedZip
);
}
}
else // if an error occurred while writing
{
error_log(
'An error occurred while writing the file content to: '.
$temporaryDownloadedZip
);
}
}
else // if the downloaded file is not valid
{
error_log(
'An error occurred while downloading the file from the docsbox server: '.
print_r($getFileResponse, 1)
);
}
}
catch(\Httpful\Exception\ConnectionErrorException $cee)
{
error_log($cee->getMessage());
}
catch (Exception $e)
{
error_log($e->getMessage());
}
return $downloaded;
}
}
+50 -20
View File
@@ -14,20 +14,28 @@ class DocumentLib
// Gets CI instance
$this->ci =& get_instance();
exec('unoconv --version', $ret_arr);
if(isset($ret_arr[0]))
// Which document converter has to be used
if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true)
{
$hlp = explode(' ', $ret_arr[0]);
if(isset($hlp[1]))
{
$this->unoconv_version = $hlp[1];
}
else
show_error('Could not get Unoconv Version');
// Use docsbox!!
}
else
show_error('Unoconv not found - Please install Unoconv');
{
exec('unoconv --version', $ret_arr);
if(isset($ret_arr[0]))
{
$hlp = explode(' ', $ret_arr[0]);
if(isset($hlp[1]))
{
$this->unoconv_version = $hlp[1];
}
else
show_error('Could not get Unoconv Version');
}
else
show_error('Unoconv not found - Please install Unoconv');
}
}
/**
@@ -57,9 +65,16 @@ class DocumentLib
case 'application/vnd.ms-word':
case 'application/vnd.oasis.opendocument.text':
case 'text/plain':
// Unoconv Version 0.6 seems to fail on converting TXT Files
if ($this->unoconv_version == '0.6')
return error();
if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true)
{
// Use docsbox
}
else
{
// Unoconv Version 0.6 seems to fail on converting TXT Files
if ($this->unoconv_version == '0.6')
return error();
}
$ret = $this->convert($filename, $outFile, 'pdf');
if(isSuccess($ret))
@@ -105,6 +120,7 @@ class DocumentLib
finfo_close($finfo);
$out = null;
exec($cmd, $out, $ret);
if ($ret != 0)
{
@@ -123,13 +139,26 @@ class DocumentLib
*/
public function convert($inFile, $outFile, $format)
{
if ($this->unoconv_version == '0.6')
$command = 'unoconv -f %1$s %3$s > %2$s';
else
$command = 'unoconv -f %s --output %s %s 2>&1';
$command = sprintf($command, $format, $outFile, $inFile);
$ret = 0;
exec($command, $out, $ret);
// If it is set to use docsbox
if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true)
{
require_once(dirname(__FILE__).'/../application/libraries/DocsboxLib.php');
$ret = DocsboxLib::convert($inFile, $outFile, $format);
}
else // otherwise use unoconv
{
if ($this->unoconv_version == '0.6')
$command = 'unoconv -f %1$s %3$s > %2$s';
else
$command = 'unoconv -f %s --output %s %s 2>&1';
$command = sprintf($command, $format, $outFile, $inFile);
$out = null;
exec($command, $out, $ret);
}
if ($ret != 0)
{
@@ -191,6 +220,7 @@ class DocumentLib
$cmd .= '/countspaces { [ exch { dup 32 ne { pop } if } forall ] length } bind def >> ';
$cmd .= 'setpagedevice viewJPEG"';
$out = null;
exec($cmd, $out, $ret);
if ($ret != 0)
{
+2 -2
View File
@@ -128,8 +128,8 @@ class Messages_model extends CI_Model
{
$ouOptions .= sprintf(
"\n".'<option value="%s">%s</option>',
is_numeric($ou->prestudent_id) ? $ou->oe_kurzbz : self::ALT_OE,
$ou->bezeichnung . (is_numeric($ou->prestudent_id) ? '' : ' *')
($ou->typ === 'l' ? $ou->oe_kurzbz : (is_numeric($ou->prestudent_id) ? $ou->oe_kurzbz : self::ALT_OE)),
$ou->bezeichnung . ((is_numeric($ou->prestudent_id) || $ou->typ === 'l' ) ? '' : ' *')
);
}
}
+9 -2
View File
@@ -586,9 +586,10 @@ class Prestudent_model extends DB_Model
o.bezeichnung,
(CASE
WHEN sg.typ = \'b\' THEN ps.prestudent_id
WHEN sg.typ = \'m\' THEN ps.prestudent_id
WHEN sg.typ = \'m\' THEN mps.prestudent_id
ELSE NULL
END) AS prestudent_id
END) AS prestudent_id,
sg.typ
FROM public.tbl_prestudent p
JOIN public.tbl_studiengang sg USING(studiengang_kz)
JOIN public.tbl_organisationseinheit o USING(oe_kurzbz)
@@ -597,11 +598,17 @@ class Prestudent_model extends DB_Model
FROM public.tbl_prestudentstatus
WHERE status_kurzbz = \'Bewerber\'
) ps USING(prestudent_id)
LEFT JOIN (
SELECT prestudent_id
FROM public.tbl_prestudentstatus
WHERE status_kurzbz = \'Interessent\' AND bestaetigtam IS NOT NULL
) mps ON p.prestudent_id = mps.prestudent_id
WHERE p.person_id = ?
GROUP BY o.oe_kurzbz,
o.bezeichnung,
sg.typ,
ps.prestudent_id,
mps.prestudent_id,
p.prestudent_id
ORDER BY o.bezeichnung';
+7
View File
@@ -260,10 +260,17 @@ define('CIS_ZEITWUNSCH_GD', false);
// Covid-Status anzeigen
define('CIS_SHOW_COVID_STATUS', false);
// Docsbox configs
define('DOCSBOX_SERVER', 'http://docconverter.technikum-wien.at/');
define('DOCSBOX_PATH_API', 'api/v1/');
define('DOCSBOX_CONVERSION_TIMEOUT', 30); // seconds
define('DOCSBOX_WAITING_SLEEP_TIME', 1);
//Vertrag Allin
define ('DEFAULT_ALLIN_DIENSTVERTRAG',[111]);
//Echter Dienstvertrag
define ('DEFAULT_ECHTER_DIENSTVERTRAG',[103,111]);
?>
+3
View File
@@ -316,4 +316,7 @@ define ('ZAHLUNGSBESTAETIGUNG_ANZEIGEN_FUER_LEHRGAENGE', true);
// Gibt an, ob im CIS die Zahlungsreferenz angezeigt wird
define ('ZAHLUNGSBESTAETIGUNG_ZAHLUNGSREFERENZ_ANZEIGEN', false);
define('DOCSBOX_ENABLED', false);
?>
+8
View File
@@ -257,6 +257,12 @@ define('BIS_FUNKTIONSCODE_6_ARR', array(
// bPk Abfrage
define('BPK_FUER_ALLE_BENUTZER_ABFRAGEN', false);
// Docsbox configs
define('DOCSBOX_SERVER', 'http://docconverter.technikum-wien.at/');
define('DOCSBOX_PATH_API', 'api/v1/');
define('DOCSBOX_CONVERSION_TIMEOUT', 30); // seconds
define('DOCSBOX_WAITING_SLEEP_TIME', 1);
// Bei folgenden Buchungstypen wird ein Anlegen geprüft ob bereits ein Eintrag für diesen Typ vorhanden ist im selben
// Semester und ggf ein Hinweis ausgegeben
define('FAS_DOPPELTE_BUCHUNGSTYPEN_CHECK', serialize(
@@ -269,6 +275,8 @@ define('ZEUGNISNOTE_NICHT_ANZEIGEN',serialize(array('iar', 'nz')));
//Default Lehrmodus
define ('DEFAULT_LEHRMODUS','regulaer');
//Echter Dienstvertrag
define ('DEFAULT_ECHTER_DIENSTVERTRAG',[103,110]);
?>
+55 -25
View File
@@ -50,17 +50,24 @@ class dokument_export
if(!isset($vorlage))
return;
exec('unoconv --version',$ret_arr);
if(isset($ret_arr[0]))
if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true)
{
$hlp = explode(' ',$ret_arr[0]);
if(isset($hlp[1]))
$this->unoconv_version = $hlp[1];
else
die('Could not get Unoconv Version');
// Use docsbox!!
}
else
die('Unoconv not found');
{
exec('unoconv --version',$ret_arr);
if(isset($ret_arr[0]))
{
$hlp = explode(' ',$ret_arr[0]);
if(isset($hlp[1]))
$this->unoconv_version = $hlp[1];
else
die('Could not get Unoconv Version');
}
else
die('Unoconv not found');
}
//Vorlage aus der Datenbank holen
$this->vorlage = new vorlage();
@@ -276,21 +283,32 @@ class dokument_export
{
case 'pdf':
case 'doc':
$ret = 0;
$this->temp_filename = $this->temp_folder . '/out.' . $this->outputformat;
// Unoconv Version 0.6 hat eine Bug wodurch die Berechtigungen des PDF/Doc nicht korrekt gesetzt
// werden. Deshalb wird dies hier speziell behandelt.
// Die 2. Variante hat den Vorteil dass hier eine bessere Fehlerbehandlung moeglich ist
if($this->unoconv_version=='0.6')
$command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' %2$s > %1$s';
else
$command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' --output %s %s 2>&1';
// If it is set to use docsbox
if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true)
{
require_once(dirname(__FILE__).'/../application/libraries/DocsboxLib.php');
$command = sprintf($command, $this->temp_filename, $tempname_zip);
$ret = DocsboxLib::convert($tempname_zip, $this->temp_filename, $this->outputformat);
}
else // otherwise use unoconv
{
// Unoconv Version 0.6 hat eine Bug wodurch die Berechtigungen des PDF/Doc nicht korrekt gesetzt
// werden. Deshalb wird dies hier speziell behandelt.
// Die 2. Variante hat den Vorteil dass hier eine bessere Fehlerbehandlung moeglich ist
if ($this->unoconv_version == '0.6')
$command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' %2$s > %1$s';
else
$command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' --output %s %s 2>&1';
exec($command, $out, $ret);
$command = sprintf($command, $this->temp_filename, $tempname_zip);
if($ret!=0)
exec($command, $out, $ret);
}
if ($ret != 0)
{
$this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator';
return false;
@@ -455,15 +473,27 @@ class dokument_export
*/
public function convert($inFile, $outFile, $format = "pdf")
{
if($this->unoconv_version=='0.6')
$command = 'unoconv -f %1$s %3$s > %2$s';
else
$command = 'unoconv -f %s --output %s %s 2>&1';
$command = sprintf($command, $format, $outFile, $inFile);
$ret = 0;
exec($command, $out, $ret);
// If it is set to use DOCSBOX
if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true)
{
require_once(dirname(__FILE__).'/../application/libraries/DocsboxLib.php');
if($ret!=0)
$ret = DocsboxLib::convert($inFile, $outFile, $format);
}
else // fallback to unoconv
{
if($this->unoconv_version=='0.6')
$command = 'unoconv -f %1$s %3$s > %2$s';
else
$command = 'unoconv -f %s --output %s %s 2>&1';
$command = sprintf($command, $format, $outFile, $inFile);
exec($command, $out, $ret);
}
if ($ret != 0)
{
$this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator';
return false;
+23 -10
View File
@@ -96,6 +96,8 @@ var Stammdaten = {
$(this).parent('div').children('div').show();
$(this).remove();
});
Stammdaten._setReadOnly(true);
},
_show: function()
@@ -142,11 +144,7 @@ var Stammdaten = {
});
});
var stammdatenform = $('.stammdaten_form');
stammdatenform.find('select').attr('disabled', false);
$('.editActionStammdaten').show();
$('.editStammdaten').hide();
Stammdaten._setReadOnly(false);
},
_updated: function()
@@ -186,10 +184,25 @@ var Stammdaten = {
$(this).remove();
});
var stammdatenform = $('.stammdaten_form');
stammdatenform.find('select').attr('disabled', true);
$('.editActionStammdaten').hide();
$('.editStammdaten').show();
Stammdaten._setReadOnly(true);
},
_setReadOnly: function(readonly)
{
var stammdatenform = $('.stammdaten_form');
stammdatenform.find('select').attr('disabled', readonly);
if (readonly === true)
{
$('.editActionStammdaten').hide();
$('.editStammdaten').show();
}
else
{
$('.editActionStammdaten').show();
$('.editStammdaten').hide();
}
}
}
+33 -31
View File
@@ -519,8 +519,8 @@ if ($rtprueflingEntSperren)
}
// Ajax-Request um einen Prüfling Zeit für ein bestimmtes Gebiet hinzuzufügen
$prueflingAddTime = filter_input(INPUT_POST, 'prueflingAddTime', FILTER_VALIDATE_BOOLEAN);
if ($prueflingAddTime)
$prestudentAddTime = filter_input(INPUT_POST, 'prestudentAddTime', FILTER_VALIDATE_BOOLEAN);
if ($prestudentAddTime)
{
if (!$rechte->isBerechtigt('lehre/reihungstestAufsicht', null, 'su'))
{
@@ -531,7 +531,7 @@ if ($prueflingAddTime)
exit();
}
if (isset($_POST['pruefling_id']) && is_numeric($_POST['pruefling_id'])
if (isset($_POST['prestudent_id']) && is_numeric($_POST['prestudent_id'])
&& isset($_POST['gebiet']) && is_numeric($_POST['gebiet'])
&& isset($_POST['time']) && is_numeric($_POST['time']))
{
@@ -552,14 +552,19 @@ if ($prueflingAddTime)
ELSE
(endtime + (" .$db->db_add_param($_POST['time']) . " * interval '1 minute'))
END
WHERE prueflingfrage_id IN
(
SELECT prueflingfrage_id
FROM testtool.tbl_pruefling
JOIN testtool.tbl_pruefling_frage USING (pruefling_id)
JOIN testtool.tbl_frage ON tbl_pruefling_frage.frage_id = tbl_frage.frage_id
WHERE pruefling_id = ". $db->db_add_param($_POST['pruefling_id']) . " AND gebiet_id = ". $db->db_add_param($_POST['gebiet']) ."
)";
WHERE prueflingfrage_id IN
(
SELECT prueflingfrage_id
FROM testtool.tbl_pruefling
JOIN testtool.tbl_pruefling_frage USING (pruefling_id)
JOIN testtool.tbl_frage ON tbl_pruefling_frage.frage_id = tbl_frage.frage_id
JOIN tbl_prestudent ps on tbl_pruefling.prestudent_id = ps.prestudent_id
JOIN tbl_prestudent pss USING (person_id)
WHERE pss.prestudent_id = ". $db->db_add_param($_POST['prestudent_id']) . "
AND gebiet_id = ". $db->db_add_param($_POST['gebiet']) ."
AND (extract(day FROM begintime) = extract(day FROM CURRENT_DATE) OR begintime IS NULL)
)";
if ($result = $db->db_query($qry))
{
@@ -2486,14 +2491,14 @@ else
});
}
}
function prueflingAddTime(pruefling_id, gebiet)
function prestudentAddTime(prestudent_id, gebiet)
{
var min = $("#prueflingAddTime_" + pruefling_id + "_gebiet_" + gebiet).val();
var min = $("#prestudentAddTime_" + prestudent_id + "_gebiet_" + gebiet).val();
data = {
pruefling_id: pruefling_id,
prestudent_id: prestudent_id,
gebiet: gebiet,
time: min,
prueflingAddTime: true
prestudentAddTime: true
};
$.ajax({
@@ -3372,25 +3377,22 @@ else
echo '<td class="rightaligned ' . $zerovalclass . 'pst_' . $erg->prestudent_id . '_gbt_' . $gbt->gebiet_id . ' punkte '.$inaktiv.'" nowrap>' . ($erg->gebiet[$gbt->gebiet_id]->prozent != '' ? number_format($erg->gebiet[$gbt->gebiet_id]->prozent, 2, ',', ' ') . ' %' : '') . '</td>';
echo '<td class="rightaligned ' . $zerovalclass . 'pst_' . $erg->prestudent_id . '_gbt_' . $gbt->gebiet_id . ' punkte '.$inaktiv.'" nowrap>';
if (!is_null($erg->pruefling_id))
$time = strtotime($gbt->zeit);
$minutes = date('i', $time);
echo '<select id="prestudentAddTime_'.$erg->prestudent_id .'_gebiet_' . $gbt->gebiet_id . '">';
for ($i = 2; $i <= 10; $i = $i +2)
{
$time = strtotime($gbt->zeit);
$minutes = date('i', $time);
echo '<select id="prueflingAddTime_'.$erg->pruefling_id .'_gebiet_' . $gbt->gebiet_id . '">';
for ($i = 2; $i <= 10; $i = $i +2)
{
if ($i < $minutes)
echo '<option value="'. $i .'">00:' . sprintf("%02d", $i) .':00</option>';
}
echo '<option value="'. $minutes .'">'. $gbt->zeit .'</option>';
echo '</select>
<a href="#" id="prueflingAddTime_'.$erg->pruefling_id .'" onclick="prueflingAddTime('. $erg->pruefling_id. '' . ', ' .$gbt->gebiet_id .')">
if ($i < $minutes)
echo '<option value="'. $i .'">00:' . sprintf("%02d", $i) .':00</option>';
}
echo '<option value="'. $minutes .'">'. $gbt->zeit .'</option>';
echo '</select>
<a href="#" class="prestudentAddTime_'.$erg->prestudent_id .'" onclick="prestudentAddTime('. $erg->prestudent_id. '' . ', ' .$gbt->gebiet_id .')">
<span class="glyphicon glyphicon-ok"></span>
</a>';
}
echo '</td>';
}
else