aboutsummaryrefslogtreecommitdiffstats
path: root/mayor-orig/mayor-portal/www/include
diff options
context:
space:
mode:
Diffstat (limited to 'mayor-orig/mayor-portal/www/include')
-rw-r--r--mayor-orig/mayor-portal/www/include/modules/portal/hirek/egyhir.php12
-rw-r--r--mayor-orig/mayor-portal/www/include/modules/portal/share/hirek.php6
2 files changed, 15 insertions, 3 deletions
diff --git a/mayor-orig/mayor-portal/www/include/modules/portal/hirek/egyhir.php b/mayor-orig/mayor-portal/www/include/modules/portal/hirek/egyhir.php
index c93a81bd..652c18ae 100644
--- a/mayor-orig/mayor-portal/www/include/modules/portal/hirek/egyhir.php
+++ b/mayor-orig/mayor-portal/www/include/modules/portal/hirek/egyhir.php
@@ -13,7 +13,7 @@
$flag = intval($DATA['flag']);
$class = intval($DATA['class']);
$lang = (in_array($DATA['lang'],$LANGUAGES)) ? $DATA['lang'] : _DEFAULT_LANG;
- if ($DATA['cid']>0) $cid = $DATA['cid'];
+ if ($DATA['cid']>0) $cid = $DATA['cid']; // -- TODO!!!!
$csoport = $DATA['csoport'];
if ($hirId!='' && __HIREKADMIN == false ) {
$q = "SELECT owner FROM hirek WHERE owner='%s'";
@@ -41,6 +41,16 @@
}
} else $q = '';
if ($q!='') $r = db_query($q,array('modul'=>'portal','result'=>'insert','values'=>$v));
+ $q = "DELETE FROM `hirKategoria` WHERE hirId=%u";
+ $v = array($hirId);
+ db_query($q,array('modul'=>'portal','result'=>'delete','values'=>$v));
+ if (is_array($DATA['kategoriaId'])) {
+ for ($i=0; $i<count($DATA['kategoriaId']); $i++) {
+ $q = "INSERT IGNORE INTO `hirKategoria` (hirId,kategoriaId) VALUES (%u,%u)";
+ $v = array($hirId,$DATA['kategoriaId'][$i]);
+ db_query($q,array('modul'=>'portal','result'=>'insert','values'=>$v));
+ }
+ }
return $r;
}
diff --git a/mayor-orig/mayor-portal/www/include/modules/portal/share/hirek.php b/mayor-orig/mayor-portal/www/include/modules/portal/share/hirek.php
index d7db431e..7b59782a 100644
--- a/mayor-orig/mayor-portal/www/include/modules/portal/share/hirek.php
+++ b/mayor-orig/mayor-portal/www/include/modules/portal/share/hirek.php
@@ -13,7 +13,7 @@
return $r;
}
- function getHirek($SET = array('all'=>true,'tolDt'=>'', 'igDt'=>'', 'id' => '', 'flag'=>array(), 'class'=>array(), 'cid'=>array(), 'limit'=>'', 'lang'=>'hu_HU') ) {
+ function getHirek($SET = array('all'=>true,'tolDt'=>'', 'igDt'=>'', 'id' => '', 'flag'=>array(), 'class'=>array(), 'cid'=>array(), 'limit'=>'', 'lang'=>'hu_HU', 'kategoria'=>array()) ) {
$tolDt = $SET['tolDt']; $igDt = $SET['igDt'];
if ($tolDt!='') $W[] = "kdt<='$tolDt'";
@@ -21,6 +21,8 @@
if (count($SET['flag'])>0) $W[] = "flag IN (".implode(',',$SET['flag']).")";
if (count($SET['class'])>0) $W[] = "class IN (".implode(',',$SET['class']).")";
if (count($SET['cid'])>0) $W[] = "cid IN (".implode(',',$SET['cid']).")";
+ if (is_array($SET['kategoria']) && count($SET['kategoria'])>0 && !is_null($SET['kategoria'][0]))
+ $W[] = "kategoriaId IN (".implode(',',$SET['kategoria']).")";
if ($SET['lang']!='') $W[] = "lang='".$SET['lang']."'";
if ($SET['limit']!='') $L = ' LIMIT '.$SET['limit'];
@@ -42,7 +44,7 @@
} else $WHERE = '';
if ($SET['all']===true) $WHERE = '';
- $q = "SELECT * FROM hirek $WHERE ORDER BY kdt DESC,vdt DESC".$L;
+ $q = "SELECT hirek.*, hirek.id AS hirId, GROUP_CONCAT(kategoriaId) AS hirkategoriak FROM hirek LEFT JOIN hirKategoria ON (hirek.id=hirId) $WHERE GROUP BY hirek.id ORDER BY kdt DESC,vdt DESC".$L;
$HIREK['szovegek'] = db_query($q, array('modul'=>'portal','result'=>'indexed'));
return $HIREK;
}