Закгрузка данных из архивной папки

parent ee953aa2
......@@ -7,3 +7,4 @@ srt/public/fotos-test/
srt/public/fotos-arch/
......@@ -119,6 +119,21 @@ return [
]
],
],
[
'name' => 'adm.main.loadfolderslist',
'path' => '/[:lang/]support/main/loadfolderslist/',
'middleware' => App\Action\Admin\Main::class,
'allowed_methods' => ['POST', 'GET'],
'options' => [
'constraints' => [
'lang' => '[a-z]{2,3}',
],
'defaults' => [
'lang' => \App\Model\Locales::DEFAULT_LANG_ADMIN,
'action' => App\Action\Admin\Main::LOAD_FOLDERS_LIST,
]
],
],
[
'name' => 'adm.init',
'path' => '/[:lang/]support/init/',
......
......@@ -16,6 +16,7 @@
}
.b-list_folders {
display: none;
margin: 8px 0 4px 0;
height: calc(100vh - 140px);
overflow-y:auto;
......@@ -35,15 +36,15 @@
right: 0;
}
.b-list_folders-item.viewed
.b-list_folders-item.active
{
opacity: 0.45;
font-weight: bold;
opacity: 1 !important;
}
.b-list_folders-item.active
.b-list_folders.new .b-list_folders-item.viewed
{
font-weight: bold;
opacity: 1;
opacity: 0.45;
}
.b-preview
......@@ -52,6 +53,11 @@
overflow:auto;
}
.b-preview_inner
{
display: none;
}
.b-loading {
display: none;
position: absolute;
......
This diff is collapsed.
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace App\Action\Admin;
use App\Entity\Feeds\Feed;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Slim\Flash\Messages;
use Zend\Diactoros\Response\HtmlResponse;
use Zend\Diactoros\Response\JsonResponse;
use Zend\Diactoros\Response\RedirectResponse;
use Zend\Hydrator\DelegatingHydrator;
/**
* Class Feeds
* @package App\Action\Admin
*/
class Feeds extends Common
{
const ACTION_CREATE = 'create';
const ACTION_EDIT = 'edit';
const ACTION_LIST = 'list';
/**
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @param callable|null $next
* @return HtmlResponse
*/
function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next = null)
{
if($request->getMethod() == 'POST') {
try {
switch ($request->getAttribute('action')) {
case self::ACTION_CREATE:
$response = $this->create($request);
break;
case self::ACTION_EDIT:
$response = $this->edit($request);
break;
default:
}
} catch(\Exception $e) {
$data = [
'result' => false,
'msg' => $e->getMessage(),
];
$response = new JsonResponse($data);
}
return $response;
} elseif($request->getAttribute('action') == self::ACTION_CREATE || $request->getAttribute('action') == self::ACTION_EDIT) {
$feed_id = $request->getAttribute('id');
if ($feed_id) {
/** @var \App\Model\Feeds $feedsModel */
$feedsModel = $this->container->get(\App\Model\Feeds\Feeds::class);
$feed = $feedsModel->findById($feed_id);
}
/** @var \App\Model\Currencies $currencyModel */
$currencyModel = $this->container->get(\App\Model\Currencies::class);
$currencies = [];
foreach($currencyModel->findAll() as $currency) {
$currencies[$currency->getCode()] = $currency->getName();
}
/** @var \App\Model\Users $usersModel */
$usersModel = $this->container->get(\App\Model\Users::class);
$all_users = $usersModel->findAll();
/** @var \App\Model\Sites $sitesModel */
$sitesModel = $this->container->get(\App\Model\Sites::class);
$sites = $sitesModel->findAll()->toArray();
$sites_users = [];
foreach($sites as $site) {
$sites_users[] = $site['users_id'];
}
$sites_users = array_unique($sites_users);
$users = [];
foreach($all_users as $user) {
$user_id = $user->getId();
if (!in_array($user_id, $sites_users)) {
$users[$user_id] = $user->getFullname();
}
}
$response = new HtmlResponse($this->template->render('adm::feeds/feed', [
'lang' => $request->getAttribute('layoutInfo')->getLang(),
'feed' => $feed,
'users' => $users,
'currencies' => $currencies,
'formats' => $this->container->get('config')['feed_conf']['formats']
]));
return $response;
} else {
/** @var \App\Model\Sites $sitesModel */
$usersModel = $this->container->get(\App\Model\Users::class);
/** @var \App\Model\Feeds $feedsModel */
$feedsModel = $this->container->get(\App\Model\Feeds\Feeds::class);
$feeds = $feedsModel->findAll()->toArray();
foreach ($feeds as $key => $feed) {
$user = $usersModel->findById($feed['clientid']);
if ($user) {
$feeds[$key]['clientid'] = $user->getFullname();
}
}
$response = new HtmlResponse($this->template->render('adm::feeds/list', [
'lang' => $request->getAttribute('layoutInfo')->getLang(),
'feeds' => $feeds,
]));
return $response;
}
}
/**
* @param ServerRequestInterface $request
* @return HtmlResponse|RedirectResponse
*/
private function create(ServerRequestInterface $request)
{
/** @var \App\Model\Feeds $feedsModel */
$feedsModel = $this->container->get(\App\Model\Feeds\Feeds::class);
/** @var DelegatingHydrator $hydrator */
$hydrator = $this->container->get(DelegatingHydrator::class);
$data = $request->getParsedBody();
$data = array(
'title' => (trim($data['title']) != "") ? trim($data['title']) : NULL,
'active' => (bool)$data['active'],
'clientid' => (int)$data['clientid'],
'url' => $data['url'],
'format' => $data['format'],
'defaultcur' => $data['defaultcur'],
);
$feed = $hydrator->hydrate($data, new Feed());
// Проверка наличия фида с таким же названием:
if(($existed = $feedsModel->findOne(['title' => $data['title']]))) {
throw new \Exception(sprintf('Feed with title &lt;%s&gt; already exists', $data['title']));
}
$result = $feedsModel->saveRetarg($feed);
if(!$result) {
throw new \Exception('DB error');
}
$response = new JsonResponse([
'result' => true,
'redirect' => $this->router->generateUri('adm.feed.edit', [
'lang' => $request->getAttribute('layoutInfo')->getLang(),
'id' => $result,
])
]);
return $response;
}
private function edit(ServerRequestInterface $request)
{
/** @var \App\Model\Feeds $feedsModel */
$feedsModel = $this->container->get(\App\Model\Feeds\Feeds::class);
/** @var DelegatingHydrator $hydrator */
$hydrator = $this->container->get(DelegatingHydrator::class);
$data = $request->getParsedBody();
$feed_id = $request->getAttribute('id');
$feed = $feedsModel->findById($feed_id);
if(!$feed) {
throw new \Exception('Feed not found');
}
//return new JsonResponse($data);
$data['title'] = (trim($data['title']) != "") ? trim($data['title']) : NULL;
$feed->setTitle($data['title']);
$feed->setActive((bool)$data['active']);
$feed->setClientid((int)$data['clientid']);
$feed->setUrl($data['url']);
$feed->setFormat($data['format']);
$feed->setDefaultcur($data['defaultcur']);
// Проверка наличия фида с таким же названием:
if(($existed = $feedsModel->findOne(['title' => $data['title']]))) {
if($existed->getId() != $feed->getId()) {
throw new \Exception(sprintf('Feed with title &lt;%s&gt; already exists', $data['title']));
}
}
//$result = $feedsModel->save($feed);
$result = $feedsModel->saveRetarg($feed);
if(!$result) {
throw new \Exception('DB error');
}
$response = new JsonResponse([
'result' => true,
'redirect' => $this->router->generateUri('adm.feed.edit', [
'lang' => $request->getAttribute('layoutInfo')->getLang(),
'id' => $feed_id,
])
]);
return $response;
}
}
\ No newline at end of file
......@@ -55,6 +55,7 @@ class Index extends Common
}
}
/** @var SupportService $auth */
/*
$auth = $this->container->get(SupportService::class);
......
......@@ -43,6 +43,9 @@ class Main extends Common
{
const SAVE_FOLDERS = 'save_folders';
const LOAD_FOLDER = 'load_folder';
const LOAD_FOLDERS_LIST = 'load_folders_list';
/**
......@@ -64,6 +67,9 @@ class Main extends Common
case self::LOAD_FOLDER:
$response = $this->loadFolder($request);
break;
case self::LOAD_FOLDERS_LIST:
$response = $this->loadFoldersList($request);
break;
default:
}
} catch(\Exception $e) {
......@@ -81,14 +87,21 @@ class Main extends Common
private function saveFolders(ServerRequestInterface $request)
{
$data = $request->getParsedBody();
//return new JsonResponse($data);
$folders_list = [];
chdir('public/');
return new JsonResponse($data);
foreach($data as $folder => $pairs) {
/*
$resp = [
'result' => true,
'folders' => $folders_list,
];
return new JsonResponse($resp);
*/
chdir('public/');
foreach($data as $folder => $pairs) {
$from = "fotos/$folder";
$to = "fotos-arch/$folder";
......@@ -109,12 +122,10 @@ class Main extends Common
$pair_num = '';
foreach ($pairs as $pair => $pair_files) {
if (in_array($entry, $pair_files)) {
$pair_num = $pair.'--';
$pair_num = $pair.'-';
break;
}
}
//$folders_list[] = $folder;
copy("$from/$entry", "$to/$pair_num$entry");
} else {
copy("$from/$entry", "$to/$entry");
......@@ -138,22 +149,24 @@ class Main extends Common
chdir('..');
return new JsonResponse($folders_list);
// Сформировать тестовые данные для статистики по фидам:
if ($data['feedTestData']) {
return $this->renderFeedTestData($request);
}
$resp = [
'result' => true,
'folders' => $folders_list,
];
return new JsonResponse($resp);
}
private function loadFolder(ServerRequestInterface $request)
{
$data = $request->getParsedBody();
if ($data['folder']) {
if ($data['folder'] && $data['type']) {
if ($data['type'] == 'new') $folder = 'fotos';
if ($data['type'] == 'arch') $folder = 'fotos-arch';
chdir('public/fotos/'.$data['folder']);
chdir("public/$folder/".$data['folder']);
$dir = getcwd();
chdir('../../..');
$entries = scandir($dir);
......@@ -172,7 +185,36 @@ class Main extends Common
$data = $filelist;
$response = new JsonResponse($data);
} else {
$data = [
'result' => false,
];
$response = new JsonResponse($data);
}
return $response;
}
private function loadFoldersList(ServerRequestInterface $request)
{
$data = $request->getParsedBody();
if ($data['type']) {
if ($data['type'] == 'new') $folder = 'fotos';
if ($data['type'] == 'arch') $folder = 'fotos-arch';
chdir("public/$folder");
$dir = getcwd();
chdir('../..');
$folders = scandir($dir);
foreach ($folders as $key=>$folder_name) {
if (strpos($folder_name, '.') > -1) {
unset($folders[$key]);
}
}
$response = new JsonResponse($folders);
} else {
$data = [
'result' => false,
......
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace App\Model\AmSystem;
use App\Model\Common;
/**
* Class Banners
* @package App\Model
*/
class Banners extends Common
{
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace App\Model\AmSystem;
use App\Model\Common;
/**
* Class Campaigns
* @package App\Model
*/
class Campaigns extends Common
{
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace App\Model\AmSystem;
use App\Model\Common;
/**
* Class Groups
* @package App\Model
*/
class Groups extends Common
{
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace App\Model\Feeds;
use App\Model\Common;
/**
* Class Categories
* @package App\Model
*/
class Categories extends Common
{
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace App\Model\Feeds;
use App\Model\Common;
/**
* Class CategoryFees
* @package App\Model
*/
class CategoryFees extends Common
{
public function saveRetargCatFee($entity, $action)
{
$data_entity = $this->delegatingHydrator->extract($entity);
$table_fields = $this->tableGateway->getColumns();
$data = [];
foreach ($table_fields as $field) {
if (isset($data_entity[mb_strtolower($field)])) {
$data[$field] = $data_entity[mb_strtolower($field)];
}
}
if ($action == 'insert') {
$query = function($data) {
$this->tableGateway->insert($data);
return $data['CatID'];
};
}
if ($action == 'update') {
$query = function($data) {
$id = $data['CatID'];
unset($data['CatID']);
$this->tableGateway->update($data, ['CatID' => $id]);
return $id;
};
}
try {
$this->tableGateway->getAdapter()->getDriver()->getConnection()->beginTransaction();
$id = $query($data);
$this->tableGateway->getAdapter()->getDriver()->getConnection()->commit();
} catch (\Exception $e) {
$this->tableGateway->getAdapter()->getDriver()->getConnection()->rollback();
throw $e;
}
return $id;
}
public function deleteRetargCatFee($entity)
{
$result = false;
$cat_id = $entity->getCatid();
if ($entity) {
$result = $this->tableGateway->delete(['CatID' => $cat_id]);
} else {
throw new \Exception("Record not found ID:" . $cat_id);
}
return $result;
}
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace App\Model\Feeds;
use App\Model\Common;
/**
* Class Feeds
* @package App\Model
*/
class Feeds extends Common
{
public function getIdListByUser($userId)
{
$feeds = $this->findAll(['clientid' => $userId])->toArray();
if ($feeds) {
$feed_id_list = [];
foreach($feeds as $feed_item) {
$feed_id = $feed_item['id'];
if (!in_array($feed_id, $feed_id_list)) {
$feed_id_list[] = $feed_id;
}
}
}
return $feed_id_list;
}
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace App\Model\Feeds;
use App\Model\Common;
/**
* Class OrdersStatus
* @package App\Model
*/
class OrdersStatus extends Common
{
public function saveRetargOrderStatus($entity, $action)
{
$data_entity = $this->delegatingHydrator->extract($entity);
$table_fields = $this->tableGateway->getColumns();
$data = [];
foreach ($table_fields as $field) {
if (isset($data_entity[mb_strtolower($field)])) {
$data[$field] = $data_entity[mb_strtolower($field)];
}
}
if ($action == 'insert') {
$query = function($data) {
$this->tableGateway->insert($data);
return $data['order_id'];
};
}
if ($action == 'update') {
$query = function($data) {
$id = $data['order_id'];
unset($data['order_id']);
$this->tableGateway->update($data, ['order_id' => $id]);
return $id;
};
}
try {
$this->tableGateway->getAdapter()->getDriver()->getConnection()->beginTransaction();
$id = $query($data);
$this->tableGateway->getAdapter()->getDriver()->getConnection()->commit();
} catch (\Exception $e) {
$this->tableGateway->getAdapter()->getDriver()->getConnection()->rollback();
throw $e;
}
return $id;
}
public function deleteRetargOrderStatus($entity)
{
$result = false;
$feed_id = $entity->getFeedId();
$order_id = $entity->getOrderId();
if ($entity) {
$result = $this->tableGateway->delete(['feed_id' => $feed_id, 'order_id' => $order_id]);
} else {
throw new \Exception("Record not found ID:" . $feed_id . " " . $order_id);
}
return $result;
}
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace App\Model\Feeds;
use App\Model\Common;
/**
* Class ShopFeeds
* @package App\Model
*/
class ShopFeeds extends Common
{
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace App\Model\Feeds;
use App\Model\Common;
/**
* Class Shops
* @package App\Model
*/
class Shops extends Common
{
}
\ No newline at end of file
This diff is collapsed.
......@@ -34,8 +34,9 @@ $this->headLink()
->appendStylesheet('/css/styles-main.css')
;
$form_save_link = $this->url('adm.main.save',['lang' => $this->lang]);
$form_load_link = $this->url('adm.main.loadfolder',['lang' => $this->lang]);
$form_save_link = $this->url('adm.main.save');
$form_load_link = $this->url('adm.main.loadfolder');
$form_loadlist_link = $this->url('adm.main.loadfolderslist');
$colors_active = $this->colors_active;
$folders = $this->folders;
......@@ -49,27 +50,35 @@ $dir = $this->dir;
<div class="b-list">
<select class="b-list_select-folders form-control">
<option value="new">Новые</option>
<option value="archive">Архив</option>
<option value="arch">Архив</option>
</select>
<ul class="b-list_folders">
<ul class="b-list_folders new" data-type="new">
<?php foreach ($folders as $folder): ?>
<li class="b-list_folders-item" data-folder="<?= $folder ?>"><?= $folder ?><b></b></li>
<?php endforeach; ?>
</ul>
<form id="save-folders-form" action="<?= $form_save_link ?>" method="POST"></form>
<ul class="b-list_folders arch" data-type="arch">
</ul>
<form id="load-folders-list-form" action="<?= $form_loadlist_link ?>" method="POST"></form>
<form id="load-folder-form" action="<?= $form_load_link ?>" method="POST"></form>
<a class="btn btn-primary save-folders" href="#">Сохранить</a>
<form id="save-folders-form" action="<?= $form_save_link ?>" method="POST"></form>
<a class="btn btn-primary save-folders disabled" href="#" disabled>Сохранить</a>
</div>
<div class="b-preview col" data-colors=<?= ($colors_active ? json_encode($colors_active) : '')?> data-pairs_count=<?= ($pairs_count ? json_encode($pairs_count) : '')?>>
<div class="b-loading"></div>
<div class="b-preview_inner new col">
</div>
<div class="b-preview_inner arch col">
</div>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment