本文整理汇总了PHP中Convert::convert_byte_1024方法的典型用法代码示例。如果您正苦于以下问题:PHP Convert::convert_byte_1024方法的具体用法?PHP Convert::convert_byte_1024怎么用?PHP Convert::convert_byte_1024使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Convert
的用法示例。
在下文中一共展示了Convert::convert_byte_1024方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: used_diskspace
public static function used_diskspace()
{
global $user;
$user_data = new DataUserData($user->get_user_id());
$user_filesize = $user_data->get_filesize();
$user_quota = $user_data->get_quota();
if ($user_quota != 0) {
$diskspace_per = $user_filesize / $user_quota * 100;
if ($diskspace_per == 0) {
$diskspace_per_display = "(0%)";
} else {
$diskspace_per = floor($diskspace_per);
if ($diskspace_per == 0) {
$diskspace_per_display = "(> 1%)";
} else {
$diskspace_per_display = "(" . $diskspace_per . "%)";
}
}
if (round($user_filesize / $user_quota * 100, 0) >= (int) Registry::get_value("data_quota_warning")) {
$quotaWarn = " <img src='images/icons/notice.png' alt='W' />";
} else {
$quotaWarn = "";
}
} else {
$quotaWarn = "";
$diskspace_per_display = "";
}
$act_filesize = Convert::convert_byte_1024($user_filesize);
$template = new HTMLTemplate("data/home/summary/used_diskspace.html");
$template->set_var("used_diskspace", $act_filesize . " " . $diskspace_per_display . "" . $quotaWarn);
return $template->get_string();
}
示例2: list_file_items
/**
* @param string $json_column_array
* @param string $json_argument_array
* @param string $css_page_id
* @param string $css_row_sort_id
* @param string $page
* @param string $sortvalue
* @param string $sortmethod
* @return string
* @throws BaseAjaxDependentArgumentMissingException
*/
public static function list_file_items($json_column_array, $json_argument_array, $css_page_id, $css_row_sort_id, $page, $sortvalue, $sortmethod)
{
$argument_array = json_decode($json_argument_array);
$handling_class = Item::get_holder_handling_class_by_name($argument_array[0][1]);
if ($handling_class) {
$sql = $handling_class::get_item_list_sql($argument_array[1][1]);
}
if ($sql) {
$list_request = new ListRequest_IO();
if ($argument_array[2][1] == true) {
$list_array = Data_Wrapper::list_item_files($sql, $sortvalue, $sortmethod, $page * 20 - 20, $page * 20);
} else {
$list_array = Data_Wrapper::list_item_files($sql, $sortvalue, $sortmethod, 0, null);
}
$list_request->set_column_array($json_column_array);
if (is_array($list_array) and count($list_array) >= 1) {
foreach ($list_array as $key => $value) {
if ($argument_array[3][1] == true) {
$column_array = json_decode($json_column_array);
if (is_array($column_array) and count($column_array) >= 1) {
foreach ($column_array as $row_key => $row_value) {
if ($row_value[1] == "checkbox") {
if ($row_value[4]) {
$checkbox_class = $row_value[4];
break;
}
}
}
}
if ($checkbox_class) {
$list_array[$key]['checkbox'] = "<input type='checkbox' name='file-" . $list_array[$key]['item_id'] . "' value='1' class='" . $checkbox_class . "' />";
} else {
$list_array[$key]['checkbox'] = "<input type='checkbox' name='file-" . $list_array[$key]['item_id'] . "' value='1' />";
}
}
$file = File::get_instance($list_array[$key]['id']);
$list_array[$key]['symbol'] = "<img src='" . $file->get_icon() . "' alt='' style='border:0;' />";
$list_array[$key]['size'] = Convert::convert_byte_1024($list_array[$key]['size']);
$datetime_handler = new DatetimeHandler($list_array[$key]['datetime']);
$list_array[$key]['datetime'] = $datetime_handler->get_datetime(false);
}
} else {
$list_request->empty_message("<span class='italic'>No Files found!</span>");
}
$list_request->set_array($list_array);
return $list_request->get_page($page);
} else {
throw new BaseAjaxDependentArgumentMissingException();
}
}
示例3: home_dialog
public static function home_dialog()
{
$template = new HTMLTemplate("data/admin/home_dialog.html");
$template->set_var("base_dir", System::get_base_directory());
$template->set_var("system_space", Convert::convert_byte_1024(System::get_system_space()));
$template->set_var("user_used_space", Convert::convert_byte_1024(DataUserData::get_used_space()));
$additional_quota_dialog_array = ModuleDialog::list_dialogs_by_type("additional_quota");
if (is_array($additional_quota_dialog_array) and count($additional_quota_dialog_array) >= 1) {
$additional_quota_array = array();
$additional_quota_counter = 0;
foreach ($additional_quota_dialog_array as $key => $value) {
if (file_exists($value['class_path'])) {
require_once $value['class_path'];
$additional_quota_array[$additional_quota_counter]['title'] = Language::get_message($value['language_address'], "dialog");
$additional_quota_array[$additional_quota_counter]['value'] = $value['class']::$value['method']();
$additional_quota_counter++;
}
}
$template->set_var("additional_quota_array", $additional_quota_array);
}
$template->set_var("db_used_space", Convert::convert_byte_1024(System::get_used_database_space()));
$template->set_var("free_space", Convert::convert_byte_1024(System::get_free_space()));
return $template->get_string();
}
示例4: get_project_admin_menu
/**
* @param string $get_array
* @return string
* @throws ProjectSecurityAccessDeniedException
* @throws ProjectIDMissingException
*/
public static function get_project_admin_menu($get_array)
{
global $user;
if ($get_array) {
$_GET = unserialize($get_array);
}
if ($_GET['project_id']) {
$project = new Project($_GET['project_id']);
$project_security = new ProjectSecurity($_GET['project_id']);
$project_owner = new User($project->get_owner_id());
$organisation_unit_id = $project->get_organisation_unit_id();
$parent_project_id = $project->get_project_toid();
if ($user->get_user_id() == $project->get_owner_id() or $project_security->is_access(2, false) == true or $project_security->is_access(3, false) == true or $project_security->is_access(4, false) == true or $project_security->is_access(5, false) == true or $project_security->is_access(6, false) == true or $project_security->is_access(7, false) == true) {
if ($organisation_unit_id) {
$organisation_unit = new OrganisationUnit($organisation_unit_id);
$parent = $organisation_unit->get_name();
$parent_type = "Organisation Unit";
} else {
$parent_project = new Project($parent_project_id);
$parent = $parent_project->get_name();
$parent_type = "Project";
}
$template = new HTMLTemplate("project/ajax/admin/menu.html");
$template->set_var("name", $project->get_name());
$template->set_var("owner", $project_owner->get_full_name(false));
$template->set_var("parent", $parent);
$template->set_var("parent_type", $parent_type);
if ($user->is_admin()) {
$template->set_var("admin", true);
} else {
$template->set_var("admin", false);
}
if ($project_security->is_access(7, false) == true or $project->get_owner_id() == $user->get_user_id()) {
$template->set_var("owner_permission", true);
} else {
$template->set_var("owner_permission", false);
}
if ($project_security->is_access(6, false) == true) {
$template->set_var("delete", true);
} else {
$template->set_var("delete", false);
}
if ($project_security->is_access(3, false) == true) {
$template->set_var("write", true);
} else {
$template->set_var("write", false);
}
if ($project->get_current_status_id() == 0) {
$template->set_var("project_canceled", true);
} else {
$template->set_var("project_canceled", false);
}
if ($project->get_deleted() == true) {
$template->set_var("project_deleted", true);
} else {
$template->set_var("project_deleted", false);
}
if ($project->get_quota() == 0) {
$template->set_var("quota", "unlimited");
} else {
$template->set_var("quota", Convert::convert_byte_1024($project->get_quota()));
}
$permission_paramquery = $_GET;
$permission_paramquery['run'] = "admin_permission";
unset($permission_paramquery['nextpage']);
unset($permission_paramquery['sure']);
$permission_params = http_build_query($permission_paramquery, '', '&');
$template->set_var("permission_params", $permission_params);
$rename_paramquery = $_GET;
$rename_paramquery['run'] = "admin_rename";
unset($rename_paramquery['nextpage']);
unset($rename_paramquery['sure']);
$rename_params = http_build_query($rename_paramquery, '', '&');
$template->set_var("rename_params", $rename_params);
$chown_paramquery = $_GET;
$chown_paramquery['run'] = "admin_chown";
unset($chown_paramquery['nextpage']);
unset($chown_paramquery['sure']);
$chown_params = http_build_query($chown_paramquery, '', '&');
$template->set_var("chown_params", $chown_params);
$move_paramquery = $_GET;
$move_paramquery['run'] = "admin_move";
unset($move_paramquery['nextpage']);
unset($move_paramquery['sure']);
$move_params = http_build_query($move_paramquery, '', '&');
$template->set_var("move_params", $move_params);
$chquota_paramquery = $_GET;
$chquota_paramquery['run'] = "admin_quota";
unset($chquota_paramquery['nextpage']);
unset($chquota_paramquery['sure']);
$chquota_params = http_build_query($chquota_paramquery, '', '&');
$template->set_var("chquota_params", $chquota_params);
return $template->get_string();
} else {
//.........这里部分代码省略.........
示例5: list_data_browser
//.........这里部分代码省略.........
}
if (is_array($list_array) and count($list_array) >= 1) {
foreach ($list_array as $key => $value) {
// Common
$datetime_handler = new DatetimeHandler($list_array[$key]['datetime']);
$list_array[$key]['datetime'] = $datetime_handler->get_datetime(false);
if ($list_array[$key]['owner_id']) {
$user = new User($list_array[$key]['owner_id']);
} else {
$user = new User(1);
}
$list_array[$key]['owner'] = $user->get_full_name(true);
// Special
if ($list_array[$key]['file_id']) {
$file = File::get_instance($list_array[$key]['file_id']);
if ($file->is_read_access() == true) {
$paramquery = $_GET;
$paramquery['nav'] = $_GET['nav'];
$paramquery['file_id'] = $list_array[$key]['file_id'];
$paramquery['action'] = "file_detail";
$params = http_build_query($paramquery, '', '&');
$list_array[$key]['symbol']['link'] = $params;
$list_array[$key]['symbol']['content'] = "<img src='" . $file->get_icon() . "' alt='' style='border:0;' />";
$tmp_name = $list_array[$key]['name'];
unset($list_array[$key]['name']);
$list_array[$key]['name']['content'] = $tmp_name;
$list_array[$key]['name']['link'] = $params;
$list_array[$key]['name']['class'] = "DataBrowserIsFile";
} else {
$list_array[$key]['symbol'] = "<img src='core/images/denied_overlay.php?image=" . $file->get_icon() . "' alt='' border='0' />";
}
$list_array[$key]['type'] = Language::get_message("DataGeneralDataTypeFile", "general");
$list_array[$key]['version'] = $file->get_version();
$list_array[$key]['size'] = Convert::convert_byte_1024($list_array[$key]['size']);
$list_array[$key]['permission'] = $file->get_permission_string();
if ($file->is_delete_access()) {
$list_array[$key]['delete_checkbox'] = "<input type='checkbox' class='DataBrowserDeleteCheckbox' value='' name=''></input>";
} else {
$list_array[$key]['delete_checkbox'] = "<input type='checkbox' class='DataBrowserDeleteCheckbox' value='' name='' disabled='disabled'></input>";
}
} elseif ($list_array[$key]['value_id']) {
$value = Value::get_instance($list_array[$key]['value_id']);
if ($value->is_read_access() == true) {
$paramquery = $_GET;
$paramquery['nav'] = $_GET['nav'];
$paramquery['value_id'] = $list_array[$key]['value_id'];
$paramquery['action'] = "value_detail";
$params = http_build_query($paramquery, '', '&');
$list_array[$key]['symbol']['link'] = $params;
$list_array[$key]['symbol']['content'] = "<img src='images/fileicons/16/unknown.png' alt='' style='border:0;' />";
$tmp_name = $list_array[$key]['name'];
unset($list_array[$key]['name']);
$list_array[$key]['name']['content'] = $tmp_name;
$list_array[$key]['name']['link'] = $params;
$list_array[$key]['name']['class'] = "DataBrowserIsValue";
} else {
$list_array[$key]['symbol'] = "<img src='core/images/denied_overlay.php?image=images/fileicons/16/unknown.png' alt='' border='0' />";
}
$list_array[$key]['type'] = Language::get_message("DataGeneralDataTypeValue", "general");
$list_array[$key]['version'] = $value->get_version();
$list_array[$key]['permission'] = $value->get_permission_string();
if ($value->is_delete_access()) {
$list_array[$key]['delete_checkbox'] = "<input type='checkbox' class='DataBrowserDeleteCheckbox' value='' name=''></input>";
} else {
$list_array[$key]['delete_checkbox'] = "<input type='checkbox' class='DataBrowserDeleteCheckbox' value='' name='' disabled='disabled'></input>";
}
示例6: detail
/**
* @throws FileIDMissingException
* @throws DataSecurityAccessDeniedException
*/
public static function detail()
{
global $regional;
if ($_GET['file_id']) {
$file = File::get_instance($_GET['file_id']);
if ($file->is_read_access()) {
$template = new HTMLTemplate("data/file_detail.html");
$folder = Folder::get_instance($file->get_parent_folder_id());
if ($_GET['version'] and is_numeric($_GET['version'])) {
$file->open_internal_revision($_GET['version']);
$internal_revision = $_GET['version'];
} else {
$internal_revision = $file->get_internal_revision();
}
$template = new HTMLTemplate("data/file_detail.html");
$folder = Folder::get_instance($file->get_parent_folder_id());
$user = new User($file->get_owner_id());
$file_version_array = $file->get_file_internal_revisions();
if (is_array($file_version_array) and count($file_version_array) > 0) {
$result = array();
$counter = 1;
$result[0]['version'] = 0;
$result[0]['text'] = "----------------------------------------------";
$file_version = File::get_instance($_GET['file_id'], true);
foreach ($file_version_array as $key => $value) {
$file_version->open_internal_revision($value);
$version_datetime_handler = new DatetimeHandler($file_version->get_datetime());
$result[$counter]['version'] = $file_version->get_internal_revision();
$result[$counter]['text'] = "Version " . $file_version->get_version() . " - " . $version_datetime_handler->get_datetime();
$counter++;
}
$template->set_var("version_option", $result);
}
$result = array();
$counter = 0;
foreach ($_GET as $key => $value) {
if ($key != "version") {
$result[$counter]['value'] = $value;
$result[$counter]['key'] = $key;
$counter++;
}
}
$template->set_var("get", $result);
$template->set_var("version", $file->get_version());
$paramquery = $_GET;
$paramquery['action'] = "file_history";
$params = http_build_query($paramquery, '', '&');
$template->set_var("version_list_link", $params);
$template->set_var("title", $file->get_name());
$template->set_var("name", $file->get_name());
$template->set_var("path", $folder->get_object_path());
$template->set_var("size", Convert::convert_byte_1024($file->get_size()));
$template->set_var("size_in_byte", $regional->format_number($file->get_size()));
$create_datetime_handler = new DatetimeHandler($file->get_datetime());
$version_datetime_handler = new DatetimeHandler($file->get_version_datetime());
$template->set_var("creation_datetime", $create_datetime_handler->get_datetime());
$template->set_var("version_datetime", $version_datetime_handler->get_datetime());
$template->set_var("mime_type", $file->get_mime_type());
$template->set_var("owner", $user->get_full_name(false));
$template->set_var("checksum", $file->get_checksum());
$template->set_var("permission", $file->get_permission_string());
$template->set_var("comment", "");
if ($file->is_image() == true) {
$template->set_var("thumbnail_image", "<img src='image.php?session_id=" . $_GET['session_id'] . "&file_id=" . $_GET['file_id'] . "&max_width=340&max_height=350' alt='' />");
} else {
$template->set_var("thumbnail_image", "");
}
$paramquery = array();
$paramquery['username'] = $_GET['username'];
$paramquery['session_id'] = $_GET['session_id'];
$paramquery['file_id'] = $_GET['file_id'];
if ($_GET['version']) {
$paramquery['version'] = $_GET['version'];
}
$params = http_build_query($paramquery, '', '&');
$template->set_var("download_params", $params);
$paramquery = $_GET;
$paramquery['action'] = "file_update";
$paramquery['version'] = $internal_revision;
$paramquery['retrace'] = Retrace::create_retrace_string();
$params = http_build_query($paramquery, '', '&');
$template->set_var("update_params", $params);
$paramquery = $_GET;
$paramquery['action'] = "file_update_minor";
$paramquery['version'] = $file->get_internal_revision();
$paramquery['retrace'] = Retrace::create_retrace_string();
$params = http_build_query($paramquery, '', '&');
$template->set_var("update_minor_params", $params);
$paramquery = $_GET;
$paramquery['action'] = "permission";
$params = http_build_query($paramquery, '', '&');
$template->set_var("set_permission_params", $params);
$template->set_var("write_access", $file->is_write_access());
if ($file->is_control_access() == true or $file->get_owner_id() == $user->get_user_id()) {
$template->set_var("change_permission", true);
} else {
//.........这里部分代码省略.........
示例7: detail
/**
* @throws ProjectIDMissingException
* @throws ProjectSecuriyAccessDeniedException
*/
public static function detail()
{
global $project_security;
if ($_GET['project_id']) {
if ($project_security->is_access(1, false) == true) {
$project = new Project($_GET['project_id']);
$project_owner = new User($project->get_owner_id());
$template = new HTMLTemplate("project/detail.html");
$template->set_var("get_array", serialize($_GET));
$template->set_var("title", $project->get_name());
$template->set_var("owner", $project_owner->get_full_name(false));
$create_datetime = new DatetimeHandler($project->get_datetime());
$template->set_var("created_at", $create_datetime->get_datetime());
$template->set_var("template", $project->get_template_name());
$template->set_var("permissions", "");
$template->set_var("size", Convert::convert_byte_1024($project->get_filesize()));
$template->set_var("quota", Convert::convert_byte_1024($project->get_quota()));
$owner_paramquery = array();
$owner_paramquery['username'] = $_GET['username'];
$owner_paramquery['session_id'] = $_GET['session_id'];
$owner_paramquery['nav'] = "project";
$owner_paramquery['run'] = "common_dialog";
$owner_paramquery['dialog'] = "user_detail";
$owner_paramquery['id'] = $project->get_owner_id();
$owner_params = http_build_query($owner_paramquery, '', '&');
$template->set_var("owner_params", $owner_params);
$template->output();
} else {
throw new ProjectSecurityAccessDeniedxception();
}
} else {
throw new ProjectIDMissingException();
}
}
示例8: get_user_module_detail_setting
/**
* @param integer $user_id
* @return array
*/
public static function get_user_module_detail_setting($user_id)
{
if ($user_id) {
$data_user_data = new DataUserData($user_id);
$paramquery = $_GET;
$paramquery['run'] = "module_value_change";
$paramquery['dialog'] = "user_quota";
$paramquery['retrace'] = Retrace::create_retrace_string();
$params = http_build_query($paramquery, '', '&');
$return_array = array();
$return_array['value'] = Convert::convert_byte_1024($data_user_data->get_quota());
$return_array['params'] = $params;
return $return_array;
} else {
return null;
}
}
示例9: list_data
/**
* @param string $json_column_array
* @param string $json_argument_array
* @param string $css_page_id
* @param string $css_row_sort_id
* @param string $entries_per_page
* @param string $page
* @param string $sortvalue
* @param string $sortmethod
* @return string
* @throws BaseAjaxArgumentMissingException
*/
public static function list_data($json_column_array, $json_argument_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
{
$argument_array = json_decode($json_argument_array);
if (is_array($argument_array)) {
$folder_id = $argument_array[0][1];
$name = $argument_array[1][1];
$list_request = new ListRequest_IO();
$list_request->set_column_array($json_column_array);
if (!is_numeric($entries_per_page) or $entries_per_page < 1) {
$entries_per_page = 20;
}
$list_array = Data_Wrapper::list_search_ffv($folder_id, $name, $sortvalue, $sortmethod, $page * $entries_per_page - $entries_per_page, $page * $entries_per_page);
if (is_array($list_array) and count($list_array) >= 1) {
foreach ($list_array as $key => $value) {
$datetime_handler = new DatetimeHandler($list_array[$key]['datetime']);
$list_array[$key]['datetime'] = $datetime_handler->get_datetime(false);
$owner = new User($value['owner']);
$list_array[$key]['owner'] = $owner->get_full_name(true);
if (is_numeric($value['file_id'])) {
$file = File::get_instance($value['file_id']);
$paramquery = $_GET;
$paramquery['nav'] = "data";
$paramquery['action'] = "file_detail";
$paramquery['file_id'] = $value['file_id'];
unset($paramquery['sortvalue']);
unset($paramquery['sortmethod']);
unset($paramquery['nextpage']);
$params = http_build_query($paramquery, '', '&');
$tmp_name = $value['name'];
unset($list_array[$key]['name']);
$list_array[$key]['name']['content'] = $tmp_name;
if ($file->is_read_access() == true) {
$list_array[$key]['symbol']['link'] = $params;
$list_array[$key]['symbol']['content'] = "<img src='" . File::get_icon_by_name($value['name']) . "' alt='' style='border:0;' />";
$list_array[$key]['name']['link'] = $params;
} else {
$list_array[$key]['symbol']['link'] = "";
$list_array[$key]['symbol']['content'] = "<img src='core/images/denied_overlay.php?image=" . File::get_icon_by_name($value['name']) . "' alt='' border='0' />";
$list_array[$key]['name']['link'] = "";
}
$list_array[$key]['type'] = "File";
$list_array[$key]['version'] = $file->get_version();
$list_array[$key]['size'] = Convert::convert_byte_1024($file->get_size());
$list_array[$key]['permission'] = $file->get_permission_string();
}
if (is_numeric($value['value_id'])) {
$value_obj = Value::get_instance($value['value_id']);
$paramquery = $_GET;
$paramquery['nav'] = "data";
$paramquery['action'] = "value_detail";
$paramquery['value_id'] = $value['value_id'];
unset($paramquery['sortvalue']);
unset($paramquery['sortmethod']);
unset($paramquery['nextpage']);
$params = http_build_query($paramquery, '', '&');
$tmp_name = $value['name'];
unset($list_array[$key]['name']);
$list_array[$key]['name']['content'] = $tmp_name;
if ($value_obj->is_read_access() == true) {
$list_array[$key]['symbol']['link'] = $params;
$list_array[$key]['symbol']['content'] = "<img src='images/fileicons/16/unknown.png' alt='' style='border: 0;'>";
$list_array[$key]['name']['link'] = $params;
} else {
$list_array[$key]['symbol']['link'] = "";
$list_array[$key]['symbol']['content'] = "<img src='core/images/denied_overlay.php?image=images/fileicons/16/unknown.png' alt='' border='0' />";
$list_array[$key]['name']['link'] = "";
}
$list_array[$key]['type'] = "Value";
$list_array[$key]['version'] = $value_obj->get_version();
$list_array[$key]['permission'] = $value_obj->get_permission_string();
}
if (is_numeric($value['folder_id'])) {
$folder = Folder::get_instance($value['folder_id']);
$paramquery = $_GET;
$paramquery['nav'] = "data";
$paramquery['folder_id'] = $value['folder_id'];
unset($paramquery['run']);
unset($paramquery['sortvalue']);
unset($paramquery['sortmethod']);
unset($paramquery['nextpage']);
$params = http_build_query($paramquery, '', '&');
$tmp_name = $value['name'];
unset($list_array[$key]['name']);
$list_array[$key]['name']['content'] = $tmp_name;
if ($folder->is_read_access() == true) {
$list_array[$key]['symbol']['link'] = $params;
$list_array[$key]['symbol']['content'] = "<img src='images/icons/folder.png' alt='' style='border: 0;'>";
$list_array[$key]['name']['link'] = $params;
//.........这里部分代码省略.........