Permalink
Browse files

Merge branch 'master' of github.com:huridocs/OpenEvSys

Conflicts:
	mod/person/personModule.class.php
  • Loading branch information...
denis-larka committed Mar 14, 2013
2 parents 42d48df + 78d97d8 commit 63425ac259d8b4d26112e7473a236a2d1767957e
View
@@ -185,6 +185,16 @@ public function LoadfromPerson($person_record_number){
$this->LoadManagementData();
}
+ public function reverse(){
+ $person = $this->person;
+ $related_person = $this->related_person;
+ $type_of_relationship = $this->type_of_relationship;
+
+ $this->person = $related_person;
+ $this->related_person = $person;
+ $this->type_of_relationship = get_biography_reverse($type_of_relationship);
+
+ }
View
@@ -235,6 +235,26 @@ public static function getBiographyList($person_id)
$rows = $browse->ExecuteQuery($sql);
return $rows;
}
+ public static function getBiographyListReverse($person_id)
+ {
+ global $conf;
+ $sql = "SELECT
+ bd.biographic_details_record_number,
+ bd.related_person,
+ rp.person_name,
+ bd.type_of_relationship as relationship_type,
+ bd.initial_date,
+ bd.final_date
+ FROM biographic_details AS bd
+ INNER JOIN person p ON bd.related_person = p.person_record_number
+ LEFT JOIN person rp ON bd.person = rp.person_record_number
+ WHERE related_person = '$person_id'";
+
+ $browse = new Browse();
+ $rows = $browse->ExecuteQuery($sql);
+ return $rows;
+ }
+
public static function getRelativeInfo($person_id)
{
@@ -258,6 +278,26 @@ public static function getRelativeInfo($person_id)
$rows = $browse->ExecuteQuery($sql);
return $rows;
}
+ public static function getRelativeInfoReverse($person_id)
+ {
+ global $conf;
+ $sql = "SELECT
+ bd.biographic_details_record_number,
+ bd.related_person,
+ p.person_name,
+ bd.type_of_relationship AS 'relationship_type',
+ bd.initial_date,
+ bd.final_date ,
+ bd.person
+ FROM biographic_details AS bd
+ INNER JOIN person p ON bd.related_person = p.person_record_number
+ LEFT JOIN person rp ON bd.person = rp.person_record_number
+ WHERE bd.person = '$person_id'";
+
+ $browse = new Browse();
+ $rows = $browse->ExecuteQuery($sql);
+ return $rows;
+ }
public static function getBiographyListArray($biographics)
{
View
@@ -481,4 +481,21 @@ function get_chaintype_reverse($type){
return $types[$type];
}
return $type;
+}
+function get_biography_reverse($type){
+ $types = array("01010300000021"=>"01010400000021",
+ "01010400000021"=>"01010300000021",
+ "01020300000021"=>"01020400000021",
+ "01020400000021"=>"01020300000021",
+ "01040200000021"=>"01040300000021",
+ "01040300000021"=>"01040200000021",
+ "01060100000021"=>"01060200000021",
+ "01060200000021"=>"01060100000021",
+ "01060201000021"=>"01060100000021",
+ "21010000000021"=>"21020000000021",
+ "21020000000021"=>"21010000000021");
+ if($types[$type]){
+ return $types[$type];
+ }
+ return $type;
}
@@ -34,15 +34,13 @@
include_once 'messages.inc';
-class personModule extends shnModule
-{
- function act_default()
- {
+class personModule extends shnModule {
+
+ function act_default() {
set_redirect_header('person','browse');
}
- function section_mod_menu()
- {
+ function section_mod_menu() {
$data['breadcrumbs'] = shnBreadcrumbs::getBreadcrumbs();
if($_GET['act']=='new_person')
$data['active'] = 'new';
@@ -85,17 +83,20 @@ private function load_related_person(){
$this->biographic_details = new BiographicDetail();
$this->biographic_details->LoadFromRecordNumber($_GET['biography_id']);
$this->biographic_details->LoadRelationships();
+ if (isset($_GET['reverse'])) {
+ $_GET['pid'] = $this->biographic_details->related_person;
+ } else {
$_GET['pid'] = $this->biographic_details->person;
}
}
+ }
/**
* act_new_person will generate ui to add a new person
*
* @access public
* @return void
*/
- public function act_new_person()
- {
+ public function act_new_person() {
$this->person_form = person_form('new');
unset($this->person_form['person_addresses']);
@@ -121,8 +122,7 @@ public function act_new_person()
* @access public
* @return void
*/
- public function act_address_list()
- {
+ public function act_address_list() {
$this->address = new Address();
$this->person = new Person();
@@ -139,8 +139,7 @@ public function act_address_list()
}
}
- public function act_new_address()
- {
+ public function act_new_address() {
$this->address = new Address();
$this->address_form = address_form('new');
@@ -158,8 +157,7 @@ public function act_new_address()
}
}
- public function act_edit_address()
- {
+ public function act_edit_address() {
$this->address = new Address();
$this->address_form = address_form('edit');
@@ -183,8 +181,7 @@ public function act_edit_address()
}
}
- function act_delete_address()
- {
+ function act_delete_address() {
$this->address = new Address();
if(!isset($_POST['addresses']) || isset($_POST['no'])){
@@ -209,8 +206,7 @@ function act_delete_address()
}
}
- function act_edit_person()
- {
+ function act_edit_person() {
include_once APPROOT.'inc/lib_form_util.inc';
include_once APPROOT.'inc/lib_uuid.inc';
@@ -245,14 +241,13 @@ function act_edit_person()
}
}
- function act_person()
- {
+ function act_person() {
$this->biographics = Browse::getRelativeInfo($_GET['pid']);//loaded for contextual info
+ $this->biographics_reverse = Browse::getRelativeInfoReverse($_GET['pid']);
}
- function act_browse()
- {
+ function act_browse() {
include_once APPROOT.'inc/lib_form.inc';
$notIn = acl_list_person_permissons();
@@ -296,8 +291,7 @@ function act_browse()
$this->htmlFields = $htmlFields;
}
- function act_delete_person()
- {
+ function act_delete_person() {
if(isset($_POST['no'])){
set_redirect_header('person','browse');
return;
@@ -333,8 +327,7 @@ function act_delete_person()
$this->intervening_party_records = $this->person_intervening_party_pager->get_page_data();
}
- public function act_delete_biographic()
- {
+ public function act_delete_biographic() {
if(!isset($_POST['biographics']) || isset($_POST['no'])){
set_redirect_header('person','biography_list');
return;
@@ -357,10 +350,8 @@ public function act_delete_biographic()
$this->biographics = Browse::getBiographyListArray($_POST['biographics']);
}
-
- function act_new_biography()
- {
+ function act_new_biography() {
global $conf;
include_once APPROOT.'inc/lib_form_util.inc';
@@ -408,8 +399,7 @@ function act_new_biography()
}
}
- function act_edit_biography()
- {
+ function act_edit_biography() {
include_once APPROOT.'inc/lib_form_util.inc';
include_once APPROOT.'inc/lib_uuid.inc';
@@ -456,8 +446,7 @@ function act_edit_biography()
}
}
- function act_biography_list()
- {
+ function act_biography_list() {
include_once APPROOT.'inc/lib_form_util.inc';
include_once APPROOT.'inc/lib_uuid.inc';
@@ -477,7 +466,11 @@ function act_biography_list()
break;
case 'rp':
$this->related_person = new Person();
+ if (isset($_GET['reverse'])) {
+ $this->related_person->LoadFromRecordNumber($this->biographic_details->person);
+ } else {
$this->related_person->LoadFromRecordNumber($this->biographic_details->related_person);
+ }
$this->related_person->LoadRelationships();
$person_form = person_form('view');
popuate_formArray($person_form, $this->related_person);
@@ -489,8 +482,7 @@ function act_biography_list()
$this->biography_list($this->pid);
}
- function act_supporting_doc()
- {
+ function act_supporting_doc() {
include_once APPROOT.'inc/lib_form_util.inc';
include_once APPROOT.'inc/lib_uuid.inc';
$this->supporting_doc_form = $supporting_doc_form;
@@ -520,8 +512,7 @@ function act_supporting_doc()
}
}
- function act_role_list()
- {
+ function act_role_list() {
$_GET['show_all'] = true;
$this->person_victim = "Victim";
$this->person_victim_type = 'victim';
@@ -563,8 +554,7 @@ function act_audit_log(){
}
}
- public function person_information($person_id,$person_form)
- {
+ public function person_information($person_id, $person_form) {
$person = new Person();
$person->LoadFromRecordNumber($person_id);
$person->LoadRelationships();
@@ -573,40 +563,38 @@ public function person_information($person_id,$person_form)
return $person;
}
- public function related_person_name($person_id)
- {
+ public function related_person_name($person_id) {
$person = new Person();
$person->LoadFromRecordNumber($person_id);
return $person->person_name;
}
- public function biography_list($person_id)
- {
+ public function biography_list($person_id) {
$this->biographics = Browse::getBiographyList($person_id);
+ $this->biographics_reverse = Browse::getBiographyListReverse($person_id);
}
- public function act_print()
- {
+ public function act_print() {
$this->person->LoadRelationships();
$this->biographics = Browse::getBiographyList($this->person->person_record_number);
+ $this->biographics_reverse = Browse::getBiographyListReverse($this->person->person_record_number);
}
- public function act_permissions()
- {
+ public function act_permissions() {
$gacl_api = acl_get_gacl_api();
$this->roles = acl_get_roles();
if(isset($_POST['update'])){
foreach($this->roles as $role_val => $role_name){
- if($role_val=='admin')continue;
+ if ($role_val == 'admin')
+ continue;
$acl_id = $gacl_api->search_acl('access','access', FALSE, FALSE, $role_name,'person', $this->person->person_record_number, FALSE, FALSE);
if( isset($_POST['roles'])&&in_array($role_val, $_POST['roles'])){
if(count($acl_id)==0){
$aro_grp = $gacl_api->get_group_id($role_val, $role_name, 'ARO');
$return = $gacl_api->add_acl( array( 'access'=>array('access')), null , array($aro_grp), array( 'person'=>array($this->person->person_record_number)), null , 1 );
}
- }
- else{
+ } else {
$gacl_api->del_acl($acl_id[0]);
}
}
Oops, something went wrong.

0 comments on commit 63425ac

Please sign in to comment.