function render()
 {
     $this->title = __('Answers the Question of the Day');
     $question = new Question();
     $params = array('cnt' => FALSE, 'show' => 1, 'page' => 1, 'is_active' => 1, 'sort_by' => 'changed', 'direction' => 'DESC');
     $data = $question->load_many($params);
     $this->links = objtoarray($data);
     $this->inner_HTML = $this->generate_inner_html();
     $network_stats = parent::render();
     return $network_stats;
 }
 function get_links()
 {
     $question = new Question();
     $param = array('cnt' => TRUE);
     $this->Paging["count"] = $question->load_many($param);
     $params = array('cnt' => FALSE, 'show' => $this->Paging["show"], 'page' => $this->Paging["page"], 'sort_by' => 'changed', 'direction' => 'DESC');
     $data = $question->load_many($params);
     $links = objtoarray($data);
     $params = array('cnt' => FALSE, 'show' => 1, 'page' => 1, 'is_active' => 1, 'sort_by' => 'changed', 'direction' => 'DESC');
     $data = $question->load_many($params);
     $this->selected = @$data[0]->content_id;
     return $links;
 }
 /**
   Get all the links of different group of given search String 
   **/
 private function get_links()
 {
     global $login_uid;
     $links = array();
     if (@$this->name_string) {
         $tag_var = new Tag();
         switch ($this->name_string) {
             case 'group_tag':
                 $this->Paging["count"] = $tag_var->get_associated_contentcollectionids($this->keyword, $cnt = TRUE);
                 $tag_list = $tag_var->get_associated_contentcollectionids($this->keyword, $cnt = FALSE, $this->Paging["show"], $this->Paging["page"]);
                 $cnt = count($tag_list);
                 if ($cnt > 0) {
                     for ($i = 0; $i < $cnt; $i++) {
                         $link[$i] = Group::load_group($tag_list[$i]['id']);
                     }
                     $links['group_info'] = objtoarray($link);
                 }
                 break;
             case 'network_tag':
                 // at present we are not using this
                 break;
             case 'user_tag':
                 $this->Paging["count"] = $tag_var->get_associated_userids($this->keyword, $cnt = TRUE);
                 $tag_list = $tag_var->get_associated_userids($this->keyword, $cnt = FALSE, $this->Paging["show"], $this->Paging["page"]);
                 $cnt = count($tag_list);
                 $link = array();
                 if ($cnt > 0) {
                     for ($i = 0; $i < $cnt; $i++) {
                         $usr = new User();
                         $usr->load((int) $tag_list[$i]['id']);
                         $link[$i] = $usr;
                     }
                 }
                 $links['user_info'] = objtoarray($link);
                 break;
             case 'content_tag':
                 $this->Paging["count"] = $tag_var->get_associated_content_ids($this->keyword, $cnt = TRUE);
                 $tag_list = $tag_var->get_associated_content_ids($this->keyword, $cnt = FALSE, $this->Paging["show"], $this->Paging["page"]);
                 $cnt = count($tag_list);
                 $link = array();
                 if ($cnt > 0) {
                     for ($i = 0; $i < $cnt; $i++) {
                         $link[$i] = Content::load_content($tag_list[$i]['id'], $login_uid);
                     }
                 }
                 $links['content_info'] = objtoarray($link);
                 break;
         }
     }
     return $links;
 }
 function get_links()
 {
     $question = new Question();
     $params = array('cnt' => FALSE, 'show' => 1, 'page' => 1, 'sort_by' => 'changed', 'direction' => 'DESC');
     $data = $question->load_many($params);
     $links = objtoarray($data);
     $this->title = $links[0]['body'];
     $this->question_id = $links[0]['content_id'];
     $comment = new Comment();
     $comment->parent_id = $this->question_id;
     $comment->parent_type = TYPE_ANSWER;
     $this->Paging["count"] = $comment->get_multiples_comment($cnt = TRUE);
     $links = $comment->get_multiples_comment($cnt = FALSE, $this->Paging["show"], $this->Paging["page"]);
     return $links;
 }
 function render()
 {
     $this->title = __("Question of the Day");
     $question = new CNQuestion();
     //-- fix by Z.Hron - show Question module only if $questions_total > 0
     $chk_cnt_params = array('cnt' => TRUE, 'is_active' => 1, 'show' => 1);
     $questions_total = $question->load_many($chk_cnt_params);
     if ($questions_total > 0) {
         //--
         $params = array('cnt' => FALSE, 'show' => 1, 'page' => 1, 'is_active' => 1, 'sort_by' => 'changed', 'direction' => 'DESC');
         $data = $question->load_many($params);
         $this->links = objtoarray($data);
         $this->inner_HTML = $this->generate_inner_html();
         $network_stats = parent::render();
         return $network_stats;
         //--
     } else {
         return null;
     }
     //--
 }
 function generate_inner_html()
 {
     $CNPagination = new CNPagination();
     $group = new group();
     $user_group_ids = array();
     if ($_SESSION['user']['id']) {
         $user_group_ids = $group->get_user_groups($_SESSION['user']['id']);
         $user_group_ids = $this->get_user_group_id($user_group_ids);
     }
     $CNPagination->setPaging($this->Paging);
     $this->page_first = $CNPagination->getFirstPage();
     $this->page_last = $CNPagination->getLastPage();
     $this->page_links = $CNPagination->getPageLinks();
     $inner_template = NULL;
     switch ($this->mode) {
         default:
             $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/cnmodule_content.php';
     }
     $inner_html_gen = new Template($inner_template);
     $this->links = objtoarray($this->links);
     $inner_html_gen->set('title', NULL);
     // $this->title
     $inner_html_gen->set('links', $this->links);
     $inner_html_gen->set('total', $this->total);
     $inner_html_gen->set('search_str', get_groups_search_options());
     $inner_html_gen->set('user_group_ids', $user_group_ids);
     $inner_html_gen->set('current_theme_path', PA::$theme_url);
     $inner_html_gen->set('page_first', $this->page_first);
     $inner_html_gen->set('page_last', $this->page_last);
     $inner_html_gen->set('page_links', $this->page_links);
     $inner_html = $inner_html_gen->fetch();
     return $inner_html;
 }
 function get_links()
 {
     $question = new Question();
     $params = array('cnt' => FALSE, 'show' => 1, 'page' => 1, 'sort_by' => 'changed', 'direction' => 'DESC');
     $data = $question->load_many($params);
     $links = NULL;
     if (!empty($data)) {
         $links = objtoarray($data);
         $links = current($links);
         $this->title = $links['body'];
         $this->question_id = $links['content_id'];
         $comment = new Comment();
         $comment->parent_id = $this->question_id;
         $comment->parent_type = TYPE_ANSWER;
         $this->Paging['count'] = $comment->get_multiples_comment(TRUE);
         $links = $comment->get_multiples_comment(FALSE, $this->Paging['show'], $this->Paging['page']);
     }
     return $links;
 }
 function generate_inner_html()
 {
     global $login_uid;
     $video_data = NULL;
     if (!isset($_GET['gid']) || empty($_GET['gid'])) {
         parent::set_vars();
         $frnd_list = null;
         if (!empty($_GET['view'])) {
             $frnd_list = $this->friend_list;
         }
         $sb_videos = array();
         $new_album = new Album(VIDEO_ALBUM);
         if ($this->album_id) {
             $new_album = new Album();
             $new_album->album_type = VIDEO_ALBUM;
             $new_album->load($this->album_id);
             $album_data['album_id'] = $new_album->collection_id;
             $album_data['album_name'] = $new_album->title;
         } else {
             $new_album->collection_id = $this->default_album_id;
             $album_data['album_id'] = $this->default_album_id;
             $album_data['album_name'] = $this->default_album_name;
         }
         $params = $condition = array();
         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;
         }
         $condition['C.collection_id'] = $album_data['album_id'];
         $video_info = TekVideo::get($params, $condition);
         $video_ids = objtoarray($video_info);
         if (!empty($video_ids)) {
             $k = 0;
             $ids = array();
             for ($i = 0; $i < count($video_ids); $i++) {
                 if ($video_ids[$i]['type'] != 7) {
                     // Type 7 is for SB Content
                     $ids[$i] = $video_ids[$i]['content_id'];
                 } else {
                     $tags = Tag::load_tags_for_content($video_ids[$i]['content_id']);
                     $tags = show_tags($tags, null);
                     //show_tags function is defined in uihelper.php
                     $sb_videos[] = array('content_id' => $video_ids[$i]['content_id'], 'title' => $video_ids[$i]['title'], 'type' => $video_ids[$i]['type'], 'created' => $video_ids[$i]['created'], 'tags' => $tags);
                 }
             }
             if (count($video_ids) > 0) {
                 $video_data = $video_ids;
             }
             // Merging Media Gallery content and SB Content
             for ($counter = 0; $counter < count($sb_videos); $counter++) {
                 $video_data[$k]['content_id'] = $sb_videos[$counter]['content_id'];
                 $video_data[$k]['title'] = $sb_videos[$counter]['title'];
                 $video_data[$k]['type'] = $sb_videos[$counter]['type'];
                 $video_data[$k]['video_caption'] = $sb_videos[$counter]['title'];
                 $video_data[$k]['created'] = $sb_videos[$counter]['created'];
                 $video_data[$k]['tags'] = $sb_videos[$counter]['tags'];
                 $k++;
             }
         }
         if (!empty($_GET['view'])) {
             if (empty($frnd_list)) {
                 $video_data = NULL;
             }
         }
         $inner_template = NULL;
         switch ($this->mode) {
             default:
                 $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public.tpl';
         }
         $obj_inner_template = new Template($inner_template);
         $obj_inner_template->set('links', $video_data);
         $obj_inner_template->set('album_data', $album_data);
         $obj_inner_template->set('uid', $this->uid);
         $obj_inner_template->set('frnd_list', $frnd_list);
         $obj_inner_template->set('my_all_album', $this->my_all_album);
         $obj_inner_template->set('show_view', $this->show_view);
         $inner_html = $obj_inner_template->fetch();
         return $inner_html;
     } else {
         // ----- Calling parents function which set all the Require variables
         parent::set_group_media_gallery();
         //------------- Handling the Groups Media gallery -----------
         $group = ContentCollection::load_collection((int) $_GET['gid'], $_SESSION['user']['id']);
         $params = $condition = array();
         $album_data['album_id'] = $group->collection_id;
         $album_data['album_name'] = $group->title;
         $condition['C.collection_id'] = $album_data['album_id'];
         $video_info = TekVideo::get($params, $condition);
         $video_data = objtoarray($video_info);
         //         $video_data = Video::load_videos_for_collection_id ($_GET['gid'], $limit = 0);
         $i = 0;
         if (!empty($video_data)) {
             foreach ($video_data as $data) {
                 $tags_array = Tag::load_tags_for_content($data['content_id']);
                 $tags_string = "";
                 $tags_string = show_all_contents_for_tag($tags_array);
                 $video_data[$i]['tags'] = $tags_string;
                 $i++;
             }
         }
         $inner_template = NULL;
         switch ($this->mode) {
             default:
                 $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public_groups.tpl';
         }
         $obj_inner_template = new Template($inner_template);
         $obj_inner_template->set('links', $video_data);
         $obj_inner_template->set('album_data', $album_data);
         $obj_inner_template->set('show_view', $this->show_view);
         $obj_inner_template->set('my_all_groups', $this->group_ids);
         $inner_html = $obj_inner_template->fetch();
         return $inner_html;
     }
 }
 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 generate_inner_html()
 {
     global $current_theme_path, $base_url, $current_blockmodule_path;
     $Pagination = new Pagination();
     $group = new group();
     $user_group_ids = array();
     if (@$_SESSION['user']['id']) {
         $user_group_ids = $group->get_user_groups($_SESSION['user']['id']);
         $user_group_ids = $this->get_user_group_id($user_group_ids);
     }
     $Pagination->setPaging($this->Paging);
     $this->page_first = $Pagination->getFirstPage();
     $this->page_last = $Pagination->getLastPage();
     $this->page_links = $Pagination->getPageLinks();
     $inner_template = NULL;
     switch ($this->mode) {
         default:
             $inner_template = dirname(__FILE__) . '/center_inner_public.tpl';
     }
     $inner_html_gen =& new Template($inner_template);
     $this->links = objtoarray($this->links);
     $inner_html_gen->set('links', $this->links);
     $inner_html_gen->set('total', $this->total);
     $inner_html_gen->set('search_str', get_groups_search_options());
     $inner_html_gen->set('user_group_ids', $user_group_ids);
     $inner_html_gen->set('current_theme_path', $current_theme_path);
     $inner_html_gen->set('base_url', $base_url);
     $inner_html_gen->set('page_first', $this->page_first);
     $inner_html_gen->set('page_last', $this->page_last);
     $inner_html_gen->set('page_links', $this->page_links);
     $inner_html = $inner_html_gen->fetch();
     return $inner_html;
 }