if ($file != "." && $file != "..") {
             $img = $file;
         }
     }
     closedir($pp);
     if (isset($img)) {
         $product['contact_logo'] = $img;
         unset($img);
     }
 }
 // Count visit of this product
 if (!isset($_SESSION['products_visited'])) {
     $_SESSION['products_visited'] = [];
 }
 // get related gifts of the user displaying this product
 $gifts = getGifts($db, $product['user_id']);
 if (!in_array($product['product_id'], $_SESSION['products_visited'])) {
     countVisit($db, $product['product_id']);
     $_SESSION['products_visited'][] = $product['product_id'];
 }
 // Muss nach $products gecalled werden
 $similar = getSimilarProducts($product['product_id'], $product['user_id'], $product['category_id'], $product['subcategory_id'], $db);
 if (isset($similar) && !empty($similar)) {
     foreach ($similar as $key => $sim) {
         if (is_dir($sim['product_image_path']) && ($pp = opendir($sim['product_image_path']))) {
             while (($file = readdir($pp)) !== false) {
                 if ($file != "." && $file != "..") {
                     $img[] = $file;
                 }
             }
             closedir($pp);
Beispiel #2
0
    ?>
</strong> <br/> given on <?php 
    echo getFormattedDate($gift->giftDate);
    ?>
<br> (<?php 
    echo $gift->plantName;
    ?>
, <?php 
    echo $gift->points;
    ?>
 Points)" class="tree has-tip radius" src="img/tree.png" width="50px" style="display:none;">
    	<?php 
}
?>
    <div class="name floater">Plants gifted</div><div class="name" style="float:right"><?php 
echo sizeof(getGifts($user));
?>
</div>
    <div style="clear:both;"></div>
    <div class="name floater">Number of friends</div><div class="name" style="float:right"><?php 
echo getCountFriendsGifted($user);
?>
</div>
    <div style="clear:both;"></div>
    <div class="centerAlign" style="padding:4%;">
         <a href="choose.php">Gift more!</a>
   </div>

</div>
</div>
     } else {
         header('Location: /dashboard');
     }
     break;
 case 'gifts':
     if ($_SESSION['user_status'] != 'pending' && $_SESSION['has_contact'] == true && $_SESSION['user_has_package']) {
         // Model
         require_once APP_PATH . 'model/getJs.php';
         require_once APP_PATH . 'model/uploadPDF.php';
         require_once APP_PATH . 'model/deletePDF.php';
         require_once APP_PATH . 'model/getGifts.php';
         // controller
         require_once APP_PATH . 'control/giftsController.php';
         // call models
         $scripts = getJs($allScripts, [], true);
         $gifts = getGifts($db, (int) $_SESSION['user_id']);
         // Template
         $menuPath = '/view/site/dashboard/user/menu.php';
         $sitePath = '/view/site/dashboard/user/gifts.php';
     } else {
         header('Location: /dashboard');
     }
     break;
 case 'contacts':
     require_once APP_PATH . 'model/getJs.php';
     require_once APP_PATH . 'model/getContacts.php';
     require_once APP_PATH . 'model/saveContact.php';
     require_once APP_PATH . 'model/updateContact.php';
     require_once APP_PATH . 'model/deleteContactLogo.php';
     $scripts = getJs($allScripts, ['maps' => 1, 'mapControl' => 1, 'tabControl' => 1], true);
     $contacts = getContacts($db);