require_once ABSPATH . WPINC . '/lib/utils/db/class-image-db-utils.php';
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);
Example #2
0
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Twelve
 * @since Twenty Twelve 1.0
 */
require_once ABSPATH . WPINC . '/lib/model/needy/class-needy-status.php';
require_once ABSPATH . WPINC . '/lib/utils/db/class-needy-item-db-utils.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/utils/class-needy-item-utils.php';
require_once ABSPATH . WPINC . '/lib/utils/class-template-utils.php';
require_once ABSPATH . WPINC . '/lib/helper/class-needy-filter-helper.php';
$needyItems = NeedyItemDBUtils::getAllNeedyItemsByStatuses(0, NeedyStatus::getNeedHelpNeedyStatuses());
$needyItemsCountPages = NeedyItemDBUtils::getAllNeedyItemsByStatusesCountPages(NeedyStatus::getNeedHelpNeedyStatuses());
$data = ["needyItems" => $needyItems, "needyItemsCountPages" => $needyItemsCountPages];
get_header();
?>

<div class="services">
    <div class="container">
        <a id="toplink" name="top"></a>
        <div class="col-md-6">
            <?php 
if (is_user_logged_in()) {
    ?>
                <div class="btn-group float-left">
                    <a href="<?php 
    echo get_site_url();
    ?>