*
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * @link 		http://www.easyscp.net
 * @author 		EasySCP Team
 */
require '../../include/easyscp-lib.php';
check_login(__FILE__);
$cfg = EasySCP_Registry::get('Config');
$tpl = EasySCP_TemplateEngine::getInstance();
$template = 'admin/manage_reseller_owners.tpl';
// static page messages
update_reseller_owner();
gen_reseller_table($tpl);
$tpl->assign(array('TR_PAGE_TITLE' => tr('EasySCP - Admin/Manage users/Reseller assignment'), 'TR_RESELLER_ASSIGNMENT' => tr('Reseller assignment'), 'TR_RESELLER_USERS' => tr('Reseller users'), 'TR_NUMBER' => tr('No.'), 'TR_MARK' => tr('Mark'), 'TR_RESELLER_NAME' => tr('Reseller name'), 'TR_OWNER' => tr('Owner'), 'TR_TO_ADMIN' => tr('To Admin'), 'TR_MOVE' => tr('Move')));
gen_admin_mainmenu($tpl, 'admin/main_menu_users_manage.tpl');
gen_admin_menu($tpl, 'admin/menu_users_manage.tpl');
gen_page_message($tpl);
if ($cfg->DUMP_GUI_DEBUG) {
    dump_gui_debug($tpl);
}
$tpl->display($template);
unset_messages();
/**
 * @todo check if it's useful to have the table admin two times in the same query
 * @param EasySCP_TemplateEngine $tpl
 */
function gen_reseller_table($tpl)
{
                $dest_admin = $_POST['dest_admin'];
                $query = <<<SQL_QUERY
                    update
                        admin
                    set
                        created_by = ?
                    where
                        admin_id  = ?
SQL_QUERY;
                $up = exec_query($sql, $query, array($dest_admin, $admin_id));
            }
            $rs->MoveNext();
        }
    }
}
/*
 *
 * static page messages.
 *
 */
$tpl->assign(array('TR_ADMIN_MANAGE_RESELLER_OWNERS_PAGE_TITLE' => tr('VHCS - Admin/Manage users/Reseller assignment'), 'THEME_COLOR_PATH' => "../themes/{$theme_color}", 'THEME_CHARSET' => tr('encoding'), 'ISP_LOGO' => get_logo($_SESSION['user_id']), 'VHCS_LICENSE' => $cfg['VHCS_LICENSE']));
gen_admin_menu($tpl);
update_reseller_owner($sql);
gen_reseller_table($tpl, $sql);
$tpl->assign(array('TR_RESELLER_ASSIGNMENT' => tr('Reseller assignment'), 'TR_RESELLER_USERS' => tr('Reseller users'), 'TR_NUMBER' => tr('No.'), 'TR_MARK' => tr('Mark'), 'TR_RESELLER_NAME' => tr('Reseller name'), 'TR_OWNER' => tr('Owner'), 'TR_TO_ADMIN' => tr('To Admin'), 'TR_MOVE' => tr('Move')));
$tpl->parse('PAGE', 'page');
$tpl->prnt();
if (isset($cfg['DUMP_GUI_DEBUG'])) {
    dump_gui_debug();
}
unset_messages();