11 define(
"TITLE_SIZE_DASHBOARD", _(
"Folder and upload dashboard"));
26 $this->Name =
"size_dashboard";
27 $this->Title = TITLE_SIZE_DASHBOARD;
28 $this->MenuList =
"Admin::Dashboards::Folder/Upload Proportions";
29 $this->Dependency = array();
31 parent::__construct();
32 $this->
dbManager = $GLOBALS[
'container']->get(
'db.manager');
33 $this->uploadDao = $GLOBALS[
'container']->get(
'dao.upload');
43 $sql =
'INNER JOIN upload ON upload.pfile_fk=pfile.pfile_pk '.
44 'INNER JOIN foldercontents ON upload.upload_pk=foldercontents.child_id '.
45 'WHERE parent_fk=$1;';
46 $statementName = __METHOD__.
"GetFolderSize";
47 $folderSizesql =
'SELECT SUM(pfile_size) FROM pfile '.$sql;
48 $row = $this->
dbManager->getSingleRow($folderSizesql,array($folderId),$statementName);
51 $statementName = __METHOD__.
"GetEachUploadSize";
52 $dispSql =
"SELECT upload_pk, upload_filename, pfile_size FROM pfile " .
54 $results = $this->
dbManager->getRows($dispSql, [$folderId], $statementName);
56 foreach ($results as $result) {
57 $clearingDuration = $this->uploadDao->getClearingDuration($result[
"upload_pk"]);
58 $var .=
"<tr><td align='left'>" . $result[
'upload_filename'] .
59 "</td><td align='left' data-order='{$result['pfile_size']}'>" .
61 "</td><td align='left' data-order='{$clearingDuration[1]}'>$clearingDuration[0]</td></tr>";
63 return [$var, $folderSize];
73 if (empty($folderId)) {
79 $formVars[
"onchangeURI"] =
Traceback_uri() .
"?mod=" . $this->Name .
"&selectfolderid=";
81 $formVars[
"tableVars"] = $tableVars;
82 $formVars[
"wholeFolderSize"] = $wholeFolderSize;
83 return $this->
renderString(
"admin-folder-size-form.html.twig", $formVars);
This is the Plugin class. All plugins should:
renderString($templateName, $vars=null)
getFolderAndUploadSize($folderId)
Given a folder's ID function will get size of the folder and uploads under it.
__construct()
base constructor. Most plugins will just use this
Output()
Generate the text for this plugin.
FolderListOption($ParentFolder, $Depth, $IncludeTop=1, $SelectId=-1, $linkParent=false, $OldParent=0)
Create the folder tree, using OPTION tags.
FolderGetTop()
DEPRECATED! Find the top-of-tree folder_pk for the current user.
Traceback_uri()
Get the URI without query to this location.
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
HumanSize( $bytes)
Translate a byte number to a proper type, xxx bytes to xxx B/KB/MB/GB/TB/PB.
#define PLUGIN_DB_WRITE
Plugin requires write permission on DB.
fo_dbManager * dbManager
fo_dbManager object