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


PHP dol_filesize函数代码示例

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


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

示例1: dol_osencode

$original_file_osencoded = dol_osencode($original_file);
// New file name encoded in OS encoding charset
// This test if file exists should be useless. We keep it to find bug more easily
if (!file_exists($original_file_osencoded)) {
    dol_print_error(0, $langs->trans("ErrorFileDoesNotExists", $original_file));
    exit;
}
// Permissions are ok and file found, so we return it
header('Content-Description: File Transfer');
if ($encoding) {
    header('Content-Encoding: ' . $encoding);
}
if ($type) {
    header('Content-Type: ' . $type . (preg_match('/text/', $type) ? '; charset="' . $conf->file->character_set_client : ''));
}
// Add MIME Content-Disposition from RFC 2183 (inline=automatically displayed, atachment=need user action to open)
if ($attachment) {
    header('Content-Disposition: attachment; filename="' . $filename . '"');
} else {
    header('Content-Disposition: inline; filename="' . $filename . '"');
}
header('Content-Length: ' . dol_filesize($original_file));
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
//ob_clean();
//flush();
readfile($original_file_osencoded);
if (is_object($db)) {
    $db->close();
}
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:document.php

示例2: showdocuments


//.........这里部分代码省略.........
     // Get list of files
     if (!empty($filedir)) {
         $file_list = dol_dir_list($filedir, 'files', 0, '', '(\\.meta|_preview\\.png)$', 'date', SORT_DESC);
         // Affiche en-tete tableau si non deja affiche
         if (!empty($file_list) && !$headershown) {
             $headershown = 1;
             $out .= '<div class="titre">' . $titletoshow . '</div>';
             $out .= '<table class="border" summary="listofdocumentstable" width="100%">';
         }
         // Loop on each file found
         if (is_array($file_list)) {
             foreach ($file_list as $file) {
                 $var = !$var;
                 // Define relative path for download link (depends on module)
                 $relativepath = $file["name"];
                 // Cas general
                 if ($modulesubdir) {
                     $relativepath = $modulesubdir . "/" . $file["name"];
                 }
                 // Cas propal, facture...
                 if ($modulepart == 'export') {
                     $relativepath = $file["name"];
                 }
                 // Other case
                 $out .= "<tr " . $bc[$var] . ">";
                 $documenturl = DOL_URL_ROOT . '/document.php';
                 if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) {
                     $documenturl = $conf->global->DOL_URL_ROOT_DOCUMENT_PHP;
                 }
                 // Show file name with link to download
                 $out .= '<td class="nowrap">';
                 $out .= '<a data-ajax="false" href="' . $documenturl . '?modulepart=' . $modulepart . '&amp;file=' . urlencode($relativepath) . '"';
                 $mime = dol_mimetype($relativepath, '', 0);
                 if (preg_match('/text/', $mime)) {
                     $out .= ' target="_blank"';
                 }
                 $out .= ' target="_blank">';
                 $out .= img_mime($file["name"], $langs->trans("File") . ': ' . $file["name"]) . ' ' . dol_trunc($file["name"], $maxfilenamelength);
                 $out .= '</a>' . "\n";
                 $out .= '</td>';
                 // Show file size
                 $size = !empty($file['size']) ? $file['size'] : dol_filesize($filedir . "/" . $file["name"]);
                 $out .= '<td align="right" class="nowrap">' . dol_print_size($size) . '</td>';
                 // Show file date
                 $date = !empty($file['date']) ? $file['date'] : dol_filemtime($filedir . "/" . $file["name"]);
                 $out .= '<td align="right" class="nowrap">' . dol_print_date($date, 'dayhour', 'tzuser') . '</td>';
                 if ($delallowed || $printer || $morepicto) {
                     $out .= '<td align="right">';
                     if ($delallowed) {
                         $out .= '<a href="' . $urlsource . (strpos($urlsource, '?') ? '&amp;' : '?') . 'action=remove_file&amp;file=' . urlencode($relativepath);
                         $out .= $param ? '&amp;' . $param : '';
                         //$out.= '&modulepart='.$modulepart; // TODO obsolete ?
                         //$out.= '&urlsource='.urlencode($urlsource); // TODO obsolete ?
                         $out .= '">' . img_picto($langs->trans("Delete"), 'delete.png') . '</a>';
                         //$out.='</td>';
                     }
                     if ($printer) {
                         //$out.= '<td align="right">';
                         $out .= '&nbsp;<a href="' . $urlsource . (strpos($urlsource, '?') ? '&amp;' : '?') . 'action=print_file&amp;printer=' . $modulepart . '&amp;file=' . urlencode($relativepath);
                         $out .= $param ? '&amp;' . $param : '';
                         $out .= '">' . img_picto($langs->trans("PrintFile", $relativepath), 'printer.png') . '</a>';
                     }
                     if ($morepicto) {
                         $morepicto = preg_replace('/__FILENAMEURLENCODED__/', urlencode($relativepath), $morepicto);
                         $out .= $morepicto;
                     }
                     $out .= '</td>';
                 }
                 if (is_object($hookmanager)) {
                     $parameters = array('socid' => isset($GLOBALS['socid']) ? $GLOBALS['socid'] : '', 'id' => isset($GLOBALS['id']) ? $GLOBALS['id'] : '', 'modulepart' => $modulepart, 'relativepath' => $relativepath);
                     $res = $hookmanager->executeHooks('formBuilddocLineOptions', $parameters, $file);
                     if (empty($res)) {
                         $out .= $hookmanager->resPrint;
                         // Complete line
                         $out .= '</tr>';
                     } else {
                         $out = $hookmanager->resPrint;
                     }
                     // Replace line
                 }
             }
             if (count($file_list) == 0 && $headershown) {
                 $out .= '<tr ' . $bc[0] . '><td colspan="3">' . $langs->trans("None") . '</td></tr>';
             }
             $this->numoffiles++;
         }
     }
     if ($headershown) {
         // Affiche pied du tableau
         $out .= "</table>\n";
         if ($genallowed) {
             if (empty($noform)) {
                 $out .= '</form>' . "\n";
             }
         }
     }
     $out .= '<!-- End show_document -->' . "\n";
     //return ($i?$i:$headershown);
     return $out;
 }
开发者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: 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

示例5: clearstatcache

    }
}
// Construit liste des fichiers
clearstatcache();
$totalsize = 0;
$filearray = array();
$errorlevel = error_reporting();
error_reporting(0);
$handle = opendir($upload_dir);
error_reporting($errorlevel);
if (is_resource($handle)) {
    $i = 0;
    while (($file = readdir($handle)) !== false) {
        if (!is_dir($dir . $file) && substr($file, 0, 1) != '.' && substr($file, 0, 3) != 'CVS') {
            $filearray[$i]->name = $file;
            $filearray[$i]->size = dol_filesize($upload_dir . "/" . $file);
            $filearray[$i]->date = dol_filemtime($upload_dir . "/" . $file);
            $totalsize += $filearray[$i]->size;
            $i++;
        }
    }
    closedir($handle);
} else {
    //            print '<div class="error">'.$langs->trans("ErrorCanNotReadDir",$upload_dir).'</div>';
}
/*
print '<table class="border"width="100%">';
// Nbre fichiers
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
//Total taille
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:docother.php

示例6: 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

示例7: dol_dir_list

/**
 *  Scan a directory and return a list of files/directories.
 *  Content for string is UTF8 and dir separator is "/".
 *
 *  @param	string		$path        	Starting path from which to search
 *  @param	string		$types        	Can be "directories", "files", or "all"
 *  @param	int			$recursive		Determines whether subdirectories are searched
 *  @param	string		$filter        	Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
 *  @param	array		$excludefilter  Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.'))
 *  @param	string		$sortcriteria	Sort criteria ("","fullname","name","date","size")
 *  @param	string		$sortorder		Sort order (SORT_ASC, SORT_DESC)
 *	@param	int			$mode			0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
 *  @param	int			$nohook			Disable all hooks
 *  @return	array						Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file')
 */
function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excludefilter = "", $sortcriteria = "name", $sortorder = SORT_ASC, $mode = 0, $nohook = false)
{
    global $db, $hookmanager;
    global $object;
    dol_syslog("files.lib.php::dol_dir_list path=" . $path . " types=" . $types . " recursive=" . $recursive . " filter=" . $filter . " excludefilter=" . json_encode($excludefilter));
    //print 'xxx'."files.lib.php::dol_dir_list path=".$path." types=".$types." recursive=".$recursive." filter=".$filter." excludefilter=".json_encode($excludefilter);
    $loaddate = $mode == 1 || $mode == 2 ? true : false;
    $loadsize = $mode == 1 || $mode == 3 ? true : false;
    // Clean parameters
    $path = preg_replace('/([\\/]+)$/i', '', $path);
    $newpath = dol_osencode($path);
    if (!$nohook) {
        $hookmanager->initHooks(array('fileslib'));
        $parameters = array('path' => $newpath, 'types' => $types, 'recursive' => $recursive, 'filter' => $filter, 'excludefilter' => $excludefilter, 'sortcriteria' => $sortcriteria, 'sortorder' => $sortorder, 'loaddate' => $loaddate, 'loadsize' => $loadsize, 'mode' => $mode);
        $reshook = $hookmanager->executeHooks('getNodesList', $parameters, $object);
    }
    // $reshook may contain returns stacked by other modules
    // $reshook is always empty with an array for can not lose returns stacked with other modules
    // $hookmanager->resArray may contain array stacked by other modules
    if (!$nohook && !empty($hookmanager->resArray)) {
        return $hookmanager->resArray['nodes'];
    } else {
        if (!is_dir($newpath)) {
            return array();
        }
        if ($dir = opendir($newpath)) {
            $filedate = '';
            $filesize = '';
            $file_list = array();
            while (false !== ($file = readdir($dir))) {
                if (!utf8_check($file)) {
                    $file = utf8_encode($file);
                }
                // To be sure data is stored in utf8 in memory
                $qualified = 1;
                // Define excludefilterarray
                $excludefilterarray = array('^\\.');
                if (is_array($excludefilter)) {
                    $excludefilterarray = array_merge($excludefilterarray, $excludefilter);
                } else {
                    if ($excludefilter) {
                        $excludefilterarray[] = $excludefilter;
                    }
                }
                // Check if file is qualified
                foreach ($excludefilterarray as $filt) {
                    if (preg_match('/' . $filt . '/i', $file)) {
                        $qualified = 0;
                        break;
                    }
                }
                if ($qualified) {
                    $isdir = is_dir(dol_osencode($path . "/" . $file));
                    // Check whether this is a file or directory and whether we're interested in that type
                    if ($isdir && ($types == "directories" || $types == "all" || $recursive)) {
                        // Add entry into file_list array
                        if ($types == "directories" || $types == "all") {
                            if ($loaddate || $sortcriteria == 'date') {
                                $filedate = dol_filemtime($path . "/" . $file);
                            }
                            if ($loadsize || $sortcriteria == 'size') {
                                $filesize = dol_filesize($path . "/" . $file);
                            }
                            if (!$filter || preg_match('/' . $filter . '/i', $file)) {
                                preg_match('/([^\\/]+)\\/[^\\/]+$/', $path . '/' . $file, $reg);
                                $level1name = isset($reg[1]) ? $reg[1] : '';
                                $file_list[] = array("name" => $file, "path" => $path, "level1name" => $level1name, "fullname" => $path . '/' . $file, "date" => $filedate, "size" => $filesize, "type" => 'dir');
                            }
                        }
                        // if we're in a directory and we want recursive behavior, call this function again
                        if ($recursive) {
                            $file_list = array_merge($file_list, dol_dir_list($path . "/" . $file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook));
                        }
                    } else {
                        if (!$isdir && ($types == "files" || $types == "all")) {
                            // Add file into file_list array
                            if ($loaddate || $sortcriteria == 'date') {
                                $filedate = dol_filemtime($path . "/" . $file);
                            }
                            if ($loadsize || $sortcriteria == 'size') {
                                $filesize = dol_filesize($path . "/" . $file);
                            }
                            if (!$filter || preg_match('/' . $filter . '/i', $file)) {
                                preg_match('/([^\\/]+)\\/[^\\/]+$/', $path . '/' . $file, $reg);
                                $level1name = isset($reg[1]) ? $reg[1] : '';
//.........这里部分代码省略.........
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:101,代码来源:files.lib.php

示例8: dol_dir_list

/**
 *  Scan a directory and return a list of files/directories.
 *  Content for string is UTF8 and dir separator is "/".
 *  @param		$path        	Starting path from which to search
 *  @param		$types        	Can be "directories", "files", or "all"
 *  @param		$recursive		Determines whether subdirectories are searched
 *  @param		$filter        	Regex for include filter
 *  @param		$excludefilter  Array of Regex for exclude filter (example: array('\.meta$','^\.')
 *  @param		$sortcriteria	Sort criteria ("","name","date","size")
 *  @param		$sortorder		Sort order (SORT_ASC, SORT_DESC)
 *	@param		$mode			0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
 *  @return		array			Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file')
 */
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0)
{
	dol_syslog("files.lib.php::dol_dir_list path=".$path." types=".$types." recursive=".$recursive." filter=".$filter." excludefilter=".$excludefilter);

	$loaddate=($mode==1||$mode==2)?true:false;
	$loadsize=($mode==1||$mode==3)?true:false;

	// Clean parameters
	$path=preg_replace('/([\\/]+)$/i','',$path);
	$newpath=dol_osencode($path);

	if (! is_dir($newpath)) return array();

	if ($dir = opendir($newpath))
	{
		$file_list = array();
		while (false !== ($file = readdir($dir)))
		{
			if (! utf8_check($file)) $file=utf8_encode($file);	// To be sure data is stored in utf8 in memory

			$qualified=1;

			// Define excludefilterarray
			$excludefilterarray=array('^\.');
			if (is_array($excludefilter))
			{
			     $excludefilterarray=array_merge($excludefilterarray,$excludefilter);
			}
			else if ($excludefilter) $excludefilterarray[]=$excludefilter;
            // Check if file is qualified
			foreach($excludefilterarray as $filt)
		    {
		         if (preg_match('/'.$filt.'/i',$file)) { $qualified=0; break; }
		    }

			if ($qualified)
			{
			    $isdir=is_dir(dol_osencode($path."/".$file));
			    // Check whether this is a file or directory and whether we're interested in that type
				if ($isdir && (($types=="directories") || ($types=="all") || $recursive))
				{
					// Add entry into file_list array
                    if (($types=="directories") || ($types=="all"))
                    {
    				    if ($loaddate || $sortcriteria == 'date') $filedate=dol_filemtime($path."/".$file);
    					if ($loadsize || $sortcriteria == 'size') $filesize=dol_filesize($path."/".$file);

    					if (! $filter || preg_match('/'.$filter.'/i',$path.'/'.$file))
    					{
    						$file_list[] = array(
    						"name" => $file,
    						"fullname" => $path.'/'.$file,
    						"date" => $filedate,
    						"size" => $filesize,
    						"type" => 'dir'
    						);
    					}
                    }

					// if we're in a directory and we want recursive behavior, call this function again
					if ($recursive)
					{
						$file_list = array_merge($file_list,dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode));
					}
				}
				else if (! $isdir && (($types == "files") || ($types == "all")))
				{
				    // Add file into file_list array
					if ($loaddate || $sortcriteria == 'date') $filedate=dol_filemtime($path."/".$file);
					if ($loadsize || $sortcriteria == 'size') $filesize=dol_filesize($path."/".$file);

					if (! $filter || preg_match('/'.$filter.'/i',$path.'/'.$file))
					{
					    $file_list[] = array(
						"name" => $file,
						"fullname" => $path.'/'.$file,
						"date" => $filedate,
						"size" => $filesize,
						"type" => 'file'
						);
					}
				}
			}
		}
		closedir($dir);

		// Obtain a list of columns
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:files.lib.php

示例9: showdocuments


//.........这里部分代码省略.........
             $out .= ' ' . img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated"));
         }
         $out .= '</th>';
         $out .= '</tr>';
         // Execute hooks
         $parameters = array('socid' => isset($GLOBALS['socid']) ? $GLOBALS['socid'] : '', 'id' => isset($GLOBALS['id']) ? $GLOBALS['id'] : '', 'modulepart' => $modulepart);
         if (is_object($hookmanager)) {
             $out .= $hookmanager->executeHooks('formBuilddocOptions', $parameters, $GLOBALS['object']);
         }
     }
     // Get list of files
     if ($filedir) {
         $png = '';
         $filter = '';
         if ($iconPDF == 1) {
             $png = '\\.png$';
             $filter = $filename . '.pdf';
         }
         $file_list = dol_dir_list($filedir, 'files', 0, $filter, '\\.meta$' . ($png ? '|' . $png : ''), 'date', SORT_DESC);
         // Affiche en-tete tableau si non deja affiche
         if (!empty($file_list) && !$headershown && !$iconPDF) {
             $headershown = 1;
             $out .= '<div class="titre">' . $titletoshow . '</div>';
             $out .= '<table class="border" summary="listofdocumentstable" width="100%">';
         } else {
             if (empty($file_list) && !empty($iconPDF)) {
                 // For ajax treatment
                 $out .= '<div id="gen_pdf_' . $filename . '" class="linkobject hideobject">' . img_picto('', 'refresh') . '</div>' . "\n";
             }
         }
         // Loop on each file found
         foreach ($file_list as $file) {
             $var = !$var;
             // Define relative path for download link (depends on module)
             $relativepath = $file["name"];
             // Cas general
             if ($filename) {
                 $relativepath = $filename . "/" . $file["name"];
             }
             // Cas propal, facture...
             // Autre cas
             if ($modulepart == 'donation') {
                 $relativepath = get_exdir($filename, 2) . $file["name"];
             }
             if ($modulepart == 'export') {
                 $relativepath = $file["name"];
             }
             if (!$iconPDF) {
                 $out .= "<tr " . $bc[$var] . ">";
             }
             // Show file name with link to download
             if (!$iconPDF) {
                 $out .= '<td nowrap="nowrap">';
             }
             $out .= '<a href="' . DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart . '&amp;file=' . urlencode($relativepath) . '"';
             $mime = dol_mimetype($relativepath, '', 0);
             if (preg_match('/text/', $mime)) {
                 $out .= ' target="_blank"';
             }
             $out .= '>';
             if (!$iconPDF) {
                 $out .= img_mime($file["name"], $langs->trans("File") . ': ' . $file["name"]) . ' ' . dol_trunc($file["name"], $maxfilenamelength);
             } else {
                 $out .= img_pdf($file["name"], 2);
             }
             $out .= '</a>' . "\n";
             if (!$iconPDF) {
                 $out .= '</td>';
                 // Show file size
                 $out .= '<td align="right" nowrap="nowrap">' . dol_print_size(dol_filesize($filedir . "/" . $file["name"])) . '</td>';
                 // Show file date
                 $out .= '<td align="right" nowrap="nowrap">' . dol_print_date(dol_filemtime($filedir . "/" . $file["name"]), 'dayhour') . '</td>';
             }
             if ($delallowed) {
                 $out .= '<td align="right">';
                 //$out.= '<a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&amp;modulepart='.$modulepart.'&amp;file='.urlencode($relativepath);
                 $out .= '<a href="' . $urlsource . '&action=remove_file&modulepart=' . $modulepart . '&file=' . urlencode($relativepath);
                 $out .= $param ? '&' . $param : '';
                 $out .= '&urlsource=' . urlencode($urlsource);
                 $out .= '">' . img_delete() . '</a></td>';
             }
             if (!$iconPDF) {
                 $out .= '</tr>';
             }
             $this->numoffiles++;
         }
     }
     if ($headershown) {
         // Affiche pied du tableau
         $out .= "</table>\n";
         if ($genallowed) {
             if (empty($noform)) {
                 $out .= '</form>' . "\n";
             }
         }
     }
     $out .= '<!-- End show_document -->' . "\n";
     //return ($i?$i:$headershown);
     return $out;
 }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:html.formfile.class.php


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