/** * Выводит икону и задданный внешний URL для определенного файла * * @param string $ulogin Логин пользователя * @param string $filename Имя файла * @param string $dir Папка файла * @param string $url Ссылка на файл * @param integer $bigtext Вместо иконкки будет большой текст расширения файла(TXT, PDF, etc...) если переменная принимает значение 1 * @return string HTML-code */ function viewattachExternal($ulogin, $filename, $dir, $url, $bigtext = 0) { $l_dir = substr($ulogin, 0, 2) . "/" . $ulogin; $cfile = new CFile("users/{$l_dir}/" . $dir . "/" . $filename); if (!$cfile->size) { return ""; } $ext = $cfile->getext($filename); $ico = getICOFile($ext, true); echo $ico; $fsize = ConvertBtoMB($cfile->size); return '<p><img src="/pda/images/mime/' . $ico . '.png" alt="' . $ext . '" width="18" height="16"> <a href="' . $url . '" target="_blank">Скачать</a> | ' . ucfirst($ext) . ', ' . $fsize . ' </p>'; }
"> <input type="hidden" id="imain_file" name="main_file" value="<?php echo $work['pict']; ?> "> <?php if ($work['pict']) { if ($width && $height && $cfile->image_size['type'] != 13 && $cfile->image_size['type'] != 4) { print view_image_file($work['pict'], $_SESSION['login'], "upload", array('max_dim' => 200, 'class' => 'b-prev__pic', 'id' => 'work_image')); } else { ?> <div id="work_image" class="b-layout b-layout_padtop_20 b-layout_padlr_10"> <table cellspacing="0" cellpadding="0" border="0" class="b-layout__table b-layout__table_width_full"> <tr class="b-layout__tr"> <td class="b-icon-layout__icon"><i class="b-icon b-icon_attach_<?php echo getICOFile($cfile->getext()); ?> "></i></td> <td class="b-icon-layout__files"><div class="b-layout__txt b-layout__txt_padtop_5"><a href="<?php echo WDCPREFIX . '/' . $cfile->path . $cfile->name; ?> " class="b-icon-layout__link b-icon-layout__link_fontsize_13"><?php echo uploader::cutNameFile($cfile->original_name, portfolio::FILE_NAME_LENGTH_EDIT); ?> </a></div></td> <td class="b-icon-layout__size" style="padding-right:0;"><div class="b-layout__txt b-layout__txt_padtop_5">,<?php echo ConvertBtoMB($cfile->size); ?> </div></td> </tr> </table>
function aEditDocument($stage_id, $doc_id) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sbr_meta.php'; $stage_id = __paramValue('int', $stage_id); $doc_id = __paramValue('int', $doc_id); $objResponse = new xajaxResponse(); if (!hasPermissions('sbr')) { return $objResponse; } $sbr = sbr_meta::getInstance(); $sbr_id = $sbr->getSbrIdFromStage($stage_id); $sbr->initFromId($sbr_id, true, false, false); if ($sbr->error) { return $objResponse; } if ($sbr->getDocs($doc_id)) { $doc = current($sbr->docs); $stage = $sbr->initFromStage($stage_id, false); $doc_info = '<i class="b-icon b-icon_attach_' . getICOFile(CFile::getext($doc['file_name'])) . '"></i> <a class="b-layout__link" href="' . WDCPREFIX . '/' . $doc['file_path'] . $doc['file_name'] . '">' . $doc['name'] . '</a>, ' . ConvertBtoMB($doc['file_size']); ob_start(); include $_SERVER['DOCUMENT_ROOT'] . '/sbr/admin/tpl.popup-doc.php'; $html = ob_get_clean(); //$objResponse->script("$('popup_admin_files').addClass('b-shadow_hide');"); $objResponse->assign('popup_admin_files_edit', 'innerHTML', $html); $objResponse->script("\n new attachedFiles2( \$('popup_admin_files{$doc['id']}').getElement('.attachedfiles_admin_sbr{$doc['id']}'), {\n 'hiddenName': 'attaches[]',\n 'files': '',\n 'selectors': {'template' : '.attachedfiles_admin_sbr-tpl'}\n });"); $objResponse->call('shadow_popup'); } return $objResponse; }
/** * * @param string $filename * @return string имя css-класса для верстки */ function getIcoClassByExt($filename) { $ext = strtolower(end(explode(".", $filename))); //return getICOFile($ext); switch (trim($ext)) { case 'doc': case 'docx': return 'doc'; break; case 'xlsx': case 'xls': return 'xls'; break; case 'rar': return 'rar'; break; case 'zip': return 'zip'; break; case 'pdf': return 'pdf'; break; case 'jpg': case 'jpeg': return 'jpg'; break; default: return getICOFile($ext); break; } return $ext; }
// сокращаем название файла, сохраняя расширение if (strlen($name) > $maxLen) { $arr = explode('.', $name); $ext = array_pop($arr); $name = preg_replace("/.{$ext}\$/", '', $name); $name = substr($name, 0, $maxLen) . '...'; $name = $name . '.' . $ext; } ?> <span> <div class="b-layout__txt b-layout__txt_inline-block b-layout__txt_valign_top b-layout__txt_padtop_7"> <a class="b-layout__link" href="<?php echo WDCPREFIX . '/wizard/' . $pict->name; ?> "><span class="b-icon b-icon_margtop_-3 b-icon_mid_<?php echo getICOFile($pict->getext()); ?> "></span><?php echo $name; ?> </a> </div><a href="javascript:void(0)" onclick="upload.remove(this);" class="b-button b-button_margtop_10 b-button_admin_del"></a> </span> <?php } //if ?> <input type="hidden" name="pict_id[<?php echo $k; ?>
function set_loaded_attach($type, $id, $name, $link = false) { global $_attached; $_attached['ids'][$type] = $id; $_attached['ext'][$type] = getICOFile(CFile::getext($name)); if (strlen($name) > 40) { $name = substr($name, 0, 18) . '...' . substr($name, strlen($name) - 18, 18); } $_attached['name'][$type] = $name; $_attached['link'][$type] = $link; }
<div class="b-post__txt b-post__txt_padbot_5 b-post__txt_bold">Менеджер арбитража</div> <div class="b-post__txt b-post__txt_fontsize_15"><?php echo reformat2($current['msg'], 40); ?> </div> <?php if ($current['src_id'] > 0) { $attach = $stage->getMsgAttach($current['own_id']); ?> <table class="b-layout__table b-layout__table_margtop_10" cellpadding="0" cellspacing="0" border="0"> <?php foreach ($attach as $src) { ?> <tr class="b-layout__tr"> <td class="b-layout__middle b-layout__middle_padbot_5"><div class="b-layout__txt"><i class="b-icon b-icon_attach_<?php echo getICOFile(CFile::getext($src['name'])); ?> "></i> <a class="b-layout__link" href="<?php echo WDCPREFIX; ?> /<?php echo $src['path'] . $src['name']; ?> " target="_blank"><?php echo $src['orig_name']; ?> </a>, <?php echo ConvertBtoMB($src['size']); ?> </div></td> <td class="b-layout__right b-layout__right_padleft_20 b-layout__right_padbot_5"><div class="b-layout__txt"><a class="b-layout__link" href="<?php
"> <div class="b-shadow__right"> <div class="b-shadow__left"> <div class="b-shadow__top"> <div class="b-shadow__bottom"> <div class="b-shadow__body b-shadow__body_pad_15 b-shadow__body_bg_fff"> <h3 class="b-shadow__title b-shadow__title_padbot_15">Новый файл</h3> <?php if ($doc['id']) { ?> <table class="b-layout__table" cellpadding="0" cellspacing="0" border="0"> <tr class="b-layout__tr"> <td class="b-layout__middle b-layout__middle_padbot_5"> <div class="b-layout__txt"> <i class="b-icon b-icon_attach_<?php echo getICOFile(CFile::getext($doc['file_name'])); ?> "></i> <a class="b-layout__link" href="<?php echo WDCPREFIX . '/' . $doc['file_path'] . $doc['file_name']; ?> "><?php echo $doc['name']; ?> </a>, <?php echo ConvertBtoMB($doc['file_size']); ?> </div> </td> </tr> </table> <?php
<div class="b-layout__txt b-layout__txt_padbot_10 b-layout__txt_color_a0763b">Для того, чтобы получить заработанные деньги, вам нужно скачать, распечатать, подписать <?php echo ending($hdoc_cnt, 'документ', 'документы', 'документы'); ?> :</div> <table cellspacing="0" cellpadding="0" border="0" class="b-layout__table"> <tbody> <?php foreach ($head_docs as $hdoc) { $e = explode('.', $hdoc['file_name']); $ext = $e[count($e) - 1]; ?> <tr class="b-layout__tr"> <td class="b-layout__middle b-layout__middle_padbot_5"> <div class="b-layout__txt"> <i class="b-icon b-icon_attach_<?php echo getICOFile($ext); ?> "></i> <a href="<?php echo WDCPREFIX; ?> /<?php echo $hdoc['file_path'] . $hdoc['file_name']; ?> " class="b-layout__link"><?php echo $hdoc['name']; ?> </a>, <?php echo ConvertBtoMB($hdoc['file_size']); ?> </div>
/** * Генерирует список файлов с иконками для комментариев (новая версия) * * @param array $attaches Массив с информацией о файле/файлах (напр. результат выборки из таблицы file) * @return string HTML код */ function viewattachListNew($attaches) { if (!$attaches || !count($attaches)) { return ''; } $thumbs = ''; $list = ''; if (isset($attaches['id'])) { $attaches = array($attaches); } foreach ($attaches as $attach) { $cfile = new CFile(); $ext = $cfile->getext($attach['fname']); $ico = getICOFile($ext); $fsize = ConvertBtoMB($attach['size']); $path = WDCPREFIX . "/{$attach['path']}{$attach['fname']}"; if ($attach['size'] < 300 * 1024 && in_array($ext, $GLOBALS['graf_array']) && $ext != 'swf') { $path_th = WDCPREFIX . "/{$attach['path']}sm_{$attach['fname']}"; $th = new CFile("{$attach['path']}sm_{$attach['fname']}"); if (!$th->id) { $path_th = $path; } $thumbs .= "<li class='afl-img c'><a href='{$path}' title='{$ext}, {$fsize}'><img src='{$path_th}' alt='{$ext}, {$fsize}' /></a></li>\n"; } else { $list .= "<li class='{$ico}'><a href='{$path}'>{$ext}, {$fsize}</a></li>\n"; } } return "<ul class='added-files-list c'>{$thumbs}{$list}</ul>"; }