示例#1
0
 public function dashboardAction()
 {
     if (Simplified_Model_Simplified::isSimplified()) {
         $this->_redirect('simplified/default/dashboard');
     }
     $identity = Zend_Auth::getInstance()->getIdentity();
     $account_id = $identity->account_id;
     $model = new Model_Wep();
     $activityModel = new Model_Activity();
     $activities_id = $model->listAll('iati_activities', 'account_id', $account_id);
     if (empty($activities_id)) {
         $data['@version'] = '01';
         $data['@generated_datetime'] = date('Y-m-d H:i:s');
         $data['user_id'] = $identity->user_id;
         $data['account_id'] = $identity->account_id;
         $data['unqid'] = uniqid();
         $activities_id = $model->insertRowsToTable('iati_activities', $data);
     } else {
         $activities_id = $activities_id[0]['id'];
     }
     $activityCollModel = new Model_ActivityCollection();
     $activities = $activityCollModel->getActivitiesByAccount($account_id);
     $activitiesAttribs = $activityCollModel->getActivityAttribs($activities);
     $regInfoModel = new Model_RegistryInfo();
     $regInfo = $regInfoModel->getOrgRegistryInfo($account_id);
     $regPublishModel = new Model_RegistryPublishedData();
     $publishedFiles = $regPublishModel->getPublishedInfoByOrg($account_id);
     $this->view->published_data = $published_data;
     $this->view->activity_count = sizeof($activities);
     $this->view->state_count = $activityModel->getCountByState($activities);
     $this->view->last_updated_datetime = $activityModel->getLastUpdatedDatetime($activities);
     $this->view->published_activity_count = $regPublishModel->getActivityCount($publishedFiles);
     $this->view->activity_elements_info = $activitiesAttribs;
     $this->view->registry_url = "/publisher/" . $regInfo->publisher_id;
     $this->view->activities_id = $activities_id;
 }
示例#2
0
 /**
  * Ported from Admin Controller::listActivityStatesAction()
  * @param None
  * @return Array containing activity states and activity registry published count for all organisations.
  */
 public function allOrganisationsActivityStates()
 {
     $model = new Model_Wep();
     $activityCollModel = new Model_ActivityCollection();
     // $activityModel = new Model_Activity();
     $orgs = $model->listOrganisation('account');
     $orgData = array();
     foreach ($orgs as $organisation) {
         $activities = $activityCollModel->getActivitiesByAccount($organisation['id']);
         $states = $this->getCountByState($activities);
         $organisation['states'] = $states;
         $regPublishModel = new Model_RegistryPublishedData();
         $publishedFiles = $regPublishModel->getPublishedInfoByOrg($organisation['id']);
         $publishedActivityCount = $regPublishModel->getActivityCount($publishedFiles);
         $organisation['registry_published_count'] = $publishedActivityCount;
         $orgData[] = $organisation;
     }
     return $orgData;
 }