public static function getSearchString() { $getParam = Admin::getConfig('searchQueryParam'); if (!empty($_GET[$getParam])) { $string = mb_eregi_replace('\\s+', ' ', $_GET[$getParam]); $string = mb_eregi_replace('\\s+$', '', $string); $string = mb_eregi_replace('^\\s+', '', $string); $string = mb_eregi_replace('^\\s+', '', $string); $string = mb_eregi_replace('[^\\d_\\. ,:\\-\\(\\)\\+\\w]+', '', $string); if (!empty($string)) { return $string; } } return ''; }
<script src="/<?php echo Admin::getConfig('sharedDir'); ?> /js/image-picker/image-picker.min.js"></script> <script src="/<?php echo Admin::getConfig('sharedDir'); ?> /js/summernote/dist/summernote.js"></script> <script src="/<?php echo Admin::getConfig('sharedDir'); ?> /js/tag-it-master/js/tag-it.min.js"></script> <script src="/<?php echo Admin::getConfig('sharedDir'); ?> /js/jquery.switcher/switcher.min.js"></script> <script src="/<?php echo Admin::getConfig('sharedDir'); ?> /js/script.js"></script> </head> <body> <?php if (!empty($content)) { echo $content; } ?> </body> </html>
public static function getRootDir() { return DOCROOT . Admin::getConfig('sharedDir') . DIRECTORY_SEPARATOR . Admin::getConfig('uploadsDir') . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR; }
?> '> <?php $pagination = ''; $content = AdminHTML::renderNoneFound(); $data = $model->getData(); $uniqueValues = []; if (!empty($data)) { $dataFirstKey = array_keys($data)[0]; $dataKeys = array_keys($data[$dataFirstKey]); foreach ($dataKeys as $dataKey) { $uniqueValues[$dataKey] = Model_Admin::getDistinctSubArrayKeyValues($data, $dataKey); } Model_Admin::filterData($data, $model); $countData = count($data); $perPage = intval(Admin::getConfig('itemsPerPage')); $pages = ceil($countData / $perPage); $page = AdminHREF::getPage(); if ($page > $pages) { $page = $pages; } $content = View::factory('Admin/Data/List', ['data' => array_slice($data, ($page - 1) * $perPage, $perPage), 'uniqueValues' => $uniqueValues, 'model' => $model]); $pagination = View::factory('Admin/Data/Pagination', ['pages' => $pages, 'page' => $page, 'countData' => $countData, 'perPage' => $perPage]); } ?> <?php echo $pagination, $content, $pagination; ?> </form>
public function action_ajaxeditor() { if (!empty($_FILES['imageupload']['name'])) { if (!$_FILES['imageupload']['error']) { $name = md5($_FILES['imageupload']['name']); $ext = pathinfo($_FILES['imageupload']['name'], PATHINFO_EXTENSION); $filename = $name . '.' . $ext; $destinationDir = Admin::getConfig('sharedDir') . DIRECTORY_SEPARATOR . Admin::getConfig('uploadsDir') . DIRECTORY_SEPARATOR . 'editorUploads' . DIRECTORY_SEPARATOR; if (!file_exists($destinationDir)) { mkdir($destinationDir, 0755, true); } $destination = $destinationDir . $filename; if (move_uploaded_file($_FILES["imageupload"]["tmp_name"], $destination)) { echo AdminHREF::getFullHost() . '/' . $destination; } } } die; }
if ($model->isDeletionAllowed()) { $delHref = AdminHREF::getDefaultAdminRouteUri('ajaxUploadDelete', $model->getShortName(), $params['primary']) . '/?directoryIndex=' . urlencode($directoryIndex) . '&file=' . urlencode(basename($file)); $deletion = '<button ' . 'type="button" ' . 'class="ajaxUploadsDelete" ' . 'confirmText="Вы уверены в удалении?" ' . 'href="' . $delHref . '">' . '<i class="fa fa-trash-o"></i> ' . 'Удалить' . '</button>'; } ?> <?php if ($model->isModifyingAllowed()) { $descriptioning = View::factory('Admin/Data/Edit/Upload/descriptionForm', ['file' => $file, 'reference' => $reference, 'modelName' => $model->getShortName()]); $makeFirst = View::factory('Admin/Data/Edit/Upload/makeFirstForm', ['reference' => $reference, 'file' => $file, 'modelName' => $model->getShortName()]); } ?> <?php $iconFile = Admin::getFileExtension($file) . '.png'; $iconPath = Admin::getConfig('sharedDir') . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'exts' . DIRECTORY_SEPARATOR; if (!file_exists(DOCROOT . $iconPath . $iconFile)) { $iconFile = 'file.png'; } $icon = '/' . mb_eregi_replace('\\\\', '/', $iconPath . $iconFile); ?> <a target='blank' title='<?php echo basename($file); ?> ' class='<?php echo $class; ?> '
<?php $spaces = intval(Admin::getConfig('paginationLinksCount')); if (!is_numeric($spaces) || $spaces < 2) { $spaces = 2; } if ($spaces % 2 !== 0) { ++$spaces; } $getParam = Admin::getConfig('pageQueryParam'); ?> <nav class="navbar navbar-default adminPagination" role="navigation"> <ul class="nav navbar-nav"> <li> <?php $countCaption = ''; if ($countData > 0) { $countCaption = 'Объектов: ' . $countData; if ($pages > 1) { $countCaption = $countCaption . ', страниц: ' . $pages; } } else { $countCaption = 'Объектов не найдено'; } ?> <a><?php echo $countCaption; ?> </a> </li>
<?php $unfiltered = []; if (method_exists($model, 'getUnfilteredColumns')) { $unfiltered = $model->getUnfilteredColumns(); } if (in_array($key, $unfiltered) || count($values) < 2) { echo $key; } else { $prefix = Admin::getConfig('filterQueryPrefix'); $values = array_unique($values); natcasesort($values); $values = array_combine(array_values($values), $values); $selected = null; $filterParams = AdminHREF::getFilterParams(); if (isset($filterParams[$key])) { $selected = $filterParams[$key]; } $attrs = ['multiple' => 'multiple', 'class' => 'sumoselect', 'placeholder' => $key]; echo Form::select($prefix . AdminHREF::$prefixSeparator . $key . '[]', $values, $selected, $attrs); }
private static function getPreviewsDir() { $sharedDir = Admin::getConfig('sharedDir'); $previewDir = Admin::getConfig('previewsDir'); return DOCROOT . $sharedDir . DIRECTORY_SEPARATOR . $previewDir . DIRECTORY_SEPARATOR; }