本文整理汇总了PHP中Kit::FormatBytes方法的典型用法代码示例。如果您正苦于以下问题:PHP Kit::FormatBytes方法的具体用法?PHP Kit::FormatBytes怎么用?PHP Kit::FormatBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kit
的用法示例。
在下文中一共展示了Kit::FormatBytes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LibraryGrid
/**
* Prints out a Table of all media items
*/
function LibraryGrid()
{
$db =& $this->db;
$user =& $this->user;
$response = new ResponseManager();
//Get the input params and store them
$filter_type = Kit::GetParam('filter_type', _REQUEST, _WORD);
$filter_name = Kit::GetParam('filter_name', _REQUEST, _STRING);
$filterId = Kit::GetParam('filterId', _REQUEST, _INT);
$filter_userid = Kit::GetParam('filter_owner', _REQUEST, _INT);
$filter_retired = Kit::GetParam('filter_retired', _REQUEST, _INT);
$filter_duration_in_seconds = Kit::GetParam('filter_duration_in_seconds', _REQUEST, _CHECKBOX);
$filter_showThumbnail = Kit::GetParam('filter_showThumbnail', _REQUEST, _CHECKBOX);
$showTags = Kit::GetParam('showTags', _REQUEST, _CHECKBOX);
setSession('content', 'filter_type', $filter_type);
setSession('content', 'filter_name', $filter_name);
setSession('content', 'filterId', $filterId);
setSession('content', 'filter_owner', $filter_userid);
setSession('content', 'filter_retired', $filter_retired);
setSession('content', 'filter_duration_in_seconds', $filter_duration_in_seconds);
setSession('content', 'filter_showThumbnail', $filter_showThumbnail);
setSession('content', 'showTags', $showTags);
setSession('content', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
// Reset the mediaId filter if it is empty (we have to do this after we have stored it in the session)
$filterId = $filterId == 0 ? -1 : $filterId;
// Construct the SQL
$mediaList = $user->MediaList(NULL, array('type' => $filter_type, 'name' => $filter_name, 'mediaId' => $filterId, 'ownerid' => $filter_userid, 'retired' => $filter_retired, 'showTags' => $showTags));
$cols = array();
$cols[] = array('name' => 'mediaid', 'title' => __('ID'));
$cols[] = array('name' => 'tags', 'title' => __('Tag'), 'hidden' => $showTags == 0, 'colClass' => 'group-word');
$cols[] = array('name' => 'media', 'title' => __('Name'));
$cols[] = array('name' => 'mediatype', 'title' => __('Type'));
if ($filter_showThumbnail == 1) {
$cols[] = array('name' => 'thumbnail', 'title' => __('Thumbnail'));
}
$cols[] = array('name' => 'duration_text', 'title' => __('Duration'));
$cols[] = array('name' => 'size_text', 'title' => __('Size'), 'sorter' => 'filesize');
$cols[] = array('name' => 'owner', 'title' => __('Owner'));
$cols[] = array('name' => 'permissions', 'title' => __('Permissions'));
$cols[] = array('name' => 'revised', 'title' => __('Revised?'), 'icons' => true);
$cols[] = array('name' => 'filename', 'title' => __('File Name'));
Theme::Set('table_cols', $cols);
$rows = array();
// Add some additional row content
foreach ($mediaList as $row) {
$row['duration_text'] = $filter_duration_in_seconds == 1 ? $row['duration'] : sec2hms($row['duration']);
$row['owner'] = $user->getNameFromID($row['ownerid']);
$row['permissions'] = $group = $this->GroupsForMedia($row['mediaid']);
$row['revised'] = $row['parentid'] != 0 ? 1 : 0;
// Display a friendly file size
$row['size_text'] = Kit::FormatBytes($row['filesize']);
// Thumbnail URL
$row['thumbnail'] = '';
if ($row['mediatype'] == 'image') {
$row['thumbnail'] = '<a class="img-replace" data-toggle="lightbox" data-type="image" data-img-src="index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid=' . $row['mediaid'] . '&width=100&height=100&dynamic=true&thumb=true" href="index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid=' . $row['mediaid'] . '"><i class="fa fa-file-image-o"></i></a>';
}
$row['buttons'] = array();
// Buttons
if ($row['edit'] == 1) {
// Edit
$row['buttons'][] = array('id' => 'content_button_edit', 'url' => 'index.php?p=module&mod=' . $row['mediatype'] . '&q=Exec&method=EditForm&mediaid=' . $row['mediaid'], 'text' => __('Edit'));
}
if ($row['del'] == 1) {
// Delete
$row['buttons'][] = array('id' => 'content_button_delete', 'url' => 'index.php?p=module&mod=' . $row['mediatype'] . '&q=Exec&method=DeleteForm&mediaid=' . $row['mediaid'], 'text' => __('Delete'));
}
if ($row['modifyPermissions'] == 1) {
// Permissions
$row['buttons'][] = array('id' => 'content_button_permissions', 'url' => 'index.php?p=module&mod=' . $row['mediatype'] . '&q=Exec&method=PermissionsForm&mediaid=' . $row['mediaid'], 'text' => __('Permissions'));
}
// Download
$row['buttons'][] = array('id' => 'content_button_download', 'linkType' => '_self', 'url' => 'index.php?p=module&mod=' . $row['mediatype'] . '&q=Exec&method=GetResource&download=1&downloadFromLibrary=1&mediaid=' . $row['mediaid'], 'text' => __('Download'));
// Add to the collection
$rows[] = $row;
}
Theme::Set('table_rows', $rows);
$output = Theme::RenderReturn('table_render');
$response->SetGridResponse($output);
$response->initialSortColumn = 2;
$response->Respond();
}
示例2: LibraryGrid
/**
* Prints out a Table of all media items
*/
function LibraryGrid()
{
$db =& $this->db;
$user =& $this->user;
$response = new ResponseManager();
//Get the input params and store them
$filter_type = Kit::GetParam('filter_type', _REQUEST, _WORD);
$filter_name = Kit::GetParam('filter_name', _REQUEST, _STRING);
$filter_userid = Kit::GetParam('filter_owner', _REQUEST, _INT);
$filter_retired = Kit::GetParam('filter_retired', _REQUEST, _INT);
$filter_duration_in_seconds = Kit::GetParam('filter_duration_in_seconds', _REQUEST, _CHECKBOX);
setSession('content', 'filter_type', $filter_type);
setSession('content', 'filter_name', $filter_name);
setSession('content', 'filter_owner', $filter_userid);
setSession('content', 'filter_retired', $filter_retired);
setSession('content', 'filter_duration_in_seconds', $filter_duration_in_seconds);
setSession('content', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
// Construct the SQL
$mediaList = $user->MediaList($filter_type, $filter_name, $filter_userid, $filter_retired);
$rows = array();
// Add some additional row content
foreach ($mediaList as $row) {
$row['duration_text'] = $filter_duration_in_seconds == 1 ? $row['duration'] : sec2hms($row['duration']);
$row['owner'] = $user->getNameFromID($row['ownerid']);
$row['permissions'] = $group = $this->GroupsForMedia($row['mediaid']);
$row['revised'] = $row['parentid'] != 0 ? Theme::Image('act.gif') : '';
// Display a friendly file size
$row['size_text'] = Kit::FormatBytes($row['filesize']);
$row['buttons'] = array();
// Buttons
if ($row['edit'] == 1) {
// Edit
$row['buttons'][] = array('id' => 'content_button_edit', 'url' => 'index.php?p=module&mod=' . $row['mediatype'] . '&q=Exec&method=EditForm&mediaid=' . $row['mediaid'], 'text' => __('Edit'));
}
if ($row['del'] == 1) {
// Delete
$row['buttons'][] = array('id' => 'content_button_delete', 'url' => 'index.php?p=module&mod=' . $row['mediatype'] . '&q=Exec&method=DeleteForm&mediaid=' . $row['mediaid'], 'text' => __('Delete'));
}
if ($row['modifyPermissions'] == 1) {
// Permissions
$row['buttons'][] = array('id' => 'content_button_permissions', 'url' => 'index.php?p=module&mod=' . $row['mediatype'] . '&q=Exec&method=PermissionsForm&mediaid=' . $row['mediaid'], 'text' => __('Permissions'));
}
// Download
$row['buttons'][] = array('id' => 'content_button_download', 'url' => 'index.php?p=module&mod=' . $row['mediatype'] . '&q=Exec&method=GetResource&download=1&mediaid=' . $row['mediaid'], 'text' => __('Download'));
// Add to the collection
$rows[] = $row;
}
Theme::Set('table_rows', $rows);
$output = Theme::RenderReturn('library_page_grid');
$response->SetGridResponse($output);
$response->initialSortColumn = 2;
$response->Respond();
}