<?php
/* Template Name: Categories Listing */

get_header();

global $parentPost;

$WidgetArea=new TLThemeWidgetArea();

$widgetAreaData=$WidgetArea->getWidgetAreaByPost($parentPost->post,true,true);
$class=$WidgetArea->getWidgetAreaCSSClass($widgetAreaData);
global $post,$parentPost;

$Page=new TLThemePage();
$Post=new TLThemePost();
$Blog=new TLThemeBlog();
$WidgetArea=new TLThemeWidgetArea();
$Validation=new TLThemeValidation();

$widgetAreaData=$WidgetArea->getWidgetAreaByPost($parentPost->post,true,true);

$query=$Blog->getPost();
$postCount=count($query->posts);
$option=TLThemeOption::getPostMeta($parentPost->post->ID);
$icon=THEME_URL.'media/image/public/icon/icon_1/tab_icon_'.$option['page_menu_icon'].'.png';
$icon_hover=THEME_URL.'media/image/public/icon/icon_1/tab_icon_'.$option['page_menu_icon'].'_hover.png';

if($postCount){
    while($query->have_posts())
    {
        $query->the_post();
        $posttags = get_the_tags(get_the_ID());
        if ($posttags) {
            foreach($posttags as $tag) {
                $all_tags_arr[$tag->slug]['name'] = $tag->name;
                $all_tags_arr[$tag->slug]['url'] = get_tag_link($tag->term_id);
            }
            asort($all_tags_arr);
        }
    }
}
?>
    <div class="page">
        <?php
        if(TLThemeOption::getGlobalOption($parentPost->post,'header_visible')==1)
        {
            ?>
            <div class="page-header">
                <h1><?php echo $parentPost->post->post_title; ?></h1>
            </div>
        <?php
        }
        ?>
        <div class="page-content clear-fix <?php echo $class; ?>">
            <?php
            if($widgetAreaData['location']==1)
            {
                ?>
                <div class="column-left"><?php $WidgetArea->create($widgetAreaData); ?></div>
                <div class="column-right">
                    <ul class="list-0 clear-fix blog-post-list">
                        <li class="post type-post status-publish format-standard hentry category-articles tag-healthcare clear-fix">
                            <div class="clear-fix">
                                <div class="post-date">
                                    <img class="menu-box-widget-icon-hover" src="http://dev.alexlaw.pro/wp-content/themes/themis/media/image/public/icon/icon_1/tab_icon_script_hover.png" alt="" style="opacity: 0;">
                                </div>
                                <div class="post-info">
                                    <h2><a href="http://dev.alexlaw.pro/doctor-patient-relationship/">Doctor-patient relationship</a></h2>
                                    <div class="clear-fix post-info-bar">
                                        <div class="post-info-bar-comment-count">
                                            <a href="http://dev.alexlaw.pro/doctor-patient-relationship/#comments">0 comments</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            <?php
            }
            elseif($widgetAreaData['location']==2)
            {
                ?>
                <div class="column-left widget">
                    <div class="clear-fix menu-box-widget-wrapper">
                    <ul class="list-0 clear-fix blog-post-list menu-box-widget">

<!--                                <span class="menu-box-widget-icon">-->
<!--                                    <img class="menu-box-widget-icon-hover" src="http://dev.alexlaw.pro/wp-content/themes/themis/media/image/public/icon/icon_1/tab_icon_script_hover.png" alt="">-->
<!--                                </span>-->
                                <?php foreach($all_tags_arr as $slug => $tag) : ?>
                                <li class="post type-post status-publish format-standard hentry category-articles tag-healthcare clear-fix">
                                    <div class="clear-fix">
                                        <a href="<?php echo $tag['url']; ?>" class="blog-article-caregory-link">
        <!--                                    <span class="menu-box-widget-icon">-->
        <!--                                        <img class="menu-box-widget-icon" src="http://dev.alexlaw.pro/wp-content/themes/themis/media/image/public/icon/icon_1/tab_icon_script.png" alt="">-->
        <!--                                        <img class="menu-box-widget-icon-hover" src="http://dev.alexlaw.pro/wp-content/themes/themis/media/image/public/icon/icon_1/tab_icon_script_hover.png" alt="">-->
        <!--                                    </span>-->
                                            <span class="menu-box-widget-icon">
                                                <img class="menu-box-widget-icon" src="<?php echo TLThemeHelper::esc_attr($icon); ?>" alt=""/>
                                                <img class="menu-box-widget-icon-hover" src="<?php echo TLThemeHelper::esc_attr($icon_hover); ?>" alt=""/>
                                            </span>
                                            <span class="post-info">
                                                <p class="menu-box-widget-header"><?php echo $Post->icon; echo $tag['name']; ?></p>
                                            </span>
                                        </a>
                                    </div>
                                </li>
                                <?php endforeach; ?>

                    </ul>
                    </div>
                </div>
                <div class="column-right"><?php $WidgetArea->create($widgetAreaData); ?></div>
            <?php
            }
            else{
            ?>
                <ul class="list-0 clear-fix blog-post-list">
                    <li class="post type-post status-publish format-standard hentry category-articles tag-healthcare clear-fix">
                        <div class="clear-fix">
                            <div class="post-date">
                                <span class="day">02</span>
                                <span class="month-year">Jun '14</span>
                            </div>
                            <div class="post-info">
                                <h2><a href="http://dev.alexlaw.pro/doctor-patient-relationship/">Doctor-patient relationship</a></h2>
                            </div>

                        </div>
                        <div class="clear-fix post-excerpt paragraph"><p>To what extent, if at all, are the three models of professional-patient interaction identified by Michael Bury applicable to the law governing the medical treatment of (i) persons with capacity and (ii) persons lacking capacity to make their own treatment decisions? The “professional-patient” (or “doctor-patient”) relationship has been a topic of particular interest for many<span class="excerpt-more"> [...]</span></p>
                        </div>
                        <div class="clear-fix">
                            <a href="http://dev.alexlaw.pro/doctor-patient-relationship/" class="post-read-more">Read more</a>
                        </div>
                        <div class="clear-fix post-tag">

                            <ul class="list-0">

                                <li><span>Tags:</span></li>
                                <li><a href="http://dev.alexlaw.pro/tag/healthcare/">Healthcare</a></li>
                            </ul>

                        </div>
                    </li>
                </ul>
        <?php } ?>
        </div>
    </div>
<?php
get_footer();
?>