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

Commit bc0d58b

Browse files
author
Charles Ma
committed
BUG: refs #198 Added reports
1 parent 6daf5ea commit bc0d58b

File tree

95 files changed

+24254
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+24254
-8
lines changed

core/AppController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ public function preDispatch()
4545
$this->view->metaDescription = Zend_Registry::get('configGlobal')->application->description;
4646
$this->view->metaKeywords = Zend_Registry::get('configGlobal')->application->keywords;
4747

48-
// init notifier
49-
Zend_Registry::set('notifier', new MIDAS_Notifier());
5048

5149
// Set the version
5250
$this->view->version = '3.0.0';
@@ -199,6 +197,8 @@ public function preDispatch()
199197
Zend_Registry::set('userSession', null);
200198
}
201199

200+
// init notifier
201+
Zend_Registry::set('notifier', new MIDAS_Notifier($this->logged, $this->userSession));
202202
$this->view->lang = Zend_Registry::get('configGlobal')->application->lang;
203203
//create a global javascript json array
204204
$jsonGlobal = array(

core/Bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ protected function _initRouter()
192192
$listeModule = array();
193193
foreach($modules as $key => $module)
194194
{
195-
if($module == 1 && file_exists(BASE_PATH.'/modules/'.$key))
195+
if($module == 1 && file_exists(BASE_PATH.'/modules/'.$key) && file_exists(BASE_PATH . "/modules/".$key."/AppController.php"))
196196
{
197197
$listeModule[] = $key;
198198
}

core/controllers/components/DemoComponent.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function reset()
7878
$applicationConfig['global']['application.description'] = '';
7979
$applicationConfig['global']['application.keywords'] = '';
8080

81-
$enabledModules = array('visualize', 'oai', 'metadataextractor', 'api', 'scheduler', 'thumbnailcreator');
81+
$enabledModules = array('visualize', 'oai', 'metadataextractor', 'api', 'scheduler', 'thumbnailcreator', 'statistics');
8282

8383
foreach($enabledModules as $module)
8484
{
@@ -103,6 +103,7 @@ public function reset()
103103
require_once BASE_PATH.'/core/controllers/components/UploadComponent.php';
104104
$uploadCompoenent = new UploadComponent();
105105
$item = $uploadCompoenent->createUploadedItem($admin, 'midasLogo.gif', BASE_PATH.'/core/public/images/midasLogo.gif', $communityDao->getPublicFolder());
106+
$item = $uploadCompoenent->createUploadedItem($admin, 'cow.vtp', BASE_PATH.'/core/public/demo/cow.vtp', $communityDao->getPublicFolder());
106107
}
107108

108109
/** recursively delete a folder*/

core/layouts/layout.phtml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,20 @@ echo $this->doctype()
103103
echo '
104104
<li onclick="location.replace(\''.$this->webroot.'/admin\');"><a>'.$this->t('Administration').'</a></li>';
105105
}
106+
107+
108+
$linksModules = Zend_Registry::get('notifier')->callback("CALLBACK_CORE_GET_USER_MENU", array());
109+
if(!empty($linksModules))
110+
{
111+
foreach($linksModules as $links)
112+
{
113+
foreach($links as $name => $link)
114+
{
115+
echo '
116+
<li onclick="location.replace(\''.$link.'\');"><a>'.$name.'</a></li>';
117+
}
118+
}
119+
}
106120
echo '
107121
</ul>
108122
';
@@ -227,6 +241,26 @@ echo $this->doctype()
227241
<li <?php if($this->activemenu=='uploaded') {echo 'class="active"';} ?> onclick="location.replace('<?php echo $this->webroot?>/browse/uploaded');" ><a href="<?php echo $this->webroot?>/browse/uploaded"><img alt="" src="<?php echo $this->coreWebroot?>/public/images/icons/addfile.png" /><span> <?php echo $this->t('My uploads');?></span></a></li>
228242
<?php
229243
}
244+
245+
$linksModules = Zend_Registry::get('notifier')->callback("CALLBACK_CORE_GET_LEFT_LINKS", array());
246+
if(!empty($linksModules))
247+
{
248+
foreach($linksModules as $links)
249+
{
250+
foreach($links as $name => $array)
251+
{
252+
if(count($array) != 2)
253+
{
254+
throw new Zend_Exception('Key = 0 should be the link, Key = 1 should be the image');
255+
}
256+
$link = $array[0];
257+
$image = $array[1];
258+
?>
259+
<li onclick="location.replace('<?php echo $link?>');" ><a href="<?php echo $link?>"><img alt="" src="<?php echo $image?>" /><span> <?php echo $name;?></span></a></li>
260+
<?php
261+
}
262+
}
263+
}
230264
?>
231265
</ul>
232266
<hr/>
@@ -293,4 +327,15 @@ echo $this->doctype()
293327
<?php echo $this->json?>
294328
</div>
295329
</body>
330+
331+
<?php
332+
$footers = Zend_Registry::get('notifier')->callback("CALLBACK_CORE_GET_FOOTER_LAYOUT", array());
333+
if(!empty($footers))
334+
{
335+
foreach($footers as $footer)
336+
{
337+
echo $footer;
338+
}
339+
}
340+
?>
296341
</html>

core/models/base/ItemModelBase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ function incrementDownloadCount($itemdao)
173173
}
174174
$itemdao->download++;
175175
parent::save($itemdao);
176+
Zend_Registry::get('notifier')->callback("CALLBACK_CORE_PLUS_ONE_DOWNLOAD", array('item' => $itemdao));
176177
}//end incrementDownloadCount
177178

178179
/** Add a revision to an item

core/models/pdo/UserModel.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,21 @@ function getAll($onlyPublic = false, $limit = 20, $order = 'lastname', $offset =
117117
return $return;
118118
} // end getAll()
119119

120+
/** Get admins */
121+
function getAdmins()
122+
{
123+
$sql = $this->database->select();
124+
$sql ->where('admin = ?', 1);
125+
126+
$rowset = $this->database->fetchAll($sql);
127+
$return = array();
128+
foreach($rowset as $row)
129+
{
130+
$return[] = $this->initDao('User', $row);
131+
}
132+
return $return;
133+
} // end getAll()
134+
120135

121136

122137
/** Returns a user given its folder (either public,private or base folder) */

core/public/demo/cow.vtp

Lines changed: 33 additions & 0 deletions
Large diffs are not rendered by default.

core/translation/fr-main.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ Add in group;Ajouter au groupe
251251
Set as moderator;Promouvoir en tant que mod�rateur
252252
Remove from community;Retirer de la communaut�
253253
Remove from group;Retirer du groupe
254-
Add Metadata;Ajouter M�tadonn�eThis name is already used;Ce nom est d�ja utilis�
254+
Add Metadata;Ajouter M�tadonn�e
255+
This name is already used;Ce nom est d�ja utilis�
255256
Name of the folder;Nom du r�pertoire
256257
Optional;Optionel
257258
Teaser;Courte descriptionMy Language;Ma Langue

core/views/item/view.phtml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,21 @@ if($this->preview) // module visualize
211211
}
212212
if($this->isAdmin)
213213
{
214+
$modules = Zend_Registry::get('modulesEnable');
215+
if(in_array('statistics', $modules))
216+
{
217+
echo
218+
"<li>
219+
<a href='".$this->webroot."/statistics/item?id=".$this->itemDao->getKey()."'><img alt='' src='{$this->coreWebroot}/public/images/icons/metadata.png'/> {$this->t('Statistics')}</a>
220+
</li>
221+
";
222+
}
214223
echo
215224
"
216225
<li>
217226
<a href='javascript:;' id='itemDeleteLink'><img alt='' src='{$this->coreWebroot}/public/images/icons/close.png'/> {$this->t('Delete')}</a>
218227
</li>
219-
";
228+
";
220229
}
221230
?>
222231
</ul>

modules/scheduler/models/pdo/JobModel.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,28 @@
1313
/** job model */
1414
class Scheduler_JobModel extends Scheduler_JobModelBase
1515
{
16-
16+
/** get by tasks */
17+
public function getJobsByTask($task)
18+
{
19+
if(!is_string($task))
20+
{
21+
throw new Zend_Exception('Error Params');
22+
}
23+
$sql = $this->database->select()
24+
->setIntegrityCheck(false)
25+
->where('task = ?', $task)
26+
->where('status = ?', SCHEDULER_JOB_STATUS_TORUN);
27+
28+
$rowset = $this->database->fetchAll($sql);
29+
$return = array();
30+
foreach($rowset as $row)
31+
{
32+
$tmpDao = $this->initDao('Job', $row, 'scheduler');
33+
$return[] = $tmpDao;
34+
unset($tmpDao);
35+
}
36+
return $return;
37+
}
1738
/** get jobs*/
1839
public function getJobsToRun()
1940
{

0 commit comments

Comments
 (0)