public function commonviewAction()
 {
     $this->view->title = "Group";
     $id = $this->_request->getParam('id');
     $this->view->groupid = $id;
     // create instance for groupcommon model page
     $groupcommon = new Groupcommonview_Model_groupcommon();
     $group_name = $groupcommon->getgroup($id);
     // get group details
     $group_location = $groupcommon->getlocation($id);
     // get group Location details - Latitude and longitude
     foreach ($group_location as $location) {
         $this->view->latitude = $location['latitude'];
         $this->view->longitude = $location['longitude'];
     }
     $this->view->groupname = $group_name;
     $group_members = $groupcommon->getgroupmembers($id);
     // get group members
     $this->view->groupmembers = $group_members;
     $groupreps = $groupcommon->groupreps($id);
     // get group representatives
     $this->view->groupreps = $groupreps;
     $dbobj = new Groupmdefault_Model_Groupdefault();
     $groupheaddetails = $dbobj->Getgrouphead($id);
     //Get group head
     foreach ($groupheaddetails as $grouphead) {
         $this->view->grouphead = $grouphead['head'];
     }
     $this->view->address = $this->view->adm->getmodule("ourbank_address", $id, "Group");
     // get address for particular group
     $this->view->contact = $this->view->adm->getmodule("ourbank_contact", $id, "Group");
     // get contact for particular group
     $module = $groupcommon->getmodule('Group');
     foreach ($module as $module_id) {
     }
     $this->view->mod_id = $module_id['parent'];
     $this->view->sub_id = $module_id['module_id'];
 }
 public function deletegroupAction()
 {
     //        $checkaccess = $access->accessRights('Group',$this->view->globalvalue[0]['name'],'activitydeleteAction');
     //        if (($checkaccess != NULL)) {
     $this->view->groupid = $this->_request->getParam('id');
     $deleteForm = new Groupmdefault_Form_Delete();
     $this->view->form = $deleteForm;
     // create instance for Groupmdefault model page
     $dbobj = new Groupmdefault_Model_Groupdefault();
     // create instance for groupcommonview model page
     $groupcommon = new Groupcommonview_Model_groupcommon();
     $module = $groupcommon->getmodule('group');
     // get module id for group dynamically
     foreach ($module as $module_id) {
     }
     $moduleid = $module_id['module_id'];
     if ($this->_request->isPost() && $this->_request->getPost('Submit')) {
         $formdata = $this->_request->getPost();
         if ($deleteForm->isValid($formdata)) {
             $grouptypeid = $this->view->adm->getsingleRecord('ourbank_accounts', 'membertype_id', 'member_id', $this->view->groupid);
             // get group type id
             //                 // get the current status of group
             $status = $dbobj->getAccountstatus($this->view->groupid, $grouptypeid);
             if (!$status) {
                 $flag = true;
             }
             if ($status) {
                 foreach ($status as $statusid) {
                     if ($statusid['status_id'] == 5) {
                         $flag = true;
                     } else {
                         $flag = false;
                     }
                 }
             }
             if ($flag == true) {
                 // if there is no account for that group we can delete
                 $redirect = $this->view->adm->deleteAction("ourbank_group", $this->view->modulename, $this->view->groupid);
                 $groupmemberdetails = $this->view->adm->getRecord('ourbank_groupmembers', 'group_id', $this->view->groupid);
                 // get groupmembers details for particular id
                 foreach ($groupmemberdetails as $groupmemberDetails) {
                     $this->view->adm->addRecord("ourbank_groupmembers_log", array('record_id' => '', 'id' => $groupmemberDetails['id'], 'group_id' => $groupmemberDetails['group_id'], 'member_id' => $groupmemberDetails['member_id'], 'groupmember_status' => $groupmemberDetails['groupmember_status']));
                 }
                 // add group members details to log table
                 $this->view->adm->deleteSubmodule("address", $this->view->groupid, $moduleid);
                 $dbobj->UpdateGroupdetails($this->view->groupid);
                 $this->_redirect("/" . $redirect);
             }
             if ($flag == false) {
                 // if account exists then display error message
                 echo "<font color='red'>You cannot delete this group, because this group have some active account.</font>";
             }
         }
         // valid ()
     }
 }