/**
  *
  * @param RP_Persona $persona
  * @param array $options
  * @param string $msg
  * @return string
  */
 function build($persona, $action, $options, $msg = '')
 {
     $isSOR = $options['is_system_of_record'] == '1' ? true : false;
     $block = "<div style='overflow:hidden;margin:20px;'>" . "<form id='editPersonaForm' action='" . $action . "' method='POST'>" . "<div  class='rp_banner' style='padding-right:15px;margin-bottom:15px;font-size:smaller;'>" . "<input type='button' name='submitPersonForm' class='submitPersonForm' value='" . __('Save', 'rootspersona') . "' onclick='updatePersona();'/>" . "&#160;&#160;&#160;<input type='button' class='submitPersonForm' name='cancel' value='" . __('Cancel', 'rootspersona') . "' onclick='gotoPersonaPage(\"" . $options['home_url'] . "\");'/>" . "&#160;&#160;&#160;<input type='button' class='submitPersonForm' name='new' value='" . __('New', 'rootspersona') . "' onclick='window.location=\"" . $options['admin_url'] . "/tools.php?page=rootsPersona&rootspage=edit&action=edit\";'/></div>";
     $block .= "<div class='persona_msg'></div>";
     $creator = new RP_Header_Panel_Creator();
     $block .= $creator->create_for_edit($persona, $options);
     if ($isSOR) {
         // if($options['header_style'] == '2') {
         $creator = new RP_Bio_Panel_Creator();
         $block .= $creator->create_for_edit($persona->notes, $options);
         // }
         $creator = new RP_Facts_Panel_Creator();
         $block .= RP_Persona_Helper::get_banner($options, 'Facts') . $creator->create_for_edit($persona->facts, $options);
         $creator = new RP_Group_Sheet_Panel_Creator();
         $block .= RP_Persona_Helper::get_banner($options, 'Family Groups') . $creator->create_for_edit($persona, $options);
     }
     $block .= $this->create_privacy_panel($persona, $options);
     $creator = new RP_Picture_Panel_Creator();
     $block .= $creator->create_for_edit($persona, $options);
     $src = '';
     if (isset($options['src_page'])) {
         $src = $options['src_page'];
     }
     $block .= "<div class='persona_msg'></div>";
     $block .= "<div  class='rp_banner' style='padding-right:15px;font-size:smaller;'>" . "<input type='button' name='submitPersonForm' class='submitPersonForm' value='" . __('Save', 'rootspersona') . "' onclick='updatePersona();'/>" . "&#160;&#160;&#160;<input type='button' class='submitPersonForm' name='cancel' value='" . __('Cancel', 'rootspersona') . "' onclick='gotoPersonaPage(\"" . $options['home_url'] . "\");'/></div>" . "<input type='hidden' name='persona_page' id='persona_page' value='" . $src . "'>" . "<input type='hidden' name='personId' id='personId' value='" . $persona->id . "'>" . "<input type='hidden' name='batchId' id='batchId' value='" . $persona->batch_id . "'>" . "<input type='hidden' name='fullName' id='fullName' value='" . $persona->full_name . "'>" . "<input type='hidden' name='imgPath' id='imgPath' value='" . WP_PLUGIN_URL . '/rootspersona/images' . "'>" . "</form></div>";
     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 array $children
  * @param array $options
  * @return string
  */
 static function show_children($pfx, $children, $options, $famc)
 {
     $pframe_color = isset($options['pframe_color']) && !empty($options['pframe_color']) ? $options['pframe_color'] : 'brown';
     $color = isset($options['group_fcolor']) && !empty($options['group_fcolor']) ? $options['group_fcolor'] : 'black';
     $bcolor = isset($options['group_bcolor']) && !empty($options['group_bcolor']) ? $options['group_bcolor'] : null;
     $img = isset($options['group_image']) && !empty($options['group_image']) ? $options['group_image'] : WP_PLUGIN_URL . '/rootspersona/images/familyGroupSidebar.jpg';
     $fill = "color:{$color};" . (empty($bcolor) ? "background-image:url('{$img}') !important;" : "background-image:none;background-color:{$bcolor} !important;");
     $isEdit = ($options['is_system_of_record'] == '1' ? true : false) && current_user_can("edit_pages");
     $a = '';
     if ($isEdit && isset($famc) && !empty($famc)) {
         $a = '<span style="float:right;"><a href="' . admin_url('/tools.php?page=rootsPersona&rootspage=edit&action=edit&famc=') . $famc . '">+</a></span>';
     }
     $block = '<tr><td class="full" colspan="4" style="' . $fill . 'border-color:' . $pframe_color . ' !important">' . __('CHILDREN', 'rootspersona') . $a . '</td></tr>';
     $cnt = count($children);
     for ($idx = 0; $idx < $cnt; $idx++) {
         $ppfx = $pfx . $idx . $children[$idx]->id;
         $birth_date = isset($children[$idx]->birth_date) ? @preg_replace('/@.*@(.*)/US', '$1', $children[$idx]->birth_date) : '';
         $birth_place = isset($children[$idx]->birth_place) ? $children[$idx]->birth_place : '';
         $death_date = isset($children[$idx]->death_date) ? @preg_replace('/@.*@(.*)/US', '$1', $children[$idx]->death_date) : '';
         $death_place = isset($children[$idx]->death_place) ? $children[$idx]->death_place : '';
         $row_span = 2 + count($children[$idx]->marriages);
         $block .= '<tr id="' . $ppfx . '" itemprop="children" itemscope itemtype="http://historical-data.org/HistoricalPerson.html">' . '<td class="gender" style="' . $fill . 'border-color:' . $pframe_color . ' !important" itemprop="gender">' . $children[$idx]->gender . '</td><td class="child" colspan="3" style="' . $fill . 'border-color:' . $pframe_color . ' !important">' . '<a href="' . $options['home_url'] . '?page_id=' . $children[$idx]->page . '" itemprop="name">' . $children[$idx]->full_name . '</a>' . '<span itemprop="birth" itemscope itemtype="http://historical-data.org/HistoricalEvent" itemref="' . $ppfx . '_bdate ' . $ppfx . '_bloc"></span>' . '<span itemprop="death" itemscope itemtype="http://historical-data.org/HistoricalEvent" itemref="' . $ppfx . '_ddate ' . $ppfx . '_dloc"></span>' . '<span itemprop="marriages" itemscope itemtype="http://historical-data.org/HistoricalEvent" itemref="' . $ppfx . '_mdate ' . $ppfx . '_mloc"></span>' . '</td></tr>' . '<tr id="' . $ppfx . '_birth">' . '<td class="inset" rowspan="' . $row_span . '" style="' . $fill . 'border-color:' . $pframe_color . ' !important"/>' . '<td class="label" style="border-color:' . $pframe_color . ' !important">' . __('Birth', 'rootspersona') . '</td>' . '<td id="' . $ppfx . '_bdate" itemprop="startDate" class="rp_date" style="border-color:' . $pframe_color . ' !important">' . ($options['hide_dates'] == 1 ? '' : $birth_date) . '</td><td id="' . $ppfx . '_bloc" itemprop="location" itemscope itemtype="http://schema.org/Place"' . ' class="notes" style="border-color:' . $pframe_color . ' !important">' . '<span itemprop="name">' . ($options['hide_places'] == 1 ? '' : $birth_place) . '</span></td></tr>' . '<tr id="' . $ppfx . '_death"><td class="label" style="border-color:' . $pframe_color . ' !important">' . __('Death', 'rootspersona') . '</td>' . '<td id="' . $ppfx . '_ddate" itemprop="startDate" class="rp_date" style="border-color:' . $pframe_color . ' !important">' . ($options['hide_dates'] == 1 ? '' : $death_date) . '</td>' . '<td id="' . $ppfx . '_dloc" itemprop="location" itemscope itemtype="http://schema.org/Place"' . ' class="notes" style="border-color:' . $pframe_color . ' !important">' . '<span itemprop="name">' . ($options['hide_places'] == 1 ? '' : $death_place) . '</span></td></tr>' . RP_Group_Sheet_Panel_Creator::show_marriage($ppfx, $children[$idx], $options);
     }
     return $block;
 }