function initializeModule($request_method, $request_data) { $this->action = !empty($request_data['faction']) ? $request_data['faction'] : null; $this->module = !empty($request_data['module']) ? $request_data['module'] : null; $this->page = empty($request_data['page']) ? 1 : (int) $request_data['page']; $this->category = empty($request_data['category']) ? null : $request_data['category']; $this->criteria = array('network_id' => PA::$network_info->network_id); $this->categories = PointsEntity::get_cetegories(); $this->renderer->add_header_css('/' . PA::$theme_rel . '/points_directory.css'); $this->relType = 'guest'; if (!empty($request_data['fid']) || !empty($request_data['gid'])) { if (!empty($request_data['fid'])) { $this->criteria['family_id'] = $request_data['fid']; } else { if (!empty($request_data['gid'])) { $this->criteria['family_id'] = $request_data['gid']; } } $this->fid = !empty($this->criteria['family_id']) ? $this->criteria['family_id'] : null; list($relType, $relLabel) = TypedGroupEntityRelation::get_relation_to_group(PA::$login_uid, (int) $this->fid); if (empty($relType)) { $relType = 'member'; } $this->relType = $relType; $this->familly = ContentCollection::load_collection((int) $this->fid, PA::$login_uid); $this->fam_members = $this->get_familly_members($this->familly); $this->edit_perm = $this->check_edit_perm(); $this->sub_title = sprintf(__('%s Points'), $this->familly->title . ' Family'); // this string should be replaced with $family->name } if (!empty($request_data['uid'])) { $this->user_id = $request_data['uid']; $this->sub_title = sprintf(__('Points for %s'), PA::$user->display_name); $this->criteria['user_id'] = $request_data['uid']; } if (!empty($this->category)) { $this->sub_title = sprintf(__('Search results for \'%s\' Category'), $this->category); $this->criteria['category'] = $this->category; } switch ($this->page_id) { case PAGE_FAMILY: $this->url_base = PA::$url . PA_ROUTE_FAMILY . "?gid={$this->fid}"; break; case PAGE_FAMILY_DIRECTORY: $this->url_base = PA::$url . PA_ROUTE_FAMILY_DIRECTORY; break; case PAGE_POINTS_DIRECTORY: if (isset($this->fid)) { $this->url_base = PA::$url . PA_ROUTE_FAMILY . "?gid={$this->fid}"; } else { $this->url_base = PA::$url . PA_ROUTE_POINTS_DIRECTORY . "?uid={$this->user_id}"; } break; } if ($request_method == 'GET') { //echo "Action: " . $this->action . "Module: " . $this->module . "clname: " . $this->class_name; die(); if (!empty($this->action) && $this->module == $this->class_name) { switch ($this->action) { case 'newPoints': $this->view_mode = 'new'; $this->sub_title = __('Add Points'); $this->set_inner_template('edit_points_form.tpl.php'); $this->renderer->add_header_css('/' . PA::$theme_rel . '/modal.css'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/forms.js'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/jquery.validate.js'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/attach_media_modal.js'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/points_directory.js'); break; case 'editPoints': $this->view_mode = 'edit'; $this->sub_title = __('Edit Points'); $this->set_inner_template('edit_points_form.tpl.php'); $this->renderer->add_header_css('/' . PA::$theme_rel . '/modal.css'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/forms.js'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/jquery.validate.js'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/attach_media_modal.js'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/points_directory.js'); break; case 'deletePoints': $this->view_mode = 'list'; break; default: } } else { $this->view_mode = 'list'; $this->set_inner_template('center_inner_public.tpl.php'); $this->showPointsDirectory($request_data); } } }