* FusionForge document manager
*
* Copyright 2011-2012, Franck Villaume - TrivialDev
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
+ * Copyright 2013, French Ministry of Education
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* @param object The Group object to which this document is associated.
* @return boolean success.
*/
- function DocumentManager(&$Group) {
+ function __construct(&$Group) {
$this->Error();
if (!$Group || !is_object($Group)) {
$this->setError('DocumentManager:: '. _('No Valid Group Object'));
return false;
}
$this->Group =& $Group;
-
- return true;
}
/**
$trashId = $this->getTrashID();
if ($trashId !== -1) {
db_begin();
+ $result = db_query_params('select docid FROM doc_data WHERE stateid=$1 and group_id=$2', array('2', $this->Group->getID()));
$emptyFile = db_query_params('DELETE FROM doc_data WHERE stateid=$1 and group_id=$2', array('2', $this->Group->getID()));
- if (!$emptyFile) {
+ if (!$emptyFile) {
db_rollback();
return false;
}
db_rollback();
return false;
}
+ while ($arr = db_fetch_array($result)) {
+ DocumentStorage::instance()->delete($arr['docid'])->commit();
+ }
db_commit();
return true;
}
echo '<li id="leaf-'.$subGroupIdValue.'" class="'.$liclass.'">'.util_make_link($link, $localDg->getName()).$nbDocsLabel;
}
if ($dg->getSubgroup($subGroupIdValue, $stateId)) {
- echo '<ul>';
+ echo '<ul class="simpleTreeMenu" >';
$this->getTree($selecteddir, $linkmenu, $subGroupIdValue);
echo '</ul>';
}
}
}
+ /**
+ * getActivity - return the number of searched actions per sections between two dates
+ *
+ * @param array Sections to search for activity
+ * @param int the start date time format time()
+ * @param int the end date time format time()
+ * @return array number per section of activities found between begin and end values
+ */
+ function getActivity($sections, $begin, $end) {
+ $qpa = db_construct_qpa(false);
+ for ($i = 0; $i < count($sections); $i++) {
+ $union = 0;
+ if (count($sections) >= 1 && $i != count($sections) -1) {
+ $union = 1;
+ }
+ $qpa = db_construct_qpa($qpa, 'SELECT count(*) FROM activity_vw WHERE activity_date BETWEEN $1 AND $2
+ AND group_id = $3 AND section = $4 ',
+ array($begin,
+ $end,
+ $this->getGroup()->getID(),
+ $sections[$i]));
+ if ($union) {
+ $qpa = db_construct_qpa($qpa, ' UNION ALL ', array());
+ }
+ }
+ $res = db_query_qpa($qpa);
+ $results = array();
+ $j = 0;
+ while ($arr = db_fetch_array($res)) {
+ $results[$sections[$j]] = $arr['0'];
+ $j++;
+ }
+ return $results;
+ }
}
-
-?>