Index: family/family.install =================================================================== RCS file: /cvs/drupal/contributions/modules/family/family.install,v retrieving revision 1.5 diff -u -r1.5 family.install --- family/family.install 6 Dec 2008 03:18:15 -0000 1.5 +++ family/family.install 15 Apr 2009 15:45:12 -0000 @@ -123,6 +123,12 @@ 'not null' => FALSE, 'default' => 'Unknown', ), + 'adopted_group' => array( + 'type' => 'varchar', + 'length' => 128, + 'not null' => FALSE, + 'default' => 'Unknown', + ), 'media' => array( 'type' => 'varchar', 'length' => 128, @@ -243,7 +249,11 @@ return $schema; } - +function family_update_6115(){ + $ret = array(); + db_add_field($ret, 'family_individual', 'adopted_group', array('type' => 'varchar', 'length' => 128, 'not null' => FALSE, 'default' => '',)); + return $ret; +} function family_uninstall() { // Remove tables. drupal_uninstall_schema('family'); Index: family/individual.inc =================================================================== RCS file: /cvs/drupal/contributions/modules/family/individual.inc,v retrieving revision 1.6 diff -u -r1.6 individual.inc --- family/individual.inc 6 Dec 2008 03:18:15 -0000 1.6 +++ family/individual.inc 15 Apr 2009 15:45:12 -0000 @@ -30,27 +30,35 @@ '#title' => check_plain($type->title_label), '#type' => 'hidden', '#default_value' => $node->NAME, + '#weight'=> -10, ); } - $form['FORE'] = array( + $form['FAM'] =array( + '#type' => 'fieldset', + '#title' => t('Individual Information'), + '#collapsible' => TRUE, + '#collapsed' => FALSE, + '#weight'=>-3, +); + $form['FAM']['FORE'] = array( '#type' => 'textfield', '#title' => t('Forename'), '#default_value' => $node->FORE, '#required' => FALSE, ); - $form['MIDN'] = array( + $form['FAM']['MIDN'] = array( '#type' => 'textfield', '#title' => t('Middle Names'), '#default_value' => $node->MIDN, '#required' => FALSE, ); - $form['SURN'] = array( + $form['FAM']['SURN'] = array( '#type' => 'textfield', '#title' => t('Surname'), '#default_value' => $node->SURN, '#required' => FALSE, ); - $form['SEX'] = array( + $form['FAM']['SEX'] = array( '#type' => 'select', '#title' => t('Gender'), '#default_value' => $node->SEX, @@ -66,37 +74,65 @@ $ancestorgroups[$data['nid']]=$data['title_format']; } } - $form['GRUP'] = array( + $form['FAM']['ANCE']['GRUP'] = array( '#type' => 'select', - '#title' => t('Ancestry Group'), + '#title' => t('Biological Ancestor Group'), '#default_value' => $node->GRUP, '#options'=> array('' => 'None', 'Groups'=>$ancestorgroups), ); - $form['BIRT']['BIRT_DATE'] = array( + /*$form['FAM']['ANCE']['ADOPTED'] = array( + '#type' => 'checkbox', + '#title' => t('Adopted?'), + '#default_value' => $node->ADOPTED, + );*/ + $form['FAM']['ANCE']['ADOPT'] = array( + '#type' => 'select', + '#title' => t('Adopted Ancestor Group'), + '#default_value' => $node->ADOPT, + '#options'=> array('' => 'Not Adopted', 'Groups'=>$ancestorgroups), + ); + $form['FAM']['BIRT'] =array( + '#type' => 'fieldset', + '#title' => t('Birth Data'), + '#collapsible' => TRUE, + '#collapsed' => FALSE, + '#weight'=>4, +); + $form['FAM']['BIRT']['BIRT_DATE'] = array( '#type' => 'textfield', '#title' => t('Birth Date'), '#description'=>t('Year-Month-Day YYYY-MM-DD'), '#default_value' => $node->BIRT_DATE, ); - $form['BIRT']['BIRT_PLAC'] = array( + $form['FAM']['BIRT']['BIRT_PLAC'] = array( '#type' => 'textfield', '#title' => t(' Birth Place'), '#default_value' => $node->BIRT_PLAC, ); - $form['DEAT']['DEAT_DATE'] = array( + $form['FAM']['DEAT'] =array( + '#type' => 'fieldset', + '#title' => t('Death Information'), + '#collapsible' => TRUE, + '#collapsed' => FALSE, + '#weight'=>6, +); + $form['FAM']['DEAT']['DEAT_DATE'] = array( '#type' => 'textfield', '#title' => t('Death Date'), '#description'=>t('Year-Month-Day YYYY-MM-DD'), '#default_value' => $node->DEAT_DATE, ); - $form['DEAT']['DEAT_PLAC'] = array( + $form['FAM']['DEAT']['DEAT_PLAC'] = array( '#type' => 'textfield', '#title' => t('Death Place'), '#default_value' => $node->DEAT_PLAC, ); - $form['body_filter']['body_field'] = node_body_field($node, $type->body_label, $type->min_word_count); - - $form['body_filter']['format'] = filter_form($node->format); //Not sure why this goes here, but all the examples have it... + $form['body_filter']=array( + '#type' => 'fieldset', + '#title' => t('Body'), + '#weight'=>-2, + ); +$form['body_filter']['body_field'] = node_body_field($node, $type->body_label, $type->min_word_count); return $form; } // function family_individual_form(&$node, &$param) @@ -113,7 +149,7 @@ $birthdate=explode("-", $node->BIRT_DATE); $node->title_format= (strtoupper($node->SURN)).', '.($node->FORE).' - '.$birthdate[0]; - db_query("INSERT INTO {family_individual} (vid, nid, title_format, firstname, middlename, lastname, gender, birthdate, birthplace, deathdate, deathplace, ancestor_group) VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $node->vid, $node->nid, $node->title_format, $node->FORE, $node->MIDN, $node->SURN, $node->SEX, $node->BIRT_DATE, $node->BIRT_PLAC,$node->DEAT_DATE, $node->DEAT_PLAC, $node->GRUP); + db_query("INSERT INTO {family_individual} (vid, nid, title_format, firstname, middlename, lastname, gender, birthdate, birthplace, deathdate, deathplace, ancestor_group, adopted_group) VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $node->vid, $node->nid, $node->title_format, $node->FORE, $node->MIDN, $node->SURN, $node->SEX, $node->BIRT_DATE, $node->BIRT_PLAC,$node->DEAT_DATE, $node->DEAT_PLAC, $node->GRUP, $node->ADOPT); } @@ -162,6 +198,10 @@ if ($ans_grup) { $additions->GRUP = $ans_grup; } + $ans_grup = $data['adopted_group']; + if ($ans_grup) { + $additions->ADOPT = $ans_grup; + } return($additions); } /** @@ -178,8 +218,8 @@ db_query("UPDATE {node} SET title='%s' WHERE nid='%d'",$node->title,$node->nid); $birthdate=explode("-", $node->BIRT_DATE); $node->title_format=(strtoupper($node->SURN)).', '.($node->FORE).' - '.$birthdate[0]; - db_query("UPDATE {family_individual} SET vid='%d', title_format='%s', firstname='%s', middlename='%s', lastname='%s', gender='%s', birthdate='%s', birthplace='%s', deathdate='%s', deathplace='%s', ancestor_group='%s' WHERE nid='%d'", - $node->vid, $node->title_format, $node->FORE, $node->MIDN, $node->SURN, $node->SEX, $node->BIRT_DATE, $node->BIRT_PLAC,$node->DEAT_DATE, $node->DEAT_PLAC, $node->GRUP, $node->nid); + db_query("UPDATE {family_individual} SET vid='%d', title_format='%s', firstname='%s', middlename='%s', lastname='%s', gender='%s', birthdate='%s', birthplace='%s', deathdate='%s', deathplace='%s', ancestor_group='%s', adopted_group='%s' WHERE nid='%d'", + $node->vid, $node->title_format, $node->FORE, $node->MIDN, $node->SURN, $node->SEX, $node->BIRT_DATE, $node->BIRT_PLAC,$node->DEAT_DATE, $node->DEAT_PLAC, $node->GRUP, $node->ADOPT, $node->nid); } /** Index: family/tree.inc =================================================================== RCS file: /cvs/drupal/contributions/modules/family/tree.inc,v retrieving revision 1.4 diff -u -r1.4 tree.inc --- family/tree.inc 6 Dec 2008 03:18:15 -0000 1.4 +++ family/tree.inc 15 Apr 2009 15:45:13 -0000 @@ -11,7 +11,7 @@ //} return $output; } -function family_tree_header($nid,$length=3,$detail){ +function family_tree_header($nid,$length=3,$detail, $adopted){ $treecontent =""; $treecontent .="
This page is still under development so not all features are working properly
Please choose a person and a tree type:
@@ -45,7 +45,11 @@ } $treecontent.=">".($i).""; } -$treecontent.="+$levelPower=pow(2,$level); +for($familyno=1;$familyno<=$levelPower;$familyno++){ + +$treecontent.= '
';
if($level!=$length){
// previous method for width of image '.((100/(pow(2,$level-1)))-(2/$level)).'
-$treecontent.='
';
+$treecontent.=' .'/img/asctree'.$treearray[$level][$familyno]['redGroup'].'.png',array('absolute' => TRUE)).')
';
}
if(isset($treearray[$level][$familyno]['NAME'])){
$treecontent.=$treearray[$level][$familyno]['NAME'];
@@ -119,11 +139,12 @@
$personnode=$nid;
$length=$_GET['len'];
$detail=$_GET['det'];
+$adopted=$_GET['adopted'];
$cellwidth=120;
if (!isset($length)){
$length=3;
}
-$treecontent.=family_tree_header($personnode,$length,$detail);
+$treecontent.=family_tree_header($personnode,$length,$detail,$adopted);
$nid=$personnode;
//$content.='
The descendancy graphs are yet to be completed; hence it probably wont work
';
//Get Data
@@ -138,13 +159,23 @@
$families = db_query("SELECT * FROM {family_group} WHERE ((parent1='%d' AND parent1<>'') OR (parent2='%d' AND parent2<>''))",$treearray[$level-1][$parentno]['nid'],$treearray[$level-1][$parentno]['nid']);
if ($families) {
while($family=db_fetch_array($families)) {
- $children=db_query("SELECT * FROM {family_individual} WHERE ancestor_group=%d",$family['nid']);
+ if($adopted){
+ $adoptedGroup=' OR adopted_group='.$family['nid'];
+ }else{
+ $adoptedGroup='';
+ }
+ $children=db_query("SELECT * FROM {family_individual} WHERE (ancestor_group=%d".$adoptedGroup.')',$family['nid']);
if($children){
while ($child = db_fetch_array($children)) {
$treearray[$level][0]++;
$treearray[$level][$familyno] = family_tree_get_info($child['nid']);
$treearray[$level][$familyno]['parent'] = $parentno;
$treearray[$level][$familyno]['blank']=FALSE;
+ if($child['adopted_group']==$family['nid']){
+ $treearray[$level][$familyno]['redGroup']='Red';
+ }else{
+ $treearray[$level][$familyno]['redGroup']='';
+ }
$familyno++;
}
}else{
@@ -204,16 +235,16 @@
";
if($treearray[$level][$familyno]['blank']==FALSE&&$level!=0){
if(($treearray[$level][$familyno-1]['parent'])&&$treearray[$level][$familyno-1]['parent']==$treearray[$level][$familyno+1]['parent']){
- $treecontent.=" TRUE))."' width=100% height=10px padding=0 margin=0>";
+ $treecontent.="
TRUE))."' width=100% height=10px padding=0 margin=0>";
}elseif($treearray[$level][$familyno]['parent']==$treearray[$level][$familyno-1]['parent']){
//$treecontent.=" background='../".drupal_get_path('module', 'family')."/img/right.png' STYLE='background-width: 100%;background-repeat: no-repeat;'";
- $treecontent.="
TRUE))."' width=100% height=10px padding=0 margin=0>";
+ $treecontent.="
TRUE))."' width=100% height=10px padding=0 margin=0>";
}elseif($treearray[$level][$familyno]['parent']==$treearray[$level][$familyno+1]['parent']){
//$treecontent.=" background='../".drupal_get_path('module', 'family')."/img/left.png' STYLE='background-width: 100%;background-repeat: no-repeat;'";
- $treecontent.="
TRUE))."' width=100% height=10px padding=0 margin=0>";
+ $treecontent.="
TRUE))."' width=100% height=10px padding=0 margin=0>";
}else{
- $treecontent.="
TRUE))."' width=100% height=10px padding=0 margin=0>";
+ $treecontent.="
TRUE))."' width=100% height=10px padding=0 margin=0>";
}
}
$treecontent.="
Adopted Children of '. family_make_name($data['parent1'],TRUE).' and '.family_make_name($data['parent2'],TRUE).':
'; + $content .= '| Name | Gender | Birth Date | Death Date |
| ".family_make_name($child['nid'],TRUE)." | ".$child['gender']." | ".$child['birthdate']." | ".$child['deathdate']." |
Family group asociated with here:'; $content .= '
| Name | Gender | Birth Date |
| ".family_make_name($child['nid'],TRUE)." | ".$child['gender']." | ".$child['birthdate']." |