function initializeModule($request_method, $request_data)
 {
     $this->groupCount = array();
     $classname = ucfirst($this->directoryType) . "TypedGroupEntity";
     $instance = new $classname();
     $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];
     $Pagination = new Pagination();
     $Pagination->setPaging($this->Paging);
     $this->page_first = $Pagination->getFirstPage();
     $this->page_last = $Pagination->getLastPage();
     $this->page_links = $Pagination->getPageLinks();
 }
 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;
     }
 }