Example #1
0
 public function updateHash($organisation_id)
 {
     $organisationClassobj = new Iati_Aidstream_Element_Organisation();
     $organisations = $organisationClassobj->fetchData($organisation_id, false);
     unset($organisations['Organisation']['@last_updated_datetime']);
     $new_hash = sha1(serialize($organisations));
     $data['organisation_id'] = $organisation_id;
     $data['hash'] = $new_hash;
     $has_hash = $this->getByOrganisationId($organisation_id);
     if ($has_hash) {
         if ($has_hash['hash'] == $new_hash) {
             return false;
         } else {
             $this->updateHashByOrganisationId($data);
             return true;
         }
     } else {
         $this->insert($data);
         return true;
     }
 }
 /**
  * Fetch Elements of an organisation 
  */
 public function viewElementsAction()
 {
     $organisationId = $this->getRequest()->getParam('parentId');
     // Fetch organisation data
     $organisationClassObj = new Iati_Aidstream_Element_Organisation();
     $organisations = $organisationClassObj->fetchData($organisationId, false);
     $this->view->organisations = $organisations;
     $this->view->parentId = $organisationId;
     // Fetch title
     $reportingOrgObj = new Iati_Aidstream_Element_Organisation_ReportingOrg();
     $reportingOrgs = $reportingOrgObj->fetchData($organisationId, true);
     $title = $reportingOrgs['text'];
     $this->view->title = $title . " Organisation File";
     // Get form for status change
     $state = $organisations['Organisation']['state_id'];
     $next_state = Iati_WEP_ActivityState::getNextStatus($state);
     if ($next_state && Iati_WEP_ActivityState::hasPermissionForState($next_state)) {
         $status_form = new Form_Organisation_OrganisationDataChangeState();
         $status_form->setAction($this->view->baseUrl() . "/organisation/update-state");
         $status_form->ids->setValue($organisationId);
         $status_form->status->setValue($next_state);
         $status_form->change_state->setLabel(Iati_WEP_ActivityState::getStatus($next_state));
     } else {
         $status_form = null;
     }
     $this->view->status_form = $status_form;
     $this->view->state = $state;
     $this->view->blockManager()->enable('partial/organisation-menu.phtml');
     $this->view->blockManager()->disable('partial/primarymenu.phtml');
     $this->view->blockManager()->disable('partial/add-activity-menu.phtml');
     $this->view->blockManager()->disable('partial/usermgmtmenu.phtml');
     $this->view->blockManager()->disable('partial/published-list.phtml');
     $this->view->blockManager()->disable('partial/organisation-data.phtml');
 }