/** * DataSet Import CSV * @return <XiboAPIResponse> */ public function DataSetImportCsv() { // Auth if (!$this->user->PageAuth('dataset')) { return $this->Error(1, 'Access Denied'); } $dataSetId = $this->GetParam('dataSetId', _INT); $auth = $this->user->DataSetAuth($dataSetId, true); if (!$auth->edit) { return $this->Error(1, 'Access Denied'); } // Expect a file id $fileId = $this->GetParam('fileId', _INT); if (!$this->user->FileAuth($fileId)) { return $this->Error(1, 'Access Denied'); } $file = new File(); if (!($csvFileLocation = $file->GetPath($fileId))) { return $this->Error($file->GetErrorNumber(), $file->GetErrorMessage()); } // Other parameters // Filter using HTML string because _STRING strips some of the JSON characters. $spreadSheetMapping = $this->GetParam('spreadSheetMapping', _HTMLSTRING); $overwrite = $this->GetParam('overwrite', _INT); $ignoreFirstRow = $this->GetParam('ignoreFirstRow', _INT); // Convert the spread sheet mapping into an Array $spreadSheetMapping = json_decode($spreadSheetMapping, true); // Check that the columns match the columns for this dataset $dataSetColumnObject = new DataSetColumn(); // Make an array with the datasetcolumnid as the key $columns = array(); foreach ($dataSetColumnObject->GetColumns($dataSetId) as $col) { $columns[$col['datasetcolumnid']] = true; } // Look through each column we have been provided and see if it matches foreach ($spreadSheetMapping as $key => $value) { if (!array_key_exists($value, $columns)) { return $this->Error(1000, __('The column mappings you have provided are invalid. Please ensure you have the correct DataSetColumnIDs.')); } } $dataSetObject = new DataSetData(); if (!$dataSetObject->ImportCsv($dataSetId, $csvFileLocation, $spreadSheetMapping, $overwrite == 1, $ignoreFirstRow == 1)) { return $this->Error($dataSetObject->GetErrorNumber(), $dataSetObject->GetErrorMessage()); } return $this->Respond($this->ReturnId('success', true)); }
foreach ($arResult["ITEMS"] as $n => $arItem) { ?> <?php $URL = str_replace('#ELEMENT_ID#', $arItem['ID'], $arSEF[$arItem['CATALOG_ID']]); $NAME = $arItem['CATALOG_ID'] == 2 ? $arItem["PROPERTIES"]["GROUP"]["VALUE"] . ' - (' . $arItem["PROPERTIES"]["YEAR"]["VALUE"] . ') ' . $arItem["PROPERTIES"]["ALBUM"]["VALUE"] : $arItem['NAME']; ?> <tr> <td width="110px" style="vertical-align: top"> <?php if (!empty($arItem['PREVIEW_PICTURE'])) { ?> <a href="<?php echo $URL; ?> "><img src="<?php echo File::GetPath($arItem['PREVIEW_PICTURE']); ?> " title="<?php echo $NAME; ?> " alt="<?php echo $NAME; ?> " width="100px"/></a> <?php } else { ?> <a href="<?php echo $URL; ?> "><div class="no-image-pic"><span><?php
if (!defined("KERNEL_INCLUDED") || KERNEL_INCLUDED !== true) { die; } ?> <div class="post no-bg"> <?php if (!empty($arResult)) { $title = $arResult["PROPERTIES"]["GROUP"]["VALUE"] . ' - (' . $arResult["PROPERTIES"]["YEAR"]["VALUE"] . ') ' . $arResult["PROPERTIES"]["ALBUM"]["VALUE"]; SetTitle($title); ?> <table width="100%"> <tr> <td width="20%"> <img src="<?php echo File::GetPath($arResult['DETAIL_PICTURE']); ?> " title="<?php echo $title; ?> " alt="<?php echo $title; ?> "/> </td> <td style="vertical-align: top"> <b>Автор: </b> <?php echo $arResult["PROPERTIES"]["GROUP"]["VALUE"]; ?> <br /> <b>Альбом: </b> <?php
<?php namespace ScriptAcid; if (!defined("KERNEL_INCLUDED") || KERNEL_INCLUDED !== true) { die; } $arParams['WIDTH'] = intVal($arParams['WIDTH']) > 0 ? intVal($arParams['WIDTH']) : 320; $arParams['HEIGHT'] = intVal($arParams['HEIGHT']) > 0 ? intVal($arParams['HEIGHT']) : 240; $arResult['B_VIDEO'] = true; if (intVal($arParams['FILE_ID']) > 0) { $arResult["FILE_PATH"] = File::GetPath($arParams['FILE_ID']); } elseif (strLen($arParams['URL']) > 0) { $arResult["FILE_PATH"] = $arParams['URL']; } else { $arResult['B_VIDEO'] = false; } $this->connectComponentTemplate();
if (!defined("KERNEL_INCLUDED") || KERNEL_INCLUDED !== true) { die; } ?> <div class="post no-bg"> <?php if (!empty($arResult)) { ?> <p><?php echo $arResult["DETAIL_TEXT"]; ?> </p> <p> <a href="<?php echo File::GetPath($arResult['PROPERTIES']['TEXT']['VALUE']); ?> " target="_blank">Читать весь</a> </p> <p class="tags"> <strong>Автор: </strong> <?php echo User::GetSign($arResult["CREATED_BY"]); ?> | <strong>Дата: </strong> <?php echo $arResult["DATE_CREATE"]; ?> </p> </div> <?php } else {