<?php

//////////////////////////////////////////////////////////////
//===========================================================
// categories_theme.php
//===========================================================
// SOFTACULOUS 
// Version : 1.1
// Inspired by the DESIRE to be the BEST OF ALL
// ----------------------------------------------------------
// Started by: Alons
// Date:       10th Jan 2009
// Time:       21:00 hrs
// Site:       http://www.softaculous.com/ (SOFTACULOUS)
// ----------------------------------------------------------
// Please Read the Terms of use at http://www.softaculous.com
// ----------------------------------------------------------
//===========================================================
// (c)Softaculous Inc.
//===========================================================
//////////////////////////////////////////////////////////////

if(!defined('SOFTACULOUS')){

	die('Hacking Attempt');

}

function categories_theme(){

global $theme, $globals, $user, $l, $langs, $skins, $error, $saved, $categories;

softheader(__('$0 - Settings Center', array(APP)));

echo '<form accept-charset="'.$globals['charset'].'" name="reordercat" method="post" action="">

	<script language="javascript" src="'.$theme['url'].'/js/reorder.js" type="text/javascript"></script>
	<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
	//The array id of all the elements to be reordered
	reo_r = new Array(\''.implode('\', \'', array_keys($categories)).'\');

	//The id of the table that will hold the elements
	reorder_holder = "cat_reorder_pos";

	//The prefix of the Dom Drag handle for every element
	reo_ha = "catha";

	//The prefix of the Dom Drag holder for every element(the parent of every element)
	reo_ho = "cat";

	//The prefix of the Hidden Input field for the reoder value for every element
	reo_hid = "cathid";
	addonload(\'init_reoder();\');
	// ]]></script>
		
	<div class="container-fluid">
		<div class="container">
			<div class="sai-card my-5 p-4">
				<div class="sai_main_head">
					<h2 class="sai-heading mb-2">'.__('Reorder Software Categories').'</h2>
					<hr class = "sai_main_head_hr"/>
				</div>
				<div class="sai_form"><br />';

				error_handle($error);
				
				if(!empty($saved)){
					echo '<div class="alert alert-success text-center"><i class="fas fa-check sai_icons mr-2"></i>
					'.__('The category orders were saved successfully.').'</div>';
				}
				
				echo '<center><div id="cat_reorder_pos" class="w-50"></div></center>';

				$temp = 1;
				foreach($categories as $ck => $cv){
						
					echo '<div id="cat'.$ck.'">
							<div class="catreo" id="catha'.$ck.'" onmousedown="this.style.zIndex=\'1\'" onmouseup="this.style.zIndex=\'0\'">
								<div>&nbsp;&nbsp;'.$l['cat_php_'.$ck].'</div>	
							</div>
						</div>';	
				
					echo '<input type="hidden" name="cat['.$ck.']" value="'.$temp.'" id="cathid'.$ck.'" />';	
					$temp = $temp + 1;
					
				}

		echo '<p align="center">
			'.csrf_display().'
			<input type="submit" name="reordercat" value="'.__('Reorder Categories').'" class="flat-butt" />
			</p>
			'.(empty($globals['lictype']) ? '<div class="notebox">'.__('NOTE: In the free version of $0, the ordering categories feature is disabled.', array(APP)).'</div>' : '').'<br />
			</div>
		</div>
		
	
	</div>
	</form><br />';

softfooter();

}

?>