ACC SHELL

Path : /srv/www/vhosts/unitedsolution/admin/page/
File Upload :
Current File : /srv/www/vhosts/unitedsolution/admin/page/edit.php

<!--skript naplnuje prvky hidden ve formulari view_form informacemi o aktualne vyplnenych hodnotach policek-->
<SCRIPT type='text/javascript'>
function FillHidden() {
    with(document) {

        getElementById("hTitle").value =  getElementById("title").value;
        getElementById("hPage").value =  getElementById("text_page").value;
        getElementById("hTemplate").value =  getElementById("template").value;
        getElementById("hCategory").value =  getElementById("IdCategory").value;
        getElementById("hFooter").value =  getElementById("footer").checked;
    }
}
</SCRIPT>

<?php
$wysiwyg = new wysiwyg;

echo '<h1 class="page_show_h">Statické stránky</h1>';//nadpis stranky

if($_POST['wysiwyg'] == 'wysiwyg off' || $_POST['wysiwyg'] == 'wysiwyg on'){//byl-li poslan pozadavek na vypnuti(zapnuti) wisiwygu
	$wysiwyg->change();
}

$status = $wysiwyg->check();//zjiseni zda je wysiwyg zapnut


$page = new page;

if($_POST['button'] == 'ulozit'){//byl-li poslan pozadavek na editaci stranky
	
	$page->edit($_POST['id'], $_POST['name'], $_POST['page'], $_POST['footer'], $_POST['category'], $_POST['home'], 
				$_POST['title'], $_POST['keywords'], $_POST['description'], $_POST['lang'], $_POST['template'], $_POST['img']);
}

if(!empty($_GET['id'])){//predani id editovane stranky getem
	$id = $_GET['id'];
}
else{//predani id editovane stranky postem
	$id = $_POST['id'];
}

$page->select_one($id);//naplneni privatnich valstnosti tridy informacemi o editovane strance

if($page->msg == PAGE_EDITED){//byla-li stranka uspesne editovana, bude presmerovana na vypis statickych stranek
	
	echo	'<div class="page_msg2">'.$page->msg.'</div>'.
			'<script language="javascript">'.
				'function refresh(){'.
					'window.location.href = \'default.php?page=page/show\''.
				'}'.
				
				'setTimeout("refresh()", 500)'.
			'</script>';

}
else{//nedoslo-li zatim k editaci
?>
<a id="page_bakc" href="default.php?page=page/show"><img border="0" src="img/Back.jpg" alt="Zpět" title="Zpět"/></a>
<form id="page_form" name="page_form" method="post" action="default.php?page=page/edit">
	<input id="page_b_1" type="submit" name="button" value="ulozit" title="Uložit" />
	<input id="wysiwyg_b" name="wysiwyg" type="submit" value="<?= $status == 1 ? 'wysiwyg off' : 'wysiwyg on' ?>" title="wysiwyg" />
	<span class="page_msg1"><?= $page->msg ?></span>
        <form name="upload" method="post" action="default.php?page=page/edit">
            <div>
		<label for="home">Zobrazit na úvode:</label>
		<input id="home" type="checkbox" name="home" value="1" <?=($_POST['sended']? $_POST['home']:$page->home) == 1 ? 'checked="checked"' : '' ?> />
            </div>
            <div>
		<label for="footer">Zobrazit patičku:</label>
		<input id="footer" type="checkbox"  name="footer" value="1" <?= ($_POST['sended']? $_POST['footer']:$page->footer) == 1 ? 'checked="checked"' : '' ?> />
            </div>
            <div>
		<label for="category">Kategorie:</label>
		<select id="IdCategory" name="category">
			<?php
			$category = new category;
			$category->show();
			
			for($i=0;$i<count($category->id);$i++){
				
				echo '<option value="'.$category->id[$i].'" '.($category->id[$i] == ($_POST['sended']? $_POST['category']:$page->category) ? 'selected="selected"' : '').' >'.
						$category->name[$i].
					 '</option>'."\n";
			
			}			
			?>
		</select>
            </div>
            <div>
		<label for="template">Sablona:</label>
		<select id="template" name="template">
		<?php
			
			$page->select_templates();
			for($i=0;$i<count($page->template_id);$i++){
				
				echo
					'<option value="'.$page->template_id[$i].'" '.($page->template_id[$i] == ($_POST['sended']? $_POST['template']:$page->template) ? 'selected="selected"' : '').'>'.
						$page->template_name[$i].
					'</option>'."\n";	
					
			}
			
		?>
		</select>
            </div>
            <div><label for="name"><strong>Jméno:</strong></label><input type="text" name="name" id="name" value="<?= ($_POST['sended']?$_POST['name']:$page->name) ?>" /></div>
            <div><label for="lang">Jazyk:</label><input type="text" name="lang" id="lang" value="<?= ($_POST['sended']?$_POST['lang']:$page->lang)?>"  /></div>
            <div>
		<label for="title">Title:</label>
		<input type="text" name="title" id="title" value="<?= ($_POST['sended']?$_POST['title']:$page->title) ?>" />
            </div>
            <div>
		<label for="keywords">Keywords:</label>
		<textarea name="keywords" id="keywords"><?= ($_POST['sended']?$_POST['keywords']:$page->keywords) ?></textarea>
            </div>
            <div>
		<label for="description">Description:</label>
		<textarea name="description" id="description"><?= ($_POST['sended']?$_POST['description']:$page->description) ?></textarea>
            </div>
            <div>
		<label for="text_page"><strong>Obsah:</strong></label>
		<div class="wysiwyg_box">
			<textarea name="page" id="text_page"><?= ($_POST['sended']?$_POST['page']:$page->page) ?></textarea>
			<?php
			
				if($status == 1){
				
					echo	'<script language="javascript" type="text/javascript" src="wysiwyg/tiny_mce.js"></script>'.
							'<script language="javascript" type="text/javascript" src="wysiwyg/config.js"></script>';
							
				}
				
			?>
		</div>
            </div>

            <input type="hidden" name="id" value="<?= $id ?>" />
            <input type="hidden" name="sended" value="true" />
            <input type="submit" name="b_upload" value="Nahraj" title="Nahrát náhled" style="left: 740px; top: 60px; position: absolute; background:url(img/nahrat_icon.png) top left no-repeat; width:35px; height:35px; font-size:0px; padding-top:50px; cursor:pointer; border:none;"/>
        </form>

        <div class="clear"></div>
 	
</form>


<!-- begin zobrazeni stranky pred jejim ulozenim -->
<form id="page_view" name="view_form" method="post" target="_blank" action="/index.php" onsubmit="FillHidden()">

    <input id="view_b" type="submit" name="view_button" value="Zobraz" title="Zobrazit náhled" style="left: 800px; top: 60px; position: absolute; background:url(img/preview_icon.png) top left no-repeat; width:35px; height:35px; font-size:0px; padding-top:50px; cursor:pointer; border:none;" />

    <input type="hidden" name="hNSeo" value="<?php echo $page->seo_url ?>" />
    <input type="hidden" name="hNTitle" id="hTitle" value="" />
    <input type="hidden" name="hNPage" id="hPage" value="" />
    <input type="hidden" name="hNTemplate" id="hTemplate" value="" />
    <input type="hidden" name="hNCategory" id="hCategory" value="" />
    <input type="hidden" name="hNFooter" id="hFooter" value="" />

</form>

<!-- end zobrazeni stranky pred jejim ulozenim -->
<? } ?>

ACC SHELL 2018