@@ -406,48 +406,6 @@ public function move($folder, $parent)
406
406
$ folder = $ this ->load ($ folder ->getKey ());
407
407
$ folder ->setParentId ($ parent ->getKey ());
408
408
parent ::save ($ folder );
409
- /*
410
-
411
- $allChildren = $this->getAllChildren($folder, null, true);
412
-
413
- $leftIndice = $folder->getLeftIndice();
414
- $rightIndice = $folder->getRightIndice();
415
- $rightParentIndice = $currentParent->getRightIndice();
416
- $this->database->getDB()->update('folder', array('left_indice' => new Zend_Db_Expr('left_indice - '.$diff)),
417
- array('left_indice > ?' => $rightIndice));
418
- $this->database->getDB()->update('folder', array('right_indice' => new Zend_Db_Expr('right_indice - '.$diff)),
419
- array('right_indice > ?' => $rightIndice));
420
-
421
-
422
- $childrenIds = array();
423
- foreach($allChildren as $child)
424
- {
425
- $childrenIds[] = $child->getKey();
426
- }
427
- $childrenIds[] = $folder->getKey();
428
- $folder = $this->load($folder->getKey());
429
- $parent = $this->load($parent->getKey());
430
-
431
- $diff = $folder->getLeftIndice() - $parent->getRightIndice();
432
-
433
- $this->database->getDB()->update('folder', array('left_indice' => new Zend_Db_Expr('left_indice - '.$diff)),
434
- array('folder_id IN (?)' => $childrenIds));
435
- $this->database->getDB()->update('folder', array('right_indice' => new Zend_Db_Expr('right_indice - '.$diff)),
436
- array('folder_id IN (?)' => $childrenIds));
437
-
438
- $this->getLogger()->info('2:'.$diff);
439
- $parent = $this->load($parent->getKey());
440
- $folder = $this->load($folder->getKey());
441
- $diff = $folder->getRightIndice() - $parent->getRightIndice() + 1;
442
-
443
- $this->database->getDB()->update('folder', array('right_indice' => new Zend_Db_Expr($diff.' + right_indice')),
444
- array('right_indice >= ?' => $parent->getRightIndice()));
445
- $this->database->getDB()->update('folder', array('left_indice' => new Zend_Db_Expr($diff.' + left_indice')),
446
- array('left_indice >= ?' => $parent->getRightIndice()));
447
- $folder = $this->load($folder->getKey());
448
- $folder->setParentId($parent->getKey());
449
- $this->getLogger()->info('3:'.$diff);
450
- parent::save($folder);*/
451
409
}//end move
452
410
453
411
/** Custom save function*/
@@ -500,11 +458,18 @@ public function save($folder)
500
458
unset($ data ['folder_id ' ]);
501
459
unset($ data ['left_indice ' ]);
502
460
unset($ data ['right_indice ' ]);
461
+ $ data ['date_update ' ] = date ('c ' );
503
462
$ this ->database ->update ($ data , array ('folder_id = ? ' => $ key ));
504
463
return $ key ;
505
464
}
506
465
else
507
466
{
467
+ if (!isset ($ data ['date_creation ' ]) || empty ($ data ['date_creation ' ]))
468
+ {
469
+ $ data ['date_creation ' ] = date ('c ' );
470
+ }
471
+ $ data ['date_update ' ] = date ('c ' );
472
+
508
473
$ this ->database ->getDB ()->update ('folder ' , array ('right_indice ' => new Zend_Db_Expr ('2 + right_indice ' )),
509
474
array ('right_indice >= ? ' => $ rightParent ));
510
475
$ this ->database ->getDB ()->update ('folder ' , array ('left_indice ' => new Zend_Db_Expr ('2 + left_indice ' )),
@@ -931,7 +896,7 @@ function getFoldersFromSearch($search, $userDao, $limit = 14, $group = true, $or
931
896
$ sql ->order (array ('f.name ASC ' ));
932
897
break ;
933
898
case 'date ' :
934
- $ sql ->order (array ('f.date ASC ' ));
899
+ $ sql ->order (array ('f.date_update ASC ' ));
935
900
break ;
936
901
case 'view ' :
937
902
default :
0 commit comments