Skip to content
This repository has been archived by the owner on Oct 22, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:huridocs/OpenEvSys
Browse files Browse the repository at this point in the history
Conflicts:
	mod/person/personModule.class.php
  • Loading branch information
Denis Larka committed Mar 14, 2013
2 parents 42d48df + 78d97d8 commit 63425ac
Show file tree
Hide file tree
Showing 8 changed files with 253 additions and 144 deletions.
10 changes: 10 additions & 0 deletions data/BiographicDetail.php
Expand Up @@ -185,6 +185,16 @@ public function LoadfromPerson($person_record_number){
$this->LoadManagementData(); $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);

}






Expand Down
40 changes: 40 additions & 0 deletions data/Browse.php
Expand Up @@ -235,6 +235,26 @@ public static function getBiographyList($person_id)
$rows = $browse->ExecuteQuery($sql); $rows = $browse->ExecuteQuery($sql);
return $rows; 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) public static function getRelativeInfo($person_id)
{ {
Expand All @@ -258,6 +278,26 @@ public static function getRelativeInfo($person_id)
$rows = $browse->ExecuteQuery($sql); $rows = $browse->ExecuteQuery($sql);
return $rows; 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) public static function getBiographyListArray($biographics)
{ {
Expand Down
17 changes: 17 additions & 0 deletions inc/lib_util.inc
Expand Up @@ -481,4 +481,21 @@ function get_chaintype_reverse($type){
return $types[$type]; return $types[$type];
} }
return $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;
} }
88 changes: 38 additions & 50 deletions mod/person/personModule.class.php
Expand Up @@ -34,15 +34,13 @@


include_once 'messages.inc'; include_once 'messages.inc';


class personModule extends shnModule class personModule extends shnModule {
{
function act_default() function act_default() {
{
set_redirect_header('person','browse'); set_redirect_header('person','browse');
} }


function section_mod_menu() function section_mod_menu() {
{
$data['breadcrumbs'] = shnBreadcrumbs::getBreadcrumbs(); $data['breadcrumbs'] = shnBreadcrumbs::getBreadcrumbs();
if($_GET['act']=='new_person') if($_GET['act']=='new_person')
$data['active'] = 'new'; $data['active'] = 'new';
Expand Down Expand Up @@ -85,17 +83,20 @@ private function load_related_person(){
$this->biographic_details = new BiographicDetail(); $this->biographic_details = new BiographicDetail();
$this->biographic_details->LoadFromRecordNumber($_GET['biography_id']); $this->biographic_details->LoadFromRecordNumber($_GET['biography_id']);
$this->biographic_details->LoadRelationships(); $this->biographic_details->LoadRelationships();
if (isset($_GET['reverse'])) {
$_GET['pid'] = $this->biographic_details->related_person;
} else {
$_GET['pid'] = $this->biographic_details->person; $_GET['pid'] = $this->biographic_details->person;
} }
} }
}
/** /**
* act_new_person will generate ui to add a new person * act_new_person will generate ui to add a new person
* *
* @access public * @access public
* @return void * @return void
*/ */
public function act_new_person() public function act_new_person() {
{
$this->person_form = person_form('new'); $this->person_form = person_form('new');
unset($this->person_form['person_addresses']); unset($this->person_form['person_addresses']);


Expand All @@ -121,8 +122,7 @@ public function act_new_person()
* @access public * @access public
* @return void * @return void
*/ */
public function act_address_list() public function act_address_list() {
{
$this->address = new Address(); $this->address = new Address();


$this->person = new Person(); $this->person = new Person();
Expand All @@ -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 = new Address();
$this->address_form = address_form('new'); $this->address_form = address_form('new');


Expand All @@ -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 = new Address();
$this->address_form = address_form('edit'); $this->address_form = address_form('edit');


Expand All @@ -183,8 +181,7 @@ public function act_edit_address()
} }
} }


function act_delete_address() function act_delete_address() {
{
$this->address = new Address(); $this->address = new Address();


if(!isset($_POST['addresses']) || isset($_POST['no'])){ if(!isset($_POST['addresses']) || isset($_POST['no'])){
Expand All @@ -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_form_util.inc';
include_once APPROOT.'inc/lib_uuid.inc'; include_once APPROOT.'inc/lib_uuid.inc';


Expand Down Expand Up @@ -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 = 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'; include_once APPROOT.'inc/lib_form.inc';


$notIn = acl_list_person_permissons(); $notIn = acl_list_person_permissons();
Expand Down Expand Up @@ -296,8 +291,7 @@ function act_browse()
$this->htmlFields = $htmlFields; $this->htmlFields = $htmlFields;
} }


function act_delete_person() function act_delete_person() {
{
if(isset($_POST['no'])){ if(isset($_POST['no'])){
set_redirect_header('person','browse'); set_redirect_header('person','browse');
return; return;
Expand Down Expand Up @@ -333,8 +327,7 @@ function act_delete_person()
$this->intervening_party_records = $this->person_intervening_party_pager->get_page_data(); $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'])){ if(!isset($_POST['biographics']) || isset($_POST['no'])){
set_redirect_header('person','biography_list'); set_redirect_header('person','biography_list');
return; return;
Expand All @@ -357,10 +350,8 @@ public function act_delete_biographic()


$this->biographics = Browse::getBiographyListArray($_POST['biographics']); $this->biographics = Browse::getBiographyListArray($_POST['biographics']);
} }



function act_new_biography() function act_new_biography() {
{
global $conf; global $conf;


include_once APPROOT.'inc/lib_form_util.inc'; include_once APPROOT.'inc/lib_form_util.inc';
Expand Down Expand Up @@ -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_form_util.inc';
include_once APPROOT.'inc/lib_uuid.inc'; include_once APPROOT.'inc/lib_uuid.inc';


Expand Down Expand Up @@ -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_form_util.inc';
include_once APPROOT.'inc/lib_uuid.inc'; include_once APPROOT.'inc/lib_uuid.inc';


Expand All @@ -477,7 +466,11 @@ function act_biography_list()
break; break;
case 'rp': case 'rp':
$this->related_person = new Person(); $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->LoadFromRecordNumber($this->biographic_details->related_person);
}
$this->related_person->LoadRelationships(); $this->related_person->LoadRelationships();
$person_form = person_form('view'); $person_form = person_form('view');
popuate_formArray($person_form, $this->related_person); popuate_formArray($person_form, $this->related_person);
Expand All @@ -489,8 +482,7 @@ function act_biography_list()
$this->biography_list($this->pid); $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_form_util.inc';
include_once APPROOT.'inc/lib_uuid.inc'; include_once APPROOT.'inc/lib_uuid.inc';
$this->supporting_doc_form = $supporting_doc_form; $this->supporting_doc_form = $supporting_doc_form;
Expand Down Expand Up @@ -520,8 +512,7 @@ function act_supporting_doc()
} }
} }


function act_role_list() function act_role_list() {
{
$_GET['show_all'] = true; $_GET['show_all'] = true;
$this->person_victim = "Victim"; $this->person_victim = "Victim";
$this->person_victim_type = 'victim'; $this->person_victim_type = 'victim';
Expand Down Expand Up @@ -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 = new Person();
$person->LoadFromRecordNumber($person_id); $person->LoadFromRecordNumber($person_id);
$person->LoadRelationships(); $person->LoadRelationships();
Expand All @@ -573,40 +563,38 @@ public function person_information($person_id,$person_form)
return $person; return $person;
} }


public function related_person_name($person_id) public function related_person_name($person_id) {
{
$person = new Person(); $person = new Person();
$person->LoadFromRecordNumber($person_id); $person->LoadFromRecordNumber($person_id);
return $person->person_name; return $person->person_name;
} }


public function biography_list($person_id) public function biography_list($person_id) {
{
$this->biographics = Browse::getBiographyList($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->person->LoadRelationships();
$this->biographics = Browse::getBiographyList($this->person->person_record_number); $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(); $gacl_api = acl_get_gacl_api();
$this->roles = acl_get_roles(); $this->roles = acl_get_roles();
if(isset($_POST['update'])){ if(isset($_POST['update'])){
foreach($this->roles as $role_val => $role_name){ 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); $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( isset($_POST['roles'])&&in_array($role_val, $_POST['roles'])){
if(count($acl_id)==0){ if(count($acl_id)==0){
$aro_grp = $gacl_api->get_group_id($role_val, $role_name, 'ARO'); $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 ); $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]); $gacl_api->del_acl($acl_id[0]);
} }
} }
Expand Down

0 comments on commit 63425ac

Please sign in to comment.