summaryrefslogtreecommitdiffstats
path: root/phpfspot.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpfspot.class.php')
-rw-r--r--phpfspot.class.php58
1 files changed, 53 insertions, 5 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index 31a3952..860b5de 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -54,21 +54,35 @@ class PHPFSPOT {
$this->tmpl->assign('searchfor', $_SESSION['searchfor']);
$this->tmpl->assign('page_title', $this->cfg->page_title);
$this->tmpl->assign('current_condition', $_SESSION['tag_condition']);
- $this->tmpl->assign('from_date', $this->get_calendar('from'));
- $this->tmpl->assign('to_date', $this->get_calendar('to'));
+
+ $_SESSION['start_action'] = $_GET['mode'];
switch($_GET['mode']) {
case 'showpi':
if(isset($_GET['tags'])) {
$_SESSION['selected_tags'] = split(',', $_GET['tags']);
}
+ if(isset($_GET['from_date'])) {
+ $_SESSION['from_date'] = $_GET['from_date'];
+ }
+ if(isset($_GET['to_date'])) {
+ $_SESSION['to_date'] = $_GET['to_date'];
+ }
break;
case 'showp':
if(isset($_GET['tags'])) {
$_SESSION['selected_tags'] = split(',', $_GET['tags']);
+ $_SESSION['start_action'] = 'showp';
}
if(isset($_GET['id'])) {
$_SESSION['current_photo'] = $_GET['id'];
+ $_SESSION['start_action'] = 'showp';
+ }
+ if(isset($_GET['from_date'])) {
+ $_SESSION['from_date'] = $_GET['from_date'];
+ }
+ if(isset($_GET['to_date'])) {
+ $_SESSION['to_date'] = $_GET['to_date'];
}
break;
case 'export':
@@ -78,6 +92,8 @@ class PHPFSPOT {
}
+ $this->tmpl->assign('from_date', $this->get_calendar('from'));
+ $this->tmpl->assign('to_date', $this->get_calendar('to'));
$this->tmpl->assign('content_page', 'welcome.tpl');
$this->tmpl->show("index.tpl");
@@ -204,6 +220,9 @@ class PHPFSPOT {
if($current_tags != "") {
$extern_link.= "&tags=". $current_tags;
}
+ if(isset($_SESSION['from_date']) && isset($_SESSION['to_date'])) {
+ $extern_link.= "&from_date=". $_SESSION['from_date'] ."&to_date=". $_SESSION['to_date'];
+ }
$this->tmpl->assign('extern_link', $extern_link);
@@ -319,6 +338,9 @@ class PHPFSPOT {
public function addTag($tag)
{
+ // if the result of a date search are displayed, reset them
+ $this->resetDateSearch();
+
if(!isset($_SESSION['selected_tags']))
$_SESSION['selected_tags'] = Array();
@@ -644,6 +666,9 @@ class PHPFSPOT {
if($current_tags != "") {
$extern_link.= "&tags=". $current_tags;
}
+ if(isset($_SESSION['from_date']) && isset($_SESSION['to_date'])) {
+ $extern_link.= "&from_date=". $_SESSION['from_date'] ."&to_date=". $_SESSION['to_date'];
+ }
$export_link = "index.php?mode=export";
@@ -1124,9 +1149,13 @@ class PHPFSPOT {
private function get_calendar($mode)
{
- $output = "<input type=\"text\" size=\"3\" id=\"". $mode ."year\" value=\"". date("Y") ."\" />\n";
- $output.= "<input type=\"text\" size=\"1\" id=\"". $mode ."month\" value=\"". date("m") ."\" />\n";
- $output.= "<input type=\"text\" size=\"1\" id=\"". $mode ."day\" value=\"". date("d") ."\" />\n";
+ $year = $_SESSION[$mode .'_date'] ? date("Y", strtotime($_SESSION[$mode .'_date'])) : date("Y");
+ $month = $_SESSION[$mode .'_date'] ? date("m", strtotime($_SESSION[$mode .'_date'])) : date("m");
+ $day = $_SESSION[$mode .'_date'] ? date("d", strtotime($_SESSION[$mode .'_date'])) : date("d");
+
+ $output = "<input type=\"text\" size=\"3\" id=\"". $mode ."year\" value=\"". $year ."\" />\n";
+ $output.= "<input type=\"text\" size=\"1\" id=\"". $mode ."month\" value=\"". $month ."\" />\n";
+ $output.= "<input type=\"text\" size=\"1\" id=\"". $mode ."day\" value=\"". $day ."\" />\n";
return $output;
} // get_calendar()
@@ -1262,6 +1291,25 @@ class PHPFSPOT {
}
} // getCurrentPhoto()
+ public function whatToDo()
+ {
+ if(isset($_SESSION['selected_tags']) && !empty($_SESSION['selected_tags'])) {
+ return "showpi_tags";
+ }
+ elseif(isset($_SESSION['from_date']) && isset($_SESSION['to_date'])) {
+ return "showpi_date";
+ }
+ elseif(isset($_SESSION['current_photo'])) {
+ return "show_photo";
+ }
+ elseif(isset($_SESSION['start_action']) && $_SESSION['start_action'] == 'showpi') {
+ return "showpi";
+ }
+
+ return "nothing special";
+
+ } // whatToDo()
+
}
?>