public function makeQuota(GSUser $user, $showpercent = false) { $rtn = '<div style="font-weight: bold; color: #999; font-family: Verdana, arial, helvetica, sans-serif; font-size: 10px; width: 102px; text-align: center:"><div style="text-align: left;width: 102px; height: 15px; border: 1px solid #ccc; background: url(' . XOOPS_URL . '/modules/galleries/images/quotagray.png) no-repeat;">'; $quota = $user->quota(); $used = $user->usedQuota(); $percent = $quota / 102; $rtn .= '<div style="text-align: center; width: ' . ($used > 0 ? $used / $percent > 102 ? 102 : round($used / $percent) : 0) . 'px; background: url(' . XOOPS_URL . '/modules/galleries/images/quotabar.png) no-repeat;"> </div>'; $rtn .= '</div>'; if ($showpercent) { $rtn .= round($user->usedQuota() * (100 / $quota)) . '%'; } else { $rtn .= RMUtilities::formatBytesSize($user->usedQuota()); } $rtn .= "</div>"; return $rtn; }
// -------------------------------------------------------------- // MyGalleries // Module for advanced image galleries management // Author: Eduardo Cortés // Email: i.bitcero@gmail.com // License: GPL 2.0 // -------------------------------------------------------------- define('GS_LOCATION', 'submit'); include '../../mainfile.php'; if (!GSFunctions::canSubmit($xoopsUser)) { redirect_header(GSFunctions::get_url(), 2, __('Sorry, you have not permission to upload pictures.', 'galleries')); die; } if ($xoopsUser) { $user = new GSUser($xoopsUser->uid(), 1); if ($user->usedQuota() >= $user->quota() && !$xoopsUser->isAdmin()) { redirect_header(GSFunctions::get_url(), 2, __('Sorry, you have exceed your quota limit!', 'galleries')); die; } } function showForm() { global $db, $xoopsOption, $xoopsUser, $mc, $tpl, $xoopsConfig, $xoopsModuleConfig, $user, $xoopsSecurity; $xoopsOption['template_main'] = "gs_submit.html"; $xoopsOption['module_subpage'] = 'submit'; include 'header.php'; GSFunctions::makeHeader(); $mc =& $xoopsModuleConfig; $tpl->assign('lang_uploadyour', __('Upload your Pictures', 'galleries')); $tpl->assign('lang_step1', __('Step 1:', 'galleries')); $tpl->assign('lang_step2', __('Step 2:', 'galleries'));