function render() { $pic = $aud = $vid = NULL; switch ($this->page) { case 'homepage': $pic = Image::load_recent_media_image(0, $this->subject); $aud = Audio::load_recent_media_audio(0, $this->subject); $vid = TekVideo::get_media_recent_tekvideo(0, $this->subject); break; case 'grouppage': $pic = Image::load_images_for_collection_id((int) $this->gid); $aud = Audio::load_audios_for_collection_id((int) $this->gid); $tekvid = TekVideo::get(NULL, array('C.collection_id' => $this->group_details->collection_id)); $vid = objtoarray($tekvid); break; case 'userpage': $pic = Image::load_user_gallery_images($this->uid, 10, PA::$login_uid); $aud = Audio::load_user_gallery_audio($this->uid, 10, PA::$login_uid); if (!empty(PA::$page_uid) || PA::$login_uid != PA::$page_uid) { $condition['M.video_perm'] = !empty($this->friend_list) && in_array(PA::$page_uid, $this->friend_list) ? array(WITH_IN_DEGREE_1, ANYONE) : ANYONE; } $tekvid = TekVideo::get(array('show' => 10, 'page' => 1), array('C.author_id' => $this->uid)); $vid = objtoarray($tekvid); $this->view_all_url = PA::$url . PA_ROUTE_MEDIA_GALLEY_IMAGES . "/uid={$this->subject}"; break; } //even if we got more media, we can display only 6 $pictures = array(); $max = count($pic) < 6 ? count($pic) : ($max = 6); for ($i = 0; $i < $max; $i++) { $pictures[$i] = $pic[$i]; } $audios = array(); $max = count($aud) < 6 ? count($aud) : ($max = 6); for ($i = 0; $i < $max; $i++) { $audios[$i] = $aud[$i]; } $videos = array(); $max = count($vid) < 6 ? count($vid) : ($max = 6); for ($i = 0; $i < $max; $i++) { $videos[$i] = $vid[$i]; } if (!empty($this->group_details) && (!empty($pictures) || !empty($audios) || !empty($videos))) { $this->view_all_url = PA::$url . PA_ROUTE_MEDIA_GALLEY_IMAGES . "/view=groups_media&gid=" . (int) $this->group_details->collection_id; } $gallery = array('images' => $pictures, 'audios' => $audios, 'videos' => $videos); $this->links = $gallery; $this->inner_HTML = $this->generate_inner_html($this->links); if (empty($gallery['images']) && empty($gallery['audios']) && empty($gallery['videos'])) { $this->height = 70; $this->view_all_url = ''; } else { $this->height = 260; } $content = parent::render(); return $content; }
function render() { $pictures = array(); $audios = array(); $videos = array(); global $base_url, $login_uid; $uid_gal = $this->uid; if (!empty($uid_gal)) { $this->view_all_url = "{$base_url}/media_gallery.php?uid={$uid_gal}"; } if ($this->page == 'homepage') { if (isset($_SESSION['user']['id'])) { $my_id = $_SESSION['user']['id']; $this->uid = $_SESSION['user']['id']; } else { $my_id = 0; } if ($this->uid) { $u_id = $this->uid; } else { $u_id = 0; } $pic = Image::load_recent_media_image(0, $my_id); $aud = Audio::load_recent_media_audio(0, $my_id); $vid = Video::load_recent_media_video(0, $my_id); //even if we got more media, we can display only 6 if (count($pic) < 6) { $max = count($pic); } else { $max = 6; } $pictures = array(); for ($i = 0; $i < $max; $i++) { $pictures[$i] = $pic[$i]; } if (count($aud) < 6) { $max = count($aud); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $audios[$i] = $aud[$i]; } if (count($vid) < 6) { $max = count($vid); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $videos[$i] = $vid[$i]; } } else { if ($this->page == 'grouppage') { $pic = Image::load_images_for_collection_id((int) $this->group_details['collection_id']); $aud = Audio::load_audios_for_collection_id((int) $this->group_details['collection_id']); //$this->links = $audios; $vid = Video::load_videos_for_collection_id((int) $this->group_details['collection_id']); if (count($pic) < 6) { $max = count($pic); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $pictures[$i] = $pic[$i]; } if (count($aud) < 6) { $max = count($aud); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $audios[$i] = $aud[$i]; } if (count($vid) < 6) { $max = count($vid); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $videos[$i] = $vid[$i]; } } else { $pic = Image::load_images($this->uid, 10, $login_uid); //$this->links = $pictures; $aud = Audio::load_audio($this->uid, 10, $login_uid); //$this->links = $audios; $vid = Video::load_video($this->uid, 10, $login_uid); if (count($pic) < 6) { $max = count($pic); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $pictures[$i] = $pic[$i]; } if (count($aud) < 6) { $max = count($aud); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $audios[$i] = $aud[$i]; } if (count($vid) < 6) { $max = count($vid); } else { $max = 6; } for ($i = 0; $i < $max; $i++) { $videos[$i] = $vid[$i]; } } } if (!empty($this->group_details) && (!empty($pictures) || !empty($audios) || !empty($videos))) { $this->view_all_url = "{$base_url}/group_media_gallery.php?gid=" . (int) $this->group_details['collection_id']; } if (!empty($this->group_details)) { $this->gid = $this->group_details['collection_id']; } $gallery = array('images' => $pictures, 'audios' => $audios, 'videos' => $videos); $this->links = $gallery; $this->inner_HTML = $this->generate_inner_html($this->links); if (empty($gallery['images']) && empty($gallery['audios']) && empty($gallery['videos'])) { $this->height = 70; $this->view_all_url = ''; } else { $this->height = 260; } $content = parent::render(); return $content; }