<?php

if (JAK_BLOG_A) {
  $newblogarticle = $jakdb->select("blog", ["[>]user" => ["opid" => "id"]], ["blog.id", "blog.title", "blog.content", "blog.previmg", "blog.time", "user.name", "user.picture"], ["AND" => ["lang" => $BT_LANGUAGE, "active" => 1], "ORDER" => ["dorder" => "DESC"], "LIMIT" => JAK_BLOG_HOME]);
}

if (isset($newblogarticle) && !empty($newblogarticle)){?>
  <div class="section" id="cards">
    <div class="container tim-container">
      <div class="card-columns">
        <?php foreach($newblogarticle as $bl) {
          $blogparseurl = JAK_rewrite::jakParseurl(JAK_BLOG_URL, 'a', $bl["id"], JAK_rewrite::jakCleanurl($bl["title"]));
          ?>
          <div class="card card-blog">
            <div class="card-image">
              <a href="<?php echo $blogparseurl;?>">
                <img class="img" src="<?php echo $bl["previmg"];?>">
              </a>
            </div>
            <div class="card-body text-center">
              <h4 class="card-title">
                <?php echo $bl["title"];?>
              </h4>
              <div class="card-description">
                <?php echo jak_cut_text($bl["content"], 200, '...');?>
              </div>
              <div class="card-footer">
                <a href="<?php echo $blogparseurl;?>" class="btn btn-danger btn-round"><?php echo $jkl['hd135'];?></a>
                <hr>
              </div>

              <div class="card-footer pb-4">
                <div class="author float-left">
                  <a href="javascript:;">
                    <img src="<?php echo BASE_URL.JAK_FILES_DIRECTORY.$bl["picture"];?>" alt="<?php echo $bl["name"];?>" class="avatar img-raised">
                    <span><?php echo $bl["name"];?></span>
                  </a>
                </div>
                <div class="stats">
                  <i class="fa fa-clock-o" aria-hidden="true"></i> <?php echo JAK_base::jakTimesince($bl['time'], JAK_DATEFORMAT, JAK_TIMEFORMAT);?>
                </div>
              </div>
            </div>
          </div>
        <?php } ?>
      </div>
    </div>
  </div>

<?php } ?>
