本文整理汇总了PHP中Widgets::show方法的典型用法代码示例。如果您正苦于以下问题:PHP Widgets::show方法的具体用法?PHP Widgets::show怎么用?PHP Widgets::show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widgets
的用法示例。
在下文中一共展示了Widgets::show方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare
public function prepare()
{
$user = new User(1);
if (!$user->isAuthorized()) {
$this->redirect('?r=auth');
}
$header = new PageHeader($this->curpage, $this->db, $this->config);
$footer = new PageFooter($this->curpage, $this->db, $this->config);
$topMenu = new TopMenu($this->curpage, $this->db, $this->config);
$topMenu->prepare();
$header->data['title'] = $this->_LANG['misc']['home_title'];
$tasksList = new JsonDB(__taskdb);
$serversList = new JsonDB(__serversdb);
$backUpsUsage = array();
$usedByAllBackups = 0;
// for local backups
foreach ($tasksList->data as $task) {
$size = round(dirSize(__archiveDIR . 'local/' . $task['id']));
$usedByAllBackups += $size;
$backUpsUsage[] = array('value' => $size, 'label' => $this->_LANG['store']['Local'] . ' / ' . $task['title']);
}
//for remote backups
foreach ($serversList->data as $server) {
if (isset($server['tasks'])) {
foreach ($server['tasks'] as $task) {
$size = round(dirSize(__archiveDIR . 'servers/' . $server['id'] . '/' . $task['id']));
$usedByAllBackups += $size;
$backUpsUsage[] = array('value' => $size, 'label' => $server['name'] . ' / ' . $task['title']);
}
}
}
function iCmp($a, $b)
{
if ($a['value'] > $b['value']) {
return 0;
} else {
return 1;
}
}
usort($backUpsUsage, "iCmp");
$usedByBackupsTmp = dirSize(__archiveDIR . 'local/');
$usedByBackups = round($usedByBackupsTmp / (1024 * 1024));
$hddTotalSize = round(disk_total_space(__workfolder) / (1024 * 1024));
$hddFreeSpace = round(disk_free_space(__workfolder) / (1024 * 1024));
$hddUsedSpace = $hddTotalSize - $hddFreeSpace - $usedByBackups;
$hddUsage = array();
$hddUsage['title'] = $this->_LANG['misc']['HDD usage'];
$hddUsage['data'] = array();
$hddUsage['data'][] = array('value' => $usedByBackups, 'color' => '#008d32', 'highlight' => '#2ac360', 'label' => $this->_LANG['misc']['Used by BackUps (Mb)']);
$hddUsage['data'][] = array('value' => $hddUsedSpace, 'color' => '#008aa3', 'highlight' => '#20abc4', 'label' => $this->_LANG['misc']['Hdd used by other (Mb)']);
$hddUsage['data'][] = array('value' => $hddFreeSpace, 'color' => '#a65200', 'highlight' => '#cd741c', 'label' => $this->_LANG['misc']['Hdd free space (Mb)']);
$widgets = new Widgets($this->db, __corePath . 'widgets/', $this->config);
$maxUsage = 0;
if (isset($backUpsUsage[0])) {
$maxUsage = $backUpsUsage[0]['value'];
}
$this->data['hddUsage'] = $widgets->show('PieGraph', $hddUsage);
$this->data['backUpsUsage'] = $backUpsUsage;
$this->data['maxUsage'] = $maxUsage;
$this->data['header'] = $header->show();
$this->data['footer'] = $footer->show();
$this->data['topMenu'] = $topMenu->show();
}