Commit 3e3d1fd9 authored by Francesco Iannuzzelli's avatar Francesco Iannuzzelli

Search events

parent 1dc9996b
......@@ -39,6 +39,8 @@ $ah->CheckAuth();
$fh = new FormHelper;
$post = $fh->HttpPost();
$get = $fh->HttpGet();
$conf = new Configuration();
$calendar_version = $conf->Get("calendar_version");
if(count($post)==0 && count($get)==0)
header("Location: /gate/index.php");
......@@ -70,14 +72,19 @@ if ($from=="event")
$id_article = $fh->Null2Zero($post['id_article']);
$visible_topic_group = $fh->Checkbox2bool($post['visible_topic_group']);
$id_group = 0;
if($id_topic>0 && $visible_topic_group)
{
include_once(SERVER_ROOT."/../classes/topic.php");
$t = new Topic($id_topic);
$id_group = $t->id_group;
if($calendar_version==1) {
if($id_topic>0 && $visible_topic_group)
{
include_once(SERVER_ROOT."/../classes/topic.php");
$t = new Topic($id_topic);
$id_group = $t->id_group;
}
$portal = $fh->Checkbox2bool($post['portal']);
$jump_to_article = $fh->Checkbox2bool($post['jump_to_article']);
} else {
$portal = 1;
$jump_to_article = 0;
}
$portal = $fh->Checkbox2bool($post['portal']);
$jump_to_article = $fh->Checkbox2bool($post['jump_to_article']);
$keywords = $post['keywords'];
$approved = $fh->Checkbox2bool($post['approved']);
$approved_old = $fh->Null2Zero($post['approved_old']);
......
......@@ -40,6 +40,7 @@ include_once(SERVER_ROOT."/../classes/file.php");
$ee = new Events();
$fm = new FileManager;
$maxfilesize = $fm->MaxFileSize();
$calendar_version = $conf->Get("calendar_version");
$id = $_GET['id'];
$id_topic = $_GET['id_topic'];
......@@ -129,6 +130,10 @@ if ($id>0 && $input_right)
echo $hh->Toolbar($tools);
}
if($calendar_version>1 && $row['facebook_id']!='') {
$fb_url = "https://www.facebook.com/events/{$row['facebook_id']}/";
echo $hh->input_note("<p>Evento importato da Facebook: <a href=\"$fb_url\" target=\"_blank\">$fb_url</a></p>");
}
echo $hh->input_form("post","actions.php",true);
echo $hh->input_hidden("MAX_FILE_SIZE",$maxfilesize);
?>
......@@ -158,6 +163,16 @@ $hh->mandatory = FALSE;
echo $hh->input_wysiwyg("description","description",$row['description'],$row['is_html'],20,$input_right,$input_right);
echo $hh->input_separator("where");
if($id>0 && $calendar_version==2) {
$gmaps_note = '';
$gmaps = "https://www.google.com/maps/search/?api=1&hl={$hh->tr->lang_code}&query=" . urlencode("{$row['address']}, {$row['place']}");
if($row['latitude']!='' && $row['longitude']!='') {
$gmaps .= "&ll={$row['latitude']},{$row['longitude']}";
$gmaps_note = "Latitudine: {$row['latitude']} - Longitudine: {$row['longitude']} - ";
}
echo $hh->input_note("$gmaps_note<a href=\"$gmaps\" target=\"_blank\">Link a Google Maps</a>");
}
$hh->mandatory = TRUE;
echo $hh->input_text("address","address",$row['address'],80,0,$input_right);
$hh->mandatory = FALSE;
......@@ -210,6 +225,9 @@ else
}
echo $hh->input_article("article_related","id_article","'/articles/popup_search.php?w=event&id_article='+document.forms['form1'].id_article.value+'&id_topic=$article_topic'",$row['id_article'],$headline,$article_topic,$input_right);
if($calendar_version==1) {
echo $hh->input_checkbox("jump_to_article","jump_to_article",$row['jump_to_article'],0,$input_right);
}
echo $hh->input_separator("administration");
if($id>0)
......@@ -221,10 +239,11 @@ if($id>0)
}
}
echo $hh->input_topics($event_topic,$row['id_group'],$ee->Topics(),"none_option",$input_super_right,false,"id_topic");
echo $hh->input_checkbox("visible_topic_group","visible_topic_group",$row['id_group']>0,0,$input_super_right);
echo $hh->input_checkbox("visible_portal","portal",$visible_portal,0,$input_super_right);
if($calendar_version==1) {
echo $hh->input_topics($event_topic,$row['id_group'],$ee->Topics(),"none_option",$input_super_right,false,"id_topic");
echo $hh->input_checkbox("visible_topic_group","visible_topic_group",$row['id_group']>0,0,$input_super_right);
echo $hh->input_checkbox("visible_portal","portal",$visible_portal,0,$input_super_right);
}
include_once(SERVER_ROOT."/../classes/ontology.php");
$o = new Ontology;
......
......@@ -1519,7 +1519,9 @@ class IRL
$path .= "&id_etype=" . $params['id_etype'];
if ($params['period']>0)
$path .= "&period=" . $params['period'];
break;
if ($params['tab']!='')
$path .= "&tab=" . $params['tab'];
break;
default:
$path .= "events.php";
break;
......
......@@ -2874,36 +2874,59 @@ class Layout
$e_array = array();
include_once(SERVER_ROOT."/../classes/events.php");
$ee = new Events();
$ee->id_topic = $id_topic;
$ee->id_group = $id_group;
$ev = array();
$ev['search'] = array('q'=>$unescaped_query,'id_geo'=>$params['id_geo'],'id_etype'=>$params['id_etype']);
if ($strlen>=$min_str_length || ($params['id_etype']>0) || ($params['id_geo']>0))
{
$events = array();
$search_words = $this->th->SearchWords($unescaped_query,$this->id_language);
$num_events = $ee->Search($events,$search_words,$params);
$ev['items'] = $this->Page($events,$num_events);
$this->Urlify($ev['search'],"events",array('id_topic'=>$id_topic,'subtype'=>"search",'q'=>$unescaped_query,'id_geo'=>$params['id_geo'],'id_etype'=>$params['id_etype'],'period'=>$params['period']),true);
}
$etypes = array();
foreach($ee->Types() as $type)
{
$etypes['t_' . $type['id_event_type'] ] = array('xname'=>"type",'id'=>$type['id_event_type'],'type'=>$type['type']);
}
$ev['event_types'] = $etypes;
$this->TopicInit($id_topic);
$ev['info'] = $this->EventsInfo();
$e_array['events'] = $ev;
$months = array();
$counter = 1;
foreach($this->tr->Translate("month") as $month)
{
$months['m_' . $counter] = array('xname'=>"month",'n'=>$counter,'name'=>$month);
$counter ++;
$search_words = $this->th->SearchWords($unescaped_query,$this->id_language);
if($this->conf->Get('calendar_version')==1) {
$ev['search'] = array('q'=>$unescaped_query,'id_geo'=>$params['id_geo'],'id_etype'=>$params['id_etype']);
$ee->id_topic = $id_topic;
$ee->id_group = $id_group;
if ($strlen>=$min_str_length || ($params['id_etype']>0) || ($params['id_geo']>0))
{
$events = array();
$num_events = $ee->Search($events,$search_words,$params);
$ev['items'] = $this->Page($events,$num_events);
$this->Urlify($ev['search'],"events",array('id_topic'=>$id_topic,'subtype'=>"search",'q'=>$unescaped_query,'id_geo'=>$params['id_geo'],'id_etype'=>$params['id_etype'],'period'=>$params['period']),true);
}
$etypes = array();
foreach($ee->Types() as $type)
{
$etypes['t_' . $type['id_event_type'] ] = array('xname'=>"type",'id'=>$type['id_event_type'],'type'=>$type['type']);
}
$ev['event_types'] = $etypes;
$this->TopicInit($id_topic);
$ev['info'] = $this->EventsInfo();
$e_array['events'] = $ev;
$months = array();
$counter = 1;
foreach($this->tr->Translate("month") as $month)
{
$months['m_' . $counter] = array('xname'=>"month",'n'=>$counter,'name'=>$month);
$counter ++;
}
$e_array['months'] = $months;
$e_array['geo'] = $this->Geo();
} else {
if ($strlen>=$min_str_length || ($params['id_geo']>0))
{
$events = array();
$params['period'] = '1';
$num_events = $ee->Search($events,$search_words,$params);
$ev['future'] = array('q'=>$unescaped_query,'id_geo'=>$params['id_geo'],'period'=>$params['period']);
$ev['future']['items'] = $this->Page($events,$num_events);
$ev['future']['items']['label'] = $this->tr->Translate("events_future");;
$this->Urlify($ev['future'],"events",array('subtype'=>"search",'q'=>$unescaped_query,'id_geo'=>$params['id_geo'],'tab'=>'future','period'=>$params['period']),true);
$events = array();
$params['period'] = '2';
$num_events = $ee->Search($events,$search_words,$params);
$ev['past'] = array('q'=>$unescaped_query,'id_geo'=>$params['id_geo'],'period'=>$params['period']);
$ev['past']['items'] = $this->Page($events,$num_events);
$ev['past']['items']['label'] = $this->tr->Translate("events_past");;
$this->Urlify($ev['past'],"events",array('subtype'=>"search",'q'=>$unescaped_query,'id_geo'=>$params['id_geo'],'tab'=>'past','period'=>$params['period']),true);
}
$ev['info'] = $this->EventsInfo();
$e_array['events'] = $ev;
$e_array['geo'] = $this->Geo();
}
$e_array['months'] = $months;
$e_array['geo'] = $this->Geo();
return $e_array;
}
......
......@@ -78,6 +78,8 @@ event_submit = Submit event
event_submit_click = Click here to submit an event
event_type = Event type
events = Events
events_future = Future events
events_past = Past events
events_containing = Events containing
events_of_day = Events of day
execution_time = Execution time: %s seconds
......
......@@ -78,6 +78,8 @@ event_submit = Segnalazione evento
event_submit_click = Clicca qui per inviare la segnalazione di un evento
event_type = Tipo di evento
events = Eventi
events_future = Eventi futuri
events_past = Eventi passati
events_containing = Eventi contenenti
events_of_day = Eventi del giorno
execution_time = Tempo di esecuzione: %s secondi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment