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


PHP dol_print_size函数代码示例

本文整理汇总了PHP中dol_print_size函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_print_size函数的具体用法?PHP dol_print_size怎么用?PHP dol_print_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: urlencode

 $relativepathdetail = $objectref . '/' . $objectref . '-detail.pdf';
 // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
 $fileimage = $file . '_preview.png';
 // If PDF has 1 page
 $fileimagebis = $file . '_preview-0.pdf.png';
 // If PDF has more than one page
 $relativepathimage = $relativepath . '_preview.png';
 $var = true;
 // Si fichier PDF existe
 if (file_exists($file)) {
     $encfile = urlencode($file);
     print '<table class="nobordernopadding" width="100%">';
     print '<tr class="liste_titre"><td colspan="4">' . $langs->trans("Documents") . '</td></tr>';
     print '<tr ' . $bc[$var] . '><td>' . $langs->trans("Proposal") . ' PDF</td>';
     print '<td><a data-ajax="false" href="' . DOL_URL_ROOT . '/document.php?modulepart=propal&file=' . urlencode($relativepath) . '">' . $object->ref . '.pdf</a></td>';
     print '<td align="right">' . dol_print_size(dol_filesize($file)) . '</td>';
     print '<td align="right">' . dol_print_date(dol_filemtime($file), 'dayhour') . '</td>';
     print '</tr>';
     print "</table>\n";
     // Conversion du PDF en image png si fichier png non existant
     if (!file_exists($fileimage) && !file_exists($fileimagebis) || filemtime($fileimage) < filemtime($file)) {
         if (class_exists("Imagick")) {
             $ret = dol_convert_file($file, 'png', $fileimage);
             if ($ret < 0) {
                 $error++;
             }
         } else {
             $langs->load("errors");
             print '<font class="error">' . $langs->trans("ErrorNoImagickReadimage") . '</font>';
         }
     }
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:apercu.php

示例2: list_of_autoecmfiles


//.........这里部分代码省略.........
                 $ref = isset($reg[1]) ? $reg[1] : '';
             }
             if ($modulepart == 'tax') {
                 preg_match('/(\\d+)\\/[^\\/]+$/', $relativefile, $reg);
                 $id = isset($reg[1]) ? $reg[1] : '';
             }
             if ($modulepart == 'project') {
                 preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
                 $ref = isset($reg[1]) ? $reg[1] : '';
             }
             if ($modulepart == 'fichinter') {
                 preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
                 $ref = isset($reg[1]) ? $reg[1] : '';
             }
             if ($modulepart == 'user') {
                 preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
                 $id = isset($reg[1]) ? $reg[1] : '';
             }
             if (!$id && !$ref) {
                 continue;
             }
             $found = 0;
             if (!empty($this->cache_objects[$modulepart . '_' . $id . '_' . $ref])) {
                 $found = 1;
             } else {
                 //print 'Fetch '.$id." - ".$ref.'<br>';
                 if ($id) {
                     $result = $object_instance->fetch($id);
                 } else {
                     //fetchOneLike looks for objects with wildcards in its reference.
                     //It is useful for those masks who get underscores instead of their actual symbols
                     //fetchOneLike requires some info in the object. If it doesn't have it, then 0 is returned
                     //that's why we look only look fetchOneLike when fetch returns 0
                     if (!($result = $object_instance->fetch('', $ref))) {
                         $result = $object_instance->fetchOneLike($ref);
                     }
                 }
                 if ($result > 0) {
                     // Save object into a cache
                     $found = 1;
                     $this->cache_objects[$modulepart . '_' . $id . '_' . $ref] = clone $object_instance;
                 }
                 if ($result == 0) {
                     $found = 1;
                     $this->cache_objects[$modulepart . '_' . $id . '_' . $ref] = 'notfound';
                     unset($filearray[$key]);
                 }
             }
             if (!$found > 0 || !is_object($this->cache_objects[$modulepart . '_' . $id . '_' . $ref])) {
                 continue;
             }
             // We do not show orphelins files
             $var = !$var;
             print '<tr ' . $bc[$var] . '>';
             print '<td>';
             if ($found > 0 && is_object($this->cache_objects[$modulepart . '_' . $id . '_' . $ref])) {
                 print $this->cache_objects[$modulepart . '_' . $id . '_' . $ref]->getNomUrl(1, 'document');
             } else {
                 print $langs->trans("ObjectDeleted", $id ? $id : $ref);
             }
             print '</td>';
             print '<td>';
             //print "XX".$file['name']; //$file['name'] must be utf8
             print '<a data-ajax="false" href="' . DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart;
             if ($forcedownload) {
                 print '&attachment=1';
             }
             print '&file=' . urlencode($relativefile) . '">';
             print img_mime($file['name'], $file['name'] . ' (' . dol_print_size($file['size'], 0, 0) . ')') . ' ';
             print dol_trunc($file['name'], $maxlength, 'middle');
             print '</a>';
             print "</td>\n";
             print '<td align="right">' . dol_print_size($file['size'], 1, 1) . '</td>';
             print '<td align="center">' . dol_print_date($file['date'], "dayhour") . '</td>';
             print '<td align="right">';
             if (!empty($useinecm)) {
                 print '<a data-ajax="false" href="' . DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart;
             }
             if ($forcedownload) {
                 print '&attachment=1';
             }
             print '&file=' . urlencode($relativefile) . '">';
             print img_view() . '</a> &nbsp; ';
             //if ($permtodelete) print '<a href="'.$url.'?id='.$object->id.'&section='.$_REQUEST["section"].'&action=delete&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>';
             //else print '&nbsp;';
             print "</td></tr>\n";
         }
     }
     if (count($filearray) == 0) {
         print '<tr ' . $bc[false] . '><td colspan="4">';
         if (empty($textifempty)) {
             print $langs->trans("NoFileFound");
         } else {
             print $textifempty;
         }
         print '</td></tr>';
     }
     print "</table>";
     // Fin de zone
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:101,代码来源:html.formfile.class.php

示例3: img_picto

        $obj = $db->fetch_object($resql);
        if ($obj) {
            $var = !$var;
            print "<tr " . $bc[$var] . ">";
            print "<td>" . $obj->df . "</td>\n";
            print '<td align="center">' . $obj->cc . '</td>';
            print '<td align="center">';
            print '<a href="' . $_SERVER["PHP_SELF"] . '?action=builddoc&amp;page=' . $page . '&amp;month=' . $obj->month . '&amp;year=' . $obj->year . '">' . img_picto($langs->trans('GenerateReport'), 'filenew') . '</a>';
            print '</td>';
            $name = "actions-" . $obj->month . "-" . $obj->year . ".pdf";
            $relativepath = $name;
            $file = $conf->agenda->dir_temp . "/" . $name;
            if (file_exists($file)) {
                print '<td align="center"><a data-ajax="false" href="' . DOL_URL_ROOT . '/document.php?page=' . $page . '&amp;file=' . urlencode($relativepath) . '&amp;modulepart=actionsreport">' . img_pdf() . '</a></td>';
                print '<td align="center">' . dol_print_date(dol_filemtime($file), 'dayhour') . '</td>';
                print '<td align="center">' . dol_print_size(dol_filesize($file)) . '</td>';
            } else {
                print '<td>&nbsp;</td>';
                print '<td>&nbsp;</td>';
                print '<td>&nbsp;</td>';
            }
            print "</tr>\n";
        }
        $i++;
    }
    print "</table>";
    $db->free($resql);
} else {
    dol_print_error($db);
}
llxFooter();
开发者ID:Albertopf,项目名称:prueba,代码行数:31,代码来源:index.php

示例4: User

print '<tr><td>'.$langs->trans("ECMCreationUser").'</td><td>';
$userecm=new User($db);
$userecm->fetch($ecmdir->fk_user_c);
print $userecm->getNomUrl(1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("ECMCreationDate").'</td><td>';
print dol_print_date($ecmdir->date_c,'dayhour');
print '</td></tr>';
print '<tr><td>'.$langs->trans("ECMDirectoryForFiles").'</td><td>';
print '/ecm/'.$relativepath;
print '</td></tr>';
print '<tr><td>'.$langs->trans("ECMNbOfDocs").'</td><td>';
print sizeof($filearray);
print '</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>';
print dol_print_size($totalsize);
print '</td></tr>';
if ($_GET["action"] == 'edit')
{
	print '<tr><td colspan="2" align="center">';
	print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">';
	print ' &nbsp; &nbsp; ';
	print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
	print '</td></tr>';
}
print '</table>';
if ($_GET["action"] == 'edit')
{
	print '</form>';
}
print '</div>';
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:docmine.php

示例5: dol_sort_array

         print '<td>' . $langs->trans("FilesUpdated") . '</td>';
         print '<td align="center">' . $langs->trans("ExpectedChecksum") . '</td>';
         print '<td align="center">' . $langs->trans("CurrentChecksum") . '</td>';
         print '<td align="right">' . $langs->trans("Size") . '</td>';
         print '<td align="right">' . $langs->trans("DateModification") . '</td>';
         print '</tr>' . "\n";
         $var = true;
         $tmpfilelist = dol_sort_array($file_list['updated'], 'filename');
         if (is_array($tmpfilelist) && count($tmpfilelist)) {
             foreach ($tmpfilelist as $file) {
                 $var = !$var;
                 print '<tr ' . $bc[$var] . '>';
                 print '<td>' . $file['filename'] . '</td>' . "\n";
                 print '<td align="center">' . $file['expectedmd5'] . '</td>' . "\n";
                 print '<td align="center">' . $file['md5'] . '</td>' . "\n";
                 print '<td align="right">' . dol_print_size(dol_filesize(DOL_DOCUMENT_ROOT . '/' . $file['filename'])) . '</td>' . "\n";
                 print '<td align="right">' . dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT . '/' . $file['filename']), 'dayhour') . '</td>' . "\n";
                 print "</tr>\n";
             }
         } else {
             print '<tr ' . $bc[false] . '><td colspan="5">' . $langs->trans("None") . '</td></tr>';
         }
         print '</table>';
     } else {
         print 'Error: Failed to found dolibarr_htdocs_dir into XML file ' . $xmlfile;
         $error++;
     }
 } else {
     print 'Error: Failed to parse XML for input file ' . $xmlfile;
     $error++;
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:filecheck.php

示例6: list_of_autoecmfiles

    /**
     *      Show list of documents in a directory
     *      @param      upload_dir          Directory that was scanned
     *      @param      filearray           Array of files loaded by dol_dir_list function before calling this function
     *      @param      modulepart          Value for modulepart used by download wrapper
     *      @param      param               Parameters on sort links
     *      @param      forcedownload       Force to open dialog box "Save As" when clicking on file
     *      @param      relativepath        Relative path of docs (autodefined if not provided)
     *      @param      permtodelete        Permission to delete
     *      @param      useinecm            Change output for use in ecm module
     *      @param      textifempty         Text to show if filearray is empty
     *      @param      maxlength           Maximum length of file name shown
     *      @return     int                 <0 if KO, nb of files shown if OK
     */
    function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0)
    {
        global $user, $conf, $langs;
        global $bc;
        global $sortfield, $sortorder;

        // Affiche liste des documents existant
        if (empty($useinecm)) print_titre($langs->trans("AttachedFiles"));
        //else { $bc[true]=''; $bc[false]=''; };
        $url=$_SERVER["PHP_SELF"];
        print '<table width="100%" class="nobordernopadding">';
        print '<tr class="liste_titre">';
        print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"","",$param,'align="left"',$sortfield,$sortorder);
        print_liste_field_titre($langs->trans("Documents2"),$_SERVER["PHP_SELF"],"name","",$param,'align="left"',$sortfield,$sortorder);
        print_liste_field_titre($langs->trans("Size"),$_SERVER["PHP_SELF"],"size","",$param,'align="right"',$sortfield,$sortorder);
        print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"date","",$param,'align="center"',$sortfield,$sortorder);
        print_liste_field_titre('','','');
        print '</tr>';

        if ($modulepart == 'invoice')
        {
            include_once(DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php');
            $object_static=new Facture($this->db);
        }
        if ($modulepart == 'invoice_supplier')
        {
            include_once(DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php');
            $object_static=new FactureFournisseur($this->db);
        }

        $var=true;
        foreach($filearray as $key => $file)
        {
            if (!is_dir($file['name'])
            && $file['name'] != '.'
            && $file['name'] != '..'
            && $file['name'] != 'CVS'
            && ! preg_match('/\.meta$/i',$file['name']))
            {
                // Define relative path used to store the file
                $relativefile=preg_replace('/'.preg_quote($upload_dir.'/','/').'/','',$file['fullname']);
                //print 'eeee'.$relativefile;
                //var_dump($file);
                $var=!$var;
                print '<tr '.$bc[$var].'>';
                print '<td>';
                $id='';$ref='';
                if ($modulepart == 'invoice')
                {
                    preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg);
                    $ref=$reg[1];
                    $object_static->fetch('',$ref);
                    //print $relativefile.'rr'.$id;
                    print $object_static->getNomUrl(1,'document');
                }
                if ($modulepart == 'invoice_supplier')
                {
                    preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg);
                    $id=$reg[1];
                    $object_static->fetch($id);
                    //print $relativefile.'rr'.$id;
                    print $object_static->getNomUrl(1,'document');
                }
                print '</td>';
                print '<td>';
                //print "XX".$file['name']; //$file['name'] must be utf8
                print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
                if ($forcedownload) print '&attachment=1';
                print '&file='.urlencode($relativefile).'">';
                print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' ';
                print dol_trunc($file['name'],$maxlength,'middle');
                print '</a>';
                print "</td>\n";
                print '<td align="right">'.dol_print_size($file['size'],1,1).'</td>';
                print '<td align="center">'.dol_print_date($file['date'],"dayhour").'</td>';
                print '<td align="right">';
                if (! empty($useinecm))  print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
                if ($forcedownload) print '&attachment=1';
                print '&file='.urlencode($relativefile).'">';
                print img_view().'</a> &nbsp; ';
                //if ($permtodelete) print '<a href="'.$url.'?id='.$object->id.'&section='.$_REQUEST["section"].'&action=delete&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>';
                //else print '&nbsp;';
                print "</td></tr>\n";
            }
        }
        if (sizeof($filearray) == 0)
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:html.formfile.class.php

示例7: htmlentities

        $theKey = htmlentities(base64_decode($_GET['key']));

        $theserver = $MEMCACHE_SERVERS[(int)$_GET['server']];
        list($h,$p) = explode(':',$theserver);
        $r = sendMemcacheCommand($h,$p,'get '.$theKey);

		print $langs->trans("PrefixForKeysInCache").': '.session_name().'_'.'<br>';
		print '<br>';

		print <<<EOB
        <table class="border" width="100%"><tbody>
			<tr><th>Server<th>Key</th><th>Value</th><th>Delete</th></tr>
EOB;
        echo "<tr><td class=td-0>",$theserver,"</td><td class=td-0>",$theKey,
             " <br/>flag:",$r['VALUE'][$theKey]['stat']['flag'],
             " <br/>Size:",dol_print_size($r['VALUE'][$theKey]['stat']['size'],1),
             "</td><td>",chunk_split($r['VALUE'][$theKey]['value'],40),"</td>",
             '<td><a href="',$PHP_SELF,'&op=5&server=',(int)$_GET['server'],'&key=',base64_encode($theKey),"\">Delete</a></td>","</tr>";
        echo <<<EOB
			</tbody></table>
EOB;
    break;
    case 5: // item delete
    	if (!isset($_GET['key']) || !isset($_GET['server'])){
			echo "No key set!";
			break;
        }
        $theKey = htmlentities(base64_decode($_GET['key']));
		$theserver = $MEMCACHE_SERVERS[(int)$_GET['server']];
		list($h,$p) = explode(':',$theserver);
        $r = sendMemcacheCommand($h,$p,'delete '.$theKey);
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:memcached_stats.php


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