Exemple #1
0
    function body_content()
    {
        global $FANNIE_OP_DB;
        $dbc = FannieDB::get($FANNIE_OP_DB);
        $ret = '';
        if (!empty($this->messages)) {
            $ret .= '<blockquote style="background: solid 1x black; 
                padding: 5px; margin: 5px;">';
            $ret .= $this->messages;
            $ret .= '</blockquote>';
        }
        $emp_no = FormLib::get_form_value('emp_no', 0);
        $employee = new EmployeesModel($dbc);
        $employee->emp_no($emp_no);
        $employee->load();
        ob_start();
        ?>
        <div id="alert-area"></div>
        <form action="<?php 
        echo filter_input(INPUT_SERVER, 'PHP_SELF');
        ?>
" method="post">
        <div class="form-group">
            <label>First Name</label>
            <input type="text" name="fname" value="<?php 
        echo $employee->FirstName();
        ?>
"
                class="form-control" required />
        </div>
        <div class="form-group">
            <label>Last Name</label>
            <input type="text" name="lname" value="<?php 
        echo $employee->LastName();
        ?>
"
                class="form-control" />
        </div>
        <div class="form-group">
            <label>Password</label>
            <input type="text" name="passwd" value="<?php 
        echo $employee->CashierPassword();
        ?>
"
                class="form-control" required />
        </div>
        <div class="form-group">
            <label>Privileges</label>
            <select name="fes" class="form-control">
            <option value="20" <?php 
        echo $employee->frontendsecurity() <= 20 ? 'selected' : '';
        ?>
>Regular</option>
            <option value="30" <?php 
        echo $employee->frontendsecurity() > 20 ? 'selected' : '';
        ?>
>Manager</option>
            </select>
        </div>
        <div class="form-group">
            <label>Active
                <input type="checkbox" name="active" class="checkbox-inline"
                    <?php 
        echo $employee->EmpActive() == 1 ? 'checked' : '';
        ?>
 />
            </label>
        </div>
        <div class="form-group">
            <label>Birthdate</label>
            <input type="text" class="form-control date-field" name="birthdate" 
                id="birth-date-field" value="<?php 
        echo $employee->birthdate();
        ?>
"
                placeholder="Optional; for stores selling age-restricted items" />
        </div>
        <?php 
        if ($this->config->get('STORE_MODE') == 'HQ') {
            echo '<div class="form-group">';
            $stores = new StoresModel($dbc);
            $mapP = $dbc->prepare('SELECT storeID FROM StoreEmployeeMap WHERE storeID=? AND empNo=?');
            foreach ($stores->find('storeID') as $s) {
                $mapR = $dbc->execute($mapP, array($s->storeID(), $emp_no));
                $checked = $mapR && $dbc->numRows($mapR) ? 'checked' : '';
                printf('<label>
                    <input type="checkbox" name="store[]" value="%d" %s />
                    %s
                    </label> | ', $s->storeID(), $checked, $s->description());
            }
            echo '</div>';
        }
        ?>
        <p>
            <button type="submit" class="btn btn-default">Save</button>
            <button type="button" class="btn btn-default"
                onclick="location='ViewCashiersPage.php';return false;">Back</button>
        </p>
        <input type="hidden" name="emp_no" value="<?php 
        echo $emp_no;
        ?>
" />
        </form>
        <?php 
        $this->add_onload_command("\$('input.form-control:first').focus();\n");
        return ob_get_clean();
    }