<?php
$page = $data['page'];
if (!is_object($page) || $page->title == '') {
    $headline = Text::get('PAGE_HEADLINE_NEW');
} else {
    $headline = Text::get('PAGE_HEADLINE_EDIT');
}
echo '
    <form action="'.PA::getURL().'admin/save_page/'.$page->id.'"
          name="savePage"
          method="post">

        <h1 class="headline">'.$headline.'</h1>
        <div class="admin_box">

            <label for="newPageTitle" class="form_label">
                <span>'.Text::get('PAGE_PAGETITLE_LABEL').'</span>
            </label>
            <input type="text"
                   id="newPageTitle"
                   name="pageTitle"
                   value="'.$page->title.'"
                   class="form_element page_headline"
                   placeholder="'.Text::get('PAGE_PAGETITLE_PLACEHOLDER').'">
        </div>
        ';

        PA::showEditor($page->body);

        echo '
        <div class="admin_box">
            <div class="admin_half left">
                <label for="offerStatus" class="form_label">
                    <span>'.Text::get('PAGE_PAGEINDEX_LABEL').'</span>
                </label>
                <input type="text"
                       id="newPageIndex"
                       name="pageSortIndex"
                       value="'.$page->sort_index.'"
                       maxlength="2"
                       placeholder="'.Text::get('PAGE_PAGEINDEX_PLACEHOLDER').'"
                       class="form_element">
                <label for="offerStatus" class="form_label">
                    <span>'.Text::get('PAGE_PAGESTATUS_LABEL').'</span>
                </label>
                <select id="offerStatus"
                        class="form_element"
                        name="pageStatus">
                    <option value="1"';
                        if ($page->status == 1) { echo ' selected'; }
                        echo '>
                        '.Text::get('PAGE_PAGESTATUS_1').'
                    </option>
                    <option value="2"';
                        if ($page->status == 2) { echo ' selected'; }
                        echo '>
                        '.Text::get('PAGE_PAGESTATUS_2').'
                    </option>
                </select>
            </div>
            <div class="admin_half right">
                <label for="offerStatus"
                       class="form_label"><span>'.Text::get('PAGE_PAGESLUG_LABEL').'</span></label>
                <input type="text"
                       name="pageSlug"
                       id="newPageSlug"
                       value="'.$page->slug.'"
                       maxlength="20"
                       placeholder="'.Text::get('PAGE_PAGESLUG_PLACEHOLDER').'"
                       class="form_element">
                <label for="admin_page_submit"
                       class="form_label"><span>'.Text::get('PAGE_PAGESAVE_LABEL').'</span></label>
                <input type="submit" value="'.Text::get('PAGE_PAGESAVE_BUTTON').'" class="form_submit" id="admin_page_submit">';
//                <a href="" class="delete_button">
//                    <div class="admin_delete_button"></div>
//                </a>
            echo '
            </div>
            <div class="clear"></div>
        </div>
    </form>';
PA::showFooter();
