当前位置: 首页>>代码示例>>PHP>>正文


PHP image::get_count方法代码示例

本文整理汇总了PHP中image::get_count方法的典型用法代码示例。如果您正苦于以下问题:PHP image::get_count方法的具体用法?PHP image::get_count怎么用?PHP image::get_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在image的用法示例。


在下文中一共展示了image::get_count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: select

 function select()
 {
     $d = array();
     $id = $this->response->html->request()->get('image_id');
     if ($id !== '') {
         $image = new image();
         $image->get_instance_by_id($id);
         $storage = new storage();
         $storage->get_instance_by_id($image->storageid);
         $resource = new resource();
         $resource->get_instance_by_id($storage->resource_id);
         require_once $this->openqrm->get('basedir') . '/plugins/image-shelf/web/class/imageshelf.class.php';
         $imageshelf = new imageshelf();
         $imageshelf->get_instance_by_id($this->id);
         $file = $this->openqrm->get('basedir') . '/plugins/image-shelf/web/image-lists/' . $imageshelf->name . '/image-shelf.conf';
         if ($this->file->exists($file)) {
             $this->file->remove($file);
         }
         $command = $this->openqrm->get('basedir') . '/plugins/image-shelf/bin/openqrm-image-shelf list';
         $command .= ' -n ' . $imageshelf->name;
         $command .= ' -i ' . $imageshelf->uri;
         $command .= ' -u ' . $imageshelf->user;
         $command .= ' -p ' . $imageshelf->password;
         $command .= ' --openqrm-ui-user ' . $this->user->name;
         $command .= ' --openqrm-cmd-mode background';
         $openqrm_server = new openqrm_server();
         $openqrm_server->send_command($command);
         while (!$this->file->exists($file)) {
             usleep(10000);
             // sleep 10ms to unload the CPU
             clearstatcache();
         }
         sleep(1);
         $distribution = '';
         $lines = explode("\n", $this->file->get_contents($file));
         foreach ($lines as $line) {
             $tmp = explode('|', $line);
             if (isset($tmp[0]) && $tmp[0] === $this->image) {
                 $distribution = $tmp[1];
                 break;
             }
         }
         $command = $this->openqrm->get('basedir') . '/plugins/image-shelf/bin/openqrm-image-shelf get';
         $command .= ' -n ' . $imageshelf->name;
         $command .= ' -i ' . $imageshelf->uri;
         $command .= ' -f ' . $this->image;
         $command .= ' -s ' . $resource->ip . ':' . $image->rootdevice;
         $command .= ' -d ' . $distribution;
         $command .= ' -u ' . $imageshelf->user;
         $command .= ' -p ' . $imageshelf->password;
         $command .= ' -o ' . $this->openqrm->admin()->name . ' -q ' . $this->openqrm->admin()->password;
         $command .= ' --openqrm-ui-user ' . $this->user->name;
         $command .= ' --openqrm-cmd-mode background';
         $openqrm_server->send_command($command);
         $d = sprintf($this->lang['msg'], $image->name, $this->image);
     } else {
         $h = array();
         $h['image_icon']['title'] = ' ';
         $h['image_icon']['sortable'] = false;
         $h['image_id']['title'] = $this->lang['table_id'];
         $h['image_name']['title'] = $this->lang['table_name'];
         $h['image_version']['title'] = $this->lang['table_version'];
         $h['image_type']['title'] = $this->lang['table_deployment'];
         $h['image_isactive']['title'] = $this->lang['table_isactive'];
         $h['image_comment']['title'] = $this->lang['table_comment'];
         $h['image_comment']['sortable'] = false;
         $h['edit']['title'] = ' ';
         $h['edit']['sortable'] = false;
         $image = new image();
         $params = $this->response->get_array($this->actions_name, 'target');
         $b = array();
         $table = $this->response->html->tablebuilder('imageshelf_target', $params);
         $table->offset = 0;
         $table->sort = 'image_id';
         $table->limit = 10;
         $table->order = 'ASC';
         $table->max = $image->get_count();
         $table->init();
         $image_arr = $image->display_overview(0, 10000, $table->sort, $table->order);
         $image_icon = "/openqrm/base/img/image.png";
         foreach ($image_arr as $index => $image_db) {
             // prepare the values for the array
             $image = new image();
             $image->get_instance_by_id($image_db["image_id"]);
             if ($image->type === 'lvm-nfs-deployment' || $image->type === 'nfs-deployment') {
                 $image_comment = $image_db["image_comment"];
                 if (!strlen($image_comment)) {
                     $image_comment = "-";
                 }
                 $image_version = $image_db["image_version"];
                 if (!strlen($image_version)) {
                     $image_version = "-";
                 }
                 // edit
                 $a = $this->response->html->a();
                 $a->title = $this->lang['action_edit'];
                 $a->handler = 'onclick="wait();"';
                 $a->css = 'edit';
                 $a->href = $this->response->get_url($this->actions_name, 'target') . '&image_id=' . $image->id;
                 $image_edit = $a->get_string();
//.........这里部分代码省略.........
开发者ID:kelubo,项目名称:OpenQRM,代码行数:101,代码来源:image-shelf.target.class.php

示例2: imtarget

 function imtarget()
 {
     $h = array();
     $h['image_icon']['title'] = ' ';
     $h['image_icon']['sortable'] = false;
     $h['image_id']['title'] = $this->lang['table_id'];
     $h['image_name']['title'] = $this->lang['table_name'];
     $h['image_version']['title'] = $this->lang['table_version'];
     $h['image_type']['title'] = $this->lang['table_deployment'];
     $h['image_isactive']['title'] = $this->lang['table_isactive'];
     $h['image_comment']['title'] = $this->lang['table_comment'];
     $h['image_comment']['sortable'] = false;
     $h['edit']['title'] = ' ';
     $h['edit']['sortable'] = false;
     $image = new image();
     $params = $this->response->get_array($this->actions_name, 'target');
     $b = array();
     $table = $this->response->html->tablebuilder('hybridcloud_imtarget', $params);
     $table->offset = 0;
     $table->sort = 'image_id';
     $table->limit = 10;
     $table->order = 'ASC';
     $table->max = $image->get_count();
     $table->init();
     $image_arr = $image->display_overview(0, 10000, $table->sort, $table->order);
     $image_icon = "/openqrm/base/img/image.png";
     foreach ($image_arr as $index => $image_db) {
         // prepare the values for the array
         $image = new image();
         $image->get_instance_by_id($image_db["image_id"]);
         if ($image->type === 'lvm-nfs-deployment' || $image->type === 'nfs-deployment') {
             $image_comment = $image_db["image_comment"];
             if (!strlen($image_comment)) {
                 $image_comment = "-";
             }
             $image_version = $image_db["image_version"];
             if (!strlen($image_version)) {
                 $image_version = " ";
             }
             // edit
             $a = $this->response->html->a();
             $a->title = $this->lang['action_import'];
             $a->label = $this->lang['action_import'];
             $a->handler = 'onclick="wait();"';
             $a->css = 'edit';
             $a->href = $this->response->get_url($this->actions_name, 'imparams') . '&image_id=' . $image->id;
             $image_edit = $a->get_string();
             // set the active icon
             $isactive_icon = "/openqrm/base/img/enable.png";
             if ($image_db["image_isactive"] == 1) {
                 $isactive_icon = "/openqrm/base/img/disable.png";
             }
             $image_isactive_icon = "<img src=" . $isactive_icon . " width='24' height='24' alt='State'>";
             $b[] = array('image_icon' => "<img width='24' height='24' src='" . $image_icon . "'>", 'image_id' => $image_db["image_id"], 'image_name' => $image_db["image_name"], 'image_version' => $image_version, 'image_type' => $image_db["image_type"], 'image_isactive' => $image_isactive_icon, 'image_comment' => $image_comment, 'edit' => $image_edit);
         }
     }
     $table->id = 'Tabelle';
     $table->css = 'htmlobject_table';
     $table->border = 1;
     $table->cellspacing = 0;
     $table->cellpadding = 3;
     $table->autosort = false;
     $table->sort_link = false;
     $table->max = count($b);
     $table->head = $h;
     $table->body = $b;
     $table->limit_select = array(array("value" => 10, "text" => 10), array("value" => 20, "text" => 20), array("value" => 30, "text" => 30), array("value" => 50, "text" => 50), array("value" => 100, "text" => 100));
     require_once $this->openqrm->get('basedir') . '/plugins/hybrid-cloud/web/class/hybrid-cloud.class.php';
     $hc = new hybrid_cloud();
     $hc->get_instance_by_id($this->id);
     $d['name'] = $hc->account_name;
     $d['form'] = $this->response->get_form($this->actions_name, 'target', false)->get_elements();
     $d['table'] = $table;
     return $d;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:75,代码来源:hybrid-cloud.imtarget.class.php

示例3: select

 function select()
 {
     $d = array();
     $h = array();
     $h['image_isactive']['title'] = $this->lang['table_isactive'];
     $h['image_id']['title'] = $this->lang['table_id'];
     $h['image_id']['hidden'] = true;
     $h['image_name']['title'] = $this->lang['table_name'];
     $h['image_name']['hidden'] = true;
     $h['image_type']['title'] = $this->lang['table_deployment'];
     $h['image_type']['hidden'] = true;
     $h['image_rootdevice']['title'] = $this->lang['table_root'];
     $h['image_rootdevice']['hidden'] = true;
     $h['image_version']['title'] = $this->lang['table_version'];
     $h['image_version']['hidden'] = true;
     $h['image_capabilities']['title'] = $this->lang['table_capabilities'];
     $h['image_capabilities']['hidden'] = true;
     $h['image_data']['title'] = '&#160;';
     $h['image_data']['sortable'] = false;
     $h['image_comment']['title'] = '&#160;';
     $h['image_comment']['sortable'] = false;
     $h['image_edit']['title'] = '&#160;';
     $h['image_edit']['sortable'] = false;
     $image = new image();
     $params = $this->response->get_array($this->actions_name, 'select');
     $b = array();
     // unset unnecessary params
     unset($params['image[sort]']);
     unset($params['image[order]']);
     unset($params['image[limit]']);
     unset($params['image[offset]']);
     unset($params['image_filter']);
     $table = $this->response->html->tablebuilder('image', $params);
     $table->offset = 0;
     $table->sort = 'image_id';
     $table->limit = 20;
     $table->order = 'ASC';
     $table->max = $image->get_count();
     $table->init();
     // handle table params
     $tps = $table->get_params();
     $tp = '';
     foreach ($tps['image'] as $k => $v) {
         $tp .= '&image[' . $k . ']=' . $v;
     }
     $image_arr = $image->display_overview(0, 10000, $table->sort, $table->order);
     $image_icon = "/openqrm/base/img/image.png";
     foreach ($image_arr as $index => $image_db) {
         if ($this->response->html->request()->get('image_filter') === '' || $this->response->html->request()->get('image_filter') == $image_db["image_type"]) {
             // prepare the values for the array
             $image = new image();
             $image->get_instance_by_id($image_db["image_id"]);
             // edit
             $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') . '&image_id=' . $image->id . '' . $tp;
             $image_edit = $a->get_string();
             // force remove
             $a = $this->response->html->a();
             $a->title = $this->lang['action_remove'];
             $a->label = $this->lang['action_remove'];
             $a->css = 'remove';
             $a->href = $this->response->get_url($this->actions_name, 'remove') . '&image_identifier=' . $image->id . '' . $tp;
             $image_remove = $a->get_string();
             $image_actions = $image_edit;
             // set the active icon
             $isactive_icon = '<span class="pill inactive">' . $this->lang['lang_inactive'] . '</span>';
             if ($image_db["image_isactive"] == 1) {
                 $isactive_icon = '<span class="pill active">' . $this->lang['lang_active'] . '</span>';
             } else {
                 $image_actions .= $image_remove;
             }
             // infos
             $storage = new storage();
             $storage->get_instance_by_id($image_db['image_storageid']);
             $deployment = new deployment();
             $deployment->get_instance_by_id($storage->type);
             $link = $storage->name;
             if ($deployment->storagetype !== 'local-server') {
                 $a = $this->response->html->a();
                 $a->label = $storage->name;
                 $a->handler = 'onclick="wait();"';
                 $a->href = $this->response->html->thisfile . '?plugin=' . $deployment->storagetype . '&' . str_replace('-', '_', $deployment->storagetype) . '_action=edit&storage_id=' . $storage->id;
                 $link = $a->get_string();
             }
             $data = '<div class="data">';
             $data .= '<b>' . $this->lang['table_id'] . '</b>: ' . $image_db["image_id"] . '<br>';
             $data .= '<b>' . $this->lang['table_name'] . '</b>: ' . $image_db["image_name"] . '<br>';
             $data .= '<b>' . $this->lang['table_deployment'] . '</b>: ' . $image_db["image_type"] . '<br>';
             $data .= '<b>' . $this->lang['table_storage'] . '</b>: ' . $link . '<br>';
             if (isset($image_db["image_rootdevice"])) {
                 $root = str_replace($image_db["image_name"], '', $image_db["image_rootdevice"]);
                 // vmware
                 $root = str_replace(':/.vmdk', '', $root);
                 $data .= '<b>' . $this->lang['table_root'] . '</b>: ' . $root . '<br>';
             }
             if (isset($image_db["image_version"])) {
//.........这里部分代码省略.........
开发者ID:kelubo,项目名称:OpenQRM,代码行数:101,代码来源:image.select.class.php


注:本文中的image::get_count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。