$items = $fetch_result['items']; // preint_r($items); $list_options['list_style'] = 'thumbnails'; $output .= rounded_corners_top(); $output .= entertain_list($items, $list_options); $output .= rounded_corners_bottom(); //En utvalt item med två kommentarer $output .= rounded_corners_top(); $fetch['entertain_type'] = $request['entertain_type']; $fetch['order'] = 'random'; $fetch['limit'] = '1'; $fetch_result = entertain_fetch($fetch); $items = $fetch_result['items']; $item = array_pop($items); $output .= '<div class="entertain_item_with_comments">' . "\n"; $output .= entertain_thumbnail_draw($item); $comments_options['limit'] = 2; $comments_options['style'] = 'no_margin'; $output .= comments_list($item['id'], 'entertain', $comments_options); $output .= '<br style="clear: both;" />' . "\n"; $output .= '</div>' . "\n"; $output .= rounded_corners_bottom(); // Visa en slumpvald item $fetch['entertain_type'] = $request['entertain_type']; $fetch['order'] = 'random'; $fetch['limit'] = '1'; $fetch_result = entertain_fetch($fetch); $items = $fetch_result['items']; $item = array_pop($items); $draw_options['comments'] = 'no'; $output .= entertain_item_draw($item, $draw_options);
/** * List entertain items in ordinary list and compact list * $items array of entertain items with all necessary data included * (id, title, handle, rank_avarage, votes, comments) */ function entertain_list($items, $options) { // Ok, lets fix some options if ($options['list_style'] == 'titles' && count($items) < 40) { $options['list_style'] = 'thumbnails'; } //preint_r($options); // $output .= '<p>list_style: ' . $options['list_style'] . '</p>'; $options['list_style'] = isset($options['list_style']) ? $options['list_style'] : 'thumbnails'; global $entertain_categories; global $entertain_list_styles; global $entertain_types; // if(isset($options[' $output .= '<div class="entertain_list">' . "\n"; if (is_string($options['headline'])) { $output .= '<h2>' . $options['headline'] . '</h2>' . "\n"; } $count = 0; switch ($options['list_style']) { case 'commented': case 'full': foreach ($items as $item) { $output .= rounded_corners_top(); $output .= '<div class="entertain_full" id="entertain_full_' . $item['handle'] . '" >' . "\n"; if (!strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.0')) { $output .= '<div style="background: url(\'' . IMAGE_URL . 'entertain/' . $item['handle'] . '.png\') 5px 5px no-repeat;" class="entertain_full_thumb">' . "\n"; $output .= '<a href="/' . $entertain_types[$item['entertain_type']]['url_handle'] . '/' . $item['handle'] . '.html">' . "\n"; $output .= '<img src="http://images.hamsterpaj.net/game_thumb_passepartout.png" />'; $output .= '</a>' . "\n"; $output .= '</div>'; } else { $output .= '<a href="/' . $entertain_types[$item['entertain_type']]['url_handle'] . '/' . $item['handle'] . '.html">' . "\n"; $output .= '<img alt="' . $item['title'] . '" class="entertain_full_thumb" src="' . IMAGE_URL . 'entertain/' . $item['handle'] . '.png" />' . "\n"; $output .= '</a>' . "\n"; } $output .= '<div class="title_and_description">' . "\n"; $output .= '<a href="/' . $entertain_types[$item['entertain_type']]['url_handle'] . '/' . $item['handle'] . '.html"><h1>' . $item['title'] . '</h1></a>' . "\n"; $output .= '<a href="/' . $entertain_types[$item['entertain_type']]['url_handle'] . '/' . $item['handle'] . '.html">' . "\n"; $output .= '<p>' . $item['description'] . '</p>' . "\n"; $output .= '</a>' . "\n"; $output .= '</div>' . "\n"; // end info $output .= '<div class="statistics">' . "\n"; $output .= '<div class="column_1">' . cute_number($item['played']) . '</div><a href="/spel/topplistan/mest_spelade/">Spelningar</a>' . "\n"; $output .= '<div class="column_1">Släpptes</div>' . date('Y-m-d', $item['release']) . "\n"; if (is_privilegied('entertain_admin')) { $output .= '<a href="/' . $entertain_types[$item['entertain_type']]['url_handle'] . '/admin/' . $item['handle'] . '.php" >Redigera</a>' . "\n"; } $output .= '</div>' . "\n"; // end statistics $output .= '</div>' . "\n"; // end entertain_full $output .= '<br style="clear: both;">' . "\n"; $output .= rounded_corners_bottom(); } break; case 'half': case 'thumbnails': foreach ($items as $item) { $output .= entertain_thumbnail_draw($item); } break; case 'titles': $letter = 'A'; $count = count($items); $border[0] = floor($count / 3); $border[1] = 2 * $border[0]; $border[2] = $count; $column = 0; $output .= '<ul class="entertain_list_titles">' . "\n"; $output .= '<h2>' . $letter . '</h2>' . "\n"; $output .= '<div class="list_slot">' . "\n"; $i = 0; $slot = 0; foreach ($items as $item) { if ($letter != strtoupper(substr($item['title'], 0, 1))) { $output .= '</div>' . "\n"; $letter = strtoupper(substr($item['title'], 0, 1)); if ($i > $border[$column]) { $column++; // $output .= '<br style="clear: both;">' . "\n"; $output .= '</ul>' . "\n"; // $output .= '<h1>Kolumn: ' . $column . '</h1>'; $output .= '<ul class="entertain_list_titles">' . "\n"; } $output .= '<h2>' . $letter . '</h2>' . "\n"; $output .= '<div class="list_slot">' . "\n"; $slot = 2; } elseif ($slot > 6) { $output .= '</div>' . "\n"; // $output .= '<div class="header_dummy"></div>' . "\n"; $output .= '<div class="list_slot">' . "\n"; $slot = 0; } $output .= '<li>' . "\n"; $output .= '<a href="/' . $entertain_types[$item['entertain_type']]['url_handle'] . '/' . $entertain_categories[$item['category_id']]['handle'] . '/' . $item['handle'] . '.html">' . "\n"; $output .= $item['title'] . "\n"; $output .= '</a>' . "\n"; $output .= '</li>' . "\n"; $i++; $slot++; } $output .= '</div' . "\n"; $output .= '</ul>' . "\n"; break; } $output .= '<br style="clear: both;">' . "\n"; $output .= '</div>' . "\n"; // end entertain_list return $output; }