<?php
/**************************************************************************
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
@Authors: Ryan Thompson(hide@address.com)
***************************************************************************/
include("./data.php");
$service['add_header'] = TRUE;
include("../config.inc.php");
include($here. "/class.preferences.php");
$prefs = new preferences;
echo $layout->page_header;
echo $layout->service_header($text['service_name'], $prefs->nav_buttons(), $text['home_layout']);
//Get accessible services. Look for home.php
//If it exists allow the
if(isset($_POST['save_layout']))
{
$i = 0;
while($i < 9)
{
$service = rtrim($_POST['position'][$i]);
$sql = "UPDATE o_home_layout SET service='$service' WHERE user_id='". $user->user_id ."' AND position='$i'";
$db->query($sql);
$i++;
}
}
$db->query("SELECT location, code FROM o_services LEFT JOIN o_user_rights ON o_services.code=o_user_rights.service
WHERE o_user_rights.user_id='". $user->user_id ."' AND o_user_rights.rights != 0");
$i = 0;
while($db->fetch_results())
{
$services[$db->record[code]]['loc'] = $db->record['location'];
//$services[$i]['code'] = $db->record['code'];
$i++;
//echo $services[]['loc'];
}
$db->query("SELECT * FROM o_home_layout WHERE user_id='". $user->user_id ."'");
while($db->fetch_results())
{
}
?>
<br />
<form action="<?php echo $_SERVER['PHP_SELF']?>?x=<?php echo $_GET['x']?>&s=<?php echo $_GET['s']?>" method="post">
<table align="center" class="input_header">
<?php
$j = 0;
while($j < 9)
{
if($j == 3 || $j == 6)
{
echo "</tr><tr>";
}
echo "<td>";
?>
<select name="position[<?php echo $j?>]">
<?php
$db->query("SELECT * FROM o_home_layout WHERE user_id='". $user->user_id ."' AND position='$j'");
$db->fetch_results();
$service = $db->record['service'];
$sql = "SELECT messages FROM o_text WHERE service='$service' AND id_text='service_name'";
$db->query($sql);
$db->fetch_results();
echo "<option value=\"". $service ."\">". $db->record['messages'] ."</option>";
echo "<option value=\"\">------------</option>";
foreach($services AS $key=>$value)
{
include($O->dir ."/". $value['loc'] ."/data.php");
$db->query("SELECT messages FROM o_text WHERE id_text='service_name' AND service='$key' AND language='". $lang->user_language ."'");
$db->fetch_results();
echo "<option value=\"". $key ."\">". $db->record['messages'] ."</option>";
}
?>
</select>
<?php
echo "</td>";
$j++;
}
?>
</tr>
<tr>
<td><input type="submit" name="save_layout" value="Save Layout" class="button1"></td>
</tr>
</table>
</form>
<br />
<?php echo $layout->create_footer()?>