<?php

require_once __DIR__ . '/wp-load.php';
require_once ABSPATH . WPINC . '/lib/utils/class-template-utils.php';
require_once ABSPATH . WPINC . '/lib/model/document/class-document-item.php';
require_once ABSPATH . WPINC . '/lib/helper/class-request-helper.php';
require_once ABSPATH . WPINC . '/lib/utils/db/class-document-item-db-utils.php';
if (!is_user_logged_in()) {
    wp_redirect(home_url());
    exit;
}
$documentType = RequestHelper::getParameter(DocumentItem::DOCUMENT_TYPE);
$documentId = RequestHelper::getParameter(DocumentItem::ID_FIELD);
if ($documentType == DocumentType::GRANT) {
    $document = DocumentItemDBUtils::getGrantById($documentId);
} else {
    $document = DocumentItemDBUtils::getProgramById($documentId);
}
$data = ["documentType" => $documentType, "document" => $document];
TemplateUtils::includeTemplate(get_template_directory() . '/page-templates/document-form.php', $data);
require_once ABSPATH . WPINC . '/lib/utils/class-needy-item-utils.php';
$filter = RequestHelper::getParameter(NeedyFilterHelper::FILTER_FIELD);
$page = RequestHelper::getParameter(NeedyFilterHelper::PAGE_FIELD) - 1;
$page = $page && $page > 0 ? $page : 0;
$needyItems = [];
$needyItemsCountPages = 0;
if ($filter == NeedyFilterHelper::ALL) {
    $needyItems = NeedyItemDBUtils::getAllNeedyItemsByStatuses($page);
    $needyItemsCountPages = NeedyItemDBUtils::getAllNeedyItemsByStatusesCountPages();
} elseif ($filter == NeedyFilterHelper::ALL_NEEDY) {
    $needyItems = NeedyItemDBUtils::getAllNeedyItemsByStatuses($page, NeedyStatus::getNeedHelpNeedyStatuses());
    $needyItemsCountPages = NeedyItemDBUtils::getAllNeedyItemsByStatusesCountPages(NeedyStatus::getNeedHelpNeedyStatuses());
} elseif ($filter == NeedyFilterHelper::ALL_CHILDS) {
    $needyItems = NeedyItemDBUtils::getAllChildsItems($page);
    $needyItemsCountPages = NeedyItemDBUtils::getAllChildsItemsCountPages();
} elseif ($filter == NeedyFilterHelper::URGENTLY_NEED_HELP_CHILDS) {
    $needyItems = NeedyItemDBUtils::getUrgentlyNeedHelpChildsItems($page);
    $needyItemsCountPages = NeedyItemDBUtils::getUrgentlyNeedHelpChildsItemsCountPages();
} elseif ($filter == NeedyFilterHelper::NEED_HELP_CHILDS) {
    $needyItems = NeedyItemDBUtils::getNeedHelpChildsItems($page);
    $needyItemsCountPages = NeedyItemDBUtils::getNeedHelpChildsItemsCountPages();
} elseif ($filter == NeedyFilterHelper::HELPED_CHILDS) {
    $needyItems = NeedyItemDBUtils::getHelpedChildsItems($page);
    $needyItemsCountPages = NeedyItemDBUtils::getHelpedChildsItemsCountPages();
} elseif ($filter == NeedyFilterHelper::ALL_ORPHANAGES) {
    $needyItems = NeedyItemDBUtils::getAllOrphanagesItems($page);
    $needyItemsCountPages = NeedyItemDBUtils::getAllOrphanagesItemsCountPages();
}
$data = ["needyItems" => $needyItems, "needyItemsCountPages" => $needyItemsCountPages, "page" => $page];
echo TemplateUtils::includeTemplate(get_template_directory() . '/page-templates/needy-item-info-block.php', $data);
<?php

require_once __DIR__ . '/wp-load.php';
require_once ABSPATH . WPINC . '/lib/utils/class-template-utils.php';
if (!is_user_logged_in()) {
    wp_redirect(home_url());
    exit;
}
TemplateUtils::includeTemplate(get_template_directory() . '/page-templates/orphanage-form.php');
Beispiel #4
0
<?php

require_once ABSPATH . WPINC . '/lib/utils/class-template-utils.php';
TemplateUtils::includeTemplate(get_template_directory() . '/page-templates/header-block.php', []);
TemplateUtils::includeTemplate(get_template_directory() . '/page-templates/banner-block.php', []);
Beispiel #5
0
                    </div>
                <?php 
}
?>
            </div>
            <div class="col-md-6">
                <div class="btn-group float-right">
                    <button type="button" class="btn btn-primary" id="active">Действующие</button>
                    <button type="button" class="btn btn-primary" id="inactive">Завершённые</button>
                </div>
            </div>
            <div class="clearfix"></div>
        </div>
        <div class="stocks-block" id="stockBlock">
            <?php 
TemplateUtils::includeTemplate(get_template_directory() . '/page-templates/stock-info-block.php', $data);
?>
        </div>
    </div>
    <!--services-end-->
    <script>
        jQuery(document).ready(function($) {
            var stockBlock = $("#stockBlock");

            $('#active').click(function(){
                changeFilter(<?php 
echo StockFilterHelper::ACTIVE;
?>
, 'Действующие мероприятия');
            });
            $('#inactive').click(function(){
<?php

require_once __DIR__ . '/wp-load.php';
require_once ABSPATH . WPINC . '/lib/utils/db/class-child-db-utils.php';
require_once ABSPATH . WPINC . '/lib/utils/db/class-image-db-utils.php';
require_once ABSPATH . WPINC . '/lib/helper/class-request-helper.php';
require_once ABSPATH . WPINC . '/lib/utils/class-template-utils.php';
if (!is_user_logged_in()) {
    wp_redirect(home_url());
    exit;
}
TemplateUtils::includeTemplate(get_template_directory() . '/page-templates/child_form.php');