Skip to content

Commit

Permalink
Merge pull request #4 from ylabio/release-0.5.0
Browse files Browse the repository at this point in the history
Release 0.5.0
  • Loading branch information
shvykov committed Jun 13, 2018
2 parents 2973335 + 5ade53d commit fd3ae03
Show file tree
Hide file tree
Showing 52 changed files with 1,199 additions and 85 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

## [Released]

## [0.5.0] - 2018-06-13
### Added
- Стандартный загрузчик битрикс
- Удаление созданных демо-данных по каждому профилю
### Fix
- Справочник с данными
- Баг генератора привязки к элементам HLB
- Незначительные исправления и улучшения

## [0.4.8] - 2018-06-05
### Fix
- Корректное удаление модуля
- phpDoc

## [0.4.7] - 2018-05-08
### Fix
- Версия модуля
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ $ git clone https://github.com/ylabio/ylab.ddata.git
В папку `local/modules` будет склонирован репозиторий модуля, после этого, необходимо в панели администратора установить
модуль: `Рабочий стол -> Marketplace -> Установленные решения`.

##Требования
1. Требуется версия 1С-Битрикс от 17.0.0.
2. Требуется версия PHP >= 7.0

## Bitrix модуль генерации демо данных

Expand Down
20 changes: 19 additions & 1 deletion admin/entity_profile_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use Bitrix\Main\Loader;
use Bitrix\Main\Localization\Loc;
use Ylab\Ddata\Interfaces\DeleteDataClass;
use Ylab\Ddata\LoadUnits;

try {
Expand Down Expand Up @@ -39,7 +40,7 @@
if (
$request->getRequestMethod() == "POST" // проверка метода вызова страницы
&&
($save != "" || $apply != "" || $generate != "") // проверка нажатия кнопок "Сохранить" и "Применить" и "Генерировать"
($save != "" || $apply != "" || $generate != "" || $delete != "") // проверка нажатия кнопок "Сохранить" и "Применить" и "Генерировать"
&&
$POST_RIGHT == "W" // проверка наличия прав на запись для модуля
&&
Expand All @@ -60,6 +61,9 @@
} else {
if (!empty($generate)) {
LocalRedirect("/bitrix/admin/ylab.ddata_entity_profile_gen.php?ID=" . $iProfileID . "&entity_id=" . $entityId . "&lang=" . LANGUAGE_ID);
} elseif (!empty($delete)) {
$oGenDataClass = new DeleteDataClass();
$oGenDataClass::deleteGenData($iProfileID);
}
}
}
Expand All @@ -68,6 +72,8 @@
if (!empty($iProfileID)) {
$oEntity = new $arEntity['CLASS']($iProfileID);
$arProfile = $oEntity->getProfile($iProfileID);
$oGenDataClass = new DeleteDataClass();
$arGenData = $oGenDataClass::getGenData($iProfileID);
} else {
$oEntity = new $arEntity['CLASS']();
}
Expand Down Expand Up @@ -288,6 +294,18 @@ class="DataFieldButton" value="..." data-name="PROPERTIES[<?= $sPropertyName ?>]
);
?>
<input name="generate" value="<?= Loc::getMessage('YLAB_DDATA_GEN')?>" class="adm-btn-save" title="<?= Loc::getMessage('YLAB_DDATA_GEN')?>" type="submit">
<? if ($arGenData): ?>
<input name="delete" value="<?= Loc::getMessage('YLAB_DDATA_GENERATE_BUTTON_DELETE') ?>" type="submit">
<? endif; ?>
<? $tabControl->End(); ?>
</form>
<?
echo BeginNote();
echo '<div style="display: inline-block; vertical-align: middle"><img width="64px" height="64px" src="' . \Ylab\Ddata\Helpers::getModulePath(true) . '/assets/images/ylab.ddata.jpg' . '" alt=""></div>';
echo '<div style="display: inline-block; vertical-align: middle; margin-left: 5px">';
echo Loc::getMessage('YLAB_DDATA_ADVERTISING_SITE');
echo Loc::getMessage('YLAB_DDATA_ADVERTISING_GIT');
echo '</div>';
echo EndNote();
?>
<? require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php"); ?>
28 changes: 24 additions & 4 deletions admin/entity_profile_gen.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use Bitrix\Main\Loader;
use Bitrix\Main\Localization\Loc;
use Ylab\Ddata\Interfaces\DeleteDataClass;
use Ylab\Ddata\LoadUnits;

/** @var \CMain $APPLICATION */
Expand Down Expand Up @@ -43,6 +44,7 @@

if (!empty($iProfileIDAjax)) {
$oEntity = new $arEntity['CLASS']($iProfileIDAjax);
$oGenDataClass = new DeleteDataClass();
}

$iLastCounter = $oRequest->get('lastcounter') > 0 ? $oRequest->get('lastcounter') : 0;
Expand All @@ -54,18 +56,19 @@
$arResult = $oEntity->genUnit();
if (empty($arResult['ERROR'])) {
$arNewElements[] = $arResult['NEW_ELEMENT_ID'];
$oGenDataClass::setGenData($iProfileIDAjax, $sEntityIDAjax, $arResult['NEW_ELEMENT_ID']);
} else {
$sError = $arResult['ERROR'];
$sErrors = $arResult['ERROR'];
}

$iLastCounter++;
$iPercent = round(100 * ($iLastCounter / $iCountElements), 2);
$sResult = '';
if (empty($sError)) {
if (empty($sErrors)) {
$sResult = Loc::getMessage('YLAB_DDATA_GENERATE_RESULT_SUCCESS',
['#ELEMENTS#' => implode(", ", $arNewElements)]);
} else {
$sResult = Loc::getMessage('YLAB_DDATA_GENERATE_RESULT_ERROR', ['#ERROR#' => implode(", ", $sError)]);
$sResult = Loc::getMessage('YLAB_DDATA_GENERATE_RESULT_ERROR', ['#ERROR#' => $sErrors]);
}

if (intval(time() - $iStart) == $iDuration) {
Expand Down Expand Up @@ -94,6 +97,8 @@
if (!empty($iProfileID)) {
$oEntity = new $arEntity['CLASS']($iProfileID);
$arProfile = $oEntity->getProfile($iProfileID);
$oGenDataClass = new DeleteDataClass();
$arGenData = $oGenDataClass::getGenData($iProfileID);
}
$arTabs = [
[
Expand Down Expand Up @@ -220,8 +225,23 @@ class="adm-btn-save"
value="<?= Loc::getMessage('YLAB_DDATA_GENERATE_BUTTON_CANCEL') ?>"
onclick="window.location.replace('ylab.ddata_entity_profile_list.php?lang=<?= LANG ?>')"
>
<? if ($arGenData): ?>
<input type="button"
class="adm-btn-cancel"
value="<?= Loc::getMessage('YLAB_DDATA_GENERATE_BUTTON_DELETE') ?>"
onclick="window.location.replace('ylab.ddata_entity_profile_list.php?lang=<?= LANG ?>')"
>
<? endif; ?>
<? $tabControl->End(); ?>
</form>

<?
echo BeginNote();
echo '<div style="display: inline-block; vertical-align: middle"><img width="64px" height="64px" src="' . \Ylab\Ddata\Helpers::getModulePath(true) . '/assets/images/ylab.ddata.jpg' . '" alt=""></div>';
echo '<div style="display: inline-block; vertical-align: middle; margin-left: 5px">';
echo Loc::getMessage('YLAB_DDATA_ADVERTISING_SITE');
echo Loc::getMessage('YLAB_DDATA_ADVERTISING_GIT');
echo '</div>';
echo EndNote();
?>

<? require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php"); ?>
25 changes: 21 additions & 4 deletions admin/entity_profile_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
$bResultProfile = false;
foreach ($arProfile['FIELDS'] as $arField) {
$bResultFields = Ylab\Ddata\Orm\DataUnitOptionsTable::delete($arField['ID']);
if($bResultFields->isSuccess()) {
if ($bResultFields->isSuccess()) {
$bResultFields = true;
}
}
Expand All @@ -47,6 +47,9 @@
$bResultProfile = true;
}
}
} elseif ($sActionButton == 'delete-data') {
$oGenDataClass = new Ylab\Ddata\Interfaces\DeleteDataClass();
$oGenDataClass::deleteGenData($iProfileID);
}
} elseif ($oRequest->isPost()) {
$arProfileID = $oRequest->get('ID');
Expand All @@ -69,7 +72,7 @@
$bResultProfile = false;
foreach ($arProfile['FIELDS'] as $arField) {
$bResultFields = Ylab\Ddata\Orm\DataUnitOptionsTable::delete($arField['ID']);
if($bResultFields->isSuccess()) {
if ($bResultFields->isSuccess()) {
$bResultFields = true;
}
}
Expand Down Expand Up @@ -210,8 +213,14 @@ function CheckFilter()
"ACTION" => $lAdmin->ActionRedirect("ylab.ddata_entity_profile_gen.php?ID=" . $f_ID . '&entity_id=' . $f_TYPE)
];

$row->AddActions($arActions);
$arActions[] = [
"ICON" => "delete",
"TEXT" => Loc::getMessage('YLAB_DDATA_ROW_ACTION_DEL_DATA'),
"ACTION" => "if(confirm('" . Loc::getMessage('YLAB_DDATA_ROW_ACTION_DEL_DATA_CONFIRM') . "')) " . $lAdmin->ActionDoGroup($f_ID,
"delete-data")
];

$row->AddActions($arActions);
}


Expand Down Expand Up @@ -288,5 +297,13 @@ function CheckFilter()
</form>

<? $lAdmin->DisplayList(); ?>

<?
echo BeginNote();
echo '<div style="display: inline-block; vertical-align: middle"><img width="64px" height="64px" src="' . \Ylab\Ddata\Helpers::getModulePath(true) . '/assets/images/ylab.ddata.jpg' . '" alt=""></div>';
echo '<div style="display: inline-block; vertical-align: middle; margin-left: 5px">';
echo Loc::getMessage('YLAB_DDATA_ADVERTISING_SITE');
echo Loc::getMessage('YLAB_DDATA_ADVERTISING_GIT');
echo '</div>';
echo EndNote();
?>
<? require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php"); ?>
Loading

0 comments on commit fd3ae03

Please sign in to comment.