@@ -51,6 +51,99 @@ public function indexAction()
51
51
$ this ->view ->json ['community ' ]['contentCreateLogin ' ]=$ this ->t ('You need to be logged in to be able to create a community. ' );
52
52
}
53
53
54
+ /** move or copy selected element*/
55
+ public function movecopyAction ()
56
+ {
57
+ $ copySubmit =$ this ->_getParam ('copyElement ' );
58
+ $ moveSubmit =$ this ->_getParam ('moveElement ' );
59
+ if (isset ($ copySubmit )||isset ($ moveSubmit ))
60
+ {
61
+ $ elements =explode ('; ' ,$ this ->_getParam ('elements ' ));
62
+ $ destination =$ this ->_getParam ('destination ' );
63
+ $ folderIds =explode ('- ' ,$ elements [0 ]);
64
+ $ itemIds =explode ('- ' ,$ elements [1 ]);
65
+ $ folders = $ this ->Folder ->load ($ folderIds );
66
+ $ items = $ this ->Item ->load ($ itemIds );
67
+ $ destination =$ this ->Folder ->load ($ destination );
68
+ if (empty ($ folders )&&empty ($ items ))
69
+ {
70
+ throw new Zend_Exception ("No element selected " );
71
+ }
72
+ if ($ destination ==false )
73
+ {
74
+ throw new Zend_Exception ("Unable to load destination " );
75
+ }
76
+
77
+ foreach ($ folders as $ folder )
78
+ {
79
+ //TODO
80
+ if (isset ($ copySubmit ))
81
+ {
82
+
83
+ }
84
+ else
85
+ {
86
+
87
+ }
88
+ }
89
+ foreach ($ items as $ item )
90
+ {
91
+ if (isset ($ copySubmit ))
92
+ {
93
+ $ this ->Folder ->addItem ($ destination ,$ item );
94
+ }
95
+ else
96
+ {
97
+ //TODO move
98
+ }
99
+ }
100
+ $ this ->_redirect ('/folder/ ' .$ destination ->getKey ());
101
+ }
102
+
103
+
104
+ if (!$ this ->getRequest ()->isXmlHttpRequest ())
105
+ {
106
+ throw new Zend_Exception ("Why are you here ? Should be ajax. " );
107
+ }
108
+ $ this ->_helper ->layout ->disableLayout ();
109
+ $ folderIds =$ this ->_getParam ('folders ' );
110
+ $ itemIds =$ this ->_getParam ('items ' );
111
+ $ move =$ this ->_getParam ('move ' );
112
+ $ this ->view ->folderIds =$ folderIds ;
113
+ $ this ->view ->itemIds =$ itemIds ;
114
+ $ this ->view ->moveEnabled =true ;
115
+ if (isset ($ move ))
116
+ {
117
+ $ this ->view ->moveEnabled =false ;
118
+ }
119
+ $ folderIds =explode ('- ' ,$ folderIds );
120
+ $ itemIds =explode ('- ' ,$ itemIds );
121
+ $ folders = $ this ->Folder ->load ($ folderIds );
122
+ $ items = $ this ->Item ->load ($ itemIds );
123
+ if (empty ($ folders )&&empty ($ items ))
124
+ {
125
+ throw new Zend_Exception ("No element selected " );
126
+ }
127
+ if (!$ this ->view ->logged )
128
+ {
129
+ throw new Zend_Exception ("Should be logged " );
130
+ }
131
+ $ this ->view ->folders =$ folders ;
132
+ $ this ->view ->items =$ items ;
133
+
134
+ $ communities =$ this ->User ->getUserCommunities ($ this ->userSession ->Dao );
135
+ $ communities =array_merge ($ communities , $ this ->Community ->getPublicCommunities ());
136
+ $ this ->view ->Date =$ this ->Component ->Date ;
137
+
138
+ $ this ->Component ->Sortdao ->field ='name ' ;
139
+ $ this ->Component ->Sortdao ->order ='asc ' ;
140
+ usort ($ communities , array ($ this ->Component ->Sortdao ,'sortByName ' ));
141
+ $ communities =$ this ->Component ->Sortdao ->arrayUniqueDao ($ communities );
142
+
143
+ $ this ->view ->user =$ this ->userSession ->Dao ;
144
+ $ this ->view ->communities =$ communities ;
145
+ }
146
+
54
147
/** get getfolders content (ajax function for the treetable) */
55
148
public function getfolderscontentAction ()
56
149
{
0 commit comments