示例#1
0
 public function organisationAction()
 {
     if ($_GET['reporting_org']) {
         $reportingOrg = $this->_request->getParam('reporting_org');
     } else {
         $this->_redirect('organisation?reporting_org=all');
     }
     !$reportingOrg ? $handler = new Iati_Snapshot_Lib_DataHandler() : ($handler = new Iati_Snapshot_Lib_DataHandler($reportingOrg));
     $accountModel = new User_Model_DbTable_Account();
     $userModel = new Model_User();
     $publishModel = new Model_Published();
     $wepModel = new Model_Wep();
     $regInfoModel = new Model_RegistryInfo();
     $result = $accountModel->getAccountByOrganisation($reportingOrg);
     if (count($result)) {
         // Get Account Id
         $accountId = $result['id'];
         $user = $userModel->getUserByAccountId($accountId);
         $regInfo = $regInfoModel->getOrgRegistryInfo($accountId);
         // Get Organisation Info
         $organisation_array['name'] = $result['name'];
         $organisation_array['image'] = $result['file_name'];
         $organisation_array['address'] = $result['address'];
         $organisation_array['email'] = $user['email'];
         $organisation_array['telephone'] = $result['telephone'] ? $result['telephone'] : 'Not Available';
         $organisation_array['website'] = $result['url'] ? $result['url'] : 'Not Available';
         $organisation_array['twitter'] = $result['twitter'] ? $result['twitter'] : 'Not Available';
         $organisation_array['prefix'] = $result['username'];
         $organisation_array['disqus_comments'] = $result['disqus_comments'];
         $this->view->organisation_array = $organisation_array;
         $this->view->publisher_id = $regInfo->publisher_id;
     } else {
         // For all organisations: snapshot
         if ($reportingOrg == 'all' || $reportingOrg == '') {
             $activityModel = new Model_Activity();
             $orgData = $activityModel->allOrganisationsActivityStates();
             foreach ($orgData as $key => $row) {
                 $total['activities'] += array_sum($row['states']);
                 $total['published'] += $row['registry_published_count'];
             }
             $accountModel = new User_Model_DbTable_Account();
             $count = $accountModel->getAccountCount();
             $total['organisations'] = $count['total'];
             $this->view->total = $total;
         } else {
             $this->_redirect('organisation?reporting_org=all');
         }
     }
     // end if
     $this->view->handler = $handler;
 }
示例#2
0
 public function listActivityStatesAction()
 {
     $activityModel = new Model_Activity();
     $orgData = $activityModel->allOrganisationsActivityStates();
     $this->view->orgs = $orgData;
 }