<?php
	// We check in which language we will work
	if (isset($_SESSION["DATAGLOBAL"][0]) && !empty($_SESSION["DATAGLOBAL"][0])) $C->LANGUAGE = $_SESSION["DATAGLOBAL"][0];

	$this->load_langfile('inside/dashboard.php');
	
	// We are here only if you're logged in
	if (!$this->user->is_logged) {
		echo('0: '.$this->lang('dashboard_no_session'));
		die();
	}
	
	$errored = 0;
	$txterror = '';
	
	$idselect = '';

	if (isset($_POST["idcat"]) && $_POST["idcat"]!='') $idselect = $this->db1->e($_POST["idcat"]);

	$r = $this->db1->query("SELECT idcategory, name FROM pages_cat WHERE idfather=0 AND num_children>0 ORDER BY name ASC");
	$txtcategories = '<option value="-1" select>'.$this->lang('dashboard_pages_txt_choosecategory').'</option>';
	while ($row=$this->db1->fetch_object($r)) {
		if ($row->idcategory == $idselect) $txtcategories.='<option value="'.$row->idcategory.'" selected="selected">'.$row->name.'</option>';
		else $txtcategories.='<option value="'.$row->idcategory.'">'.$row->name.'</option>';
	}
	echo("1: ".$txtcategories);
?>