diff options
| author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-06-04 12:55:26 +0000 |
|---|---|---|
| committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-06-04 12:55:26 +0000 |
| commit | 9c976c3c04e8a3f9bc9f9dbbdb429d82559f58b0 (patch) | |
| tree | 928b80f63c70a9b8addd26cf3d099140e5f0febd /frontends/php/include/config.inc.php | |
| parent | 16bfe6f1840d96fda7902f78a781430aa21d1e7e (diff) | |
- added history of last five visited pages (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@4229 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/config.inc.php')
| -rw-r--r-- | frontends/php/include/config.inc.php | 71 |
1 files changed, 69 insertions, 2 deletions
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index 100504b4..d3b71f18 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -1343,8 +1343,10 @@ $result = } - function get_profile($idx,$default_value=null,$type=PROFILE_TYPE_UNKNOWN) - { +/********** USER PROFILE ***********/ + +//---------- GET USER VALUE ------------- + function get_profile($idx,$default_value=null,$type=PROFILE_TYPE_UNKNOWN){ global $USER_DETAILS; $result = $default_value; @@ -1375,6 +1377,7 @@ $result = return $result; } +//----------- ADD/EDIT USERPROFILE ------------- function update_profile($idx,$value,$type=PROFILE_TYPE_UNKNOWN) { @@ -1411,6 +1414,70 @@ $result = } } +/***********************************/ + +/************ HISTORY **************/ + function get_user_history(){ + $history=''; + $delimiter = new CSpan('»','delimiter'); + $delimiter = $delimiter->ToString(); + for($i = 0; $i < 5; $i++){ + if($rows = get_profile('web.history.'.$i,false)){ + $history.= ($i>0)?($delimiter):(''); + $url = new CLink($rows[0],$rows[1],'history'); + $history.= SPACE.($url->ToString()).SPACE; + } + } + return $history; + } + + function add_user_history($page){ + + $title = explode('[',$page['title']); + $title = $title[0]; + + if(!(isset($page['hist_arg']) && is_array($page['hist_arg']))){ + return FALSE; + } + + $url = ''; + foreach($page['hist_arg'] as $arg){ + if(isset($_REQUEST[$arg]) && !empty($_REQUEST[$arg])){ + $url.=((empty($url))?('?'):('&')).$arg.'='.$_REQUEST[$arg]; + } + } + $url = $page['file'].$url; + + $curr = 0; + $profile = array(); + for($i = 0; $i < 5; $i++){ + if($history = get_profile('web.history.'.$i,false)){ + if($history[0] != $title){ + $profile[$curr] = $history; + $curr++; + } + } + } + + $history = array($title,$url); + + if($curr < 5){ + for($i = 0; $i < $curr; $i++){ + update_profile('web.history.'.$i,$profile[$i],PROFILE_TYPE_ARRAY); + } + $result = update_profile('web.history.'.$curr,$history,PROFILE_TYPE_ARRAY); + } else { + for($i = 1; $i < 5; $i++){ + update_profile('web.history.'.($i-1),$profile[$i],PROFILE_TYPE_ARRAY); + } + $result = update_profile('web.history.'.(5-1),$history,PROFILE_TYPE_ARRAY); + } + + return $result; + } + +/***********************************/ + function insert_showhint_javascript() { if(defined('SHOW_HINT_SCRIPT_INSERTTED')) return; |
