403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/grain.iiko/admin/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/grain.iiko/admin/modifiers.php
<?php

use \Grain\Iiko\Modifier;
use \Grain\Iiko\ModifierListTable;
use \Grain\Iiko\ModifierListGroupTable;
use \Grain\Iiko\Restaurants;
use \Bitrix\Main\Config\Option;
use \Bitrix\Main\Localization\Loc;
use \Bitrix\Main\Loader;

require_once(__DIR__ ."/page_header.php");

Loc::loadMessages(__FILE__);

/** @var \CAllMain $APPLICATION */

if($restaurant=Restaurants::getRestaurantById($request->get('restaurant')))
{
	$APPLICATION->SetTitle(Loc::getMessage('GRAIN_IIKO_ADMIN_MODIFIERS_RESTAURANT_TITLE',array('#NAME#'=>$restaurant['NAME'])));
	if($modifierTree = Modifier::getTree($restaurant['XML_ID']))
	{	
		if($request->get('action')=='save')
		{
			$groupsToSave = is_array($request->get('group'))?$request->get('group'):array();
			$itemsToSave = is_array($request->get('item'))?$request->get('item'):array();
			foreach($modifierTree as $group)
			{
				if(array_key_exists($group['ID'], $groupsToSave))
				{
					$active = $groupsToSave[$group['ID']]=='Y'?'Y':'N';
					ModifierListGroupTable::update($group['ID'],array('ACTIVE'=>$active));
				}
				foreach($group['ITEMS'] as $item)
				{
					if(array_key_exists($item['ID'], $itemsToSave))
					{
						$active = $itemsToSave[$item['ID']]=='Y'?'Y':'N';
						ModifierListTable::update($item['ID'],array('ACTIVE'=>$active));
					}
				}
			}
			$modifierTree = Modifier::getTree($restaurant['XML_ID']);
			echo BeginNote(/* 'align="center"' */).Loc::getMessage("GRAIN_IIKO_ADMIN_MODIFIERS_SAVED").EndNote();
		}
		?>
		<script>
			function grainIikoModifierCheckAll(check) {
				var blocks = BX.findChildren(document, { tag: 'label',className: 'grain-iiko-admin-modifier-group' }, true);
				blocks = blocks.concat(BX.findChildren(document, { tag: 'label',className: 'grain-iiko-admin-modifier-item' }, true));
				for(var i in blocks)
				{
					var inputs =  BX.findChildren(blocks[i], { tag: 'input'}, true);
					for(var a in inputs)
					{
						if(inputs[a].getAttribute('type')!='checkbox')
							continue;
						inputs[a].checked = check;
					}
				}
			}
		</script>
		<form action="<?=$APPLICATION->GetCurPageParam()?>" method="POST">
			<div class="grain-iiko-admin-modifiers-tools">
				<a href="#" onclick="grainIikoModifierCheckAll(true); return false;"><?=Loc::getMessage('GRAIN_IIKO_ADMIN_MODIFIERS_BTN_SET')?></a>
				<a href="#" onclick="grainIikoModifierCheckAll(false); return false;"><?=Loc::getMessage('GRAIN_IIKO_ADMIN_MODIFIERS_BTN_UNSET')?></a>
			</div>
			<div class="grain-iiko-admin-modifiers">
				<input type="hidden" name="action" value="save"/>
				<?php
				foreach($modifierTree as $group)
				{
					
					?><label class="grain-iiko-admin-modifier-group" style="--depth:<?=$group['DEPTH_LEVEL']?>">
						<input type="hidden" name="group[<?=$group['ID']?>]" value="N"/>
						<input type="checkbox" name="group[<?=$group['ID']?>]" value="Y"<?=$group['ACTIVE']=='Y'?' checked':''?>/>
						<?=$group['NAME']?>
					</label><?php
					foreach($group['ITEMS'] as $item)
					{
						?><label class="grain-iiko-admin-modifier-item" style="--depth:<?=$group['DEPTH_LEVEL']+1?>">
							<input type="hidden" name="item[<?=$item['ID']?>]" value="N"/>
							<input type="checkbox" name="item[<?=$item['ID']?>]" value="Y"<?=$item['ACTIVE']=='Y'?' checked':''?>/>
							<?=$item['NAME']?>
						</label><?php
					}
				}
				?>
			</div>
			<input type="submit" name="save" value="<?=Loc::getMessage('GRAIN_IIKO_ADMIN_MODIFIERS_BTN_SAVE')?>" class="adm-btn-save">
			<input type="reset" value="<?=Loc::getMessage('GRAIN_IIKO_ADMIN_MODIFIERS_BTN_RESET')?>">
		</form><?php
	}
	else
	{
		echo BeginNote(/* 'align="center"' */).Loc::getMessage("GRAIN_IIKO_ADMIN_MODIFIERS_NO_MODIFIERS").EndNote();
	}
	
}
else
{
	$APPLICATION->SetTitle(Loc::getMessage('GRAIN_IIKO_ADMIN_MODIFIERS_RESTAURANTS_TITLE'));
	$restaurants = Restaurants::getRestaurantList();
	if($restaurants)
	{
		$restaurantList = array(); $i=0;
		foreach($restaurants as $restaurant)
		{
			$restaurantList[$i] = array(
				"NAME" => '<a href="grain_iiko_modifiers.php?lang='.LANGUAGE_ID.'&amp;restaurant='.$restaurant['ID'].'">'.$restaurant['NAME'].'</a>',
			);
			
			$i++;
		}

		$sTableID = "t_grain_iiko_restaurants";

		$lAdmin = new \CAdminList($sTableID);

		/*
		$lAdmin->BeginPrologContent();
		echo "<h4>".GetMessage("")."</h4>\n";
		$lAdmin->EndPrologContent();
		*/

		$lAdmin->AddHeaders(array(
			array(
				"id" => "NAME",
				"content" => Loc::getMessage("GRAIN_IIKO_ADMIN_MODIFIERS_RESTAURANTS_TABLE_HEADER"),
				"default" => true,
			),
		));

		$rsData = new \CDBResult;
		$rsData->InitFromArray($restaurantList);
		$rsData = new \CAdminResult($rsData, $sTableID);

		$j = 0;
		while ($arRes = $rsData->NavNext(true, "f_"))
		{
			$row =& $lAdmin->AddRow($j++, $arRes);
			foreach ($arRes as $key => $value)
				$row->AddViewField($key, $value);
		}

		$lAdmin->CheckListMode();
		$lAdmin->DisplayList();
		
	}
	else
	{
		echo BeginNote(/* 'align="center"' */).Loc::getMessage("GRAIN_IIKO_ADMIN_MODIFIERS_NO_RESTAURANTS").EndNote();
	}
}


require_once(__DIR__ . "/page_footer.php");

Youez - 2016 - github.com/yon3zu
LinuXploit