Esempio n. 1
0
function show_records($domain)
{
    ?>
        <h1><?php 
    echo $domain->domain;
    ?>
</h1>
        <table border="1">
            <tr>
                <th>Name</th>
                <th>Type</th>
                <th>Value</th>
                <th>TTL</th>
                <th>Priority</th>
                <th></th>
                <th></th>
            </tr>
        <?php 
    foreach ($domain->get_all_records() as $record) {
        ?>
                <tr>
                    <form method="post" action="#">
                        <input type="hidden" name="id" value="<?php 
        echo $record->id;
        ?>
">
                        <input type="hidden" name="action" value="save_record">
                        <td>
                            <input type="text" name="name" value="<?php 
        echo $record->name;
        ?>
">
                        </td>
                        <td>
                            <select name="type">
                                <?php 
        foreach (\DNS\Record::get_record_types() as $type) {
            ?>
                                    <option value="<?php 
            echo $type;
            ?>
" <?php 
            echo $record->type == $type ? 'selected' : '';
            ?>
><?php 
            echo $type;
            ?>
</option>
                                <?php 
        }
        ?>
                            </select>
                        </td>
                        <td>
                            <input type="text" name="value" value="<?php 
        echo $record->value;
        ?>
">
                        </td>
                        <td>
                            <input type="number" name="ttl" value="<?php 
        echo $record->ttl;
        ?>
">
                        </td>
                        <td>
                            <input type="number" name="priority" value="<?php 
        echo $record->priority;
        ?>
">
                        </td>
                        <td>
                            <input type="submit" value="Save">
                        </td>
                    </form>
                    <td>
                        <form method="post" action="#">
                            <input type="hidden" name="id" value="<?php 
        echo $record->id;
        ?>
">
                            <input type="hidden" name="action" value="delete_record">
                            <input type="submit" value="Delete">
                        </form>
                    </td>
                </tr>
                <?php 
    }
    ?>
        </table>
        <?php 
}
Esempio n. 2
0
 function get_all_records()
 {
     return Record::all_for_domain($this);
 }