Skip to content
Snippets Groups Projects
open.inc.php 3.26 KiB
Newer Older
Jared Hancock's avatar
Jared Hancock committed
<?php
if(!defined('OSTCLIENTINC')) die('Access Denied!');
$info=array();
if($thisclient && $thisclient->isValid()) {
    $info=array('name'=>$thisclient->getName(),
                'email'=>$thisclient->getEmail(),
                'phone'=>$thisclient->getPhone());
$info=($_POST && $errors)?Format::htmlchars($_POST):$info;
Jared Hancock's avatar
Jared Hancock committed
?>
<h1>Open a New Ticket</h1>
<p>Please fill in the form below to open a new ticket.</p>
<form id="ticketForm" method="post" action="open.php" enctype="multipart/form-data">
  <?php csrf_token(); ?>
  <input type="hidden" name="a" value="open">
  <table width="800" cellpadding="1" cellspacing="0" border="0">
Jared Hancock's avatar
Jared Hancock committed
    <tbody>
    <tr>
        <td class="required">Help Topic:</td>
        <td>
Jared Hancock's avatar
Jared Hancock committed
            <select id="topicId" name="topicId" onchange="javascript:
                    $('#dynamic-form').load(
                        'ajax.php/form/help-topic/' + this.value);
                    ">
                <option value="" selected="selected">&mdash; Select a Help Topic &mdash;</option>
                <?php
                if($topics=Topic::getPublicHelpTopics()) {
                    foreach($topics as $id =>$name) {
                        echo sprintf('<option value="%d" %s>%s</option>',
                                $id, ($info['topicId']==$id)?'selected="selected"':'', $name);
                    }
                } else { ?>
                    <option value="0" >General Inquiry</option>
                <?php
                } ?>
            </select>
            <font class="error">*&nbsp;<?php echo $errors['topicId']; ?></font>
        </td>
    </tr>
        if (!$thisclient) {
            $uform = UserForm::getUserForm()->getForm($_POST);
            if ($_POST) $uform->isValid();
            $uform->render(false, 'Your Information');
        }
        else { ?>
            <tr><td colspan="2"><hr /></td></tr>
        <tr><td>Email:</td><td><?php echo $thisclient->getEmail(); ?></td></tr>
        <tr><td>Client:</td><td><?php echo $thisclient->getName(); ?></td></tr>
        <?php }
        $tform = TicketForm::getInstance()->getForm($_POST);
        if ($_POST) $tform->isValid();
        $tform->render(false); ?>
Jared Hancock's avatar
Jared Hancock committed
    </tbody>
    <tbody id="dynamic-form">
        <?php if ($form) {
            include(CLIENTINC_DIR . 'templates/dynamic-form.tmpl.php');
Jared Hancock's avatar
Jared Hancock committed
        } ?>
    </tbody>
    <tbody>
Jared Hancock's avatar
Jared Hancock committed
    <?php
    if($cfg && $cfg->isCaptchaEnabled() && (!$thisclient || !$thisclient->isValid())) {
Jared Hancock's avatar
Jared Hancock committed
        if($_POST && $errors && !$errors['captcha'])
            $errors['captcha']='Please re-enter the text again';
        ?>
    <tr class="captchaRow">
        <td class="required">CAPTCHA Text:</td>
        <td>
            <span class="captcha"><img src="captcha.php" border="0" align="left"></span>
            &nbsp;&nbsp;
            <input id="captcha" type="text" name="captcha" size="6">
            <em>Enter the text shown on the image.</em>
            <font class="error">*&nbsp;<?php echo $errors['captcha']; ?></font>
        </td>
    </tr>
Jared Hancock's avatar
Jared Hancock committed
    <?php
    } ?>
    <tr><td colspan=2>&nbsp;</td></tr>
Jared Hancock's avatar
Jared Hancock committed
    </tbody>
  </table>
  <p style="padding-left:150px;">
Jared Hancock's avatar
Jared Hancock committed
        <input type="submit" value="Create Ticket">
        <input type="reset" value="Reset">
        <input type="button" value="Cancel" onClick='window.location.href="index.php"'>
Jared Hancock's avatar
Jared Hancock committed
</form>