<?php
include_once("postget.php");
if ($_SESSION['hd_accesslvl'] < 2) {
    no_access();
}
?>


<?php
if ($_SESSION['hd_accesslvl'] == 4) {
?>
<div class="container">
    <div class="row">

        <div class="navbar">
            <div class="navbar-inner">
                <div class="container">
                    <a class="brand" href="#"><?php echo lang('_SETTINGS'); ?> ></a>
                    <ul class="nav">

                        <li class="dropdown"><a href="#"  class="dropdown-toggle" data-toggle="dropdown"><?php echo ucfirst(_menu_TICKETS); ?></a>
                            <ul class="dropdown-menu">
                                <li><a href="<?php echo $serverurl . "/departments.php" ?>"><img class="sprites menu_Money" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_DEPARTMENTS); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/canned.php" ?>"><img class="sprites menu_clock" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_CANNED_RESPONSES); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/ticketsmailtemplates.php" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_EMAIL_TEMPLATES); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/tickets_search.php" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_SEARCH_TICKETS); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/preferences14.php" ?>"><img class="sprites menu_settings" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_OPTIONS); ?></a></li>
                            </ul>
                        </li>

                        <li class="dropdown"><a href="#"  class="dropdown-toggle" data-toggle="dropdown"><?php echo ucfirst(_menu_FAQ); ?></a>
                            <ul class="dropdown-menu">
                                <li><a href="<?php echo $serverurl . "/faq.php" ?>"><img class="sprites menu_eye" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_VIEW); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/faq_admin.php" ?>"><img class="sprites menu_settings" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_MANAGE); ?></a></li>
<!--                                <li><a href="<?php echo $serverurl . "/faq_reorder.php?o=C" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_REORDER) . ' ' . _CATEGORIES; ?></a></li>-->
<!--                                <li><a href="<?php echo $serverurl . "/faq_reorder.php?o=S" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_REORDER) . ' ' . _SUB_CATEGORIES; ?></a></li>-->
<!--                                <li><a href="<?php echo $serverurl . "/faq_reorder.php?o=I" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_REORDER) . ' ' . _FAQS; ?></a></li>-->
                            </ul>
                        </li>

                        <li class="dropdown"><a href="#"  class="dropdown-toggle" data-toggle="dropdown"><?php echo ucfirst(_menu_MANUALS); ?></a>
                            <ul class="dropdown-menu">
                                <li><a href="<?php echo $serverurl . "/manuals.php" ?>"><img class="sprites menu_eye" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_VIEW); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/manuals_ad.php" ?>"><img class="sprites menu_settings" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_MANAGE); ?></a></li>
<!--                                <li><a href="<?php echo $serverurl . "/manuals_reorder.php?o=C" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_REORDER) . ' ' . _MANUALS; ?></a></li>-->
<!--                                <li><a href="<?php echo $serverurl . "/manuals_reorder.php?o=S" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_REORDER) . ' ' . _CHAPTERS; ?></a></li>-->
<!--                                <li><a href="<?php echo $serverurl . "/manuals_reorder.php?o=I" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_REORDER) . ' ' . _PAGES; ?></a></li>-->
                            </ul>
                        </li>

                        <li class="dropdown"><a href="#"  class="dropdown-toggle" data-toggle="dropdown"><?php echo ucfirst(_menu_ANNOUNCEMENTS); ?></a>
                            <ul class="dropdown-menu">
                                <li><a href="<?php echo $serverurl . "/announcements.php" ?>"><img class="sprites menu_eye" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_VIEW); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/announcements_admin.php" ?>"><img class="sprites menu_settings" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_MANAGE); ?></a></li>
                            </ul>
                        </li>

                        <li class="dropdown"><a href="#"  class="dropdown-toggle" data-toggle="dropdown"><?php echo ucfirst(_menu_DOWNLOADS); ?></a>
                            <ul class="dropdown-menu">
                                <li><a href="<?php echo $serverurl . "/downloads.php" ?>"><img class="sprites menu_eye" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_VIEW); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/downloads_admin.php" ?>"><img class="sprites menu_settings" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_MANAGE); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/preferences16.php" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_OPTIONS); ?></a></li>
                            </ul>
                        </li>


                        <li class="dropdown"><a href="#"  class="dropdown-toggle" data-toggle="dropdown"><?php echo ucfirst(_menu_TOOLS); ?></a>
                            <ul class="dropdown-menu">
                                <li><a href="<?php echo $serverurl . "/tables_maintenance.php?option=check" ?>"><img class="sprites menu_db_accept" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_CHECK_TABLES); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/tables_maintenance.php?option=analyze" ?>"><img class="sprites menu_db_process" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_ANALYZE_TABLES); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/tables_maintenance.php?option=repair" ?>"><img class="sprites menu_db_process" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_REPAIR_TABLES); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/tables_maintenance.php?option=optimize" ?>"><img class="sprites menu_db_process" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_OPTIMIZE_TABLES); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/sendmessages.php?clientid=" . $_SESSION['hd_clientid'] ?>"><img class="sprites menu_sendmail" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_SEND_MESSAGES); ?></a></li>
                            </ul>
                        </li>



                        <li class="dropdown"><a href="#"  class="dropdown-toggle" data-toggle="dropdown"><?php echo ucfirst(_menu_CONFIG); ?></a>
                            <ul class="dropdown-menu">
                                <li><a href="<?php echo $serverurl . "/firstsetup.php" ?>"><img class="sprites menu_settings" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_FIRST_SETUP); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/preferences.php" ?>"><img class="sprites menu_settings" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_PREFERENCES); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/preferences12.php" ?>"><img class="sprites menu_settings" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_ENABLE_AND_DISABLE_MODULES); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/users.php" ?>"><img class="sprites menu_users" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_USERS); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/changepass.php" ?>"><img class="sprites menu_key2" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_CHANGE_YOUR_PASSWORD); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/texts_admin.php" ?>"><img class="sprites menu_TextEdit" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_TEXTS); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/languages.php" ?>"><img class="sprites menu_languages" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_LANGUAGES); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/languagescode.php" ?>"><img class="sprites menu_langcodes" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_LANGUAGE_CODES); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/countries.php" ?>"><img class="sprites menu_langcodes" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_COUNTRIES) . " / " . strtolower(_STATES); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/spamfilters.php" ?>"><img class="sprites menu_spamfilter" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_SPAM_FILTERS); ?></a></li>
                            </ul>
                        </li>

                        <li class="dropdown"><a href="#"  class="dropdown-toggle" data-toggle="dropdown"><?php echo ucfirst(_ABOUT); ?></a>
                            <ul class="dropdown-menu">
                                <li><a href="<?php echo $serverurl . "/about.php" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_ABOUT); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/license.php" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_LICENSE); ?></a></li>
                            </ul>
                        </li>

                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
<?php
}
?>







<div class="container">
    <div class="row">

        <div class="navbar">
            <div class="navbar-inner">
                <div class="container">
                    <a class="brand" href="#"><?php echo lang('_MENU'); ?> ></a>
                    <ul class="nav">

                        <li><a href="main.php"><?php echo ucfirst(_menu_HOME); ?></a></li>

                        <li class="dropdown"><a href="#"  class="dropdown-toggle" data-toggle="dropdown"><?php echo ucfirst(_menu_CLIENTS); ?></a>
                            <ul class="dropdown-menu">
                                <li><a href="<?php echo $serverurl . "/addclient.php" ?>"><img class="sprites menu_addclient" src="images/transparent.gif">&nbsp;&nbsp;<b><?php echo ucfirst(_ADD_NEW_CLIENT); ?></b></a></li>
                                <li><a href="<?php echo $serverurl . "/clientslist.php?active=9" ?>"><img class="sprites menu_users" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_ALL_CLIENTS); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/clientslist.php?active=-2" ?>"><img class="sprites menu_YellowBall" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_SUSPENDED_CLIENTS); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/clientslist.php?active=-1" ?>"><img class="sprites menu_RedBall" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_ELIMINATED_CLIENTS); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/clientslist.php?active=-9" ?>"><img class="sprites menu_remove_user" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_CLIENTS_NOT_SUBSCRIBED); ?></a></li>
                            </ul>
                        </li>




                        <li class="dropdown"><a href="#"  class="dropdown-toggle" data-toggle="dropdown"><?php echo ucfirst(_menu_LAST_20); ?></a>
                            <ul class="dropdown-menu">
                                <li><a href="<?php echo $serverurl . "/last20clients.php" ?>"><img class="sprites menu_user" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_CLIENTS); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/last20logins.php" ?>"><img class="sprites menu_key2" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_LOGINS); ?></a></li>
                            </ul>
                        </li>

                        <li class="dropdown"><a href="#"  class="dropdown-toggle" data-toggle="dropdown"><?php echo ucfirst(_menu_NOTES); ?></a>
                            <ul class="dropdown-menu">
                                <li><a href="<?php echo $serverurl . "/notes.php" ?>"><img class="sprites menu_note_edit" src="images/transparent.gif">&nbsp;&nbsp;<b><?php echo ucfirst(_VIEW_NOTES); ?></b></a></li>
                                <li><a href="<?php echo $serverurl . "/notes_I.php" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_ADD_NOTE); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/notes_admin.php" ?>"><img class="sprites menu_settings" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_MANAGE); ?></a></li>
<!--                                <li><a href="<?php echo $serverurl . "/notes_reorder.php?o=C" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_REORDER) . ' ' . _CATEGORIES; ?></a></li>-->
<!--                                <li><a href="<?php echo $serverurl . "/notes_reorder.php?o=S" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_REORDER) . ' ' . _SUB_CATEGORIES; ?></a></li>-->
<!--                                <li><a href="<?php echo $serverurl . "/notes_reorder.php?o=I" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_REORDER) . ' ' . _NOTES; ?></a></li>-->
                            </ul>
                        </li>

                        <li class="dropdown"><a href="#"  class="dropdown-toggle" data-toggle="dropdown"><?php echo ucfirst(_menu_REPORTS); ?></a>
                            <ul class="dropdown-menu">
                                <li><a href="<?php echo $serverurl . "/logs.php" ?>"><img class="sprites menu_history" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_VIEW_EVENT_LOG); ?></a></li>
                                <li><a href="<?php echo $serverurl . "/tickets_search.php" ?>"><img class="sprites menu_nothing" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_SEARCH_TICKETS); ?></a></li>
                           </ul>
                        </li>
                        


                        <?php if ($thisclient == 1) { ?>
                        <li class="dropdown"><a href="#"  class="dropdown-toggle" data-toggle="dropdown"><strong><?php echo ucfirst(_CLIENT).' '.  clientname($_SESSION['hd_clientid']); ?></strong></a>
                                <ul class="dropdown-menu">
                                    <li><a href="<?php echo $serverurl . "/tickets.php?clientid=" . $_SESSION['hd_clientid'] ?>"><img class="sprites menu_tickets" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_SUPPORT_TICKETS); ?></a></li>
                                    <li><a href="<?php echo $serverurl . "/passgenerate.php?clientid=" . $_SESSION['hd_clientid'] ?>"><img class="sprites menu_key" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_SEND_PASSWORD); ?></a></li>
                                    <li><a href="<?php echo $serverurl . "/editclient.php?clientid=" . $_SESSION['hd_clientid'] ?>"><img class="sprites menu_edit_user" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_EDIT_ACCOUNT); ?></a></li>
                                    <li><a href="<?php echo $serverurl . "/suspendclient.php?clientid=" . $_SESSION['hd_clientid'] ?>"><img class="sprites menu_YellowBall" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_SUSPEND_CLIENT); ?></a></li>
                                    <li><a href="<?php echo $serverurl . "/deleteclient.php?clientid=" . $_SESSION['hd_clientid'] ?>"><img class="sprites menu_RedBall" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_DELETE_ACCOUNT); ?></a></li>
                                    <li><a href="<?php echo $serverurl . "/mergeaccount.php?clientid=" . $_SESSION['hd_clientid'] ?>"><img class="sprites menu_export" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_MERGE_THIS_ACCOUNT_INSIDE_OTHER_ACCOUNT); ?></a></li>
                                    <li><a href="<?php echo $serverurl . "/events.php?clientid=" . $_SESSION['hd_clientid'] ?>"><img class="sprites menu_history" src="images/transparent.gif">&nbsp;&nbsp;<?php echo ucfirst(_VIEW_EVENT_LOG); ?></a></li>
                                </ul>
                            </li>
                        <?php } ?>


                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>


<?php

if ($_SESSION['hd_accesslvl']>1 AND $_SESSION['hd_clientid']) {
    echo '<div class="container">
            <div class="row">';
    $clientcomments = query("SELECT comments FROM hd_clients WHERE clientid=".$_SESSION['hd_clientid']."",1);
	if (strlen($clientcomments['comments'])>1) {
		$status = substr($clientcomments['comments'],0,1);
		//		test('status',$status);
		if ($status=='1') {
			$fondo = '#B6EAB0';
			$texto = 'black';
			$comenzaren = 1;
		}elseif($status=='0'){
			$fondo = '#FFBFBF';
			$texto = 'black';
			$comenzaren = 1;
		}elseif($status=='2'){
			$fondo = '#FFFF99';
			$texto = 'black';
			$comenzaren = 1;
		}else{
			$fondo = '#FFFF99';
			$texto = 'black';
			$comenzaren = 0;
		}
		echo "<table class='table table-bordered'><tr><td width='50%'>";
		echo "<font color='$texto' size='2'><b>".strtoupper(_INTERNAL_NOTE)."</b> (".strtolower(_NOT_VISIBLE_TO_THE_CLIENT).")</font>";

		echo '
		<script>
	  	$(document).ready(function(){
		    	$("#editdata").click(function () {
		    		if ($("#modificadatos:first").is(":hidden")) {
			      		$("#modificadatos").slideDown("slow");
		    		}else{
		    			$("#modificadatos").slideUp("slow");
		    		}
		    	});
	  	});
	  	</script>
	  	<div id="editdata"><a href="#"><b>'.ucfirst(_EDIT).'</b></a></div>

		';

		echo "</td><td><font color='$texto' size='2'>".nl2br(substr(strip_tags($clientcomments['comments']),$comenzaren))."</font>";


		echo "<div id='modificadatos' style='display: none'>";

		$status = substr($clientcomments['comments'],0,1);
		if ($status == '0' OR $status == '1' OR $status == '2') {
			$comenzaren = 1;
		}else{
			$comenzaren = 0;
		}

		echo "<form method='POST' class='well form-inline' action='clientdata2.php?clientid=".$_SESSION['hd_clientid']."' style='margin-bottom:0;'>";
		echo "<textarea name='commentsnew' cols='160' rows='8'>".substr($clientcomments['comments'],$comenzaren)."</textarea>";

		echo "<br><b>".ucfirst(_PRIORITY).":</b> ";
		echo "<label class='radio'><input type='radio' name=commentscolor value='1' ";
		if ($status == '1') {echo "checked";}
		echo "><span class='metro-radio'>".ucfirst(_LOW)."</span></label> ";

		echo "<label class='radio'><input type='radio' name=commentscolor value='2' ";
		if ($status == '2') {echo "checked";}
		echo "><span class='metro-radio'>".ucfirst(_MEDIUM)."</span></label> ";

		echo "<label class='radio'><input type='radio' name=commentscolor value='0' ";
		if ($status == '0') {echo "checked";}
		echo "><span class='metro-radio'>".ucfirst(_HIGH)."</span></label> ";

		echo "<input type='hidden' name='clientid' value=".$_SESSION['hd_clientid'].">
		<br><br><input type='submit' name='changecomments' value='"._SAVE."' class='btnformgreen'></form>";
		echo "</div>";

		echo "</td></tr></table><br>";

	}
        echo '</div>
            </div>';
}

?>




