<?
    global $vis_language;
    if($twitter_details!=-1) { ?>
        <table cellpadding="3" cellspacing="3" width="100%">
            <tr><td width="150"><?= $vis_language['TXTTITLE'] ?></td><td><input type="text" name="vis_title" class="vis_input" value="<?= $twitter_details['host_name'] ?>" /></td></tr>
            <tr><td><?= $vis_language['TXTCONKEY'] ?></td><td><input type="text" name="vis_conkey" class="vis_input" value="<?= base64_decode($twitter_details['user_name']) ?>" /></td></tr>
            <tr><td><?= $vis_language['TXTCONSKEY'] ?></td><td><input type="text" name="vis_conskey" class="vis_input" value="<?= base64_decode($twitter_details['db_name']) ?>" /></td></tr>
            <tr><td><?= $vis_language['TXTUSRKEY'] ?></td><td><input type="text" name="vis_usrkey" class="vis_input" value="<?= base64_decode($twitter_details['db_password']) ?>" /></td></tr>
            <tr><td><?= $vis_language['TXTUSRSKEY'] ?></td><td><input type="text" name="vis_usrskey" class="vis_input" value="<?= base64_decode($twitter_details['api_key']) ?>" /></td></tr>
            <tr><td><?= $vis_language['TXTDEPARTMENT'] ?></td><td><select name="vis_department_id" class="vis_input"><? if($department!=-1) for($i=0;$i<count($department);$i++) echo '<option value="'.$department[$i]['department_id'].'"'.($department[$i]['department_id']==$twitter_details['department_id']?' selected="selected"':'').'>'.$department[$i]['department_name'].'</option>'; ?></select></td></tr>
            <tr><td>Auto ticket convert if mentioned</td><td><input type="radio" name="vis_status" id="vis_status_en" value="1" <?= $twitter_details['db_prefix']==1?' checked="checked"':'' ?> /><label for="vis_status_en"><?= $vis_language['TXTENABLE'] ?></label> <input type="radio" name="vis_status" id="vis_status_ds" value="0" <?= $twitter_details['db_prefix']!=1?' checked="checked"':'' ?> /><label for="vis_status_ds"><?= $vis_language['TXTDISABLE'] ?></label></td></tr>
            <tr><td colspan="2"><div class="vis_seperator_horizontal"></div></td></tr>
            <tr><td colspan="2"><span class="vis_button" onclick="$(this).visExecution('submit_form',{'vis_module':'setting', 'vis_operation':'update_twitter_details', 'vis_form':'vis_integration_form'})"><?= $vis_language['TXTUPDATE'] ?></span> <span class="vis_button" onclick="$(this).visExecution('load_operations',{'vis_module':'setting', 'vis_operation':'delete_twitter_details', 'vis_integration_id':<?= $twitter_details['integration_id'] ?>})"><?= $vis_language['TXTDELETE'] ?></span> </td></tr>
        </table><input type="hidden" name="vis_integration_id" value="<?= $twitter_details['integration_id'] ?>" /><?
    }
    else { ?>
        <div class="vis_sub_title">Create an app with access read, write and direct message from <a target="_blank" href="https://dev.twitter.com/apps">https://dev.twitter.com/apps</a> and genereate required details from "Details >> Create my access token"</div><br />
        <table cellpadding="3" cellspacing="3" width="100%">
            <tr><td width="150"><?= $vis_language['TXTTITLE'] ?></td><td><input type="text" name="vis_title" class="vis_input" /></td></tr>
            <tr><td><?= $vis_language['TXTCONKEY'] ?></td><td><input type="text" name="vis_conkey" class="vis_input" /></td></tr>
            <tr><td><?= $vis_language['TXTCONSKEY'] ?></td><td><input type="text" name="vis_conskey" class="vis_input" /></td></tr>
            <tr><td><?= $vis_language['TXTUSRKEY'] ?></td><td><input type="text" name="vis_usrkey" class="vis_input" /></td></tr>
            <tr><td><?= $vis_language['TXTUSRSKEY'] ?></td><td><input type="text" name="vis_usrskey" class="vis_input" /></td></tr>
            <tr><td><?= $vis_language['TXTDEPARTMENT'] ?></td><td><select name="vis_department_id" class="vis_input"><? if($department!=-1) for($i=0;$i<count($department);$i++) echo '<option value="'.$department[$i]['department_id'].'">'.$department[$i]['department_name'].'</option>'; ?></select></td></tr>
            <tr><td>Auto ticket convert if mentioned</td><td><input type="radio" name="vis_status" id="vis_status_en" value="1" <?= $twitter['db_prefix']==1?' checked="checked"':'' ?> /><label for="vis_status_en"><?= $vis_language['TXTENABLE'] ?></label> <input type="radio" name="vis_status" id="vis_status_ds" value="0" <?= $twitter['db_prefix']!=1?' checked="checked"':'' ?> /><label for="vis_status_ds"><?= $vis_language['TXTDISABLE'] ?></label></td></tr>
            <tr><td colspan="2"><div class="vis_seperator_horizontal"></div></td></tr>
            <tr><td colspan="2"><span class="vis_button" onclick="$(this).visExecution('submit_form',{'vis_module':'setting', 'vis_operation':'save_twitter_details', 'vis_form':'vis_integration_form'})"><?= $vis_language['TXTADD'] ?></span></td></tr>
        </table><?
    }
?>