$i";
}
return $output;
}
function comboMonth ($selItem = "") {
$output = "";
for( $i = 1; $i <= 12; $i++) {
$month = date("m");
if($i == $selItem) {
$selected = "selected";
}
else {
$selected = "";
}
$output .= "";
}
return $output;
}
function comboYear ($selItem = "") {
$output = "";
$currYear = date("Y") + 2;
for( $i = 2000; $i <= $currYear; $i++) {
if($i == $selItem) {
$selected = "selected";
}
else {
$selected = "";
}
$output .= "";
}
return $output;
}
function getNav($pageNum, $numrows, $maxPage) {
$self = $_SERVER['PHP_SELF'];
if ($pageNum > 1){
$page = $pageNum - 1;
$output .= " [Prima Pagina] ";
$output .= " [Indietro] ";
}
else{
$prev = ' [Indietro] ';
$first = ' [Prima Pagina] ';
}
$output .= $first . $prev . " Pagina $pageNum di $maxPage pagine " . $next . $last;
if ($pageNum < $maxPage){
$page = $pageNum + 1;
$output .= " [Avanti] ";
$output .= " [Ultima Pagina] ";
}
else{
$next = ' [Avanti] ';
$last = ' [Ultima Pagina] ';
}
return $output;
}
function txtAbstract ($string, $len) {
if ( strlen($string) > $len ) {
$pos = ( $len - stripos(strrev(substr($string, 0, $len)), ' ') );
$sum = substr($string, 0, $pos-1);
$chr = $sum[strlen($sum)-1];
if (strpos($chr, '.,!?;:')) {
// STRIP LAST CHAR
$sum = substr($sum, 0, strlen($sum)-1);
echo $sum ;
}
// ADD ELLIPSIS
return $sum."…";
} else {
return $string;
}
}
function getMenuName ($selItem = "") {
GLOBAL $conn;
$outPut = "";
$Query = "SELECT * FROM ".TABLE_MENU_DETT." WHERE RefId = '".$selItem."' AND ItemLang = 'it'";
$query = mysqli_query($conn, $Query);
$item = mysqli_fetch_array($query);
$outPut = $item['ItemTitle'];
return $outPut;
}
function getMenuTabList ($selItem = "") {
GLOBAL $conn;
$outPut = "";
$Query = "SELECT * FROM ".TABLE_MENU." WHERE ID = '".$selItem."' ORDER BY ID ASC";
$query = mysqli_query($conn, $Query);
while ($item = mysqli_fetch_array($query)) {
$outPut .= getMenuTabList($item['ParentId']);
$outPut .= getMenuName($item['ID'])." >";
}
return $outPut;
}
function getComboLang ($selItem = "") {
global $lingue;
foreach ($lingue as $key => $lingua) {
$selected = "";
if($selItem == $key){
$selected = "selected";
}
$outPut .= "";
}
return $outPut;
}
function cleanString($string) {
//$strResult = utf8_encode($string);
/*
$strResult = str_ireplace("à", "a", $strResult);
$strResult = str_ireplace("á", "a", $strResult);
$strResult = str_ireplace("è", "e", $strResult);
$strResult = str_ireplace("é", "e", $strResult);
$strResult = str_ireplace("ì", "i", $strResult);
$strResult = str_ireplace("í", "i", $strResult);
$strResult = str_ireplace("ò", "o", $strResult);
$strResult = str_ireplace("ó", "o", $strResult);
$strResult = str_ireplace("ù", "u", $strResult);
$strResult = str_ireplace("ú", "u", $strResult);
$strResult = str_ireplace("À", "a", $strResult);
$strResult = str_ireplace("Á", "a", $strResult);
$strResult = str_ireplace("È", "e", $strResult);
$strResult = str_ireplace("É", "e", $strResult);
$strResult = str_ireplace("Ì", "i", $strResult);
$strResult = str_ireplace("Í", "i", $strResult);
$strResult = str_ireplace("Ò", "o", $strResult);
$strResult = str_ireplace("Ó", "o", $strResult);
$strResult = str_ireplace("Ù", "u", $strResult);
$strResult = str_ireplace("Ú", "u", $strResult);
*/
//$strResult = utf8_encode($string);
$strResult = str_replace("à", "a", $string);
$strResult = str_replace("è", "e", $strResult);
$strResult = str_replace("ò", "o", $strResult);
$strResult = str_replace("ù", "u", $strResult);
$strResult = str_replace("ì", "i", $strResult);
$strResult = str_replace("é", "e", $strResult);
/*
$strResult = str_replace("è", "e", $string);
$strResult = str_replace("Ã ", "a", $strResult);
$strResult = str_replace("ò", "o", $strResult);
$strResult = str_replace("ì", "i", $strResult);
$strResult = str_replace("ù", "u", $strResult);
*/
$strResult = str_ireplace("'", " ", $strResult);
$strResult = preg_replace('/[^A-Za-z0-9 ]/', " ", $strResult);
$strResult = trim($strResult);
$strResult = preg_replace('/[ ]{2,}/', " ", $strResult);
$strResult = str_replace(" ", "_", $strResult);
return strtolower($strResult);
}
function getPartentId ($selItem = "") {
GLOBAL $conn;
$outPut = "";
$Query = "SELECT * FROM ".TABLE_MENU." WHERE ID = '".$selItem."' ORDER BY ID ASC";
$query = mysqli_query($conn, $Query);
while ($item = mysqli_fetch_array($query)) {
$outPut = (int)$item['ParentId'];
}
return $outPut;
}
?>