Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit abd69a0

Browse files
author
Charles Marion
committed
ENH: improved feeds management
1 parent 8428aab commit abd69a0

File tree

16 files changed

+311
-133
lines changed

16 files changed

+311
-133
lines changed

application/AppController.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,21 @@ public function preDispatch()
6666
"webroot"=>$this->view->webroot,
6767
"logged"=>$this->logged,
6868
"currentUri"=>$this->getRequest()->REQUEST_URI,
69-
"lang"=>Zend_Registry::get('configGlobal')->application->lang
69+
"lang"=>Zend_Registry::get('configGlobal')->application->lang,
70+
"Yes"=>$this->t('Yes'),
71+
"No"=>$this->t('No')
7072
);
7173
$login=array(
7274
"titleUploadLogin"=>$this->t('Please log in'),
7375
"contentUploadLogin"=>utf8_encode($this->t('You need to be logged in to be able to upload files.'))
7476
);
77+
78+
$feed=array(
79+
"deleteFeed"=>$this->t('Do you really want to delete the feed')
80+
);
7581

7682
$this->view->json=array(
77-
"global"=>$jsonGlobal,"login"=>$login
83+
"global"=>$jsonGlobal,"login"=>$login,'feed'=>$feed
7884
);
7985
Zend_Loader::loadClass("JsonComponent",BASE_PATH.'/application/controllers/components');
8086
} // end preDispatch()

application/controllers/DownloadController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class DownloadController extends AppController
1818
*/
1919
public function indexAction()
2020
{
21+
set_time_limit(0);
2122
$this->_helper->layout->disableLayout();
2223
$itemIds=$this->_getParam('items');
2324
$folderIds=$this->_getParam('folders');
@@ -119,7 +120,7 @@ public function indexAction()
119120
$zip = new ZipStream($name.'.zip');
120121
foreach ($bitstreams as $bitstream)
121122
{
122-
$zip->add_file_from_path('test/'.$bitstream->getName(), $bitstream->getPath());
123+
$zip->add_file_from_path($bitstream->getName(), $bitstream->getPath());
123124
}
124125
$zip->finish();
125126
}

application/controllers/FeedController.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,34 @@ public function indexAction()
2121
$this->view->feeds=$this->Feed->getGlobalFeeds($this->userSession->Dao);
2222
}
2323

24+
/** get getfolders Items' size */
25+
public function deleteajaxAction()
26+
{
27+
if(!$this->getRequest()->isXmlHttpRequest())
28+
{
29+
throw new Zend_Exception("Why are you here ? Should be ajax.");
30+
}
31+
32+
$this->_helper->layout->disableLayout();
33+
$this->_helper->viewRenderer->setNoRender();
34+
35+
$feedId=$this->_getParam('feed');
36+
if(!isset($feedId)||!is_numeric($feedId))
37+
{
38+
throw new Zend_Exception("Please set the folder Id");
39+
}
40+
$feed= $this->Feed->load($feedId);
41+
if($feed==false)
42+
{
43+
return;
44+
}
45+
if(!$this->Feed->policyCheck($feed,$this->userSession->Dao,2))
46+
{
47+
return;
48+
}
49+
$this->Feed->delete($feed);
50+
}//end getfolderscontent
51+
2452
} // end class
2553

2654

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/** Sort Daos*/
3+
class SortdaoComponent extends AppComponent
4+
{
5+
public $field='';
6+
public $order='asc';
7+
8+
/* sort daos*/
9+
public function sortByDate($a,$b)
10+
{
11+
if($this->field==''||!isset($a->{$this->field}))
12+
{
13+
throw new Zend_Exception("Error field.");
14+
}
15+
$a_t = strtotime( $a->{$this->field} ) ;
16+
$b_t = strtotime( $b->{$this->field} ) ;
17+
18+
if( $a_t == $b_t )
19+
return 0 ;
20+
21+
if($this->order=='asc')
22+
{
23+
return ($a_t > $b_t ) ? -1 : 1;
24+
}
25+
else
26+
{
27+
return ($a_t > $b_t ) ? 1 : -1;
28+
}
29+
}
30+
31+
} // end class
32+
?>

0 commit comments

Comments
 (0)