Skip to content
Snippets Groups Projects
class.forms.php 34.2 KiB
Newer Older
  • Learn to ignore specific revisions
  • Jared Hancock's avatar
    Jared Hancock committed
         * Function: getValue
         * Combines the datepicker date value and the time dropdown selected
         * time value into a single date and time string value.
         */
        function getValue() {
    
            $data = $this->field->getSource();
    
    Jared Hancock's avatar
    Jared Hancock committed
            $datetime = parent::getValue();
    
            if ($datetime && isset($data[$this->name . ':time']))
                $datetime .= ' ' . $data[$this->name . ':time'];
    
    Jared Hancock's avatar
    Jared Hancock committed
            return $datetime;
        }
    }
    
    
    class SectionBreakWidget extends Widget {
        function render() {
            ?><div class="form-header section-break"><h3><?php
            echo Format::htmlchars($this->field->get('label'));
            ?></h3><em><?php echo Format::htmlchars($this->field->get('hint'));
            ?></em></div>
            <?php
        }
    }
    
    class ThreadEntryWidget extends Widget {
    
        function render($client=null) {
            global $cfg;
    
            ?><div style="margin-bottom:0.5em;margin-top:0.5em"><strong><?php
            echo Format::htmlchars($this->field->get('label'));
            ?></strong>:</div>
    
            <textarea name="<?php echo $this->field->get('name'); ?>"
    
                placeholder="<?php echo Format::htmlchars($this->field->get('hint')); ?>"
                <?php if (!$client) { ?>
                    data-draft-namespace="ticket.staff"
                <?php } else { ?>
                    data-draft-namespace="ticket.client"
                    data-draft-object-id="<?php echo substr(session_id(), -12); ?>"
                <?php } ?>
                class="richtext draft draft-delete ifhtml"
    
                cols="21" rows="8" style="width:80%;"><?php echo
                $this->value; ?></textarea>
        <?php
        }
    
    
        function showAttachments($errors=array()) {
    
            global $cfg, $thisclient;
    
            if(($cfg->allowOnlineAttachments()
                && !$cfg->allowAttachmentsOnlogin())
                || ($cfg->allowAttachmentsOnlogin()
                    && ($thisclient && $thisclient->isValid()))) { ?>
            <hr/>
            <div><strong>Attachments:</strong></div>
            <div class="uploads"></div><br>
            <input type="file" class="multifile" name="attachments[]" id="attachments" size="30" value="" />
            <font class="error">&nbsp;<?php echo $errors['attachments']; ?></font>
            <?php
            }
        }
    }