1515
1616jimport ('joomla.application.component.controller ' );
1717//jimport('components.com_search.controller');
18- JLoader::register ('SearchController ' , 'components /com_search/controller.php ' );
18+ JLoader::register ('SearchController ' , 'helper /com_search/controller.php ' );
1919
20+ JLoader::register ('fieldsattachHelper ' , JPATH_ADMINISTRATOR .'/components/com_fieldsattach/helpers/fieldsattach.php ' );
2021
2122
2223/**
@@ -45,6 +46,9 @@ public function display($cachable = false, $urlparams = false)
4546
4647 //echo "VIEW:".JRequest::getVar("view");
4748 $ vName = JRequest::getVar ("view " );
49+ $ task = JRequest::getVar ('task ' , 'default ' );
50+
51+
4852 // echo "<br>vNAEMMME: ".$vName;
4953 if ($ vName == "images " || $ vName == "imagesList " || $ vName == "fieldsattachimage " || $ vName == "fieldsattachimages " || $ vName == "fieldsattachimagesajax " ){
5054
@@ -112,8 +116,17 @@ public function display($cachable = false, $urlparams = false)
112116 // Set the layout
113117 $ view ->setLayout ($ vLayout );
114118
119+
115120 // Display the view
116- $ view ->display ();
121+
122+ if ($ task == "fieldsattachimagesorderajax " )
123+ {
124+ // Add a message.
125+ $ this ->fieldsattachimagesorderajax ();
126+ }else {
127+ $ view ->display ();
128+ }
129+
117130
118131 //return $this;
119132
@@ -122,8 +135,8 @@ public function display($cachable = false, $urlparams = false)
122135 return parent ::display ($ cachable , $ urlparams );
123136 }
124137 }
125- /*DELETE IMAGE GALLERY*/
126- public function delete ()
138+ /*DELETE IMAGE GALLERY*/
139+ public function delete ()
127140 {
128141 $ model = $ this ->getModel ( "fieldsattachimage " );
129142 $ model ->delete ();
@@ -253,9 +266,9 @@ function advancedsearch()
253266 $ uri = JURI ::getInstance ();
254267 $ uri ->setQuery ($ post );
255268 $ uri ->setVar ('option ' , 'com_fieldsattach ' );
256- $ uri ->setVar ('view ' , 'advancedsearch ' );
257- $ uri ->setVar ('advancedsearchcategories ' , $ advancedsearchcategories );
258- $ uri ->setVar ('fields ' , $ fields );
269+ $ uri ->setVar ('view ' , 'advancedsearch ' );
270+ $ uri ->setVar ('advancedsearchcategories ' , $ advancedsearchcategories );
271+ $ uri ->setVar ('fields ' , $ fields );
259272
260273
261274
@@ -265,4 +278,53 @@ function advancedsearch()
265278
266279 }
267280
281+ /* Reorder Galery type */
282+ function fieldsattachimagesorderajax ()
283+ {
284+
285+
286+
287+ fieldsattachHelper::fieldsattachimagesorderajax ();
288+
289+ // Log the start
290+ // Initialise a basic logger with no options (once only).
291+ // Include the JLog class.
292+ /*jimport('joomla.log.log');
293+
294+ JLog::addLogger(array());
295+
296+
297+ // Create a new query object.
298+ $db = JFactory::getDBO();
299+ $query = $db->getQuery(true);
300+
301+ $session = JFactory::getSession();
302+ $fieldsattachid = JRequest::getVar("fieldsid");
303+ $order = JRequest::getVar("order");
304+ //Article -------------------
305+ $articleid = $session->get('articleid');
306+
307+ if(empty($articleid) || empty($fieldsattachid) || empty($order)){
308+ //Empty Nothing TODO
309+ }else{
310+ //SQL
311+ $tmporder = explode(",",$order);
312+ if(count($tmporder)>0)
313+ {
314+ $cont = 1;
315+ foreach($tmporder as $obj){
316+ $query = 'UPDATE #__fieldsattach_images SET ordering='.$cont.' WHERE id='.$obj ;
317+
318+ $db->setQuery($query);
319+ // Add a message.
320+ $db->execute();
321+ //$db->query();
322+ $cont++;
323+ }
324+
325+ }
326+ }*/
327+
328+ }
329+
268330}
0 commit comments