'node/add/family_individual', 'title' => t('Family: Individual'), 'access' => user_access('add/edit/delete family')); $items[] = array('path' => 'node/add/family_location', 'title' => t('Family: Location'), 'access' => user_access('add/edit/delete family')); $items[] = array('path' => 'admin/family/general', 'title' => t('general'), 'callback' => '_family_administer', 'access' => user_access('administer family'), 'type' => MENU_DEFAULT_LOCAL_TASK); $items[] = array('path' => 'admin/family/import', 'title' => t('Import'), 'callback' => 'family_import', 'access' => user_access('administer family'), 'type'=> MENU_CALLBACK); $items[] = array('path' => 'admin/family/import_done', 'title' => t('Import Done'), 'callback' => 'family_import_done', 'access' => user_access('administer family'), 'type' => MENU_CALLBACK); $items[] = array('path' => 'family/view', 'title' => t('View records'), 'callback' => 'family_viewrec', // Change to family_view after adapting viewing to nodes 'access' => user_access('access family'), 'type'=> MENU_CALLBACK); $items[] = array('path' => 'family/individuals', 'title' => t('Individual List'), 'callback' => 'family_indilist', 'access' => user_access('access family'), 'type' => MENU_CALLBACK); $items[] = array('path' => 'admin/family/export', 'title' => t('export'), 'callback' => '_family_export', 'access' => user_access('administer family'), 'type'=>MENU_LOCAL_TASK); return $items; } // function family_menu() function _family_export() { return t("here will be the export feature..."); } // function _family_export() { function _family_administer() { return t("all general administration of family.module will be here."); } // function _family_administer() { function family_node_info() { return array( 'family_location' => array('name' => t('Family: location'), 'base' => 'family_location'), 'family_individual' => array('name' => t('Family: individual'), 'base' => 'family_individual'), ); } function family_individual_form(&$node, &$param) { $form['title'] = array( '#type'=> 'textfield', '#title' => t('Title'), '#required' => TRUE, ); $form['body'] = array( '#type' => 'textatea', '#title' => t('Description'), '#rows' => 20, '#required' => TRUE, ); $form['field1'] = array( '#type' => 'textfield', '#title' => t('Custom field'), '#default_value' => $node->field1, '#maxlength' => 127, ); $form['selectbox'] = array( '#type' => 'select', '#title' => t('Select box'), '#default_value' => $node->selectbox, '#options' => array( 1 => 'Option A', 2 => 'Option B', 3 => 'Option C' ), '#description' => t('Please choose an option.'), ); return $form; } // function family_individual_form(&$node, &$param) { function family_location_form(&$node, &$param) { $form['title'] = array( '#type'=> 'textfield', '#title' => t('Title'), '#required' => TRUE, ); $form['body'] = array( '#type' => 'textatea', '#title' => t('Description'), '#rows' => 20, '#required' => TRUE, ); $form['field1'] = array( '#type' => 'textfield', '#title' => t('Custom field'), '#default_value' => $node->field1, '#maxlength' => 127, ); $form['selectbox'] = array( '#type' => 'select', '#title' => t('Select box'), '#default_value' => $node->selectbox, '#options' => array( 1 => 'Option A', 2 => 'Option B', 3 => 'Option C' ), '#description' => t('Please choose an option.'), ); return $form; } // function family_location_form(&$node, &$param) { function family_view($node) { $output = ""; switch ($node->type) { case "family_individual": $output .= t("I am me!"); break; case "family_location": $output .= t("Location, location location"); break; } return theme($output); } /** * Display help and module information * @param section which section of the site we're displaying help * @return help text for section */ function family_help($section='') { $output = ''; switch ($section) { case "admin/modules#description": $output = t("A complete archiving system for socio-historical data."); break; case "admin/modules#description": $output = t("A jolly exciting module for recording and archiving all aspects of your family's history."); break; case "node/add#family_individual": $output = t("A record of a single person. Part of the Family module."); break; case "node/add#family_location": $output = t("A record of a single location, which may be contained in other locations in a hierarchy. Part of the Family module."); break; } return $output; } // function family_help($section='') { function family_perm() { return array('access family', 'add/edit/delete family', 'administer family'); } // function family_perm() { function family_getfacts($fid) { $personfact = array(); $person = db_query("SELECT {family_facts}.fid, {family_facts}.fact_code, {family_facts}.value from {family_facts} INNER JOIN {family_relations} ON {family_facts}.fid = {family_relations}.fid1 AND {family_relations}.fid2 = %d", $fid); while($attribs = db_fetch_array($person)) { $personfact[$attribs['fact_code']]=array('value' => $attribs['value'], 'fid' => $attribs['fid']); } return $personfact; } function makelink($fid, $text) { $output = ""; $output .= $text; $output .= ""; return $output; } function family_indilist() { $output = ''; $header = array( 'Last Name', 'First Name', 'Sex', 'Birth Date', 'Death Date' ); $facts = array(); $individuals = db_query("SELECT fid FROM {family_facts} WHERE fact_code = 'INDI'"); if ($individuals) { for ($i = 0; $i < db_num_rows($individuals); $i++) { $fid=db_result($individuals,$i); $personfact = family_getfacts($fid); $name = $personfact['NAME']; $namefacts = family_getfacts($name['fid']); $birth = $personfact['BIRT']; $birthfacts = family_getfacts($birth['fid']); $death = $personfact['DEAT']; $deathfacts = family_getfacts($death['fid']); $facts[$fid] = array( 'SURN' => makelink($fid, $namefacts['SURN']['value']), 'GIVN' => makelink($fid, $namefacts['GIVN']['value']), 'SEX' => makelink($fid, $personfact['SEX']['value']), 'BIRT' => makelink($fid, $birthfacts['DATE']['value']), 'DEAT' => makelink($fid, $deathfacts['DATE']['value']) ); } } $output .= theme('table', $header, $facts); return $output; } ?>