function generate_inner_html()
 {
     $links = $this->get_links();
     // set links for pagination
     $CNPagination = new CNPagination();
     $CNPagination->setPaging($this->Paging);
     $this->page_first = $CNPagination->getFirstPage();
     $this->page_last = $CNPagination->getLastPage();
     $this->page_links = $CNPagination->getPageLinks();
     $tmp_file = PA::$blockmodule_path . '/' . get_class($this) . '/cnmodule_content.php';
     $inner_html_gen = new Template($tmp_file, $this);
     $inner_html_gen->set('links', $links);
     $inner_html_gen->set('edit', $this->edit);
     $inner_html_gen->set('form_data', $this->form_data);
     $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;
 }
 public function initializeModule($request_method, $request_data)
 {
     global $paging;
     if (empty(PA::$login_uid)) {
         return 'skip';
     }
     $this->uid = PA::$login_uid;
     $this->mid = !empty($request_data['mid']) ? $request_data['mid'] : NULL;
     $this->search_string = !empty($request_data['q']) ? $request_data['q'] : NULL;
     $this->folder_name = !empty($request_data['folder']) ? $request_data['folder'] : INBOX;
     $this->folders = Message::get_user_folders($this->uid);
     $this->Paging = $paging;
     if (!empty($this->Paging['page'])) {
         $this->page = $this->Paging['page'];
     }
     if (!isset($request_data['action'])) {
         if (!empty($this->search_string)) {
             $messages = Message::search($this->uid, $this->search_string);
             $this->Paging['count'] = count($messages);
             $messages = Message::search($this->uid, $this->search_string, $this->page, $this->Paging['show']);
             $this->title = __("Search Results");
         } else {
             $this->Paging['count'] = Message::load_folder_for_user($this->uid, $this->folder_name, true);
             $messages = Message::load_folder_for_user($this->uid, $this->folder_name, false, $this->page, (int) $this->Paging['show']);
         }
         $Pagination = new CNPagination();
         // echo "<pre>".print_r($messages,1)."</pre>";exit;
         $Pagination->setPaging($this->Paging);
         $this->page_prev = $Pagination->getPreviousPage();
         $this->page_next = $Pagination->getNextPage();
         $this->page_links = $Pagination->getPageLinks();
         if (empty($this->search_string)) {
             $this->title .= ' : ' . ucfirst($this->folder_name);
         }
         $this->set_inner_template('cnmodule.php');
         $this->inner_HTML = $this->generate_inner_html(array('messages' => $messages, 'page_prev' => $this->page_prev, 'page_next' => $this->page_next, 'page_links' => $this->page_links, 'folder_name' => $this->folder_name, 'folders' => $this->folders, 'current_theme_path' => PA::$theme_url, 'search_string' => $this->search_string));
     }
 }
 function generate_inner_html()
 {
     global $number_user;
     $extra = unserialize(PA::$network_info->extra);
     $this->rel_term = __('Friend');
     // default title
     if (isset($extra['relationship_show_mode']['term'])) {
         $this->rel_term = $extra['relationship_show_mode']['term'];
     }
     $msg = $this->msg;
     $CNPagination = new CNPagination();
     $CNPagination->setPaging($this->Paging);
     $this->page_first = $CNPagination->getFirstPage($this->search_data);
     $this->page_last = $CNPagination->getLastPage($this->search_data);
     $this->page_links = $CNPagination->getPageLinks($this->search_data);
     $tmp_file = PA::$blockmodule_path . '/' . get_class($this) . '/cnmodule_content.php';
     $inner_html_gen = new Template($tmp_file);
     $inner_html_gen->set('links', $this->users_data);
     $inner_html_gen->set('error_msg', $msg);
     $inner_html_gen->set('page_first', $this->page_first);
     $inner_html_gen->set('page_last', $this->page_last);
     //$inner_html_gen->set('facewall_path', $this->facewall_path);
     $inner_html_gen->set('page_links', $this->page_links);
     $inner_html_gen->set('people_count', $this->Paging["count"]);
     $row_count = ceil($this->Paging["count"] / FACEWALL_COLUMN_COUNT) > 10 ? 10 : ceil($this->Paging["count"] / FACEWALL_COLUMN_COUNT);
     $number_user = $this->Paging["count"];
     $inner_html_gen->set("row_count", $row_count);
     $inner_html_gen->set('show_advance_search_options', $this->show_advance_search_options);
     $inner_html_gen->set('search_data', $this->search_data);
     $inner_html_gen->set('rel_term', $this->rel_term);
     $inner_html_gen->set('no_photo_ok', $this->no_photo_ok);
     $inner_html_gen->set('show_people_with_photo', $this->show_people_with_photo);
     $inner_html_gen->set('only_with_photo', $this->only_with_photo);
     $inner_html_gen->set('block_name', $this->html_block_id);
     $inner_html = $inner_html_gen->fetch();
     return $inner_html;
 }
 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 generate_inner_html()
 {
     $links = $this->get_links();
     // set links for pagination
     $CNPagination = new CNPagination();
     $CNPagination->setPaging($this->Paging);
     $this->page_first = $CNPagination->getFirstPage();
     $this->page_last = $CNPagination->getLastPage();
     $this->page_links = $CNPagination->getPageLinks();
     $tmp_file = NULL;
     $config_link_page = NULL;
     switch ($this->mode) {
         case 'textpad':
             $tmp_file = PA::$blockmodule_path . '/' . get_class($this) . '/cnmodule_content_textpad.php';
             $config_link_page = 'manage_textpads';
             break;
         default:
             $tmp_file = PA::$blockmodule_path . '/' . get_class($this) . '/cnmodule_content.php';
             $config_link_page = 'manage_ad_center';
     }
     $inner_html_gen = new Template($tmp_file, $this);
     $inner_html_gen->set('links', $links);
     $inner_html_gen->set('edit', $this->edit);
     $inner_html_gen->set('form_data', $this->form_data);
     $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_gen->set('config_navigation_url', network_config_navigation($config_link_page));
     $inner_html = $inner_html_gen->fetch();
     return $inner_html;
 }
 private function showPointsDirectory($request_data)
 {
     if (!empty($this->fid)) {
         $this->Paging["querystring"] = "fid={$this->fid}&gid={$this->fid}";
     } else {
         if (!empty($this->user_id)) {
             $this->Paging["querystring"] = "uid={$this->user_id}";
         }
     }
     $this->Paging['page'] = $this->page;
     $this->Paging['show'] = $this->limit;
     $this->Paging['count'] = PointsEntity::search($this->criteria, true);
     $pagination = new CNPagination();
     $pagination->setPaging($this->Paging);
     $this->page_first = $pagination->getFirstPage();
     $this->page_last = $pagination->getLastPage();
     $this->page_links = $pagination->getPageLinks();
     $items = PointsEntity::search($this->criteria, false, "(SELECT attribute_value FROM entityattributes where attribute_name = 'created' AND id = EA.id) DESC", $this->page, $this->limit);
     $this->items = $this->build_list_of_items($items);
     $this->inner_HTML = $this->generate_inner_html(array('sub_title' => $this->sub_title, 'category' => $this->category, 'categories' => $this->categories, 'items' => $this->items, 'edit_perm' => $this->edit_perm, 'user_id' => $this->user_id, 'page_first' => $this->page_first, 'page_last' => $this->page_last, 'page_links' => $this->page_links, 'url_base' => $this->url_base, 'message' => isset($request_data['message']) ? $request_data['message'] : null, 'fid' => isset($this->fid) ? $this->fid : null, 'fam_members' => isset($this->fam_members) ? $this->fam_members : null));
 }
 function initializeModule($request_method, $request_data)
 {
     if (empty(PA::$config->useTypedGroups)) {
         return 'skip';
     }
     $this->availTypes = TypedGroupentity::get_avail_types();
     $this->directoryType = NULL;
     $this->groupCount = array();
     if (!empty($request_data['type'])) {
         if (!empty($this->availTypes[$request_data['type']])) {
             // we have been passed a valid TypedGroupEntity type
             $this->directoryType = $request_data['type'];
         }
     }
     if ($this->directoryType) {
         $this->title = sprintf(__("%s directory"), $this->availTypes[$this->directoryType]);
         $this->inner_template = PA::$blockmodule_path . '/' . get_class($this) . "/cnmodule_directory.php";
         $classname = ucfirst($this->directoryType) . "TypedGroupEntity";
         @(include_once "api/Entity/{$classname}.php");
         if (class_exists($classname)) {
             $instance = new $classname();
         } else {
             // just get default
             $instance = new TypedGroupEntity();
         }
         $this->profilefields = $instance->get_profile_fields();
         if (!empty($_REQUEST['sort_by'])) {
             $this->sort_by = $_REQUEST['sort_by'];
         } else {
             $this->sort_by = 'name';
         }
         $this->sortFields = array(array('name' => 'name', 'label' => __('Name')));
         foreach ($this->profilefields as $i => $field) {
             if (!empty($field['sort'])) {
                 $this->sortFields[] = array('name' => $field['name'], 'label' => $field['label']);
             }
         }
         // get TypedGroupEntities for this type and build paging etc
         if (!empty($request_data['page'])) {
             $this->page = (int) $request_data['page'];
         }
         $this->Paging['page'] = $this->page;
         $this->Paging['show'] = $this->show;
         $this->groupCount[$this->directoryType] = TypedGroupentity::get_count($this->directoryType);
         // load list of entities
         $this->typedGroupEntities = TypedGroupentity::get_entities($this->directoryType, $this->sort_by, $this->page, $this->show);
         $this->Paging['count'] = $this->groupCount[$this->directoryType];
         $CNPagination = new CNPagination();
         $CNPagination->setPaging($this->Paging);
         $this->page_first = $CNPagination->getFirstPage();
         $this->page_last = $CNPagination->getLastPage();
         $this->page_links = $CNPagination->getPageLinks();
     } else {
         foreach ($this->availTypes as $type => $label) {
             $this->groupCount[$type] = TypedGroupentity::get_count($type);
         }
     }
     switch ($this->column) {
         case 'middle':
             break;
         case 'left':
         case 'right':
         default:
             break;
     }
 }
 public function generate_inner_html($links)
 {
     $usr = new User();
     $network = new Network();
     if (!empty($links)) {
         foreach ($links as $link_var) {
             if ($link_var->owner_id) {
                 $usr->load((int) $link_var->owner_id);
                 $owner_info[$link_var->network_id]['name'] = $usr->login_name;
             } else {
                 $owner_info[$link_var->network_id]['name'] = "None";
             }
         }
         // End of foreach
     }
     $users_network = NULL;
     if (!is_null(PA::$login_uid) && PA::$login_uid == PA::$page_uid) {
         $users_network = $network->get_networks_by_user(PA::$login_uid, FALSE, 'ALL', 1, 'created', 'DESC', ALL_NETWORKS);
     } else {
         if (!is_null(PA::$login_uid)) {
             $users_network = $network->get_networks_by_user(PA::$login_uid);
             $users_network = $this->get_user_network_id($users_network);
         }
     }
     $CNPagination = new CNPagination();
     $CNPagination->setPaging($this->Paging);
     $this->page_first = $CNPagination->getFirstPage();
     $this->page_last = $CNPagination->getLastPage();
     $this->page_links = $CNPagination->getPageLinks();
     switch ($this->mode) {
         default:
             $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/cnmodule.php';
     }
     $this->Paging["count"] = $this->uid ? count($links) : $this->Paging["count"];
     $inner_html_gen = new Template($inner_template);
     $inner_html_gen->set('links', $links);
     if (!empty($owner_info)) {
         $inner_html_gen->set('owner_info', $owner_info);
     }
     $inner_html_gen->set('users_network', $users_network);
     $inner_html_gen->set('total', $this->Paging["count"]);
     $inner_html_gen->set('search_str', get_network_search_options());
     $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 render()
 {
     if ($this->type == 'group') {
         $this->outer_template = 'outer_show_content_module_group.php';
         if ($this->content_type == NULL) {
             $this->content_type = 'all';
         }
         //$type = 'all',$cnt=FALSE, $show='ALL', $page=0, $sort_by='created', $direction='DESC'
         if (!empty($this->content_type)) {
             $this->Paging["count"] = $this->links = $this->group->get_contents_for_collection($this->content_type, TRUE, 10, 1, 'created', 'DESC', TRUE);
             $this->contents = $this->group->get_contents_for_collection($this->content_type, FALSE, $this->Paging["show"], $this->Paging["page"], 'created', 'DESC', TRUE);
         } else {
             $this->Paging["count"] = $this->links = $this->group->get_contents_for_collection($type = 'all', $cnt = TRUE, 'all', 0, $sort_by = 'created', $direction = 'DESC');
             $this->contents = $this->group->get_contents_for_collection($type = 'all', $cnt = FALSE, $this->Paging["show"], $this->Paging["page"], 'created', 'DESC');
         }
         $this->title = chop_string(sprintf(__("%s's Group Blog"), $this->group->title, 32));
     } else {
         if ($this->type == "tag") {
             $this->Paging["count"] = Tag::get_associated_content_ids((int) $this->tag_id, $cnt = TRUE);
             $this->contents = Tag::get_associated_content_ids((int) $this->tag_id, $cnt = FALSE, $this->Paging["show"], $this->Paging["page"]);
             if (!empty($this->contents)) {
                 foreach ($this->contents as $key => $value) {
                     $this->contents[$key]['content_id'] = $value['id'];
                 }
             }
         } else {
             if ($this->type == "search") {
                 $this->Paging["count"] = CNContent::content_search($this->search_string_array, $cnt = TRUE);
                 $this->contents = CNContent::content_search($this->search_string_array, $cnt = FALSE, $this->Paging["show"], $this->Paging["page"]);
             } else {
                 $this->Paging["count"] = CNContent::load_content_id_array($this->uid, $this->content_type, $cnt = TRUE);
                 $contents = CNContent::load_content_id_array($this->uid, $this->content_type, $cnt = FALSE, $this->Paging["show"], $this->Paging["page"]);
                 $this->contents = $contents;
             }
         }
     }
     $this->orientation = LEFT;
     if ($this->type == 'user') {
         $this->block_type = 'ShowContentUserBlock';
         // $this->do_pagination=TRUE;
     } else {
         if ($this->type == 'group') {
             if ($this->html_block_id_flag == 1) {
                 $this->block_type = 'ShowAllContent';
                 // $this->do_pagination=TRUE;
             } else {
                 $this->block_type = 'ShowContentGroupBlock';
             }
         } else {
             if ($this->type == "tag") {
                 $this->block_type = 'ShowAllContent';
                 // $this->do_pagination=TRUE;
             } else {
                 if ($this->type == "search") {
                     $this->block_type = 'ShowAllContent';
                     // $this->do_pagination=TRUE;
                 } else {
                     if ($this->show_all == 1) {
                         $this->block_type = 'ShowAllContent';
                         // $this->do_pagination=TRUE;
                     } else {
                         $this->block_type = 'ShowContentBlock';
                         // $this->do_pagination=TRUE;
                     }
                 }
             }
         }
     }
     $this->inner_HTML = $this->generate_inner_html($this->contents, $this->type);
     if ($this->do_pagination) {
         $CNPagination = new CNPagination();
         $CNPagination->setPaging($this->Paging);
         $this->page_first = $CNPagination->getFirstPage();
         $this->page_last = $CNPagination->getLastPage();
         $this->page_links = $CNPagination->getPageLinks();
     }
     $content = parent::render();
     return $content;
 }
 function generate_inner_html()
 {
     $CNPagination = new CNPagination();
     $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.php';
     }
     $inner_html_gen = new Template($inner_template);
     $inner_html_gen->set('links', $this->links);
     $inner_html_gen->set('search_str', get_tag_search_option());
     $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;
 }