本文整理汇总了PHP中storage::get_count方法的典型用法代码示例。如果您正苦于以下问题:PHP storage::get_count方法的具体用法?PHP storage::get_count怎么用?PHP storage::get_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类storage
的用法示例。
在下文中一共展示了storage::get_count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: select
function select()
{
// set ENV
$deployment = new deployment();
$storage = new storage();
$resource = new resource();
$type = $this->response->html->request()->get('storage_type');
if ($type === '') {
$type = 'kvm';
}
$deployment->get_instance_by_type($type);
$storages = $storage->display_overview(0, $storage->get_count(), 'storage_id', 'ASC');
$b = array();
if (count($storages) >= 1) {
foreach ($storages as $k => $v) {
$storage->get_instance_by_id($v["storage_id"]);
$resource->get_instance_by_id($storage->resource_id);
$deployment->get_instance_by_id($storage->type);
if ($deployment->storagetype === 'kvm') {
$resource_icon_default = "/img/resource.png";
$storage_icon = "/plugins/kvm/img/plugin.png";
$state_icon = $this->openqrm->get('baseurl') . "/img/" . $resource->state . ".png";
if ($this->file->exists($this->openqrm->get('webdir') . $storage_icon)) {
$resource_icon_default = $storage_icon;
}
$resource_icon_default = $this->openqrm->get('baseurl') . $resource_icon_default;
$a = $this->response->html->a();
$a->title = $this->lang['action_edit'];
$a->label = $this->lang['action_edit'];
$a->handler = 'onclick="wait();"';
$a->css = 'edit';
$a->href = $this->response->get_url($this->actions_name, "edit") . '&storage_id=' . $storage->id;
$data = '<b>' . $this->lang['table_recource'] . ':</b> ' . $resource->id . ' / ' . $resource->ip . '<br>';
$data .= '<b>' . $this->lang['table_type'] . ':</b> ' . $deployment->storagetype . '<br>';
$data .= '<b>' . $this->lang['table_deployment'] . ':</b> ' . $deployment->storagedescription . '<br>';
$b[] = array('state' => '<img width="24" height="24" src="' . $state_icon . '" alt="State">', 'icon' => '<img width="24" height="24" src="' . $resource_icon_default . '" alt="Icon">', 'storage_id' => $storage->id, 'name' => $storage->name, 'storage_resource_id' => $storage->resource_id, 'deployment' => $deployment->storagedescription, 'data' => $data, 'comment' => '', 'edit' => $a->get_string());
}
}
$h = array();
$h['state'] = array();
$h['state']['title'] = ' ';
$h['state']['sortable'] = false;
$h['icon'] = array();
$h['icon']['title'] = ' ';
$h['icon']['sortable'] = false;
$h['storage_id'] = array();
$h['storage_id']['title'] = $this->lang['table_id'];
$h['name'] = array();
$h['name']['title'] = $this->lang['table_name'];
$h['storage_resource_id'] = array();
$h['storage_resource_id']['title'] = $this->lang['table_recource'];
$h['storage_resource_id']['hidden'] = true;
$h['data'] = array();
$h['data']['title'] = ' ';
$h['data']['sortable'] = false;
$h['deployment'] = array();
$h['deployment']['title'] = $this->lang['table_deployment'];
$h['deployment']['hidden'] = true;
$h['comment'] = array();
$h['comment']['title'] = ' ';
$h['comment']['sortable'] = false;
$h['edit'] = array();
$h['edit']['title'] = ' ';
$h['edit']['sortable'] = false;
$table = $this->response->html->tablebuilder('kvm', $this->response->get_array($this->actions_name, 'select'));
$table->sort = 'storage_id';
$table->limit = 10;
$table->offset = 0;
$table->order = 'ASC';
$table->max = count($b);
$table->autosort = false;
$table->sort_link = false;
$table->autosort = true;
$table->id = 'Tabelle';
$table->css = 'htmlobject_table';
$table->border = 1;
$table->cellspacing = 0;
$table->cellpadding = 3;
$table->form_action = $this->response->html->thisfile;
$table->head = $h;
$table->body = $b;
return $table->get_string();
} else {
$a = $this->response->html->a();
$a->title = $this->lang['new_storage'];
$a->label = $this->lang['new_storage'];
$a->handler = 'onclick="wait();"';
$a->css = 'add';
$a->href = $this->response->html->thisfile . '?base=storage&storage_action=add';
$box = $this->response->html->div();
$box->id = 'Tabelle';
$box->css = 'htmlobject_box';
$content = $this->lang['error_no_storage'] . '<br><br>';
$content .= $a->get_string();
$box->add($content);
return $box->get_string();
}
}
示例2: select
function select()
{
$d = array();
$h = array();
$h['storage_state']['title'] = $this->lang['table_state'];
$h['storage_state']['sortable'] = false;
$h['storage_id']['title'] = $this->lang['table_id'];
$h['storage_id']['hidden'] = true;
$h['storage_name']['title'] = $this->lang['table_name'];
$h['storage_name']['hidden'] = true;
$h['storage_resource_id']['title'] = $this->lang['table_resource'];
$h['storage_resource_id']['hidden'] = true;
$h['storage_type']['title'] = $this->lang['table_type'];
$h['storage_type']['hidden'] = true;
$h['data']['title'] = ' ';
$h['data']['sortable'] = false;
$h['storage_comment']['title'] = ' ';
$h['storage_comment']['sortable'] = false;
$h['storage_edit']['title'] = ' ';
$h['storage_edit']['sortable'] = false;
$storage = new storage();
$params = $this->response->get_array($this->actions_name, 'select');
$b = array();
unset($params['storage_filter']);
$table = $this->response->html->tablebuilder('storage', $params);
$table->offset = 0;
$table->sort = 'storage_id';
$table->limit = 20;
$table->order = 'ASC';
$table->max = $storage->get_count();
$table->init();
$storages = $storage->display_overview(0, 10000, $table->sort, $table->order);
// handle table params
$tps = $table->get_params();
$tp = '';
foreach ($tps['storage'] as $k => $v) {
$tp .= '&storage[' . $k . ']=' . $v;
}
$i = 0;
$deployment = new deployment();
foreach ($storages as $key => $value) {
$storage = new storage();
$storage->get_instance_by_id($value["storage_id"]);
$resource = new resource();
$resource->get_instance_by_id($storage->resource_id);
$deployment = new deployment();
$deployment->get_instance_by_id($storage->type);
$resource_icon_default = "/img/resource.png";
$storage_icon = '/plugins/' . $deployment->storagetype . '/img/plugin.png';
$state_icon = '<span class="pill ' . $resource->state . '">' . $resource->state . '</span>';
if ($this->file->exists($this->openqrm->get('webdir') . $storage_icon)) {
$resource_icon_default = $storage_icon;
}
$resource_icon_default = $this->openqrm->get('baseurl') . $resource_icon_default;
$data = '<b>' . $this->lang['table_id'] . ':</b> ' . $value["storage_id"] . '<br>';
$data .= '<b>' . $this->lang['table_name'] . ':</b> ' . $value["storage_name"] . '<br>';
$data .= '<b>' . $this->lang['table_resource'] . ':</b> ' . $resource->id . ' / ' . $resource->ip . '<br>';
$data .= '<b>' . $this->lang['table_type'] . ':</b> ' . $deployment->storagetype . '<br>';
$data .= '<b>' . $this->lang['table_deployment'] . ':</b> ' . $deployment->storagedescription;
$a = $this->response->html->a();
$a->title = $this->lang['action_edit'];
$a->label = $this->lang['action_edit'];
$a->handler = 'onclick="wait();"';
$a->css = 'edit';
$a->href = $this->response->get_url($this->actions_name, "edit") . '&storage_id=' . $storage->id . '' . $tp;
$edit = $a->get_string();
#$url = $this->openqrm->get('baseurl').'/index.php?plugin='.$deployment->storagetype.'&'.str_replace('-', '_',$deployment->storagetype).'_action=edit&storage_id='.$value["storage_id"];
$url = $this->response->get_url($this->actions_name, 'load') . '&splugin=' . $deployment->storagetype . '&' . str_replace('-', '_', $deployment->storagetype) . '_action=edit&storage_id=' . $value["storage_id"];
if ($deployment->storagetype === 'equallogic-storage' || $deployment->storagetype === 'netapp-storage' || $deployment->storagetype === 'vbox') {
$url = $this->openqrm->get('baseurl') . '/index.php?plugin=' . $deployment->storagetype . '¤ttab=tab0&action=select&identifier[]=' . $storage->id;
}
$a = $this->response->html->a();
$a->title = $this->lang['action_mgmt'];
$a->label = $this->lang['action_mgmt'];
$a->handler = 'onclick="wait();"';
$a->css = 'manage';
$a->href = $url;
// no mgmt for local-server resources
if (strstr($storage->capabilities, "TYPE=local-server")) {
$mgmt = ' ';
} else {
$mgmt = $a->get_string();
}
if ($this->response->html->request()->get('storage_filter') === '' || strstr($this->response->html->request()->get('storage_filter'), $deployment->storagetype)) {
$b[] = array('storage_state' => $state_icon, 'storage_id' => $value["storage_id"], 'storage_name' => $value["storage_name"], 'storage_type' => '', 'storage_resource_id' => "", 'data' => $data, 'storage_comment' => $value["storage_comment"], 'storage_edit' => $edit . $mgmt);
}
$i++;
}
$list = $deployment->get_storagetype_list();
$filter = array();
$filter[] = array('', '');
foreach ($list as $l) {
$filter[] = array($l['value'], ucfirst($l['label']));
}
asort($filter);
$select = $this->response->html->select();
$select->add($filter, array(0, 1));
$select->name = 'storage_filter';
$select->handler = 'onchange="wait();this.form.submit();return false;"';
$select->selected = array($this->response->html->request()->get('storage_filter'));
//.........这里部分代码省略.........