Beispiel #1
0
                    <div class="col-lg-8">
                        <h4 class="p-0-20 text-pink ">
                            <small  class="pull-right">
                                    <?php 
    if ($value->ID === \Mariana\Framework\Session\Session::get('id')) {
        echo '<i class="fa fa-times pink-text rotate-on-hover" onclick="deleteRecipe(event); " data-id="<?= $value->id ; ?>">   </i>';
    }
    ?>
                            </small><span class="text-capitalize-first">
                                <?php 
    echo $value->name;
    ?>
                            </span>
                        </h4>
                        <p><?php 
    echo mfr_excerpt($value->instructions, 250);
    ?>
</p>
                        <p>
                            <small class="pull-right pink-text">Clicar para adaptar.</small>
                            <small class="pull-left "><?php 
    echo $value->user_nicename;
    ?>
</small>
                            <br></p>

                    </div>
                    <div class="col-lg-4">
                        <img src="<?php 
    echo COACHING_URL . DS . $value->thumbnail;
    ?>
 public function topics($offset = 1)
 {
     // FACADE
     //  Step1 : getting stuff
     $return = array();
     $this->offset = $this->offset * $offset;
     # user_id
     $id = Session::get('id');
     if (!$id) {
         $id = 0;
     }
     # Lang
     //$lang = Session::get('application-language');
     $lang = 'pt';
     # Step 1 - Count How Many Results
     if (!$this->topic_id) {
         $sql = "SELECT\n                  mfr_forum_topics.id\n                FROM mfr_forum_topics\n                  INNER JOIN mfr_forum_topic_categorys\n                    ON mfr_forum_topics.id = mfr_forum_topic_categorys.topic_id\n                  INNER JOIN mfr_forum_categorys\n                    ON mfr_forum_topic_categorys.category_id = mfr_forum_categorys.id\n                WHERE mfr_forum_topics.lang = '{$lang}'\n                AND mfr_forum_categorys.lang = '{$lang}'";
         $sql = $this->sqlBuild($sql, true) . ' GROUP BY mfr_forum_topics.id';
         $stmt = Database::getConnection()->prepare($sql);
         $stmt = $this->stmtBuild($stmt);
         $stmt->execute();
         $row = $stmt->fetchAll(PDO::FETCH_ASSOC);
         /**
          * @confirm:
          *  1- simple query -> Passou
          *  2- by category
          *      2.1- by_category(1) -> Passou
          *      2.2- by_category(2) -> Passou
          *  3- by text
          *      3.1- by_text(a) -> Passou
          *      3.2- by_text(xxxyyy) -> Passou
          *  4- by text and cat
          *      4.1- (1,'a') -> Passou
          *      4.2- (1,'xxxyyy') -> Passou
          *      4.3- (2,'xxxyyy') -> Passou
          *
          */
         $return['pagination'] = ceil(sizeof($row) / $this->limit);
         # Get in Values:
         $row = array_slice($row, $this->offset, $this->limit);
         // Just remember: array_slice(array,start,length,preserve)
         $in = '0,';
         foreach ($row as $item) {
             $in .= $item['id'] . ',';
         }
         $in = '(' . trim($in, ',') . ')';
     } else {
         $in = '(' . $this->topic_id . ')';
     }
     # Get topics query
     /*
     $sql = "SELECT
               mfr_forum_topics.id,
               mfr_forum_topics.date_created,
               mfr_forum_topics.user_id,
               mfr_forum_topics.name,
               mfr_forum_topics.description,
               mfr_forum_topics.last_updated,
               mfr_forum_topics.status,
               mfr_forum_topics.views,
               mfr_forum_categorys.name as cat_name,
               wp_users.user_nicename,
               (SELECT count(mfr_forum_answers.id) FROM mfr_forum_answers WHERE mfr_forum_answers.topic_id = mfr_forum_topics.id) as reply,
               (SELECT count(mfr_forum_likes.id) FROM mfr_forum_likes WHERE mfr_forum_likes.subject_id = mfr_forum_topics.id AND mfr_forum_likes.type = 'topic') as likes,
               (SELECT count(mfr_forum_likes.id) FROM mfr_forum_likes WHERE mfr_forum_likes.subject_id = mfr_forum_topics.id AND mfr_forum_likes.type = 'topic' AND mfr_forum_likes.user_id = $id) as i_like,
               mfr_users.level,
               mfr_users.avatar
             FROM mfr_forum_topic_categorys
               INNER JOIN mfr_forum_topics
                 ON mfr_forum_topic_categorys.topic_id = mfr_forum_topics.id
               INNER JOIN mfr_forum_categorys
                 ON mfr_forum_categorys.id = mfr_forum_topic_categorys.category_id
               INNER JOIN mfr_forum_answers
                 ON mfr_forum_topics.id = mfr_forum_answers.topic_id
               INNER JOIN mfr_forum_likes
                 ON mfr_forum_topics.id = mfr_forum_likes.subject_id
                 AND  mfr_forum_likes.type = 'topic'
               INNER JOIN wp_users
                 ON mfr_forum_topics.user_id = wp_users.ID
               INNER JOIN mfr_users
                 ON wp_users.ID = mfr_users.id
             WHERE mfr_forum_topics.id IN $in
             AND mfr_forum_topics.lang = '$lang'
             AND mfr_forum_categorys.lang = '$lang'
             ";
     */
     $sql = "SELECT\n                      mfr_forum_topics.id,\n                      mfr_forum_topics.user_id,\n                      mfr_forum_topics.name,\n                      mfr_forum_topics.description ,\n                      mfr_forum_topics.status,\n                      mfr_forum_topics.lang,\n                      mfr_forum_topics.views,\n                      mfr_users.level,\n                      mfr_users.coach,\n                      mfr_users.active,\n                      mfr_users.avatar,\n                      mfr_forum_topic_categorys.category_id,\n                      wp_users.user_nicename,\n                      mfr_forum_topics.date_created,\n                      mfr_forum_topics.last_updated,\n                      (SELECT count(mfr_forum_answers.id) FROM mfr_forum_answers WHERE mfr_forum_answers.topic_id = mfr_forum_topics.id) as reply,\n                      (SELECT count(mfr_forum_likes.id) FROM mfr_forum_likes WHERE mfr_forum_likes.subject_id = mfr_forum_topics.id AND mfr_forum_likes.type = 'topic') as likes,\n                      (SELECT count(mfr_forum_likes.id) FROM mfr_forum_likes WHERE mfr_forum_likes.subject_id = mfr_forum_topics.id AND mfr_forum_likes.type = 'topic' AND mfr_forum_likes.user_id = {$id}) as i_like,\n                      mfr_forum_categorys.name as cat_name,\n                      mfr_forum_categorys.id as cat_id\n                    FROM mfr_forum_topics\n                      INNER JOIN mfr_forum_topic_categorys\n                        ON mfr_forum_topics.id = mfr_forum_topic_categorys.topic_id\n                      INNER JOIN mfr_forum_categorys\n                        ON mfr_forum_topic_categorys.category_id = mfr_forum_categorys.id\n                      INNER JOIN mfr_users\n                        ON mfr_forum_topics.user_id = mfr_users.id\n                      INNER JOIN wp_users\n                        ON mfr_users.id = wp_users.ID\n                      WHERE mfr_forum_topics.id IN {$in}\n                        AND mfr_forum_topics.lang = '{$lang}'\n                        AND mfr_forum_categorys.lang = '{$lang}'";
     //Conditions:
     $sql = $this->sqlBuild($sql, true);
     // Order descending
     //$sql .= 'ORDER BY  mfr_forum_topics.last_updated ';
     $stmt = \Mariana\Framework\Database::getConnection()->prepare($sql);
     $stmt = $this->stmtBuild($stmt);
     $stmt->execute();
     $row = $stmt->fetchAll(PDO::FETCH_ASSOC);
     $topics = array();
     $i = 0;
     $last_r = 0;
     $last_i = 0;
     Session::get('id') ? $session = Session::get('id') : ($session = 0);
     foreach ($row as $r) {
         if ($last_r !== $r['id']) {
             $i++;
             $topics[$i]['session'] = $session;
             $topics[$i]['id'] = $r['id'];
             $topics[$i]['date_created'] = Time::humanDifference(time() - $r['date_created']);
             $topics[$i]['last_updated'] = Time::humanDifference(time() - $r['last_updated']);
             $topics[$i]['user_id'] = $r['user_id'];
             $topics[$i]['user_avatar'] = $r['avatar'];
             $topics[$i]['username'] = $r['user_nicename'];
             $topics[$i]['reply_count'] = $r['reply'];
             $topics[$i]['like_count'] = $r['likes'];
             $topics[$i]['i_like'] = $r['i_like'];
             $topics[$i]['status'] = $r['status'];
             $topics[$i]['views'] = $r['views'];
             $topics[$i]['topic_name'] = $r['name'];
             $topics[$i]['topic_desc'] = $r['description'];
             $topics[$i]['topic_excerpt'] = mfr_excerpt($r['description'], 150);
             $topics[$i]['categories'] = array();
             $lu = explode(' ', $topics[$i]['last_updated']);
             $topics[$i]['last_updated_0'] = $lu[0];
             $topics[$i]['last_updated_1'] = $lu[1];
             $last_r = $r['id'];
             $last_i = $i;
         }
         if (!in_array($r['cat_name'], $topics[$last_i]['categories'])) {
             array_push($topics[$last_i]['categories'], array('cat_name' => $r['cat_name'], 'cat_id' => $r['cat_id']));
         }
     }
     $return['topics'] = $topics;
     return $return;
 }
Beispiel #3
0
echo $scope['intro-title'];
?>
</h2>
    <?php 
echo $scope['intro-text'];
?>
</div>

<!-- // RIGHT PANEL -->
<div class="col-lg-6">
    <?php 
$tmp_args = array();
$args = array();
foreach ($scope['file-list'] as $file) {
    $title = $file["post_title"];
    $excerpt = mfr_excerpt($file['post_content'], 100);
    $id = $file['ID'];
    $action = 'click="get_file(' . $id . ')" ';
    $value = '
        <div style="vertical-align: top">
            <strong>' . $title . '</strong>
            <br>
            <small>' . $excerpt . '</small>
        </div>';
    array_push($args, array('value' => $value, 'action' => 'onclick="get_file(' . $id . ')"', 'class' => 'list-hovered'));
}
include_once VIEW_PATH . DS . 'templates' . DS . 'list_panel' . DS . 'simple.php';
include_once VIEW_PATH . DS . 'templates' . DS . 'modal' . DS . 'index.php';
?>
</div>
<script>