Blame view

js/tiny_mce/plugins/ajaxfilemanager/inc/class.sessionaction.php 1.89 KB
42868d70   andryeyev   Создал GIT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
  <?php
  /**
  	 *Session Action Class 
  	 * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
  	 * @link www.phpletter.com
  	 * @since 22/May/2007
  	 *
  	 */
  	class SessionAction
  	{
  		var $actionIndex = 'ajax_file_action';
  		var $selectedDocIndex = 'ajax_selected_doc';
  		var $fromFolderIndex = 'ajax_from_folder';
  		function __construct()
  		{
  			if(!isset($_SESSION[$this->actionIndex]))
  			{
  				$_SESSION[$this->actionIndex] = '';
  			}
  			if(!isset($_SESSION[$this->selectedDocIndex]) || !is_array($_SESSION[$this->selectedDocIndex]))
  			{
  				$_SESSION[$this->selectedDocIndex] = array();
  			}
  			if(!isset($_SESSION[$this->fromFolderIndex]))
  			{
  				$_SESSION[$this->fromFolderIndex] = '';
  			}
  		}
  		
  		function SessionAction()
  		{
  			$this->__construct();
  		}
  		/**
  		 * count the  number of selected documents
  		 *
  		 */
  		function count()
  		{
  			return (isset($_SESSION[$this->selectedDocIndex])?sizeof($_SESSION[$this->selectedDocIndex]):0);
  		}
  		/**
  		 * assign the selected documents
  		 *
  		 * @param array $selectedDocuments
  		 */
  		function set($selectedDocuments)
  		{
  			$_SESSION[$this->selectedDocIndex] = $selectedDocuments;
  
  		}
  		/**
  		 * get the selected documents
  		 * @return array
  		 */
  		function get()
  		{
  			return (isset($_SESSION[$this->selectedDocIndex])?$_SESSION[$this->selectedDocIndex]:array());
  		}
  		
  		function setAction($action)
  		{
  			$_SESSION[$this->actionIndex] = $action;			
  		}
  		/**
  		 * get the action
  		 *
  		 * @return unknown
  		 */
  		function getAction()
  		{
  			return (isset($_SESSION[$this->actionIndex])?$_SESSION[$this->actionIndex]:'');
  		}
  		/**
  		 * set the folder
  		 *
  		 * @param string $folder
  		 */
  		function setFolder($folder)
  		{
  			$_SESSION[$this->fromFolderIndex] = $folder;
  		}
  		/**
  		 * get the folder
  		 *
  		 * @return string
  		 */
  		function getFolder()
  		{
  			return (isset($_SESSION[$this->fromFolderIndex])?$_SESSION[$this->fromFolderIndex]:'');
  		}
  	}
  ?>