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


PHP Toolbox::getSize方法代码示例

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


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

示例1: fileScript

 /**
  * fileScript : file upload script
  *
  * @since version 0.85
  *
  * @param $options   array of possible options:
  *     - imagePaste        boolean  image paste with tinyMce
  *     - name              string   field name (default filename)
  *     - multiple          boolean  allow multiple file upload (default false)
  *     - onlyimages        boolean  restrict to image files (default false)
  *     - showfilecontainer string   DOM ID of the container showing file uploaded:
  *                                  use selector to display
  *     - pasteZone         string   DOM ID of the paste zone
  *     - dropZone          string   DOM ID of the drop zone
  *     - rand              string   already computed rand value
  *
  * @return nothing (print the image paste)
  **/
 static function fileScript($options = array())
 {
     global $CFG_GLPI;
     $randupload = mt_rand();
     $p['imagePaste'] = 0;
     $p['name'] = 'filename';
     $p['multiple'] = false;
     $p['onlyimages'] = false;
     $p['showfilecontainer'] = '';
     $p['pasteZone'] = false;
     $p['dropZone'] = 'dropdoc' . $randupload;
     $p['rand'] = $randupload;
     $p['values'] = array();
     if (is_array($options) && count($options)) {
         foreach ($options as $key => $val) {
             $p[$key] = $val;
         }
     }
     $script = "fileindex" . $p['rand'] . " = 0;\n         function uploadFile" . $p['rand'] . "() {\n            \$('#fileupload" . $p['rand'] . "').fileupload({\n               //forceIframeTransport: true,\n               //replaceFileInput: false,\n               dataType: 'json',";
     if ($p['pasteZone'] != false) {
         $script .= "pasteZone : \$('#" . $p['pasteZone'] . "'),";
     } else {
         if (!$p['imagePaste']) {
             $script .= "pasteZone : false,";
         }
     }
     if ($p['dropZone'] != false) {
         $script .= "dropZone : \$('#" . $p['dropZone'] . "'),";
     } else {
         $script .= "dropZone : false,";
     }
     if ($p['onlyimages']) {
         $script .= "acceptFileTypes: '/(\\.|\\/)(gif|jpe?g|png)\$/i',";
     }
     $script .= "   progressall: function (e, data) {\n                        var progress = parseInt(data.loaded / data.total * 100, 10);\n                        \$('#progress" . $p['rand'] . "').show();\n                        \$('#progress" . $p['rand'] . " .uploadbar').css({\n                              'width':progress + '%'\n                        });\n                        \$('#progress" . $p['rand'] . " .uploadbar').text(progress + '%').show().delay(5000).fadeOut('slow');\n                  },\n               send: function (e, data) {\n                  if (1==" . ($p['imagePaste'] ? 1 : 0) . "\n                     && tinyMCE != undefined\n                     && tinyMCE.imagePaste != undefined\n                     && tinyMCE.imagePaste.pasteddata == undefined\n                     && tinyMCE.imagePaste.stockimage == undefined) {\n\n                     if (!tinyMCE.isIE) {\n                        var reader = new FileReader();\n                        reader.readAsDataURL(data.originalFiles[0]);//Convert the blob from clipboard to base64\n                        reader.onloadend = function(e){\n                           \$('#desc_paste_image').html(e.target.result);\n                           tinyMCE.imagePaste.processpaste(\$('#desc_paste_image'),\n                                                           '" . _sx('button', 'Paste image') . "',\n                                                           data.originalFiles[0]);\n                        }\n                     }\n                     return false\n                  }\n               },\n               done: function (e, data) {\n                     var filedata = data;\n                     // Load image tag, and display image uploaded\n                     \$.ajax({\n                        type: 'POST',\n                        url: '" . $CFG_GLPI['root_doc'] . "/ajax/getFileTag.php',\n                        data: {'data':data.result." . $p['name'] . "},\n                        dataType: 'JSON',\n                        success: function(tag){\n                           \$.each(filedata.result." . $p['name'] . ", function (index, file) {\n                              if (file.error == undefined) {\n\n                                 displayUploadedFile" . $p['rand'] . "(file,tag[index]);\n                                 ";
     if ($p['imagePaste']) {
         $script .= "             // Insert tag in textarea\n                                 if (tinyMCE != undefined) {\n\n                                    tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<p>'+tag[index].tag+'</p>');\n\n                                    if (tinyMCE.imagePaste != undefined) {\n                                       tinyMCE.imagePaste.pasteddata = undefined;\n                                       tinyMCE.imagePaste.stockimage = undefined;\n                                    }\n                                 }\n";
     }
     $script .= "                 \$('#progress" . $p['rand'] . " .uploadbar').text('" . __('Upload successful') . "');\n\n                                 \$('#progress" . $p['rand'] . " .uploadbar').css('width', '100%');\n\n                              } else {\n\n                                 \$('#progress" . $p['rand'] . " .uploadbar').text(file.error);\n\n                                 \$('#progress" . $p['rand'] . " .uploadbar').css('width', '100%');\n\n                              }\n                           });\n                        }\n                    });\n\n               }\n            });\n         };\n\n         function displayUploadedFile" . $p['rand'] . "(file, tag){\n            var p = \$('<p/>').attr('id',file.id).html('<b>" . __('File') . " : </b>'+file.display+' <b>" . __('Tag') . " : </b>'+tag.tag+' ').appendTo('#" . $p['showfilecontainer'] . "');\n\n            var p2 = \$('<p/>').attr('id',file.id+'2').css({'display':'none'}).appendTo('#" . $p['showfilecontainer'] . "');\n\n\n            // File\n            \$('<input/>').attr('type', 'hidden').attr('name', '_" . $p['name'] . "['+fileindex" . $p['rand'] . "+']').attr('value',file.name).appendTo(p);\n\n\n            // Tag\n            \$('<input/>').attr('type', 'hidden').attr('name', '_tag_" . $p['name'] . "['+fileindex" . $p['rand'] . "+']').attr('value', tag.name).appendTo(p);\n\n\n            // Coordinates\n            if (tinyMCE != undefined\n                  && tinyMCE.imagePaste != undefined\n                  && (tinyMCE.imagePaste.imageCoordinates != undefined || tinyMCE.imagePaste.imageCoordinates != null)) {\n               \$('<input/>').attr('type', 'hidden').attr('name', '_coordinates['+fileindex" . $p['rand'] . "+']').attr('value', encodeURIComponent(JSON.stringify(tinyMCE.imagePaste.imageCoordinates))).appendTo(p2);\n               tinyMCE.imagePaste.imageCoordinates = null;\n            }\n\n            // Delete button\n            var elementsIdToRemove = {0:file.id, 1:file.id+'2'};\n            \$('<img src=\"" . $CFG_GLPI['root_doc'] . "/pics/delete.png\" class=\"pointer\">').click(function(){\n\n               deleteImagePasted(elementsIdToRemove, tag.tag);\n\n            }).appendTo(p);\n\n            ";
     if ($p['multiple']) {
         $script .= "             fileindex" . $p['rand'] . " = fileindex" . $p['rand'] . "+1;\n";
     }
     $script .= "}\n         function deleteImagePasted(elementsIdToRemove, tagToRemove){\n\n            // Remove file display lines\n            \$.each(elementsIdToRemove, function (index, id) {\n\n                \$('#'+id).remove();\n\n            });\n\n            ";
     if ($p['imagePaste']) {
         $script .= "\n            // TINYMCE : Remove tag from textarea\n            if (tinyMCE != undefined) {\n               tinyMCE.activeEditor.setContent(tinyMCE.activeEditor.getContent().replace('<p>'+tagToRemove+'</p>', ''));\n\n            }";
     }
     $script .= "\n            // File counter\n            if (fileindex" . $p['rand'] . " > 0) {\n\n               fileindex" . $p['rand'] . "--;\n\n            }\n         };\n";
     if (is_array($p['values']) && isset($p['values']['filename']) && is_array($p['values']['filename']) && count($p['values']['filename'])) {
         foreach ($p['values']['filename'] as $key => $name) {
             if (isset($p['values']['tag'][$key])) {
                 $file = GLPI_TMP_DIR . '/' . $p['values']['filename'][$key];
                 if (file_exists($file)) {
                     $display = sprintf('%1$s %2$s', $p['values']['filename'][$key], Toolbox::getSize(filesize($file)));
                     $script .= "var tag{$key} = {};\n                              tag{$key}.tag = '" . $p['values']['tag'][$key] . "';\n                              tag{$key}.name = '#" . $p['values']['tag'][$key] . "#';\n                              var file{$key}= {};\n                              file{$key}.name = '" . addslashes($p['values']['filename'][$key]) . "'\n                              file{$key}.display = '" . addslashes($display) . "';\n                              file{$key}.id = 'file{$key}';\n                              displayUploadedFile" . $p['rand'] . "(file{$key}, tag{$key});\n                              ";
                 }
             }
         }
     }
     return $script;
 }
开发者ID:OlivierLM,项目名称:glpi,代码行数:78,代码来源:html.class.php

示例2: array

// Load Language file
Session::loadLanguage();
include_once GLPI_ROOT . '/lib/jqueryplugins/jquery-file-upload/server/php/UploadHandler.php';
$errors = array(1 => __('The uploaded file exceeds the upload_max_filesize directive in php.ini'), 2 => __('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'), 3 => __('The uploaded file was only partially uploaded'), 4 => __('No file was uploaded'), 6 => __('Missing a temporary folder'), 7 => __('Failed to write file to disk'), 8 => __('A PHP extension stopped the file upload'), 'post_max_size' => __('The uploaded file exceeds the post_max_size directive in php.ini'), 'max_file_size' => __('File is too big'), 'min_file_size' => __('File is too small'), 'accept_file_types' => __('Filetype not allowed'), 'max_number_of_files' => __('Maximum number of files exceeded'), 'max_width' => __('Image exceeds maximum width'), 'min_width' => __('Image requires a minimum width'), 'max_height' => __('Image exceeds maximum height'), 'min_height' => __('Image requires a minimum height'));
$upload_dir = GLPI_TMP_DIR . '/';
$upload_handler = new UploadHandler(array('upload_dir' => $upload_dir, 'param_name' => $_GET['name'], 'orient_image' => false, 'image_versions' => array()), false, $errors);
$response = $upload_handler->post(false);
// clean compute display filesize
if (isset($response[$_GET['name']]) && is_array($response[$_GET['name']])) {
    foreach ($response[$_GET['name']] as $key => &$val) {
        if (Document::isValidDoc(addslashes($val->name))) {
            if (isset($val->name)) {
                $val->display = $val->name;
            }
            if (isset($val->size)) {
                $val->filesize = Toolbox::getSize($val->size);
                if (isset($_GET['showfilesize']) && $_GET['showfilesize']) {
                    $val->display = sprintf('%1$s %2$s', $val->display, $val->filesize);
                }
            }
        } else {
            // Unlink file
            $val->error = $errors['accept_file_types'];
            if (file_exists($upload_dir . $val->name)) {
                @unlink($upload_dir . $val->name);
            }
        }
        $val->id = 'doc' . $_GET['name'] . mt_rand();
    }
}
// Ajout du Doc + generation tag + autre traitement
开发者ID:stweil,项目名称:glpi,代码行数:31,代码来源:fileupload.php

示例3: getRecursiveAttached

 /**
  * Private function : Recursivly get attached documents
  *
  * @param $mid          message id
  * @param $path         temporary path
  * @param $maxsize      of document to be retrieved
  * @param $structure    of the message or part
  * @param $part         part for recursive
  *
  * Result is stored in $this->files
  **/
 function getRecursiveAttached($mid, $path, $maxsize, $structure, $part = "")
 {
     if ($structure->type == 1) {
         // multipart
         reset($structure->parts);
         while (list($index, $sub) = each($structure->parts)) {
             $this->getRecursiveAttached($mid, $path, $maxsize, $sub, $part ? $part . "." . ($index + 1) : $index + 1);
         }
     } else {
         $filename = '';
         if ($structure->ifdparameters) {
             // get filename of attachment if present
             // if there are any dparameters present in this part
             if (count($structure->dparameters) > 0) {
                 foreach ($structure->dparameters as $dparam) {
                     if (Toolbox::strtoupper($dparam->attribute) == 'NAME' || Toolbox::strtoupper($dparam->attribute) == 'FILENAME') {
                         $filename = $dparam->value;
                     }
                 }
             }
         }
         //if no filename found
         if (empty($filename) && $structure->ifparameters) {
             // if there are any parameters present in this part
             if (count($structure->parameters) > 0) {
                 foreach ($structure->parameters as $param) {
                     if (Toolbox::strtoupper($param->attribute) == 'NAME' || Toolbox::strtoupper($param->attribute) == 'FILENAME') {
                         $filename = $param->value;
                     }
                 }
             }
         }
         if (empty($filename) && $structure->type == 5 && $structure->subtype) {
             // Embeded image come without filename - generate trivial one
             $filename = "image_{$part}." . $structure->subtype;
         }
         // if no filename found, ignore this part
         if (empty($filename)) {
             return false;
         }
         //try to avoid conflict between inline image and attachment
         $i = 2;
         while (in_array($filename, $this->files)) {
             //replace filename with name_(num).EXT by name_(num+1).EXT
             $new_filename = preg_replace("/(.*)_([0-9])*(\\.[a-zA-Z0-9]*)\$/", "\$1_" . $i . "\$3", $filename);
             if ($new_filename !== $filename) {
                 $filename = $new_filename;
             } else {
                 //the previous regex didn't found _num pattern, so add it with this one
                 $filename = preg_replace("/(.*)(\\.[a-zA-Z0-9]*)\$/", "\$1_" . $i . "\$2", $filename);
             }
             $i++;
         }
         $filename = $this->decodeMimeString($filename);
         if ($structure->bytes > $maxsize) {
             $this->addtobody .= "\n\n" . sprintf(__('%1$s: %2$s'), __('Too large attached file'), sprintf(__('%1$s (%2$s)'), $filename, Toolbox::getSize($structure->bytes)));
             return false;
         }
         if (!Document::isValidDoc($filename)) {
             //TRANS: %1$s is the filename and %2$s its mime type
             $this->addtobody .= "\n\n" . sprintf(__('%1$s: %2$s'), __('Invalid attached file'), sprintf(__('%1$s (%2$s)'), $filename, $this->get_mime_type($structure)));
             return false;
         }
         if ($message = imap_fetchbody($this->marubox, $mid, $part)) {
             switch ($structure->encoding) {
                 case 1:
                     $message = imap_8bit($message);
                     break;
                 case 2:
                     $message = imap_binary($message);
                     break;
                 case 3:
                     $message = imap_base64($message);
                     break;
                 case 4:
                     $message = quoted_printable_decode($message);
                     break;
             }
             if (file_put_contents($path . $filename, $message)) {
                 $this->files[$filename] = $filename;
                 // If embeded image, we add a tag
                 if ($structure->type == 5 && $structure->subtype) {
                     end($this->files);
                     $tag = Rule::getUuid();
                     $this->tags[$filename] = $tag;
                     // Link file based on id
                     if (isset($structure->id)) {
                         $clean = array('<' => '', '>' => '');
                         $this->altfiles[strtr($structure->id, $clean)] = $filename;
//.........这里部分代码省略.........
开发者ID:remicollet,项目名称:glpi,代码行数:101,代码来源:mailcollector.class.php

示例4: showPerformanceInformations

 /**
  * Display a report about system performance
  * - opcode cache (opcache)
  * - user data cache (apcu / apcu-bc)
  *
  * @since 9.1
  **/
 function showPerformanceInformations()
 {
     global $CFG_GLPI;
     if (!Config::canUpdate()) {
         return false;
     }
     echo "<div class='center' id='tabsbody'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='4'>" . __('PHP opcode cache') . "</th></tr>";
     $ext = 'Zend OPcache';
     if (extension_loaded($ext) && ($info = opcache_get_status(false))) {
         echo "<tr><td>" . sprintf(__('The "%s" extension is installed'), $ext) . "</td>\n               <td>" . phpversion($ext) . "</td>\n               <td></td>\n               <td><img src='" . $CFG_GLPI['root_doc'] . "/pics/ok_min.png' alt='{$ext}'></td></tr>";
         // echo "<tr><td><pre>".print_r($info, true)."</pre></td></tr>";
         // Memory
         $used = $info['memory_usage']['used_memory'];
         $free = $info['memory_usage']['free_memory'];
         $rate = round(100.0 * $used / ($used + $free));
         $max = Toolbox::getSize($used + $free);
         $used = Toolbox::getSize($used);
         echo "<tr><td>" . __('Memory') . "</td>\n               <td>" . sprintf(__('%1$s / %2$s'), $used, $max) . "</td><td>";
         Html::displayProgressBar('100', $rate, array('simple' => true, 'forcepadding' => false));
         echo "</td><td><img src='" . $CFG_GLPI['root_doc'] . "/pics/" . ($rate > 5 && $rate < 75 ? 'ok_min.png' : 'ko_min.png') . "' alt='{$ext}'></td></tr>";
         // Hits
         $hits = $info['opcache_statistics']['hits'];
         $miss = $info['opcache_statistics']['misses'];
         $max = $hits + $miss;
         $rate = round($info['opcache_statistics']['opcache_hit_rate']);
         echo "<tr><td>" . __('Hits rate') . "</td>\n               <td>" . sprintf(__('%1$s / %2$s'), $hits, $max) . "</td><td>";
         Html::displayProgressBar('100', $rate, array('simple' => true, 'forcepadding' => false));
         echo "</td><td><img src='" . $CFG_GLPI['root_doc'] . "/pics/" . ($rate > 90 ? 'ok_min.png' : 'ko_min.png') . "' alt='{$ext}'></td></tr>";
         // Restart (1 seems ok, can happen)
         $max = $info['opcache_statistics']['oom_restarts'];
         echo "<tr><td>" . __('Out of memory restart') . "</td>\n               <td>{$max}</td><td>";
         echo "</td><td><img src='" . $CFG_GLPI['root_doc'] . "/pics/" . ($max < 2 ? 'ok_min.png' : 'ko_min.png') . "' alt='{$ext}'></td></tr>";
         if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
             echo "<tr><td></td><td colspan='3'>";
             echo "<a class='vsubmit' href='config.form.php?reset_opcache=1'>";
             _e('Reset');
             echo "</a></td></tr>\n";
         }
     } else {
         echo "<tr><td>" . sprintf(__('Installing and enabling the "%s" extension may improve GLPI performance'), $ext) . "</td>\n               <td></td>\n               <td><img src='" . $CFG_GLPI['root_doc'] . "/pics/ko_min.png' alt='{$ext}'></td></tr>";
     }
     echo "<tr><th colspan='4'>" . __('User data cache') . "</th></tr>";
     $ext = PHP_MAJOR_VERSION < 7 ? 'APCu' : 'apcu-bc';
     if (function_exists('apc_fetch')) {
         echo "<tr><td>" . sprintf(__('The "%s" extension is installed'), $ext) . "</td>\n               <td>" . phpversion('apc') . "</td>\n               <td></td>\n               <td><img src='" . $CFG_GLPI['root_doc'] . "/pics/ok_min.png' alt='{$ext}'></td></tr>";
         $info = apc_sma_info(true);
         $stat = apc_cache_info('user', true);
         // echo "<tr><td><pre>Info:".print_r($info, true)."Stat:".print_r($stat, true)."</pre></td></tr>";
         // Memory
         $max = $info['num_seg'] * $info['seg_size'];
         $free = $info['avail_mem'];
         $used = $max - $free;
         $rate = round(100.0 * $used / $max);
         $max = Toolbox::getSize($used + $free);
         $used = Toolbox::getSize($used);
         echo "<tr><td>" . __('Memory') . "</td>\n               <td>" . sprintf(__('%1$s / %2$s'), $used, $max) . "</td><td>";
         Html::displayProgressBar('100', $rate, array('simple' => true, 'forcepadding' => false));
         echo "</td><td><img src='" . $CFG_GLPI['root_doc'] . "/pics/" . ($rate > 5 && $rate < 50 ? 'ok_min.png' : 'ko_min.png') . "' alt='{$ext}'></td></tr>";
         // Hits
         $hits = $stat['num_hits'];
         $miss = $stat['num_misses'];
         $max = $hits + $miss;
         $rate = round(100 * $hits / ($hits + $miss));
         echo "<tr><td>" . __('Hits rate') . "</td>\n               <td>" . sprintf(__('%1$s / %2$s'), $hits, $max) . "</td><td>";
         Html::displayProgressBar('100', $rate, array('simple' => true, 'forcepadding' => false));
         echo "</td><td><img src='" . $CFG_GLPI['root_doc'] . "/pics/" . ($rate > 90 ? 'ok_min.png' : 'ko_min.png') . "' alt='{$ext}'></td></tr>";
         if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
             echo "<tr><td></td><td colspan='3'>";
             echo "<a class='vsubmit' href='config.form.php?reset_apcu=1'>";
             _e('Reset');
             echo "</a></td></tr>\n";
         }
     } else {
         echo "<tr><td>" . sprintf(__('Installing the "%s" extension may improve GLPI performance'), $ext) . "</td>\n               <td></td>\n               <td><img src='" . $CFG_GLPI['root_doc'] . "/pics/ko_min.png' alt='{$ext}'></td></tr>";
     }
     echo "</table></div>\n";
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:86,代码来源:config.class.php

示例5: closedir

    }
}
closedir($dir);
$dir = opendir($path);
unset($files);
$files = array();
while ($file = readdir($dir)) {
    if ($file != "." && $file != ".." && preg_match("/\\.xml\$/i", $file)) {
        $files[$file] = filemtime($path . "/" . $file);
    }
}
arsort($files);
if (count($files)) {
    foreach ($files as $file => $date) {
        $taille_fic = filesize($path . "/" . $file);
        echo "<tr class='tab_bg_1'><td colspan='6'><hr noshade></td></tr>" . "<tr class='tab_bg_2'><td>{$file}&nbsp;</td>" . "<td class='right'>" . Toolbox::getSize($taille_fic) . "</td>" . "<td>&nbsp;" . Html::convDateTime(date("Y-m-d H:i", $date)) . "</td>";
        if (Session::haveRight('backup', PURGE)) {
            echo "<td colspan=2>";
            //TRANS: %s is the filename
            $string = sprintf(__('Delete the file %s?'), $file);
            Html::showSimpleForm($_SERVER['PHP_SELF'], 'delfile', _x('button', 'Delete permanently'), array('file' => $file), '', '', $string);
            echo "</td>";
        }
        if (Session::haveRight('backup', CREATE)) {
            echo "<td>&nbsp;<a class='vsubmit' href=\"document.send.php?file=_dumps/{$file}\">" . __('Download') . "</a></td>";
        }
        echo "</tr>";
    }
}
closedir($dir);
echo "</table>";
开发者ID:stweil,项目名称:glpi,代码行数:31,代码来源:backup.php

示例6: footer

 /**
  * Print footer for every page
  *
  * @param $keepDB booleen, closeDBConnections if false (false by default)
  **/
 static function footer($keepDB = false)
 {
     global $CFG_GLPI, $FOOTER_LOADED, $TIMER_DEBUG;
     // Print foot for every page
     if ($FOOTER_LOADED) {
         return;
     }
     $FOOTER_LOADED = true;
     echo "</div>";
     // fin de la div id ='page' initiée dans la fonction header
     echo "<div id='footer' >";
     echo "<table width='100%'><tr><td class='left'><span class='copyright'>";
     $timedebug = sprintf(_n('%1$s second', '%1$s seconds', $TIMER_DEBUG->getTime()), $TIMER_DEBUG->getTime());
     if (function_exists("memory_get_usage")) {
         $timedebug = sprintf(__('%1$s - %2$s'), $timedebug, Toolbox::getSize(memory_get_usage()));
     }
     echo $timedebug;
     echo "</span></td>";
     if (!empty($CFG_GLPI["founded_new_version"])) {
         echo "<td class='copyright'>";
         $latest_version = "<a href='http://www.glpi-project.org' target='_blank' title=\"" . __s('You will find it on the GLPI-PROJECT.org site.') . "\"> " . preg_replace('/0$/', '', $CFG_GLPI["founded_new_version"]) . "</a>";
         printf(__('A new version is available: %s.'), $latest_version);
         echo "</td>";
     }
     echo "<td class='right'>";
     echo "<a href='http://glpi-project.org/'>";
     echo "<span class='copyright'>GLPI " . $CFG_GLPI["version"] . " Copyright (C) 2003-" . date("Y") . " by the INDEPNET Development Team.</span>";
     echo "</a></td>";
     echo "</tr></table></div>";
     if ($_SESSION['glpi_use_mode'] == Session::TRANSLATION_MODE) {
         // debug mode traduction
         echo "<div id='debug-float'>";
         echo "<a href='#see_debug'>GLPI MODE TRANSLATION</a>";
         echo "</div>";
     }
     if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
         // mode debug
         echo "<div id='debug-float'>";
         echo "<a href='#see_debug'>GLPI MODE DEBUG</a>";
         echo "</div>";
     }
     self::displayDebugInfos();
     echo "</body></html>";
     if (!$keepDB) {
         closeDBConnections();
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:52,代码来源:html.class.php

示例7: showForComputer

 /**
  * Print the computers disks
  *
  * @param $comp                  Computer object
  * @param $withtemplate boolean  Template or basic item (default '')
  *
  * @return Nothing (call to classes members)
  **/
 static function showForComputer(Computer $comp, $withtemplate = '')
 {
     global $DB;
     $ID = $comp->fields['id'];
     if (!$comp->getFromDB($ID) || !$comp->can($ID, READ)) {
         return false;
     }
     $canedit = $comp->canEdit($ID);
     if ($canedit && !(!empty($withtemplate) && $withtemplate == 2)) {
         echo "<div class='center firstbloc'>" . "<a class='vsubmit' href='computerdisk.form.php?computers_id={$ID}&amp;withtemplate=" . $withtemplate . "'>";
         _e('Add a volume');
         echo "</a></div>\n";
     }
     echo "<div class='center'>";
     $query = "SELECT `glpi_filesystems`.`name` AS fsname,\n                       `glpi_computerdisks`.*\n                FROM `glpi_computerdisks`\n                LEFT JOIN `glpi_filesystems`\n                          ON (`glpi_computerdisks`.`filesystems_id` = `glpi_filesystems`.`id`)\n                WHERE `computers_id` = '{$ID}'\n                      AND `is_deleted` = '0'";
     if ($result = $DB->query($query)) {
         echo "<table class='tab_cadre_fixehov'>";
         $colspan = 7;
         if (Plugin::haveImport()) {
             $colspan++;
         }
         echo "<tr class='noHover'><th colspan='{$colspan}'>" . self::getTypeName($DB->numrows($result)) . "</th></tr>";
         if ($DB->numrows($result)) {
             $header = "<tr><th>" . __('Name') . "</th>";
             if (Plugin::haveImport()) {
                 $header .= "<th>" . __('Automatic inventory') . "</th>";
             }
             $header .= "<th>" . __('Partition') . "</th>";
             $header .= "<th>" . __('Mount point') . "</th>";
             $header .= "<th>" . __('File system') . "</th>";
             $header .= "<th>" . __('Global size') . "</th>";
             $header .= "<th>" . __('Free size') . "</th>";
             $header .= "<th>" . __('Free percentage') . "</th>";
             $header .= "</tr>";
             echo $header;
             Session::initNavigateListItems(__CLASS__, sprintf(__('%1$s = %2$s'), Computer::getTypeName(1), $comp->getName()));
             $disk = new self();
             while ($data = $DB->fetch_assoc($result)) {
                 $disk->getFromDB($data['id']);
                 echo "<tr class='tab_bg_2'>";
                 echo "<td>" . $disk->getLink() . "</td>";
                 if (Plugin::haveImport()) {
                     echo "<td>" . Dropdown::getYesNo($data['is_dynamic']) . "</td>";
                 }
                 echo "<td>" . $data['device'] . "</td>";
                 echo "<td>" . $data['mountpoint'] . "</td>";
                 echo "<td>" . $data['fsname'] . "</td>";
                 //TRANS: %s is a size
                 $tmp = Toolbox::getSize($data['totalsize'] * 1024 * 1024);
                 echo "<td class='right'>{$tmp}<span class='small_space'></span></td>";
                 $tmp = Toolbox::getSize($data['freesize'] * 1024 * 1024);
                 echo "<td class='right'>{$tmp}<span class='small_space'></span></td>";
                 echo "<td>";
                 $percent = 0;
                 if ($data['totalsize'] > 0) {
                     $percent = round(100 * $data['freesize'] / $data['totalsize']);
                 }
                 Html::displayProgressBar('100', $percent, array('simple' => true, 'forcepadding' => false));
                 echo "</td>";
                 echo "</tr>";
                 Session::addToNavigateListItems(__CLASS__, $data['id']);
             }
             echo $header;
         } else {
             echo "<tr class='tab_bg_2'><th colspan='{$colspan}'>" . __('No item found') . "</th></tr>";
         }
         echo "</table>";
     }
     echo "</div><br>";
 }
开发者ID:stweil,项目名称:glpi,代码行数:78,代码来源:computerdisk.class.php

示例8: showForCollectFile

 function showForCollectFile($collects_files_id)
 {
     $pfCollect_File = new PluginFusioninventoryCollect_File();
     $computer = new Computer();
     $pfCollect_File->getFromDB($collects_files_id);
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr>";
     echo "<th colspan='3'>";
     echo $pfCollect_File->fields['name'];
     echo "</th>";
     echo "</tr>";
     echo "<tr>";
     echo "<th>" . __('Computer') . "</th>";
     echo "<th>" . __('pathfile', 'fusioninventory') . "</th>";
     echo "<th>" . __('Size', 'fusioninventory') . "</th>";
     echo "</tr>";
     $a_data = $this->find("`plugin_fusioninventory_collects_files_id`='" . $collects_files_id . "'", "`pathfile`");
     foreach ($a_data as $data) {
         echo "<tr class='tab_bg_1'>";
         echo '<td>';
         $computer->getFromDB($data['computers_id']);
         echo $computer->getLink(1);
         echo '</td>';
         echo '<td>';
         echo $data['pathfile'];
         echo '</td>';
         echo '<td>';
         echo Toolbox::getSize($data['size']);
         echo '</td>';
         echo "</tr>";
     }
     echo '</table>';
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:33,代码来源:collect_file_content.class.php


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