/** * * @param array $facts * @param array $options * @return string */ public static function create($facts, $options) { $block = '<section class="rp_truncate">'; $block .= RP_Persona_Helper::get_banner($options, __('Facts', 'rootspersona')); $block .= '<div class="rp_facts">'; $block .= '<ul>'; $cnt = count($facts); for ($idx = 0; $idx < $cnt; $idx++) { if ((!isset($facts[$idx]['classification']) || empty($facts[$idx]['classification'])) && (!isset($facts[$idx]['cause']) || empty($facts[$idx]['cause'])) && ($options['hide_dates'] || !isset($facts[$idx]['date']) || empty($facts[$idx]['date']))) { continue; } // no real meaningfull data, so skip it $block .= '<li>'; if (!$options['hide_dates'] && isset($facts[$idx]['date']) && !empty($facts[$idx]['date'])) { $block .= @preg_replace('/@.*@(.*)/US', '$1', $facts[$idx]['date']) . ' - '; } $block .= $facts[$idx]['type'] . ' - ' . $facts[$idx]['classification'] . ' ' . $facts[$idx]['cause']; if (!$options['hide_places'] && isset($facts[$idx]['place']) && !empty($facts[$idx]['place'])) { $block .= '; <span class="rp_place">' . $facts[$idx]['place'] . '</span>'; } $p = $facts[$idx]['associated_person']; if (isset($p) && !empty($p)) { $block .= ' ' . __('with', 'rootspersona') . ' ' . $p['name']; } $block .= '</li>'; } $block .= '</ul></div></section>'; return $block; }
/** * * @param array $marriage * @param array $options * @return string */ public static function create_group_spouse($pfx, $marriage, $options) { $pframe_color = isset($options['pframe_color']) && !empty($options['pframe_color']) ? $options['pframe_color'] : 'brown'; $fams = $marriage['fams']; $block = '<section class="rp_truncate">' . RP_Persona_Helper::get_banner($options, __('Family Group Sheet - Spouse', 'rootspersona')) . '<div class="rp_family">' . '<table class="familygroup" style="border-color:' . $pframe_color . ' !important"' . ' itemscope itemtype="http://historical-data.org/HistoricalFamily.html"><tbody>' . RP_Group_Sheet_Panel_Creator::show_parent($pfx . 'p', $marriage['spouse1'], $marriage['spouse1']->f_persona, $marriage['spouse1']->m_persona, $options) . RP_Group_Sheet_Panel_Creator::show_parent($pfx . 'm', $marriage['spouse2'], $marriage['spouse2']->f_persona, $marriage['spouse2']->m_persona, $options); if (isset($marriage['children'])) { $block .= RP_Group_Sheet_Panel_Creator::show_children($pfx . 'c', $marriage['children'], $options, $fams); } $block .= '</tbody></table></div></section>'; return $block; }
public static function create_for_edit($notes, $options) { $block = '<section class="rp_truncate">' . RP_Persona_Helper::get_banner($options, __('Biography', 'rootspersona')) . '<div class="rp_bio" style="margin:10px; 0px !important;">'; $cnt = count($notes); if ($cnt == 0) { $block .= '<textarea id="rp_bio" name="rp_bio" cols="120" rows="5"></textarea><br/>'; } for ($idx = 0; $idx < $cnt; $idx++) { $block .= '<textarea id="rp_bio" name="rp_bio" cols="120" rows="5">' . $notes[$idx]->note . '</textarea><br/>'; } $block .= '</div></section>'; return $block; }
/** * * @param RP_Persona $persona * @param array $options * @return string */ public static function create_for_edit($persona, $options) { $default = $options['plugin_url'] . '/images/boy-silhouette.gif'; if (isset($persona->gender) && $persona->gender == 'F') { $default = $options['plugin_url'] . '/images/girl-silhouette.gif'; } $block = '<div class="rp_truncate">' . RP_Persona_Helper::get_banner($options, 'Picture Gallery') . '<div class="rp_pictures">'; $cnt = 6; for ($idx = 1; $idx <= $cnt; $idx++) { $link = isset($persona->picfiles[$idx]) ? $persona->picfiles[$idx] : $default; $i = $idx + 1; $block .= '<div class="rp_picture" style="text-align:center;"><a href="' . $link . '"><img id="img_' . $i . '" width="100px" src="' . $link . '"/></a>' . '<input id="img_path_' . $i . '" type="hidden" name="img_path_' . $i . '" value="' . $link . '"/>' . '<br/><input class="submitPersonForm" id="img_' . $i . '_upload_button" type="button" value="Browse" />' . '<div class="rp_caption"><textarea id="cap_' . $i . '" name="cap_' . $i . '" cols="12">' . (isset($persona->piccaps[$idx]) ? $persona->piccaps[$idx] : ' ') . '</textarea></div>' . '</div>'; } $block .= '</div>' . "</div>"; return $block; }
/** * * @param RP_Persona $persona * @param array $options * @return string */ public static function create($persona, $options) { $block = '<section class="rp_truncate">'; $block .= RP_Persona_Helper::get_banner($options, __('Evidence', 'rootspersona')); $block .= '<div class="rp_evidence">'; $block .= '<table class="rp_evi">'; $cnt = count($persona->sources); for ($idx = 0; $idx < $cnt; $idx++) { if (isset($persona->sources[$idx]['page_id']) && !empty($persona->sources[$idx]['page_id'])) { $link = '<a href="' . $options['home_url'] . "?page_id=" . $persona->sources[$idx]['page_id'] . '">' . '[' . $persona->sources[$idx]['src_id'] . ']</a>'; } else { $win1 = sprintf(__('Evidence page has not yet been created for this source', 'rootspersona'), 'persona') . "."; $link = "<a href='#' onClick='javascript:rootsConfirm(\"" . $win1 . "\",\"\");return false;'>" . '[' . $persona->sources[$idx]['src_id'] . ']</a>'; } $block .= '<tr><td valign="top"><sup>' . $link . '</sup></td><td><span style="padding-left:10px;display:inline-block;">' . $persona->sources[$idx]['src_title'] . '</span></td></tr>'; } $block .= '</table></div></section>'; return $block; }
/** * * @param RP_Persona $persona * @param array $options * @param integer $page_id * @return string */ public function build($persona, $options, $page_id) { $block = ''; if ($options['hide_header'] == 0) { $block .= RP_Header_Panel_Creator::create($persona, $options); } if ($options['hide_bio'] == 0 && isset($persona->notes) && count($persona->notes) > 0) { $block .= RP_Bio_Panel_Creator::create($persona->notes, $options); } if ($options['hide_facts'] == 0 && isset($persona->facts) && count($persona->facts) > 0) { $block .= RP_Facts_Panel_Creator::create($persona->facts, $options); } if ($options['hide_ancestors'] == 0 && isset($persona->ancestors)) { $creator = new RP_Ancestors_Panel_Creator(); $block .= $creator->create($persona->ancestors, $options); } if ($options['hide_descendancy'] == 0 && isset($persona->marriages)) { $creator = new RP_Descendancy_Panel_Creator(); $block .= $creator->create($persona, $options); } if ($options['hide_family_c'] == 0 && isset($persona->ancestors)) { $block .= RP_Group_Sheet_Panel_Creator::create_group_child('c0', $persona->ancestors, $persona->siblings, $options); } if ($options['hide_family_s'] == 0 && isset($persona->marriages) && count($persona->marriages) > 0) { $cnt = count($persona->marriages); for ($idx = 0; $idx < $cnt; $idx++) { $marriage = $persona->marriages[$idx]; $block .= RP_Group_Sheet_Panel_Creator::create_group_spouse('p' . $idx, $marriage, $options); } } if ($options['hide_pictures'] == 0 && isset($persona->picfiles) && count($persona->picfiles) > 0) { $block .= RP_Picture_Panel_Creator::create($persona, $options); } if ($options['hide_evidence'] == 0 && isset($persona->sources) && count($persona->sources) > 0) { $block .= RP_Evidence_Panel_Creator::create($persona, $options); } $block .= RP_Persona_Helper::get_banner($options, ''); $block .= RP_Persona_Page_Builder::create_end_of_page($persona->id, $persona->batch_id, $page_id, $options); return $block; }
/** * * @param RP_Persona $persona * @param array $options * @return string */ function create_privacy_panel($persona, $options) { $opt = $persona->privacy; $exc = ''; $pvt = ''; $mbr = ''; $pub = ''; $def = ''; if (isset($opt)) { if ($opt == 'Pub') { $pub = "checked"; } else { if ($opt == 'Mbr') { $mbr = "checked"; } else { if ($opt == 'Exc') { $exc = "checked"; } else { if ($opt == 'Pvt') { $pvt = "checked"; } else { if ($opt == 'Def') { $def = "checked"; } } } } } } else { $def = "checked"; } $block = RP_Persona_Helper::get_banner($options, 'Select Privacy Setting') . '<div class="rp_truncate">' . '<div class="rp_header" style="overflow:hidden;">' . '<div style="font-size:smaller;padding:10px;overflow:hidden">'; if (isset($persona->id) && !empty($persona->id)) { // makes no sense to exclude a new person $block .= '<div style="width:99%;clear:left;;"><div style="width:9em;float:left;font-weight:bold;">' . '<input type="radio" name="privacy_grp" value="Exc" ' . $exc . '>Exclude' . '</div><div style="float:left;width:35em;">' . __('Delete page and exclude this person FROM future uploads.', 'rootspersona') . '</div></div>'; } $block .= '<div style="width:99%;clear:left;"><div style="width:9em;float:left;font-weight:bold;">' . '<input type="radio" name="privacy_grp" value="Pvt" ' . $pvt . '>Private' . '</div><div style="float:left;width:35em;">' . __('This person will only be visible to the admin role.', 'rootspersona') . '</div></div>' . '<div style="width:99%;clear:left;"><div style="width:9em;float:left;font-weight:bold;">' . '<input type="radio" name="privacy_grp" value="Mbr" ' . $mbr . '>Members Only' . '</div><div style="float:left;width:35em;">' . __('This person will only be visible to users who are logged in.', 'rootspersona') . '</div></div>' . '<div style="width:99%;clear:left;"><div style="width:9em;float:left;font-weight:bold;">' . '<input type="radio" name="privacy_grp" value="Pub" ' . $pub . '>Public' . '</div><div style="float:left;width:35em;">' . __('This person will be visible to ANYONE, even if they are living.', 'rootspersona') . '</div></div>' . '<div style="width:99%;clear:left;"><div style="width:9em;float:left;font-weight:bold;">' . '<input type="radio" name="privacy_grp" value="Def" ' . $def . '>Default' . '</div><div style="float:left;width:35em;">' . __('This person will be visible based on the privacy setting for living persons or the global default setting.', 'rootspersona') . '</div></div></div></div></div>'; return $block; }
/** * * @param array $ancestors * @param array $options * @return string */ public static function create($ancestors, $options) { $pframe_color = isset($options['pframe_color']) && !empty($options['pframe_color']) ? $options['pframe_color'] : 'brown'; $isEdit = ($options['is_system_of_record'] == '1' ? true : false) && current_user_can("edit_pages"); $fname = $ancestors[4]->full_name; if ($isEdit && $fname == '?' && $ancestors[2]->full_name != '?') { $fname = '+'; } $block = '<section class="rp_truncate">' . RP_Persona_Helper::get_banner($options, __('Ancestors', 'rootspersona')) . '<div class="rp_ancestors">' . '<table cellpadding="0" cellspacing="0" class="ancestors"><tbody>' . '<tr><td colspan="2" rowspan="6"> </td>' . '<td colspan="3" rowspan="2"> </td><td> </td>' . '<td rowspan="2" class="rp_nameBox" style="border-color:' . $pframe_color . ' !important">' . RP_Ancestors_Panel_Creator::buildBlock($ancestors[4], $options, $fname, $ancestors[2], 1, $ancestors[5]); $fname = $ancestors[2]->full_name; if ($isEdit && $fname == '?') { $fname = '+'; } $block .= '</td></tr>' . '<tr><td class="rp_topleft" style="border-color:' . $pframe_color . ' !important"> </td></tr>' . '<tr><td> </td>' . '<td rowspan="2" class="rp_nameBox" style="border-color:' . $pframe_color . ' !important">' . RP_Ancestors_Panel_Creator::buildBlock($ancestors[2], $options, $fname, $ancestors[1], 1, $ancestors[3]); $fname = $ancestors[5]->full_name; if ($isEdit && $fname == '?' && $ancestors[2]->full_name != '?') { $fname = '+'; } $block .= '</td><td class="rp_bottom" style="border-color:' . $pframe_color . ' !important"> </td><td colspan="2" rowspan="2" class="rp_left" style="border-color:' . $pframe_color . ' !important"> </td></tr>' . '<tr><td class="rp_topleft" style="border-color:' . $pframe_color . ' !important"> </td><td> </td></tr>' . '<tr><td colspan="3" rowspan="6" class="rp_left" style="border-color:' . $pframe_color . ' !important"> </td><td class="rp_leftbottom" style="border-color:' . $pframe_color . ' !important"> </td>' . '<td rowspan="2" class="rp_nameBox" style="border-color:' . $pframe_color . ' !important">' . RP_Ancestors_Panel_Creator::buildBlock($ancestors[5], $options, $fname, $ancestors[2], 2, $ancestors[4]); $block .= '</td></tr>' . '<tr><td> </td></tr><tr><td rowspan="2" class="rp_nameBox" style="border-color:' . $pframe_color . ' !important">' . RP_Ancestors_Panel_Creator::buildBlock($ancestors[1], $options, $ancestors[1]->full_name, null, null, null); $fname = $ancestors[6]->full_name; if ($isEdit && $fname == '?' && $ancestors[3]->full_name != '?') { $fname = '+'; } $block .= '</td><td class="rp_bottom" style="border-color:' . $pframe_color . ' !important"> </td><td colspan="2" rowspan="2"> </td></tr>' . '<tr><td> </td></tr>' . '<tr><td colspan="2" rowspan="6"> </td><td> </td><td rowspan="2" class="rp_nameBox" style="border-color:' . $pframe_color . ' !important">' . RP_Ancestors_Panel_Creator::buildBlock($ancestors[6], $options, $fname, $ancestors[3], 1, $ancestors[7]); $fname = $ancestors[3]->full_name; if ($isEdit && $fname == '?') { $fname = '+'; } $block .= '</td></tr><tr><td class="rp_topleft" style="border-color:' . $pframe_color . ' !important"> </td></tr>' . '<tr><td class="rp_leftbottom" style="border-color:' . $pframe_color . ' !important"> </td><td rowspan="2" class="rp_nameBox" style="border-color:' . $pframe_color . ' !important">' . RP_Ancestors_Panel_Creator::buildBlock($ancestors[3], $options, $fname, $ancestors[1], 2, $ancestors[2]); $fname = $ancestors[7]->full_name; if ($isEdit && $fname == '?' && $ancestors[3]->full_name != '?') { $fname = '+'; } $block .= '</td><td class="rp_bottom" style="border-color:' . $pframe_color . ' !important"> </td><td colspan="2" rowspan="2" class="rp_left" style="border-color:' . $pframe_color . ' !important"> </td></tr>' . '<tr><td> </td><td> </td></tr><tr><td colspan="3" rowspan="2"> </td>' . '<td class="rp_leftbottom" style="border-color:' . $pframe_color . ' !important"> </td><td rowspan="2" class="rp_nameBox" style="border-color:' . $pframe_color . ' !important">' . RP_Ancestors_Panel_Creator::buildBlock($ancestors[7], $options, $fname, $ancestors[3], 2, $ancestors[6]); $block .= '</td></tr><tr><td> </td></tr>'; $block .= '</tbody></table></div></section>'; return $block; }
/** * * @param array $descendants * @param array $options * @return string */ public static function create($persona, $options) { $pframe_color = isset($options['pframe_color']) && !empty($options['pframe_color']) ? $options['pframe_color'] : 'brown'; $block = '<section class="rp_truncate">' . RP_Persona_Helper::get_banner($options, __('Descendancy Chart', 'rootspersona')) . '<div class="rp_descendants" style="padding:10px 4px;">' . RP_Descendancy_Panel_Creator::build_level($persona, $options, 1) . '</div></section>'; return $block; }