Leitgedanken/further_publication.php
2022-11-21 09:47:28 +01:00

83 lines
2.2 KiB
PHP

<?php
/*
# Fuer debugging
error_reporting(E_ALL);
ini_set('display_errors', 1);
#echo __LINE__."<br>";
*/
#error_reporting(E_ALL);
#ini_set('display_errors', 1);
setlocale(LC_ALL, 'de_DE@UTF8', 'de_DE', 'de', 'ge');
function further_publication($lid, $user_admin, $template)
{
include_once 'classes/lg-on_Smarty.class.php';
$smarty = new lgon_Smarty();
require_once("config.inc.php");
$templatename = "further_publication.html"; # bei dynamischem Inhalt nimmt er ansicht.html
$db = dbconnect();
$query = "SELECT eid, upper(stichwort) upper_stichwort, stichwort, case_sensitive
FROM lue_stichworte";
$result = $db->query($query) or die("Cannot execute query");
while ($row = $result->fetch_array()) {
if($row['case_sensitive'] == 'N'){
$result1 = $db->query("SELECT count(*) Anz
FROM quelle
WHERE UPPER(Inhalt) REGEXP '[[:<:]]$row[upper_stichwort][[:>:]]'
AND lid = $lid");
$row1 = $result1->fetch_array();
}else{
$result1 = $db->query("SELECT count(*) Anz
FROM quelle
WHERE BINARY Inhalt REGEXP '[[:<:]]$row[stichwort][[:>:]]'
AND lid = $lid");
$row1 = $result1->fetch_array();
}
if ($row1['Anz'] > 0) {
$eids[] = $row['eid'];
}
}
if (isset($eids)) {
$eid_in = "";
for ($i = 0; $i < count($eids); $i++) {
$eid_in .= "$eids[$i],";
}
#echo substr($eid_in,0,-1);
$query2 = "SELECT DISTINCT eid, thema, bezeichnung
FROM lue_quelle a, lue_art b
WHERE a.lueaid = b.lueaid
AND a.eid IN (" . substr($eid_in, 0, -1) . ")
ORDER BY eid DESC
";
$result2 = $db->query($query2);
while ($row2 = $result2->fetch_array()) {
$value[] = $row2;
}
// Assign this array to smarty...
$smarty->assign('table_data', $value);
return $smarty->fetch("$template/$templatename");
}else{
return 0;
}
}
#$lid = 5514;
#$user_admin = 'schwaral';
#$template = 'standard';
#echo further_publication($lid, $user_admin, $template);
?>