Ejemplo n.º 1
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-repo');
     if (Auth::isEditor($this->record->getTree())) {
         $fact = $this->record->getFirstFact('NAME');
         if ($fact) {
             // Edit existing name
             $menu->addSubmenu(new Menu(I18N::translate('Edit the repository'), '#', 'menu-repo-edit', array('onclick' => 'return edit_record("' . $this->record->getXref() . '", "' . $fact->getFactId() . '");')));
         } else {
             // Add new name
             $menu->addSubmenu(new Menu(I18N::translate('Edit the repository'), '#', 'menu-repo-edit', array('onclick' => 'return add_fact("' . $this->record->getXref() . '", "NAME");')));
         }
     }
     // delete
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-repo-del', array('onclick' => 'return delete_record("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-repo-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     // add to favorites
     if (Module::getModuleByName('user_favorites')) {
         $menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-repo-addfav', array('onclick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite" ,{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
     }
     return $menu;
 }
Ejemplo n.º 2
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-note');
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit note'), '#', 'menu-note-edit', array('onclick' => 'return edit_note("' . $this->record->getXref() . '");')));
     }
     // delete
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-note-del', array('onclick' => 'return delete_note("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJS(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
     }
     // add to favorites
     if (Module::getModuleByName('user_favorites')) {
         $menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-note-addfav', array('onclick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite",{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
     }
     // Get the link for the first submenu and set it as the link for the main menu
     if ($menu->getSubmenus()) {
         $submenus = $menu->getSubmenus();
         $menu->setLink($submenus[0]->getLink());
         $menu->setAttrs($submenus[0]->getAttrs());
     }
     return $menu;
 }
Ejemplo n.º 3
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-obje');
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit the media object'), '#', 'menu-obje-edit', array('onclick' => 'window.open("addmedia.php?action=editmedia&pid=' . $this->record->getXref() . '", "_blank", edit_window_specs)')));
         // main link displayed on page
         if (Module::getModuleByName('GEDFact_assistant')) {
             $menu->addSubmenu(new Menu(I18N::translate('Manage the links'), '#', 'menu-obje-link', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","manage");')));
         } else {
             $menu->addSubmenu(new Menu(I18N::translate('Link this media object to an individual'), '#', 'menu-obje-link-indi', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","person");')));
             $menu->addSubmenu(new Menu(I18N::translate('Link this media object to a family'), '#', 'menu-obje-link-fam', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","family");')));
             $menu->addSubmenu(new Menu(I18N::translate('Link this media object to a source'), '#', 'menu-obje-link-sour', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","source");')));
         }
         // delete
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-obje-del', array('onclick' => 'return delete_record("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-obje-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     return $menu;
 }
Ejemplo n.º 4
0
 /**
  * Upgrade to to the next version
  */
 public function upgrade()
 {
     // New modules (charts) have been added.
     Module::getInstalledModules('enabled');
     // Delete old/unused settings
     Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('COMMON_NAMES_ADD', 'COMMON_NAMES_REMOVE', 'COMMON_NAMES_THRESHOLD')");
 }
Ejemplo n.º 5
0
 /**
  * {@inhericDoc}
  * @see \MyArtJaub\Webtrees\Module\DependentInterface::validatePrerequisites()
  */
 public function validatePrerequisites()
 {
     try {
         Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
         return !is_null(Module::getModuleByName(Constants::MODULE_MAJ_SOSA_NAME));
     } catch (\Exception $ex) {
     }
     return false;
 }
Ejemplo n.º 6
0
 /**
  * Upgrade to to the next version
  */
 public function upgrade()
 {
     Database::exec("CREATE TABLE IF NOT EXISTS `##gedcom` (" . " gedcom_id     INTEGER AUTO_INCREMENT NOT NULL," . " gedcom_name   VARCHAR(255)           NOT NULL," . " sort_order    INTEGER                NOT NULL DEFAULT 0," . " PRIMARY KEY                (gedcom_id)," . " UNIQUE  KEY `##gedcom_ix1` (gedcom_name)," . "         KEY `##gedcom_ix2` (sort_order)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##site_setting` (" . " setting_name  VARCHAR(32)  NOT NULL," . " setting_value VARCHAR(255) NOT NULL," . " PRIMARY KEY (setting_name)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##gedcom_setting` (" . " gedcom_id     INTEGER      NOT NULL," . " setting_name  VARCHAR(32)  NOT NULL," . " setting_value VARCHAR(255) NOT NULL," . " PRIMARY KEY                        (gedcom_id, setting_name)," . " FOREIGN KEY `##gedcom_setting_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##user` (" . " user_id   INTEGER AUTO_INCREMENT NOT NULL," . " user_name VARCHAR(32)            NOT NULL," . " real_name VARCHAR(64)            NOT NULL," . " email     VARCHAR(64)            NOT NULL," . " password  VARCHAR(128)           NOT NULL," . " PRIMARY KEY              (user_id)," . " UNIQUE  KEY `##user_ix1` (user_name)," . " UNIQUE  KEY `##user_ix2` (email)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##user_setting` (" . " user_id       INTEGER      NOT NULL," . " setting_name  VARCHAR(32)  NOT NULL," . " setting_value VARCHAR(255) NOT NULL," . " PRIMARY KEY                      (user_id, setting_name)," . " FOREIGN KEY `##user_setting_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##user_gedcom_setting` (" . " user_id       INTEGER      NOT NULL," . " gedcom_id     INTEGER      NOT NULL," . " setting_name  VARCHAR(32)  NOT NULL," . " setting_value VARCHAR(255) NOT NULL," . " PRIMARY KEY                             (user_id, gedcom_id, setting_name)," . " FOREIGN KEY `##user_gedcom_setting_fk1` (user_id)   REFERENCES `##user` (user_id) /* ON DELETE CASCADE */," . " FOREIGN KEY `##user_gedcom_setting_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##log` (" . " log_id      INTEGER AUTO_INCREMENT NOT NULL," . " log_time    TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP," . " log_type    ENUM('auth', 'config', 'debug', 'edit', 'error', 'media', 'search') NOT NULL," . " log_message TEXT         NOT NULL," . " ip_address  VARCHAR(40)  NOT NULL," . " user_id     INTEGER          NULL," . " gedcom_id   INTEGER          NULL," . " PRIMARY KEY             (log_id)," . "         KEY `##log_ix1` (log_time)," . "         KEY `##log_ix2` (log_type)," . "         KEY `##log_ix3` (ip_address)," . " FOREIGN KEY `##log_fk1` (user_id)   REFERENCES `##user`(user_id) /* ON DELETE SET NULL */," . " FOREIGN KEY `##log_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE SET NULL */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##change` (" . " change_id      INTEGER AUTO_INCREMENT                  NOT NULL," . " change_time    TIMESTAMP                               NOT NULL DEFAULT CURRENT_TIMESTAMP," . " status         ENUM('accepted', 'pending', 'rejected') NOT NULL DEFAULT 'pending'," . " gedcom_id      INTEGER                                 NOT NULL," . " xref           VARCHAR(20)                             NOT NULL," . " old_gedcom     MEDIUMTEXT                              NOT NULL," . " new_gedcom     MEDIUMTEXT                              NOT NULL," . " user_id        INTEGER                                 NOT NULL," . " PRIMARY KEY                (change_id)," . "         KEY `##change_ix1` (gedcom_id, status, xref)," . " FOREIGN KEY `##change_fk1` (user_id)   REFERENCES `##user` (user_id) /* ON DELETE RESTRICT */," . " FOREIGN KEY `##change_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##message` (" . " message_id INTEGER AUTO_INCREMENT NOT NULL," . " sender     VARCHAR(64)            NOT NULL," . " ip_address VARCHAR(40)            NOT NULL," . " user_id    INTEGER                NOT NULL," . " subject    VARCHAR(255)           NOT NULL," . " body       TEXT                   NOT NULL," . " created    TIMESTAMP              NOT NULL DEFAULT CURRENT_TIMESTAMP," . " PRIMARY KEY                 (message_id)," . " FOREIGN KEY `##message_fk1` (user_id)   REFERENCES `##user` (user_id) /* ON DELETE RESTRICT */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##default_resn` (" . " default_resn_id INTEGER AUTO_INCREMENT                             NOT NULL," . " gedcom_id       INTEGER                                            NOT NULL," . " xref            VARCHAR(20)                                            NULL," . " tag_type        VARCHAR(15)                                            NULL," . " resn            ENUM ('none', 'privacy', 'confidential', 'hidden') NOT NULL," . " comment         VARCHAR(255)                                           NULL," . " updated         TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," . " PRIMARY KEY                      (default_resn_id)," . " UNIQUE  KEY `##default_resn_ix1` (gedcom_id, xref, tag_type)," . " FOREIGN KEY `##default_resn_fk1` (gedcom_id)  REFERENCES `##gedcom` (gedcom_id)" . ") ENGINE=InnoDB COLLATE=utf8_unicode_ci");
     Database::exec("CREATE TABLE IF NOT EXISTS `##individuals` (" . " i_id     VARCHAR(20)         NOT NULL," . " i_file   INTEGER             NOT NULL," . " i_rin    VARCHAR(20)         NOT NULL," . " i_sex    ENUM('U', 'M', 'F') NOT NULL," . " i_gedcom MEDIUMTEXT          NOT NULL," . " PRIMARY KEY                     (i_id, i_file)," . " UNIQUE  KEY `##individuals_ix1` (i_file, i_id)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##families` (" . " f_id      VARCHAR(20)  NOT NULL," . " f_file    INTEGER      NOT NULL," . " f_husb    VARCHAR(20)      NULL," . " f_wife    VARCHAR(20)      NULL," . " f_gedcom  MEDIUMTEXT   NOT NULL," . " f_numchil INTEGER      NOT NULL," . " PRIMARY KEY                  (f_id, f_file)," . " UNIQUE  KEY `##families_ix1` (f_file, f_id)," . "         KEY `##families_ix2` (f_husb)," . "         KEY `##families_ix3` (f_wife)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##places` (" . " p_id          INTEGER AUTO_INCREMENT NOT NULL," . " p_place       VARCHAR(150)               NULL," . " p_parent_id   INTEGER                    NULL," . " p_file        INTEGER               NOT  NULL," . " p_std_soundex TEXT                       NULL," . " p_dm_soundex  TEXT                       NULL," . " PRIMARY KEY                (p_id)," . "         KEY `##places_ix1` (p_file, p_place)," . " UNIQUE  KEY `##places_ix2` (p_parent_id, p_file, p_place)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##placelinks` (" . " pl_p_id INTEGER NOT NULL," . " pl_gid  VARCHAR(20)  NOT NULL," . " pl_file INTEGER  NOT NULL," . " PRIMARY KEY                    (pl_p_id, pl_gid, pl_file)," . "         KEY `##placelinks_ix1` (pl_p_id)," . "         KEY `##placelinks_ix2` (pl_gid)," . "         KEY `##placelinks_ix3` (pl_file)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##dates` (" . " d_day        TINYINT     NOT NULL," . " d_month      CHAR(5)         NULL," . " d_mon        TINYINT     NOT NULL," . " d_year       SMALLINT    NOT NULL," . " d_julianday1 MEDIUMINT   NOT NULL," . " d_julianday2 MEDIUMINT   NOT NULL," . " d_fact       VARCHAR(15) NOT NULL," . " d_gid        VARCHAR(20) NOT NULL," . " d_file       INTEGER     NOT NULL," . " d_type       ENUM ('@#DGREGORIAN@', '@#DJULIAN@', '@#DHEBREW@', '@#DFRENCH R@', '@#DHIJRI@', '@#DROMAN@', '@#DJALALI@') NOT NULL," . " KEY `##dates_ix1` (d_day)," . " KEY `##dates_ix2` (d_month)," . " KEY `##dates_ix3` (d_mon)," . " KEY `##dates_ix4` (d_year)," . " KEY `##dates_ix5` (d_julianday1)," . " KEY `##dates_ix6` (d_julianday2)," . " KEY `##dates_ix7` (d_gid)," . " KEY `##dates_ix8` (d_file)," . " KEY `##dates_ix9` (d_type)," . " KEY `##dates_ix10` (d_fact, d_gid)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##media` (" . " m_id       VARCHAR(20)            NOT NULL," . " m_ext      VARCHAR(6)                 NULL," . " m_type     VARCHAR(20)                NULL," . " m_titl     VARCHAR(255)               NULL," . " m_filename VARCHAR(512)               NULL," . " m_file     INTEGER                NOT NULL," . " m_gedcom   MEDIUMTEXT                 NULL," . " PRIMARY KEY               (m_file, m_id)," . " UNIQUE  KEY `##media_ix1` (m_id, m_file)," . "         KEY `##media_ix2` (m_ext, m_type)," . "         KEY `##media_ix3` (m_titl)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##next_id` (" . " gedcom_id   INTEGER     NOT NULL," . " record_type VARCHAR(15) NOT NULL," . " next_id     DECIMAL(20) NOT NULL," . " PRIMARY KEY                 (gedcom_id, record_type)," . " FOREIGN KEY `##next_id_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##other` (" . " o_id     VARCHAR(20) NOT NULL," . " o_file   INTEGER     NOT NULL," . " o_type   VARCHAR(15) NOT NULL," . " o_gedcom MEDIUMTEXT      NULL," . " PRIMARY KEY               (o_id, o_file)," . " UNIQUE  KEY `##other_ix1` (o_file, o_id)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##sources` (" . " s_id     VARCHAR(20)    NOT NULL," . " s_file   INTEGER        NOT NULL," . " s_name   VARCHAR(255)   NOT NULL," . " s_gedcom MEDIUMTEXT     NOT NULL," . " PRIMARY KEY                 (s_id, s_file)," . " UNIQUE  KEY `##sources_ix1` (s_file, s_id)," . "         KEY `##sources_ix2` (s_name)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##link` (" . " l_file    INTEGER     NOT NULL," . " l_from    VARCHAR(20) NOT NULL," . " l_type    VARCHAR(15) NOT NULL," . " l_to      VARCHAR(20) NOT NULL," . " PRIMARY KEY              (l_from, l_file, l_type, l_to)," . " UNIQUE  KEY `##link_ix1` (l_to, l_file, l_type, l_from)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##name` (" . " n_file             INTEGER      NOT NULL," . " n_id               VARCHAR(20)  NOT NULL," . " n_num              INTEGER      NOT NULL," . " n_type             VARCHAR(15)  NOT NULL," . " n_sort             VARCHAR(255) NOT NULL," . " n_full             VARCHAR(255) NOT NULL," . " n_surname          VARCHAR(255)     NULL," . " n_surn             VARCHAR(255)     NULL," . " n_givn             VARCHAR(255)     NULL," . " n_soundex_givn_std VARCHAR(255)     NULL," . " n_soundex_surn_std VARCHAR(255)     NULL," . " n_soundex_givn_dm  VARCHAR(255)     NULL," . " n_soundex_surn_dm  VARCHAR(255)     NULL," . " PRIMARY KEY              (n_id, n_file, n_num)," . "         KEY `##name_ix1` (n_full, n_id, n_file)," . "         KEY `##name_ix2` (n_surn, n_file, n_type, n_id)," . "         KEY `##name_ix3` (n_givn, n_file, n_type, n_id)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##module` (" . " module_name   VARCHAR(32)                 NOT NULL," . " status        ENUM('enabled', 'disabled') NOT NULL DEFAULT 'enabled'," . " tab_order     INTEGER                         NULL, " . " menu_order    INTEGER                         NULL, " . " sidebar_order INTEGER                         NULL," . " PRIMARY KEY (module_name)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##module_setting` (" . " module_name   VARCHAR(32) NOT NULL," . " setting_name  VARCHAR(32) NOT NULL," . " setting_value MEDIUMTEXT  NOT NULL," . " PRIMARY KEY                        (module_name, setting_name)," . " FOREIGN KEY `##module_setting_fk1` (module_name) REFERENCES `##module` (module_name) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##module_privacy` (" . " module_name   VARCHAR(32) NOT NULL," . " gedcom_id     INTEGER     NOT NULL," . " component     ENUM('block', 'chart', 'menu', 'report', 'sidebar', 'tab', 'theme') NOT NULL," . " access_level  TINYINT     NOT NULL," . " PRIMARY KEY                        (module_name, gedcom_id, component)," . " FOREIGN KEY `##module_privacy_fk1` (module_name) REFERENCES `##module` (module_name) /* ON DELETE CASCADE */," . " FOREIGN KEY `##module_privacy_fk2` (gedcom_id)   REFERENCES `##gedcom` (gedcom_id)   /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##block` (" . " block_id    INTEGER AUTO_INCREMENT NOT NULL," . " gedcom_id   INTEGER                    NULL," . " user_id     INTEGER                    NULL," . " xref        VARCHAR(20)                NULL," . " location    ENUM('main', 'side')       NULL," . " block_order INTEGER                NOT NULL," . " module_name VARCHAR(32)            NOT NULL," . " PRIMARY KEY               (block_id)," . " FOREIGN KEY `##block_fk1` (gedcom_id)   REFERENCES `##gedcom` (gedcom_id),  /* ON DELETE CASCADE */" . " FOREIGN KEY `##block_fk2` (user_id)     REFERENCES `##user`   (user_id),    /* ON DELETE CASCADE */" . " FOREIGN KEY `##block_fk3` (module_name) REFERENCES `##module` (module_name) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##block_setting` (" . " block_id      INTEGER     NOT NULL," . " setting_name  VARCHAR(32) NOT NULL," . " setting_value TEXT        NOT NULL," . " PRIMARY KEY                       (block_id, setting_name)," . " FOREIGN KEY `##block_setting_fk1` (block_id) REFERENCES `##block` (block_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     Database::exec("CREATE TABLE IF NOT EXISTS `##hit_counter` (" . " gedcom_id      INTEGER     NOT NULL," . " page_name      VARCHAR(32) NOT NULL," . " page_parameter VARCHAR(32) NOT NULL," . " page_count     INTEGER     NOT NULL," . " PRIMARY KEY                     (gedcom_id, page_name, page_parameter)," . " FOREIGN KEY `##hit_counter_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
     // Set the default site preferences
     Site::setPreference('INDEX_DIRECTORY', 'data/');
     Site::setPreference('USE_REGISTRATION_MODULE', '1');
     Site::setPreference('ALLOW_USER_THEMES', '1');
     Site::setPreference('ALLOW_CHANGE_GEDCOM', '1');
     Site::setPreference('SESSION_TIME', '7200');
     Site::setPreference('SMTP_ACTIVE', 'internal');
     Site::setPreference('SMTP_HOST', 'localhost');
     Site::setPreference('SMTP_PORT', '25');
     Site::setPreference('SMTP_AUTH', '1');
     Site::setPreference('SMTP_AUTH_USER', '');
     Site::setPreference('SMTP_AUTH_PASS', '');
     Site::setPreference('SMTP_SSL', 'none');
     Site::setPreference('SMTP_HELO', $_SERVER['SERVER_NAME']);
     Site::setPreference('SMTP_FROM_NAME', $_SERVER['SERVER_NAME']);
     // Search for all installed modules, and enable them.
     Module::getInstalledModules('enabled');
 }
Ejemplo n.º 7
0
 /**
  * Get an array of the different titles (tag TITL) of an individual
  * 
  * @return array Array of titles
  */
 public function getTitles()
 {
     if (is_null($this->titles) && ($module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME))) {
         $pattern = '/(.*) ((' . $module->getSetting('MAJ_TITLE_PREFIX', '') . ')(.*))/';
         $this->titles = array();
         $titlefacts = $this->gedcomrecord->getFacts('TITL');
         foreach ($titlefacts as $titlefact) {
             $ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2);
             if ($ct2 > 0) {
                 $this->titles[$match2[1][0]][] = trim($match2[2][0]);
             } else {
                 $this->titles[$titlefact->getValue()][] = '';
             }
         }
     }
     return $this->titles;
 }
Ejemplo n.º 8
0
 /**
  * {@inheritDoc}
  * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getPossibleHooks()
  */
 public function getPossibleHooks()
 {
     static $hooks = null;
     if ($hooks === null) {
         $hooks = array();
         // Cannot use the same logic as the core Module loading,
         // as this forces a new include of the module.php file.
         // This causes issue when classes are defined in this file.
         // Cannot use Module::getActiveModules as well, as this is private.
         $module_names = Database::prepare('SELECT SQL_CACHE module_name FROM `##module`')->fetchOneColumn();
         foreach ($module_names as $module_name) {
             $module = Module::getModuleByName($module_name);
             if ($module instanceof HookSubscriberInterface) {
                 $subscribedhooks = $module->getSubscribedHooks();
                 if (is_array($subscribedhooks)) {
                     foreach ($subscribedhooks as $key => $value) {
                         if (is_int($key)) {
                             $hook_item = $value;
                             $priority = self::DEFAULT_PRIORITY;
                         } else {
                             $hook_item = explode('#', $key, 2);
                             $priority = $value;
                         }
                         if ($hook_item && count($hook_item) == 2) {
                             $hook_func = $hook_item[0];
                             $hook_cont = $hook_item[1];
                         } else {
                             $hook_func = $hook_item[0];
                             $hook_cont = 'all';
                         }
                         if (method_exists($module, $hook_func)) {
                             $hooks[$module->getName() . '#' . $hook_func . '#' . $hook_cont] = $priority;
                         }
                     }
                 }
             }
         }
     }
     return $hooks;
 }
Ejemplo n.º 9
0
 /**
  * Generate the HTML content of this block.
  *
  * @param int      $block_id
  * @param bool     $template
  * @param string[] $cfg
  *
  * @return string
  */
 public function getBlock($block_id, $template = true, $cfg = array())
 {
     global $WT_TREE;
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     $title = '<span dir="auto">' . I18N::translate('Welcome %s', Auth::user()->getRealNameHtml()) . '</span>';
     $content = '<table><tr>';
     $content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>' . I18N::translate('My account') . '</a></td>';
     $gedcomid = $WT_TREE->getUserPreference(Auth::user(), 'gedcomid');
     if ($gedcomid) {
         if (Module::isActiveChart($WT_TREE, 'pedigree_chart')) {
             $content .= '<td><a href="pedigree.php?rootid=' . $gedcomid . '&amp;ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('My pedigree') . '</a></td>';
         }
         $content .= '<td><a href="individual.php?pid=' . $gedcomid . '&amp;ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-indis"></i><br>' . I18N::translate('My individual record') . '</a></td>';
     }
     $content .= '</tr></table>';
     if ($template) {
         return Theme::theme()->formatBlock($id, $title, $class, $content);
     } else {
         return $content;
     }
 }
Ejemplo n.º 10
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-obje');
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit media object'), '#', 'menu-obje-edit', array('onclick' => 'window.open("addmedia.php?action=editmedia&pid=' . $this->record->getXref() . '", "_blank", edit_window_specs)')));
         // main link displayed on page
         if (Module::getModuleByName('GEDFact_assistant')) {
             $menu->addSubmenu(new Menu(I18N::translate('Manage links'), '#', 'menu-obje-link', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","manage");')));
         } else {
             $menu->addSubmenu(new Menu(I18N::translate('Link this media object to an individual'), '#', 'menu-obje-link-indi', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","person");')));
             $menu->addSubmenu(new Menu(I18N::translate('Link this media object to a family'), '#', 'menu-obje-link-fam', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","family");')));
             $menu->addSubmenu(new Menu(I18N::translate('Link this media object to a source'), '#', 'menu-obje-link-sour', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","source");')));
         }
     }
     // delete
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-obje-del', array('onclick' => 'return delete_media("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJS(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit raw GEDCOM'), '#', 'menu-obje-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     // add to favorites
     if (Module::getModuleByName('user_favorites')) {
         $menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-obje-addfav', array('onclick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite",{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
     }
     // Get the link for the first submenu and set it as the link for the main menu
     if ($menu->getSubmenus()) {
         $submenus = $menu->getSubmenus();
         $menu->setLink($submenus[0]->getLink());
         $menu->setAttrs($submenus[0]->getAttrs());
     }
     return $menu;
 }
Ejemplo n.º 11
0
 /**
  * {@inheritDoc}
  * @see \MyArtJaub\Webtrees\Module\ModuleManagerInterface::isOperational()
  */
 public function isOperational($moduleName)
 {
     if (!array_key_exists($moduleName, $this->modules_list)) {
         if ($module = fw\Module::getModuleByName($moduleName)) {
             if ($module instanceof DependentInterface) {
                 if ($module->validatePrerequisites()) {
                     $this->modules_list[$moduleName] = TRUE;
                     return true;
                 } else {
                     // Do not cache the result,
                     // as they could change by the next call to the method
                     return false;
                 }
             } else {
                 $this->modules_list[$moduleName] = TRUE;
                 return true;
             }
         } else {
             $this->modules_list[$moduleName] = FALSE;
         }
     }
     return $this->modules_list[$moduleName];
 }
Ejemplo n.º 12
0
 /**
  * Generate the HTML content of this block.
  *
  * @param int      $block_id
  * @param bool     $template
  * @param string[] $cfg
  *
  * @return string
  */
 public function getBlock($block_id, $template = true, $cfg = array())
 {
     global $controller, $WT_TREE;
     $indi_xref = $controller->getSignificantIndividual()->getXref();
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     $title = $WT_TREE->getTitleHtml();
     $content = '<table><tr>';
     if (Module::isActiveChart($WT_TREE, 'pedigree_chart')) {
         $content .= '<td><a href="pedigree.php?rootid=' . $indi_xref . '&amp;ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('Default chart') . '</a></td>';
     }
     $content .= '<td><a href="individual.php?pid=' . $indi_xref . '&amp;ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-indis"></i><br>' . I18N::translate('Default individual') . '</a></td>';
     if (Site::getPreference('USE_REGISTRATION_MODULE') && !Auth::check()) {
         $content .= '<td><a href="' . WT_LOGIN_URL . '?action=register"><i class="icon-user_add"></i><br>' . I18N::translate('Request a new user account') . '</a></td>';
     }
     $content .= "</tr>";
     $content .= "</table>";
     if ($template) {
         return Theme::theme()->formatBlock($id, $title, $class, $content);
     } else {
         return $content;
     }
 }
Ejemplo n.º 13
0
 /**
  * get edit menu
  */
 public function getEditMenu()
 {
     if (!$this->record || $this->record->isPendingDeletion()) {
         return null;
     }
     // edit menu
     $menu = new Menu(I18N::translate('Edit'), '#', 'menu-sour');
     if (Auth::isEditor($this->record->getTree())) {
         $fact = $this->record->getFirstFact('TITL');
         if ($fact) {
             // Edit existing name
             $menu->addSubmenu(new Menu(I18N::translate('Edit source'), '#', 'menu-sour-edit', array('onclick' => 'return edit_record("' . $this->record->getXref() . '", "' . $fact->getFactId() . '");')));
         } else {
             // Add new name
             $menu->addSubmenu(new Menu(I18N::translate('Edit source'), '#', 'menu-sour-edit', array('onclick' => 'return add_fact("' . $this->record->getXref() . '", "TITL");')));
         }
     }
     // delete
     if (Auth::isEditor($this->record->getTree())) {
         $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-sour-del', array('onclick' => "return delete_record('" . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . "', '" . $this->record->getXref() . "');")));
     }
     // edit raw
     if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
         $menu->addSubmenu(new Menu(I18N::translate('Edit raw GEDCOM'), '#', 'menu-sour-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
     }
     // add to favorites
     if (Module::getModuleByName('user_favorites')) {
         $menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-sour-addfav', array('onlick' => 'jQuery.post("module.php?mod=user_favorites&amp;mod_action=menu-add-favorite",{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
     }
     // Get the link for the first submenu and set it as the link for the main menu
     if ($menu->getSubmenus()) {
         $submenus = $menu->getSubmenus();
         $menu->setLink($submenus[0]->getLink());
         $menu->setAttrs($submenus[0]->getAttrs());
     }
     return $menu;
 }
Ejemplo n.º 14
0
 /**
  * Generate the HTML content of this tab.
  *
  * @return string
  */
 public function getTabContent()
 {
     global $WT_TREE, $controller;
     $html = '<div id="' . $this->getName() . '_content">';
     //Show Lightbox-Album header Links
     if (Auth::isEditor($WT_TREE)) {
         $html .= '<table class="facts_table"><tr><td class="descriptionbox rela">';
         // Add a new media object
         if ($WT_TREE->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($WT_TREE)) {
             $html .= '<span><a href="#" onclick="window.open(\'addmedia.php?action=showmediaform&linktoid=' . $controller->record->getXref() . '\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=780,width=600\');return false;">';
             $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/image_add.png" id="head_icon" class="icon" title="' . I18N::translate('Add a new media object') . '" alt="' . I18N::translate('Add a new media object') . '">';
             $html .= I18N::translate('Add a new media object');
             $html .= '</a></span>';
             // Link to an existing item
             $html .= '<span><a href="#" onclick="window.open(\'inverselink.php?linktoid=' . $controller->record->getXref() . '&linkto=person\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=300,width=450\');">';
             $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/image_link.png" id="head_icon" class="icon" title="' . I18N::translate('Link to an existing media object') . '" alt="' . I18N::translate('Link to an existing media object') . '">';
             $html .= I18N::translate('Link to an existing media object');
             $html .= '</a></span>';
         }
         if (Auth::isManager($WT_TREE) && $this->getMedia()) {
             // Popup Reorder Media
             $html .= '<span><a href="#" onclick="reorder_media(\'' . $controller->record->getXref() . '\')">';
             $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/images.png" id="head_icon" class="icon" title="' . I18N::translate('Re-order media') . '" alt="' . I18N::translate('Re-order media') . '">';
             $html .= I18N::translate('Re-order media');
             $html .= '</a></span>';
         }
         $html .= '</td></tr></table>';
     }
     // Used when sorting media on album tab page
     $html .= '<table class="facts_table"><tr><td class="facts_value">';
     // one-cell table - for presentation only
     $html .= '<ul class="album-list">';
     foreach ($this->getMedia() as $media) {
         //View Edit Menu ----------------------------------
         //Get media item Notes
         $haystack = $media->getGedcom();
         $needle = '1 NOTE';
         $before = substr($haystack, 0, strpos($haystack, $needle));
         $after = substr(strstr($haystack, $needle), strlen($needle));
         $notes = FunctionsPrint::printFactNotes($before . $needle . $after, 1, true);
         // Prepare Below Thumbnail  menu ----------------------------------------------------
         $menu = new Menu('<div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap">' . $media->getFullName() . '</div>');
         $menu->addClass('', 'submenu');
         // View Notes
         if (strpos($media->getGedcom(), "\n1 NOTE")) {
             $submenu = new Menu(I18N::translate('View notes'), '#', '', array('onclick' => 'modalNotes("' . Filter::escapeJs($notes) . '","' . I18N::translate('View notes') . '"); return false;'));
             $submenu->addClass("submenuitem");
             $menu->addSubmenu($submenu);
         }
         //View Details
         $submenu = new Menu(I18N::translate('View details'), $media->getHtmlUrl());
         $submenu->addClass("submenuitem");
         $menu->addSubmenu($submenu);
         //View Sources
         foreach ($media->getFacts('SOUR') as $source_fact) {
             $source = $source_fact->getTarget();
             if ($source && $source->canShow()) {
                 $submenu = new Menu(I18N::translate('Source') . ' – ' . $source->getFullName(), $source->getHtmlUrl());
                 $submenu->addClass('submenuitem');
                 $menu->addSubmenu($submenu);
             }
         }
         if (Auth::isEditor($media->getTree())) {
             // Edit Media
             $submenu = new Menu(I18N::translate('Edit media'), '#', '', array('onclick' => 'return window.open("addmedia.php?action=editmedia&pid=' . $media->getXref() . '", "_blank", edit_window_specs);'));
             $submenu->addClass("submenuitem");
             $menu->addSubmenu($submenu);
             if (Auth::isAdmin()) {
                 if (Module::getModuleByName('GEDFact_assistant')) {
                     $submenu = new Menu(I18N::translate('Manage links'), '#', '', array('onclick' => 'return window.open("inverselink.php?mediaid=' . $media->getXref() . '&linkto=manage", "_blank", find_window_specs);'));
                     $submenu->addClass("submenuitem");
                     $menu->addSubmenu($submenu);
                 } else {
                     $submenu = new Menu(I18N::translate('Link this media object to an individual'), '#', 'menu-obje-link-indi', array('onclick' => 'return ilinkitem("' . $media->getXref() . '","person");'));
                     $submenu->addClass('submenuitem');
                     $menu->addSubmenu($submenu);
                     $submenu = new Menu(I18N::translate('Link this media object to a family'), '#', 'menu-obje-link-fam', array('onclick' => 'return ilinkitem("' . $media->getXref() . '","family");'));
                     $submenu->addClass('submenuitem');
                     $menu->addSubmenu($submenu);
                     $submenu = new Menu(I18N::translate('Link this media object to a source'), '#', 'menu-obje-link-sour', array('onclick' => 'return ilinkitem("' . $media->getXref() . '","source");'));
                     $submenu->addClass('submenuitem');
                     $menu->addSubmenu($submenu);
                 }
                 $submenu = new Menu(I18N::translate('Unlink media'), '#', '', array('onclick' => 'return unlink_media("' . I18N::translate('Are you sure you want to remove links to this media object?') . '", "' . $controller->record->getXref() . '", "' . $media->getXref() . '");'));
                 $submenu->addClass("submenuitem");
                 $menu->addSubmenu($submenu);
             }
         }
         $html .= '<li class="album-list-item">';
         $html .= '<div class="album-image">' . $media->displayImage() . '</div>';
         $html .= '<div class="album-title">' . $menu->getMenu() . '</div>';
         $html .= '</li>';
     }
     $html .= '</ul>';
     $html .= '</td></tr></table>';
     return $html;
 }
Ejemplo n.º 15
0
 */
namespace Fisharebest\Webtrees;

/**
 * Defined in session.php
 *
 * @global Tree $WT_TREE
 */
global $WT_TREE;
use Fisharebest\Webtrees\Controller\PedigreeController;
use Fisharebest\Webtrees\Functions\FunctionsEdit;
use Fisharebest\Webtrees\Functions\FunctionsPrint;
define('WT_SCRIPT_NAME', 'pedigree.php');
require './includes/session.php';
$controller = new PedigreeController();
$controller->restrictAccess(Module::isActiveChart($WT_TREE, 'pedigree_chart'))->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('
	(function() {
		autocomplete();

		jQuery("#childarrow").on("click", ".menuselect", function(e) {
			e.preventDefault();
			jQuery("#childbox").slideToggle("fast");
		});

		jQuery("#pedigree_chart")
			.width(' . $controller->chartsize['x'] . ')
			.height(' . $controller->chartsize['y'] . ');

		// Set variables
		var p0, p1, p2,  // Holds the ids of the boxes used in the join calculations
			canvas       = jQuery("#pedigree_canvas"),
Ejemplo n.º 16
0
 /**
  * print a note record
  *
  * @param string $text
  * @param int $nlevel the level of the note record
  * @param string $nrec the note record to print
  * @param bool $textOnly Don't print the "Note: " introduction
  *
  * @return string
  */
 public static function printNoteRecord($text, $nlevel, $nrec, $textOnly = false)
 {
     global $WT_TREE;
     $text .= Functions::getCont($nlevel, $nrec);
     // Check if shared note (we have already checked that it exists)
     if (preg_match('/^0 @(' . WT_REGEX_XREF . ')@ NOTE/', $nrec, $match)) {
         $note = Note::getInstance($match[1], $WT_TREE);
         $label = 'SHARED_NOTE';
         // If Census assistant installed, allow it to format the note
         if (Module::getModuleByName('GEDFact_assistant')) {
             $html = CensusAssistantModule::formatCensusNote($note);
         } else {
             $html = Filter::formatText($note->getNote(), $WT_TREE);
         }
     } else {
         $note = null;
         $label = 'NOTE';
         $html = Filter::formatText($text, $WT_TREE);
     }
     if ($textOnly) {
         return strip_tags($text);
     }
     if (strpos($text, "\n") === false) {
         // A one-line note? strip the block-level tags, so it displays inline
         return GedcomTag::getLabelValue($label, strip_tags($html, '<a><strong><em>'));
     } elseif ($WT_TREE->getPreference('EXPAND_NOTES')) {
         // A multi-line note, and we're expanding notes by default
         return GedcomTag::getLabelValue($label, $html);
     } else {
         // A multi-line note, with an expand/collapse option
         $element_id = Uuid::uuid4();
         // NOTE: class "note-details" is (currently) used only by some third-party themes
         if ($note) {
             $first_line = '<a href="' . $note->getHtmlUrl() . '">' . $note->getFullName() . '</a>';
         } else {
             list($text) = explode("\n", strip_tags($html));
             $first_line = strlen($text) > 100 ? mb_substr($text, 0, 100) . I18N::translate('…') : $text;
         }
         return '<div class="fact_NOTE"><span class="label">' . '<a href="#" onclick="expand_layer(\'' . $element_id . '\'); return false;"><i id="' . $element_id . '_img" class="icon-plus"></i></a> ' . GedcomTag::getLabel($label) . ':</span> ' . '<span id="' . $element_id . '-alt">' . $first_line . '</span>' . '</div>' . '<div class="note-details" id="' . $element_id . '" style="display:none">' . $html . '</div>';
     }
 }
Ejemplo n.º 17
0
 /**
  * Create any of the other blocks.
  *
  * Use as #callBlock:block_name#
  *
  * @param string[] $params
  *
  * @return string
  */
 public function callBlock($params = array())
 {
     global $ctype;
     if (isset($params[0]) && $params[0] != '') {
         $block = $params[0];
     } else {
         return '';
     }
     $all_blocks = array();
     foreach (Module::getActiveBlocks($this->tree) as $name => $active_block) {
         if ($ctype == 'user' && $active_block->isUserBlock() || $ctype == 'gedcom' && $active_block->isGedcomBlock()) {
             $all_blocks[$name] = $active_block;
         }
     }
     if (!array_key_exists($block, $all_blocks) || $block == 'html') {
         return '';
     }
     // Build the config array
     array_shift($params);
     $cfg = array();
     foreach ($params as $config) {
         $bits = explode('=', $config);
         if (count($bits) < 2) {
             continue;
         }
         $v = array_shift($bits);
         $cfg[$v] = implode('=', $bits);
     }
     $block = $all_blocks[$block];
     $block_id = Filter::getInteger('block_id');
     $content = $block->getBlock($block_id, false, $cfg);
     return $content;
 }
Ejemplo n.º 18
0
$blocks = Module::getActiveBlocks($WT_TREE);
if (!$block || !array_key_exists($block->module_name, $blocks) || $block->gedcom_id && !Auth::isManager(Tree::findById($block->gedcom_id)) || $block->user_id && $block->user_id != Auth::id() && !Auth::isAdmin()) {
    header('Location: ' . WT_BASE_URL);
    return;
}
$block = $blocks[$block->module_name];
if (Filter::post('save')) {
    $ctype = Filter::post('ctype', 'user', 'gedcom');
    header('Location: ' . WT_BASE_URL . 'index.php?ctype=' . $ctype . '&ged=' . $WT_TREE->getNameUrl());
    $block->configureBlock($block_id);
    return;
}
$ctype = FIlter::get('ctype', 'user', 'gedcom');
$controller = new PageController();
$controller->setPageTitle(I18N::translate('Configure') . ' — ' . $block->getTitle())->pageHeader();
if (Module::getModuleByName('ckeditor')) {
    CkeditorModule::enableEditor($controller);
}
?>
<h2><?php 
echo $controller->getPageTitle();
?>
</h2>

<form name="block" method="post" action="?block_id=<?php 
echo $block_id;
?>
">
	<input type="hidden" name="save" value="1">
	<input type="hidden" name="ged" value="<?php 
echo $WT_TREE->getNameHtml();
 /** {@inheritdoc} */
 public function getTabContent()
 {
     global $controller;
     $EXPAND_HISTO_EVENTS = false;
     $indifacts = array();
     // The individual’s own facts
     foreach ($controller->record->getFacts() as $fact) {
         switch ($fact->getTag()) {
             case 'SEX':
             case 'NAME':
             case 'SOUR':
             case 'OBJE':
             case 'NOTE':
             case 'FAMC':
             case 'FAMS':
                 break;
             default:
                 if (!array_key_exists('extra_info', Module::getActiveSidebars($controller->record->getTree())) || !ExtraInformationModule::showFact($fact)) {
                     $indifacts[] = $fact;
                 }
                 break;
         }
     }
     // Add spouse-family facts
     foreach ($controller->record->getSpouseFamilies() as $family) {
         foreach ($family->getFacts() as $fact) {
             switch ($fact->getTag()) {
                 case 'SOUR':
                 case 'NOTE':
                 case 'OBJE':
                 case 'CHAN':
                 case '_UID':
                 case 'RIN':
                 case 'HUSB':
                 case 'WIFE':
                 case 'CHIL':
                     break;
                 default:
                     $indifacts[] = $fact;
                     break;
             }
         }
         $spouse = $family->getSpouse($controller->record);
         if ($spouse) {
             foreach (self::spouseFacts($controller->record, $spouse) as $fact) {
                 $indifacts[] = $fact;
             }
         }
         foreach (self::childFacts($controller->record, $family, '_CHIL', '') as $fact) {
             $indifacts[] = $fact;
         }
     }
     foreach (self::parentFacts($controller->record, 1) as $fact) {
         $indifacts[] = $fact;
     }
     foreach (self::historicalFacts($controller->record) as $fact) {
         $indifacts[] = $fact;
     }
     foreach (self::associateFacts($controller->record) as $fact) {
         $indifacts[] = $fact;
     }
     Functions::sortFacts($indifacts);
     ob_start();
     echo '<table class="facts_table">';
     echo '<tbody>';
     if (!$indifacts) {
         echo '<tr><td colspan="2" class="facts_value">', I18N::translate('There are no facts for this individual.'), '</td></tr>';
     }
     echo '<tr><td colspan="2" class="descriptionbox rela"><form action="?"><input id="checkbox_rela_facts" type="checkbox" ';
     echo $controller->record->getTree()->getPreference('EXPAND_RELATIVES_EVENTS') ? 'checked' : '';
     echo ' onclick="jQuery(\'tr.rela\').toggle();"><label for="checkbox_rela_facts">', I18N::translate('Events of close relatives'), '</label>';
     if (file_exists(Site::getPreference('INDEX_DIRECTORY') . 'histo.' . WT_LOCALE . '.php')) {
         echo ' <input id="checkbox_histo" type="checkbox" ';
         echo $EXPAND_HISTO_EVENTS ? 'checked' : '';
         echo ' onclick="jQuery(\'tr.histo\').toggle();"><label for="checkbox_histo">', I18N::translate('Historical facts'), '</label>';
     }
     echo '</form></td></tr>';
     foreach ($indifacts as $fact) {
         FunctionsPrintFacts::printFact($fact, $controller->record);
     }
     //-- new fact link
     if ($controller->record->canEdit()) {
         FunctionsPrint::printAddNewFact($controller->record->getXref(), $indifacts, 'INDI');
     }
     echo '</tbody>';
     echo '</table>';
     if (!$controller->record->getTree()->getPreference('EXPAND_RELATIVES_EVENTS')) {
         echo '<script>jQuery("tr.rela").toggle();</script>';
     }
     if (!$EXPAND_HISTO_EVENTS) {
         echo '<script>jQuery("tr.histo").toggle();</script>';
     }
     return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>';
 }
Ejemplo n.º 20
0
 /**
  * Print a row for the notes tab on the individual page.
  *
  * @param Fact $fact
  * @param int $level
  */
 public static function printMainNotes(Fact $fact, $level)
 {
     $factrec = $fact->getGedcom();
     $fact_id = $fact->getFactId();
     $parent = $fact->getParent();
     $pid = $parent->getXref();
     if ($fact->isPendingAddition()) {
         $styleadd = ' new';
         $can_edit = $level == 1 && $fact->canEdit();
     } elseif ($fact->isPendingDeletion()) {
         $styleadd = ' old';
         $can_edit = false;
     } else {
         $styleadd = '';
         $can_edit = $level == 1 && $fact->canEdit();
     }
     $ct = preg_match_all("/{$level} NOTE (.*)/", $factrec, $match, PREG_SET_ORDER);
     for ($j = 0; $j < $ct; $j++) {
         // Note object, or inline note?
         if (preg_match("/{$level} NOTE @(.*)@/", $match[$j][0], $nmatch)) {
             $note = Note::getInstance($nmatch[1], $fact->getParent()->getTree());
             if ($note && !$note->canShow()) {
                 continue;
             }
         } else {
             $note = null;
         }
         if ($level >= 2) {
             echo '<tr class="row_note2"><td class="descriptionbox rela ', $styleadd, ' width20">';
         } else {
             echo '<tr><td class="descriptionbox ', $styleadd, ' width20">';
         }
         if ($can_edit) {
             echo '<a onclick="return edit_record(\'', $pid, '\', \'', $fact_id, '\');" href="#" title="', I18N::translate('Edit'), '">';
             if ($level < 2) {
                 if ($fact->getParent()->getTree()->getPreference('SHOW_FACT_ICONS')) {
                     echo '<i class="icon-note"></i> ';
                 }
                 if ($note) {
                     echo GedcomTag::getLabel('SHARED_NOTE');
                 } else {
                     echo GedcomTag::getLabel('NOTE');
                 }
                 echo '</a>';
                 echo '<div class="editfacts">';
                 echo "<div class=\"editlink\"><a class=\"editicon\" onclick=\"return edit_record('{$pid}', '{$fact_id}');\" href=\"#\" title=\"" . I18N::translate('Edit') . "\"><span class=\"link_text\">" . I18N::translate('Edit') . "</span></a></div>";
                 echo '<div class="copylink"><a class="copyicon" href="#" onclick="return copy_fact(\'', $pid, '\', \'', $fact_id, '\');" title="' . I18N::translate('Copy') . '"><span class="link_text">' . I18N::translate('Copy') . '</span></a></div>';
                 echo "<div class=\"deletelink\"><a class=\"deleteicon\" onclick=\"return delete_fact('" . I18N::translate('Are you sure you want to delete this fact?') . "', '{$pid}', '{$fact_id}');\" href=\"#\" title=\"" . I18N::translate('Delete') . "\"><span class=\"link_text\">" . I18N::translate('Delete') . "</span></a></div>";
                 if ($note) {
                     echo '<a class="icon-note" href="', $note->getHtmlUrl(), '" title="' . I18N::translate('View') . '"><span class="link_text">' . I18N::translate('View') . '</span></a>';
                 }
                 echo '</div>';
             }
         } else {
             if ($level < 2) {
                 if ($fact->getParent()->getTree()->getPreference('SHOW_FACT_ICONS')) {
                     echo '<i class="icon-note"></i> ';
                 }
                 if ($note) {
                     echo GedcomTag::getLabel('SHARED_NOTE');
                 } else {
                     echo GedcomTag::getLabel('NOTE');
                 }
             }
             $factlines = explode("\n", $factrec);
             // 1 BIRT Y\n2 NOTE ...
             $factwords = explode(" ", $factlines[0]);
             // 1 BIRT Y
             $factname = $factwords[1];
             // BIRT
             $parent = GedcomRecord::getInstance($pid, $fact->getParent()->getTree());
             if ($factname == 'EVEN' || $factname == 'FACT') {
                 // Add ' EVEN' to provide sensible output for an event with an empty TYPE record
                 $ct = preg_match("/2 TYPE (.*)/", $factrec, $ematch);
                 if ($ct > 0) {
                     $factname = trim($ematch[1]);
                     echo $factname;
                 } else {
                     echo GedcomTag::getLabel($factname, $parent);
                 }
             } elseif ($factname != 'NOTE') {
                 // Note is already printed
                 echo GedcomTag::getLabel($factname, $parent);
                 if ($note) {
                     echo '<div class="editfacts"><a class="icon-note" href="', $note->getHtmlUrl(), '" title="' . I18N::translate('View') . '"><span class="link_text">' . I18N::translate('View') . '</span></a></div>';
                 }
             }
         }
         echo '</td>';
         if ($note) {
             // Note objects
             if (Module::getModuleByName('GEDFact_assistant')) {
                 // If Census assistant installed, allow it to format the note
                 $text = CensusAssistantModule::formatCensusNote($note);
             } else {
                 $text = Filter::formatText($note->getNote(), $fact->getParent()->getTree());
             }
         } else {
             // Inline notes
             $nrec = Functions::getSubRecord($level, "{$level} NOTE", $factrec, $j + 1);
             $text = $match[$j][1] . Functions::getCont($level + 1, $nrec);
             $text = Filter::formatText($text, $fact->getParent()->getTree());
         }
         echo '<td class="optionbox', $styleadd, ' wrap">';
         echo $text;
         if (!empty($noterec)) {
             echo self::printFactSources($noterec, 1);
         }
         // 2 RESN tags.  Note, there can be more than one, such as "privacy" and "locked"
         if (preg_match_all("/\n2 RESN (.+)/", $factrec, $matches)) {
             foreach ($matches[1] as $match) {
                 echo '<br><span class="label">', GedcomTag::getLabel('RESN'), ':</span> <span class="field">';
                 switch ($match) {
                     case 'none':
                         // Note: "2 RESN none" is not valid gedcom, and the GUI will not let you add it.
                         // However, webtrees privacy rules will interpret it as "show an otherwise private fact to public".
                         echo '<i class="icon-resn-none"></i> ', I18N::translate('Show to visitors');
                         break;
                     case 'privacy':
                         echo '<i class="icon-resn-privacy"></i> ', I18N::translate('Show to members');
                         break;
                     case 'confidential':
                         echo '<i class="icon-resn-confidential"></i> ', I18N::translate('Show to managers');
                         break;
                     case 'locked':
                         echo '<i class="icon-resn-locked"></i> ', I18N::translate('Only managers can edit');
                         break;
                     default:
                         echo $match;
                         break;
                 }
                 echo '</span>';
             }
         }
         echo '</td></tr>';
     }
 }
Ejemplo n.º 21
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
namespace Fisharebest\Webtrees;

use Fisharebest\Webtrees\Controller\PageController;
use Fisharebest\Webtrees\Functions\FunctionsEdit;
use Fisharebest\Webtrees\Module\ModuleConfigInterface;
define('WT_SCRIPT_NAME', 'admin_module_sidebar.php');
require 'includes/session.php';
$controller = new PageController();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Sidebars'));
$action = Filter::post('action');
$modules = Module::getAllModulesByComponent('sidebar');
if ($action === 'update_mods' && Filter::checkCsrf()) {
    foreach ($modules as $module) {
        foreach (Tree::getAll() as $tree) {
            $access_level = Filter::post('access-' . $module->getName() . '-' . $tree->getTreeId(), WT_REGEX_INTEGER, $module->defaultAccessLevel());
            Database::prepare("REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'sidebar', ?)")->execute(array($module->getName(), $tree->getTreeId(), $access_level));
        }
        $order = Filter::post('order-' . $module->getName());
        Database::prepare("UPDATE `##module` SET sidebar_order = ? WHERE module_name = ?")->execute(array($order, $module->getName()));
    }
    header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
    return;
}
$controller->addInlineJavascript('
		jQuery("#module_table").sortable({
			items: ".sortme",
Ejemplo n.º 22
0
// Define all the icons we're going to use
$IconUarrow = 'icon-uarrow';
$IconDarrow = 'icon-darrow';
if (I18N::direction() === 'ltr') {
    $IconRarrow = 'icon-rarrow';
    $IconLarrow = 'icon-larrow';
    $IconRDarrow = 'icon-rdarrow';
    $IconLDarrow = 'icon-ldarrow';
} else {
    $IconRarrow = 'icon-larrow';
    $IconLarrow = 'icon-rarrow';
    $IconRDarrow = 'icon-ldarrow';
    $IconLDarrow = 'icon-rdarrow';
}
$all_blocks = array();
foreach (Module::getActiveBlocks($WT_TREE) as $name => $block) {
    if ($user_id && $block->isUserBlock() || $gedcom_id && $block->isGedcomBlock()) {
        $all_blocks[$name] = $block;
    }
}
if ($user_id) {
    $blocks = FunctionsDb::getUserBlocks($user_id);
} else {
    $blocks = FunctionsDb::getTreeBlocks($gedcom_id);
}
if ($action === 'update') {
    foreach (array('main', 'side') as $location) {
        if ($location === 'main') {
            $new_blocks = $main;
        } else {
            $new_blocks = $right;
    /**
     * Action from the configuration page
     */
    private function edit()
    {
        global $WT_TREE;
        if (Filter::postBool('save') && Filter::checkCsrf()) {
            $block_id = Filter::postInteger('block_id');
            if ($block_id) {
                Database::prepare("UPDATE `##block` SET gedcom_id = NULLIF(:tree_id, '0'), block_order = :block_order WHERE block_id = :block_id")->execute(array('tree_id' => Filter::postInteger('gedcom_id'), 'block_order' => Filter::postInteger('block_order'), 'block_id' => $block_id));
            } else {
                Database::prepare("INSERT INTO `##block` (gedcom_id, module_name, block_order) VALUES (NULLIF(:tree_id, '0'), :module_name, :block_order)")->execute(array('tree_id' => Filter::postInteger('gedcom_id'), 'module_name' => $this->getName(), 'block_order' => Filter::postInteger('block_order')));
                $block_id = Database::getInstance()->lastInsertId();
            }
            $this->setBlockSetting($block_id, 'header', Filter::post('header'));
            $this->setBlockSetting($block_id, 'faqbody', Filter::post('faqbody'));
            $languages = Filter::postArray('lang');
            $this->setBlockSetting($block_id, 'languages', implode(',', $languages));
            $this->config();
        } else {
            $block_id = Filter::getInteger('block_id');
            $controller = new PageController();
            if ($block_id) {
                $controller->setPageTitle(I18N::translate('Edit FAQ item'));
                $header = $this->getBlockSetting($block_id, 'header');
                $faqbody = $this->getBlockSetting($block_id, 'faqbody');
                $block_order = Database::prepare("SELECT block_order FROM `##block` WHERE block_id = :block_id")->execute(array('block_id' => $block_id))->fetchOne();
                $gedcom_id = Database::prepare("SELECT gedcom_id FROM `##block` WHERE block_id = :block_id")->execute(array('block_id' => $block_id))->fetchOne();
            } else {
                $controller->setPageTitle(I18N::translate('Add an FAQ item'));
                $header = '';
                $faqbody = '';
                $block_order = Database::prepare("SELECT IFNULL(MAX(block_order)+1, 0) FROM `##block` WHERE module_name = :module_name")->execute(array('module_name' => $this->getName()))->fetchOne();
                $gedcom_id = $WT_TREE->getTreeId();
            }
            $controller->pageHeader();
            if (Module::getModuleByName('ckeditor')) {
                CkeditorModule::enableEditor($controller);
            }
            ?>
			<ol class="breadcrumb small">
				<li><a href="admin.php"><?php 
            echo I18N::translate('Control panel');
            ?>
</a></li>
				<li><a href="admin_modules.php"><?php 
            echo I18N::translate('Module administration');
            ?>
</a></li>
				<li><a
						href="module.php?mod=<?php 
            echo $this->getName();
            ?>
&mod_action=admin_config"><?php 
            echo I18N::translate('Frequently asked questions');
            ?>
</a>
				</li>
				<li class="active"><?php 
            echo $controller->getPageTitle();
            ?>
</li>
			</ol>
			<h1><?php 
            echo $controller->getPageTitle();
            ?>
</h1>

			<form name="faq" class="form-horizontal" method="post" action="module.php?mod=<?php 
            echo $this->getName();
            ?>
&amp;mod_action=admin_edit">
			<?php 
            echo Filter::getCsrf();
            ?>
			<input type="hidden" name="save" value="1">
			<input type="hidden" name="block_id" value="<?php 
            echo $block_id;
            ?>
">

			<div class="form-group">
				<label for="header" class="col-sm-3 control-label">
					<?php 
            echo I18N::translate('Question');
            ?>
				</label>

				<div class="col-sm-9">
					<input type="text" class="form-control" name="header" id="header"
					       value="<?php 
            echo Filter::escapeHtml($header);
            ?>
">
				</div>
			</div>

			<div class="form-group">
				<label for="faqbody" class="col-sm-3 control-label">
					<?php 
            echo I18N::translate('Answer');
            ?>
				</label>

				<div class="col-sm-9">
					<textarea name="faqbody" id="faqbody" class="form-control html-edit"
					          rows="10"><?php 
            echo Filter::escapeHtml($faqbody);
            ?>
</textarea>
				</div>
			</div>

			<div class="form-group">
				<label for="xref" class="col-sm-3 control-label">
					<?php 
            echo I18N::translate('Show this block for which languages?');
            ?>
				</label>

				<div class="col-sm-9">
					<?php 
            echo FunctionsEdit::editLanguageCheckboxes('lang', explode(',', $this->getBlockSetting($block_id, 'languages')));
            ?>
				</div>
			</div>

			<div class="form-group">
				<label for="block_order" class="col-sm-3 control-label">
					<?php 
            echo I18N::translate('FAQ position');
            ?>
				</label>

				<div class="col-sm-9">
					<input type="text" name="block_order" id="block_order" class="form-control" value="<?php 
            echo $block_order;
            ?>
">
				</div>
			</div>

			<div class="form-group">
				<label for="gedcom_id" class="col-sm-3 control-label">
					<?php 
            echo I18N::translate('FAQ visibility');
            ?>
				</label>

				<div class="col-sm-9">
					<?php 
            echo FunctionsEdit::selectEditControl('gedcom_id', Tree::getIdList(), I18N::translate('All'), $gedcom_id, 'class="form-control"');
            ?>
					<p class="small text-muted">
						<?php 
            echo I18N::translate('A FAQ item can be displayed on just one of the family trees, or on all the family trees.');
            ?>
					</p>
				</div>
			</div>

			<div class="form-group">
				<div class="col-sm-offset-3 col-sm-9">
					<button type="submit" class="btn btn-primary">
						<i class="fa fa-check"></i>
						<?php 
            echo I18N::translate('save');
            ?>
					</button>
				</div>
			</div>

		</form>
		<?php 
        }
    }
Ejemplo n.º 24
0
    /**
     * {@inhericDoc}
     * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
     */
    protected function renderContent()
    {
        if (Module::getModuleByName('ckeditor')) {
            CkeditorModule::enableEditor($this->ctrl);
        }
        /** @var AbstractModule $module  */
        $module = $this->data->get('module');
        ?>
        
        <ol class="breadcrumb small">
        	<li><a href="admin.php"><?php 
        echo I18N::translate('Control panel');
        ?>
</a></li>
			<li><a href="admin_modules.php"><?php 
        echo I18N::translate('Module administration');
        ?>
</a></li>
			<li class="active"><?php 
        echo $this->data->get('title');
        ?>
</li>
		</ol>
		
		<h1><?php 
        echo $this->data->get('title');
        ?>
</h1>

		<form method="post" class="form-horizontal">
			<?php 
        echo Filter::getCsrf();
        ?>
			<input type="hidden" name="action" value="update">
			
			<h3><?php 
        echo I18N::translate('Titles');
        ?>
</h3>
			
			<!--  MAJ_TITLE_PREFIX -->        	
        	<div class="form-group">			
        		<label for="MAJ_TITLE_PREFIX" class="col-sm-3 control-label">
        			<?php 
        echo I18N::translate('Title prefixes');
        ?>
        		</label>
    			<div class="col-sm-9">
    				<input type="text" class="form-control" dir="auto" id="MAJ_TITLE_PREFIX" name="MAJ_TITLE_PREFIX" value="<?php 
        echo Filter::escapeHtml($module->getSetting('MAJ_TITLE_PREFIX'));
        ?>
" maxlength="255" placeholder="de |d'|du |of |von |vom |am |zur |van |del |della |t'|da |ten |ter |das |dos |af ">
        			<p class="small text-muted">
        				<?php 
        echo I18N::translate('Set possible aristocratic particles to separate titles from the land they refer to (e.g. Earl <strong>of</strong> Essex). Variants must be separated by the character |.');
        ?>
<br />
        				<?php 
        echo I18N::translate('An example for this setting is : <strong>de |d\'|du |of |von |vom |am |zur |van |del |della |t\'|da |ten |ter |das |dos |af </strong> (covering some of French, English, German, Dutch, Italian, Spanish, Portuguese, Swedish common particles).');
        ?>
        			</p>
        		</div>        		
        	</div>
        	
        	<h3><?php 
        echo I18N::translate('Header');
        ?>
</h3>
        	
        	<!-- MAJ_ADD_HTML_HEADER -->
    		<div class="form-group">
    			<label class="control-label col-sm-3" for="MAJ_ADD_HTML_HEADER">
    				<?php 
        echo I18N::translate('Include additional HTML in header');
        ?>
    			</label>
    			<div class="col-sm-9">
    				<?php 
        echo FunctionsEdit::editFieldYesNo('MAJ_ADD_HTML_HEADER', $module->getSetting('MAJ_ADD_HTML_HEADER', 0), 'class="radio-inline"');
        ?>
				    <p class="small text-muted">
    					<?php 
        echo I18N::translate('Enable this option to include raw additional HTML in the header of the page.');
        ?>
    				</p>
    			</div>
    		</div>
        	
        	<!-- MAJ_SHOW_HTML_HEADER -->
        	<div class="form-group">
        		<label class="control-label col-sm-3" for="MAJ_SHOW_HTML_HEADER">
        			<?php 
        echo I18N::translate('Hide additional header');
        ?>
        		</label>
        		<div class="col-sm-9">
        			<?php 
        echo FunctionsEdit::editFieldAccessLevel('MAJ_SHOW_HTML_HEADER', $module->getSetting('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE), 'class="form-control"');
        ?>
        			<p class="small text-muted">
        				<?php 
        echo I18N::translate('Select the access level until which the additional header should be displayed. The <em>Hide from everyone</em> should be used to show the header to everybody.');
        ?>
        			</p>
        		</div>
        	</div>
        	
        	<!--  MAJ_HTML_HEADER -->        	
        	<div class="form-group">			
        		<label for="MAJ_HTML_HEADER" class="col-sm-3 control-label">
        			<?php 
        echo I18N::translate('Additional HTML in header');
        ?>
        		</label>
    			<div class="col-sm-9">
    				<textarea class="form-control html-edit" rows="10" dir="auto" id="MAJ_HTML_HEADER" name="MAJ_HTML_HEADER" ><?php 
        echo Filter::escapeHtml($module->getSetting('MAJ_HTML_HEADER'));
        ?>
</textarea>
        			<p class="small text-muted">
        				<?php 
        echo I18N::translate('If the option has been enabled, the saved HTML will be inserted in the header.');
        ?>
<br>
        				<?php 
        echo I18N::translate('In edit mode, the HTML characters might have been transformed to their HTML equivalents (for instance &amp;gt; for &gt;), it is however possible to insert HTML characters, they will be automatically converted to their equivalent values.');
        ?>
        			</p>
        		</div>        		
        	</div>
        	
        	<h3><?php 
        echo I18N::translate('Footer');
        ?>
</h3>
        	
        	<!-- MAJ_DISPLAY_CNIL -->
    		<div class="form-group">
    			<label class="control-label col-sm-3" for="MAJ_DISPLAY_CNIL">
    				<?php 
        echo I18N::translate('Display French <em>CNIL</em> disclaimer');
        ?>
    			</label>
    			<div class="col-sm-9">
    				<?php 
        echo FunctionsEdit::editFieldYesNo('MAJ_DISPLAY_CNIL', $module->getSetting('MAJ_DISPLAY_CNIL', 0), 'class="radio-inline"');
        ?>
				    <p class="small text-muted">
    					<?php 
        echo I18N::translate('Enable this option to display an information disclaimer in the footer required by the French <em>CNIL</em> for detaining personal information on users.');
        ?>
    				</p>
    			</div>
    		</div>
    		
    		<!--  MAJ_CNIL_REFERENCE -->        	
        	<div class="form-group">			
        		<label for="MAJ_CNIL_REFERENCE" class="col-sm-3 control-label">
        			<?php 
        echo I18N::translate('<em>CNIL</em> reference');
        ?>
        		</label>
    			<div class="col-sm-9">
    				<input type="text" class="form-control" dir="auto" id="MAJ_CNIL_REFERENCE" name="MAJ_CNIL_REFERENCE" value="<?php 
        echo Filter::escapeHtml($module->getSetting('MAJ_CNIL_REFERENCE'));
        ?>
" maxlength="255">
        			<p class="small text-muted">
        				<?php 
        echo I18N::translate('If the website has been notified to the French <em>CNIL</em>, an authorisation number may have been delivered. Providing this reference will display a message in the footer visible to all users.');
        ?>
        			</p>
        		</div>        		
        	</div>
        	
        	<!-- MAJ_ADD_HTML_FOOTER -->
    		<div class="form-group">
    			<label class="control-label col-sm-3" for="MAJ_ADD_HTML_FOOTER">
    				<?php 
        echo I18N::translate('Include additional HTML in footer');
        ?>
    			</label>
    			<div class="col-sm-9">
    				<?php 
        echo FunctionsEdit::editFieldYesNo('MAJ_ADD_HTML_FOOTER', $module->getSetting('MAJ_ADD_HTML_FOOTER', 0), 'class="radio-inline"');
        ?>
				    <p class="small text-muted">
    					<?php 
        echo I18N::translate('Enable this option to include raw additional HTML in the footer of the page.');
        ?>
    				</p>
    			</div>
    		</div>
        	
        	<!-- MAJ_SHOW_HTML_FOOTER -->
        	<div class="form-group">
        		<label class="control-label col-sm-3" for="MAJ_SHOW_HTML_FOOTER">
        			<?php 
        echo I18N::translate('Hide additional footer');
        ?>
        		</label>
        		<div class="col-sm-9">
        			<?php 
        echo FunctionsEdit::editFieldAccessLevel('MAJ_SHOW_HTML_FOOTER', $module->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE), 'class="form-control"');
        ?>
        			<p class="small text-muted">
        				<?php 
        echo I18N::translate('Select the access level until which the additional footer should be displayed. The <em>Hide from everyone</em> should be used to show the footer to everybody.');
        ?>
        			</p>
        		</div>
        	</div>
        	
        	<!--  MAJ_HTML_FOOTER -->        	
        	<div class="form-group">			
        		<label for="MAJ_HTML_FOOTER" class="col-sm-3 control-label">
        			<?php 
        echo I18N::translate('Additional HTML in footer');
        ?>
        		</label>
    			<div class="col-sm-9">
    				<textarea class="form-control html-edit" rows="10" dir="auto" id="MAJ_HTML_FOOTER" name="MAJ_HTML_FOOTER" ><?php 
        echo Filter::escapeHtml($module->getSetting('MAJ_HTML_FOOTER'));
        ?>
</textarea>
        			<p class="small text-muted">
        				<?php 
        echo I18N::translate('If the option has been enabled, the saved HTML will be inserted in the footer, before the logo.');
        ?>
<br>
        				<?php 
        echo I18N::translate('In edit mode, the HTML characters might have been transformed to their HTML equivalents (for instance &amp;gt; for &gt;), it is however possible to insert HTML characters, they will be automatically converted to their equivalent values.');
        ?>
        			</p>
        		</div>        		
        	</div>
        	
        	<div class="form-group">
        		<div class="col-sm-offset-3 col-sm-9">
        			<button type="submit" class="btn btn-primary">
        				<i class="fa fa-check"></i>
        				<?php 
        echo I18N::translate('save');
        ?>
        			</button>
        		</div>
        	</div>
        	
        </form>
		
		<?php 
    }
Ejemplo n.º 25
0
    /**
     * Get the contents of sidebar.
     *
     * @return string
     */
    public function getSideBarContent()
    {
        global $controller;
        $html = '';
        $active = 0;
        $n = 0;
        foreach (Module::getActiveSidebars($this->record->getTree()) as $mod) {
            if ($mod->hasSidebarContent()) {
                $html .= '<h3 id="' . $mod->getName() . '"><a href="#">' . $mod->getTitle() . '</a></h3>';
                $html .= '<div id="sb_content_' . $mod->getName() . '">' . $mod->getSidebarContent() . '</div>';
                // The family navigator should be opened by default
                if ($mod->getName() == 'family_nav') {
                    $active = $n;
                }
                ++$n;
            }
        }
        if ($html) {
            $controller->addInlineJavascript('
				jQuery("#sidebarAccordion").accordion({
					active:' . $active . ',
					heightStyle: "content",
					collapsible: true,
				});
			');
            return '<div id="sidebar"><div id="sidebarAccordion">' . $html . '</div></div>';
        } else {
            return '';
        }
    }
Ejemplo n.º 26
0
    /**
     * Called by placelist.php
     *
     * @param string $placelevels
     */
    public function createMap($placelevels)
    {
        global $level, $levelm, $plzoom, $controller, $WT_TREE;
        Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
        $STREETVIEW = $this->getSetting('GM_USE_STREETVIEW');
        $parent = Filter::getArray('parent');
        // create the map
        echo '<table style="margin:20px auto 0 auto;"><tr valign="top"><td>';
        //<!-- start of map display -->
        echo '<table><tr valign="top">';
        echo '<td class="center" width="200px">';
        $levelm = $this->setLevelMap($level, $parent);
        $latlng = Database::prepare("SELECT pl_place, pl_id, pl_lati, pl_long, pl_zoom, sv_long, sv_lati, sv_bearing, sv_elevation, sv_zoom FROM `##placelocation` WHERE pl_id=?")->execute(array($levelm))->fetch(PDO::FETCH_ASSOC);
        if ($STREETVIEW && $level != 0) {
            echo '<div id="place_map" style="margin-top:20px; border:1px solid gray; width: ', $this->getSetting('GM_PH_XSIZE'), 'px; height: ', $this->getSetting('GM_PH_YSIZE'), 'px; ';
        } else {
            echo '<div id="place_map" style="border:1px solid gray; width:', $this->getSetting('GM_PH_XSIZE'), 'px; height:', $this->getSetting('GM_PH_YSIZE'), 'px; ';
        }
        echo "\"><i class=\"icon-loading-large\"></i></div>";
        echo '</td>';
        echo '<script src="', $this->googleMapsScript(), '"></script>';
        $plzoom = $latlng['pl_zoom'];
        // Map zoom level
        if (Auth::isAdmin()) {
            $placecheck_url = 'module.php?mod=googlemap&amp;mod_action=admin_placecheck';
            if ($parent && isset($parent[0])) {
                $placecheck_url .= '&amp;country=' . $parent[0];
                if (isset($parent[1])) {
                    $placecheck_url .= '&amp;state=' . $parent[1];
                }
            }
            $adminplaces_url = 'module.php?mod=googlemap&amp;mod_action=admin_places';
            if ($latlng && isset($latlng['pl_id'])) {
                $adminplaces_url .= '&amp;parent=' . $latlng['pl_id'];
            }
            echo '</tr><tr><td>';
            echo '<a href="module.php?mod=googlemap&amp;mod_action=admin_config">', I18N::translate('Google Maps™ preferences'), '</a>';
            echo '&nbsp;|&nbsp;';
            echo '<a href="' . $adminplaces_url . '">', I18N::translate('Geographic data'), '</a>';
            echo '&nbsp;|&nbsp;';
            echo '<a href="' . $placecheck_url . '">', I18N::translate('Place check'), '</a>';
            if (Module::getModuleByName('batch_update')) {
                $placelevels = preg_replace('/, ' . I18N::translate('unknown') . '/', ', ', $placelevels);
                // replace ", unknown" with ", "
                $placelevels = substr($placelevels, 2);
                // remove the leading ", "
                if ($placelevels) {
                    $batchupdate_url = 'module.php?mod=batch_update&amp;mod_action=admin_batch_update&amp;plugin=BatchUpdateSearchReplacePlugin&amp;method=exact&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;search=' . urlencode($placelevels);
                    // exact match
                    echo '&nbsp;|&nbsp;';
                    echo '<a href="' . $batchupdate_url . '">', I18N::translate('Batch update'), '</a>';
                }
            }
        }
        echo '</td></tr></table>';
        echo '</td>';
        echo '<td style="margin-left:15px; float:right;">';
        if ($STREETVIEW) {
            $controller->addInlineJavascript('
				function update_sv_params(placeid) {
					var svlati = document.getElementById("sv_latiText").value.slice(0, -1);
					var svlong = document.getElementById("sv_longText").value.slice(0, -1);
					var svbear = document.getElementById("sv_bearText").value.slice(0, -1);
					var svelev = document.getElementById("sv_elevText").value.slice(0, -1);
					var svzoom = document.getElementById("sv_zoomText").value;
					win03 = window.open("module.php?mod=googlemap&mod_action=places_edit&action=update_sv_params&placeid="+placeid+"&svlati="+svlati+"&svlong="+svlong+"&svbear="+svbear+"&svelev="+svelev+"&svzoom="+svzoom, "win03", indx_window_specs);
					if (window.focus) {win03.focus();}
				}
			');
            global $pl_lati, $pl_long;
            if ($level >= 1) {
                $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlng['pl_lati']);
                // WT_placelocation lati
                $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlng['pl_long']);
                // WT_placelocation long
                // Check if Streetview location parameters are stored in database
                $placeid = $latlng['pl_id'];
                // Placelocation place id
                $sv_lat = $latlng['sv_lati'];
                // StreetView Point of View Latitude
                $sv_lng = $latlng['sv_long'];
                // StreetView Point of View Longitude
                $sv_dir = $latlng['sv_bearing'];
                // StreetView Point of View Direction (degrees from North)
                $sv_pitch = $latlng['sv_elevation'];
                // StreetView Point of View Elevation (+90 to -90 degrees (+=down, -=up)
                $sv_zoom = $latlng['sv_zoom'];
                // StreetView Point of View Zoom (0, 1, 2 or 3)
                // Check if Street View Lati/Long are the default of 0, if so use regular Place Lati/Long to set an initial location for the panda
                if ($latlng['sv_lati'] == 0 && $latlng['sv_long'] == 0) {
                    $sv_lat = $pl_lati;
                    $sv_lng = $pl_long;
                }
                ?>
				<div>
				<iframe style="background: transparent; margin-top: -3px; margin-left: 2px; width: 530px; height: 405px; padding: 0; border: 0;" src="module.php?mod=googlemap&amp;mod_action=wt_street_view&amp;x=<?php 
                echo $sv_lng;
                ?>
&amp;y=<?php 
                echo $sv_lat;
                ?>
&amp;z=18&amp;t=2&amp;c=1&amp;s=1&amp;b=<?php 
                echo $sv_dir;
                ?>
&amp;p=<?php 
                echo $sv_pitch;
                ?>
&amp;m=<?php 
                echo $sv_zoom;
                ?>
&amp;j=1&amp;k=1&amp;v=1" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe>
				</div>

				<?php 
                $list_latlon = GedcomTag::getLabel('LATI') . "<input name='sv_latiText' id='sv_latiText' type='text' style='width:42px; background:none; border:none;' value='" . $sv_lat . "'>" . GedcomTag::getLabel('LONG') . "<input name='sv_longText' id='sv_longText' type='text' style='width:42px; background:none; border:none;' value='" . $sv_lng . "'>" . I18N::translate('Bearing') . "<input name='sv_bearText' id='sv_bearText' type='text' style='width:46px; background:none; border:none;' value='" . $sv_dir . "'>" . I18N::translate('Elevation') . "<input name='sv_elevText' id='sv_elevText' type='text' style='width:30px; background:none; border:none;' value='" . $sv_pitch . "'>" . I18N::translate('Zoom') . "<input name='sv_zoomText' id='sv_zoomText' type='text' style='width:30px; background:none; border:none;' value='" . $sv_zoom . "'>\n\t\t\t\t";
                if (Auth::isAdmin()) {
                    echo "<table align=\"center\" style=\"margin-left:6px; border:solid 1px black; width:522px; margin-top:-28px; background:#cccccc; \">";
                } else {
                    echo "<table align=\"center\" style=\"display:none; \">";
                }
                echo "<tr><td>";
                echo "<form style=\"text-align:left; margin-left:5px; font:11px verdana; color:blue;\" method=\"post\" action=\"\">";
                echo $list_latlon;
                echo "<input type=\"submit\" name=\"Submit\" onclick=\"update_sv_params({$placeid});\" value=\"", I18N::translate('save'), "\">";
                echo "</form>";
                echo "</td></tr>";
                echo "</table>";
            }
            // Next line puts Place hierarchy on new row -----
            echo '</td></tr><tr>';
        }
        // End Streetview window ===================================================================
    }
Ejemplo n.º 27
0
 /**
  * Generate both the HTML and PNG components of the fan chart
  *
  * The HTML and PNG components both require the same co-ordinate calculations,
  * so we generate them using the same code, but we send them in separate
  * HTTP requests.
  *
  * @param string $what "png" or "html"
  *
  * @return string
  */
 public function generateFanChart($what)
 {
     $treeid = $this->sosaAncestors($this->generations);
     $fanw = 640 * $this->fan_width / 100;
     $fandeg = 90 * $this->fan_style;
     $html = '';
     $treesize = count($treeid) + 1;
     // generations count
     $gen = log($treesize) / log(2) - 1;
     $sosa = $treesize - 1;
     // fan size
     if ($fandeg == 0) {
         $fandeg = 360;
     }
     $fandeg = min($fandeg, 360);
     $fandeg = max($fandeg, 90);
     $cx = $fanw / 2 - 1;
     // center x
     $cy = $cx;
     // center y
     $rx = $fanw - 1;
     $rw = $fanw / ($gen + 1);
     $fanh = $fanw;
     // fan height
     if ($fandeg == 180) {
         $fanh = round($fanh * ($gen + 1) / ($gen * 2));
     }
     if ($fandeg == 270) {
         $fanh = round($fanh * 0.86);
     }
     $scale = $fanw / 640;
     // image init
     $image = ImageCreate($fanw, $fanh);
     $white = ImageColorAllocate($image, 0xff, 0xff, 0xff);
     ImageFilledRectangle($image, 0, 0, $fanw, $fanh, $white);
     ImageColorTransparent($image, $white);
     $color = ImageColorAllocate($image, hexdec(substr(Theme::theme()->parameter('chart-font-color'), 0, 2)), hexdec(substr(Theme::theme()->parameter('chart-font-color'), 2, 2)), hexdec(substr(Theme::theme()->parameter('chart-font-color'), 4, 2)));
     $bgcolor = ImageColorAllocate($image, hexdec(substr(Theme::theme()->parameter('chart-background-u'), 0, 2)), hexdec(substr(Theme::theme()->parameter('chart-background-u'), 2, 2)), hexdec(substr(Theme::theme()->parameter('chart-background-u'), 4, 2)));
     $bgcolorM = ImageColorAllocate($image, hexdec(substr(Theme::theme()->parameter('chart-background-m'), 0, 2)), hexdec(substr(Theme::theme()->parameter('chart-background-m'), 2, 2)), hexdec(substr(Theme::theme()->parameter('chart-background-m'), 4, 2)));
     $bgcolorF = ImageColorAllocate($image, hexdec(substr(Theme::theme()->parameter('chart-background-f'), 0, 2)), hexdec(substr(Theme::theme()->parameter('chart-background-f'), 2, 2)), hexdec(substr(Theme::theme()->parameter('chart-background-f'), 4, 2)));
     // imagemap
     $imagemap = '<map id="fanmap" name="fanmap">';
     // loop to create fan cells
     while ($gen >= 0) {
         // clean current generation area
         $deg2 = 360 + ($fandeg - 180) / 2;
         $deg1 = $deg2 - $fandeg;
         ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bgcolor, IMG_ARC_PIE);
         $rx -= 3;
         // calculate new angle
         $p2 = pow(2, $gen);
         $angle = $fandeg / $p2;
         $deg2 = 360 + ($fandeg - 180) / 2;
         $deg1 = $deg2 - $angle;
         // special case for rootid cell
         if ($gen == 0) {
             $deg1 = 90;
             $deg2 = 360 + $deg1;
         }
         // draw each cell
         while ($sosa >= $p2) {
             $person = $treeid[$sosa];
             if ($person) {
                 $name = $person->getFullName();
                 $addname = $person->getAddName();
                 $text = I18N::reverseText($name);
                 if ($addname) {
                     $text .= "\n" . I18N::reverseText($addname);
                 }
                 $text .= "\n" . I18N::reverseText($person->getLifeSpan());
                 switch ($person->getSex()) {
                     case 'M':
                         $bg = $bgcolorM;
                         break;
                     case 'F':
                         $bg = $bgcolorF;
                         break;
                     default:
                         $bg = $bgcolor;
                         break;
                 }
                 ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bg, IMG_ARC_PIE);
                 // split and center text by lines
                 $wmax = (int) ($angle * 7 / Theme::theme()->parameter('chart-font-size') * $scale);
                 $wmax = min($wmax, 35 * $scale);
                 if ($gen == 0) {
                     $wmax = min($wmax, 17 * $scale);
                 }
                 $text = $this->splitAlignText($text, $wmax);
                 // text angle
                 $tangle = 270 - ($deg1 + $angle / 2);
                 if ($gen == 0) {
                     $tangle = 0;
                 }
                 // calculate text position
                 $deg = $deg1 + 0.44;
                 if ($deg2 - $deg1 > 40) {
                     $deg = $deg1 + ($deg2 - $deg1) / 11;
                 }
                 if ($deg2 - $deg1 > 80) {
                     $deg = $deg1 + ($deg2 - $deg1) / 7;
                 }
                 if ($deg2 - $deg1 > 140) {
                     $deg = $deg1 + ($deg2 - $deg1) / 4;
                 }
                 if ($gen == 0) {
                     $deg = 180;
                 }
                 $rad = deg2rad($deg);
                 $mr = ($rx - $rw / 4) / 2;
                 if ($gen > 0 && $deg2 - $deg1 > 80) {
                     $mr = $rx / 2;
                 }
                 $tx = $cx + $mr * cos($rad);
                 $ty = $cy - $mr * -sin($rad);
                 if ($sosa == 1) {
                     $ty -= $mr / 2;
                 }
                 // print text
                 ImageTtfText($image, Theme::theme()->parameter('chart-font-size'), $tangle, $tx, $ty, $color, Theme::theme()->parameter('chart-font-name'), $text);
                 $imagemap .= '<area shape="poly" coords="';
                 // plot upper points
                 $mr = $rx / 2;
                 $deg = $deg1;
                 while ($deg <= $deg2) {
                     $rad = deg2rad($deg);
                     $tx = round($cx + $mr * cos($rad));
                     $ty = round($cy - $mr * -sin($rad));
                     $imagemap .= "{$tx},{$ty},";
                     $deg += ($deg2 - $deg1) / 6;
                 }
                 // plot lower points
                 $mr = ($rx - $rw) / 2;
                 $deg = $deg2;
                 while ($deg >= $deg1) {
                     $rad = deg2rad($deg);
                     $tx = round($cx + $mr * cos($rad));
                     $ty = round($cy - $mr * -sin($rad));
                     $imagemap .= "{$tx},{$ty},";
                     $deg -= ($deg2 - $deg1) / 6;
                 }
                 // join first point
                 $mr = $rx / 2;
                 $deg = $deg1;
                 $rad = deg2rad($deg);
                 $tx = round($cx + $mr * cos($rad));
                 $ty = round($cy - $mr * -sin($rad));
                 $imagemap .= "{$tx},{$ty}";
                 // add action url
                 $pid = $person->getXref();
                 $imagemap .= '" href="#' . $pid . '"';
                 $tempURL = 'fanchart.php?rootid=' . $pid . '&amp;generations=' . $this->generations . '&amp;fan_width=' . $this->fan_width . '&amp;fan_style=' . $this->fan_style . '&amp;ged=' . $person->getTree()->getNameUrl();
                 $html .= '<div id="' . $pid . '" class="fan_chart_menu">';
                 $html .= '<div class="person_box"><div class="details1">';
                 $html .= '<a href="' . $person->getHtmlUrl() . '" class="name1">' . $name;
                 if ($addname) {
                     $html .= $addname;
                 }
                 $html .= '</a>';
                 $html .= '<ul class="charts">';
                 $html .= '<li><a href="pedigree.php?rootid=' . $pid . '&amp;ged=' . $person->getTree()->getNameUrl() . '" >' . I18N::translate('Pedigree') . '</a></li>';
                 if (Module::getModuleByName('googlemap')) {
                     $html .= '<li><a href="module.php?mod=googlemap&amp;mod_action=pedigree_map&amp;rootid=' . $pid . '&amp;ged=' . $person->getTree()->getNameUrl() . '">' . I18N::translate('Pedigree map') . '</a></li>';
                 }
                 $gedcomid = $person->getTree()->getUserPreference(Auth::user(), 'gedcomid');
                 if ($gedcomid && $gedcomid != $pid) {
                     $html .= '<li><a href="relationship.php?pid1=' . $gedcomid . '&amp;pid2=' . $pid . '&amp;ged=' . $person->getTree()->getNameUrl() . '">' . I18N::translate('Relationship to me') . '</a></li>';
                 }
                 $html .= '<li><a href="descendancy.php?rootid=' . $pid . '&amp;ged=' . $person->getTree()->getNameUrl() . '" >' . I18N::translate('Descendants') . '</a></li>';
                 $html .= '<li><a href="ancestry.php?rootid=' . $pid . '&amp;ged=' . $person->getTree()->getNameUrl() . '">' . I18N::translate('Ancestors') . '</a></li>';
                 $html .= '<li><a href="compact.php?rootid=' . $pid . '&amp;ged=' . $person->getTree()->getNameUrl() . '">' . I18N::translate('Compact tree') . '</a></li>';
                 $html .= '<li><a href="' . $tempURL . '">' . I18N::translate('Fan chart') . '</a></li>';
                 $html .= '<li><a href="hourglass.php?rootid=' . $pid . '&amp;ged=' . $person->getTree()->getNameUrl() . '">' . I18N::translate('Hourglass chart') . '</a></li>';
                 if (Module::getModuleByName('tree')) {
                     $html .= '<li><a href="module.php?mod=tree&amp;mod_action=treeview&amp;ged=' . $person->getTree()->getNameUrl() . '&amp;rootid=' . $pid . '">' . I18N::translate('Interactive tree') . '</a></li>';
                 }
                 $html .= '</ul>';
                 // spouse(s) and children
                 foreach ($person->getSpouseFamilies() as $family) {
                     $spouse = $family->getSpouse($person);
                     if ($spouse) {
                         $html .= '<a href="' . $spouse->getHtmlUrl() . '" class="name1">' . $spouse->getFullName() . '</a>';
                         $kids = $family->getChildren();
                         if ($kids) {
                             $html .= '<ul class="children">';
                             foreach ($kids as $child) {
                                 $html .= '<li><a href="' . $child->getHtmlUrl() . '" class="name1">' . $child->getFullName() . '</a></li>';
                             }
                             $html .= '</ul>';
                         }
                     }
                 }
                 // siblings
                 foreach ($person->getChildFamilies() as $family) {
                     $children = $family->getChildren();
                     if ($children) {
                         $html .= '<div class="name1">';
                         // With two children in a family, you have only one sibling.
                         $html .= count($children) > 2 ? I18N::translate('Siblings') : I18N::translate('Sibling');
                         $html .= '</div>';
                         $html .= '<ul class="siblings">';
                         foreach ($children as $sibling) {
                             if ($sibling !== $person) {
                                 $html .= '<li><a href="' . $sibling->getHtmlUrl() . '" class="name1"> ' . $sibling->getFullName() . '</a></li>';
                             }
                         }
                         $html .= '</ul>';
                     }
                 }
                 $html .= '</div></div>';
                 $html .= '</div>';
                 $imagemap .= ' alt="' . strip_tags($person->getFullName()) . '" title="' . strip_tags($person->getFullName()) . '">';
             }
             $deg1 -= $angle;
             $deg2 -= $angle;
             $sosa--;
         }
         $rx -= $rw;
         $gen--;
     }
     $imagemap .= '</map>';
     switch ($what) {
         case 'html':
             return $html . $imagemap . '<div id="fan_chart_img"><img src="' . WT_SCRIPT_NAME . '?rootid=' . $this->root->getXref() . '&amp;fan_style=' . $this->fan_style . '&amp;generations=' . $this->generations . '&amp;fan_width=' . $this->fan_width . '&amp;img=1" width="' . $fanw . '" height="' . $fanh . '" alt="' . strip_tags($this->getPageTitle()) . '" usemap="#fanmap"></div>';
         case 'png':
             ImageStringUp($image, 1, $fanw - 10, $fanh / 3, WT_BASE_URL, $color);
             ob_start();
             ImagePng($image);
             ImageDestroy($image);
             return ob_get_clean();
         default:
             throw new \InvalidArgumentException(__METHOD__ . ' ' . $what);
     }
 }
Ejemplo n.º 28
0
 /**
  * A menu with a list of reports.
  *
  * @return Menu|null
  */
 protected function menuReports()
 {
     $submenus = array();
     foreach (Module::getActiveReports($this->tree) as $report) {
         $submenus[] = $report->getReportMenu();
     }
     if ($submenus) {
         return new Menu(I18N::translate('Reports'), '#', 'menu-report', array('rel' => 'nofollow'), $submenus);
     } else {
         return null;
     }
 }
Ejemplo n.º 29
0
/**
 * Defined in session.php
 *
 * @global Tree $WT_TREE
 */
global $WT_TREE;
use Fisharebest\Webtrees\Controller\AncestryController;
use Fisharebest\Webtrees\Functions\FunctionsCharts;
use Fisharebest\Webtrees\Functions\FunctionsEdit;
use Fisharebest\Webtrees\Functions\FunctionsPrint;
use Fisharebest\Webtrees\Functions\FunctionsPrintLists;
define('WT_SCRIPT_NAME', 'ancestry.php');
require './includes/session.php';
$MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS');
$controller = new AncestryController();
$controller->restrictAccess(Module::isActiveChart($WT_TREE, 'ancestors_chart'))->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();');
?>
<div id="ancestry-page">
	<h2><?php 
echo $controller->getPageTitle();
?>
</h2>
	<form name="people" id="people" method="get" action="?">
		<input type="hidden" name="ged" value="<?php 
echo $WT_TREE->getNameHtml();
?>
">
		<table class="list_table">
			<tbody>
				<tr>
					<td class="descriptionbox">
Ejemplo n.º 30
0
 /**
  * Create a new tree
  *
  * @param string $tree_name
  * @param string $tree_title
  *
  * @return Tree
  */
 public static function create($tree_name, $tree_title)
 {
     try {
         // Create a new tree
         Database::prepare("INSERT INTO `##gedcom` (gedcom_name) VALUES (?)")->execute(array($tree_name));
         $tree_id = Database::prepare("SELECT LAST_INSERT_ID()")->fetchOne();
     } catch (PDOException $ex) {
         // A tree with that name already exists?
         return self::findByName($tree_name);
     }
     // Update the list of trees - to include this new one
     self::$trees = null;
     $tree = self::findById($tree_id);
     $tree->setPreference('imported', '0');
     $tree->setPreference('title', $tree_title);
     // Module privacy
     Module::setDefaultAccess($tree_id);
     // Set preferences from default tree
     Database::prepare("INSERT INTO `##gedcom_setting` (gedcom_id, setting_name, setting_value)" . " SELECT :tree_id, setting_name, setting_value" . " FROM `##gedcom_setting` WHERE gedcom_id = -1")->execute(array('tree_id' => $tree_id));
     Database::prepare("INSERT INTO `##default_resn` (gedcom_id, tag_type, resn)" . " SELECT :tree_id, tag_type, resn" . " FROM `##default_resn` WHERE gedcom_id = -1")->execute(array('tree_id' => $tree_id));
     Database::prepare("INSERT INTO `##block` (gedcom_id, location, block_order, module_name)" . " SELECT :tree_id, location, block_order, module_name" . " FROM `##block` WHERE gedcom_id = -1")->execute(array('tree_id' => $tree_id));
     // Gedcom and privacy settings
     $tree->setPreference('CONTACT_USER_ID', Auth::id());
     $tree->setPreference('WEBMASTER_USER_ID', Auth::id());
     $tree->setPreference('LANGUAGE', WT_LOCALE);
     // Default to the current admin’s language
     switch (WT_LOCALE) {
         case 'es':
             $tree->setPreference('SURNAME_TRADITION', 'spanish');
             break;
         case 'is':
             $tree->setPreference('SURNAME_TRADITION', 'icelandic');
             break;
         case 'lt':
             $tree->setPreference('SURNAME_TRADITION', 'lithuanian');
             break;
         case 'pl':
             $tree->setPreference('SURNAME_TRADITION', 'polish');
             break;
         case 'pt':
         case 'pt-BR':
             $tree->setPreference('SURNAME_TRADITION', 'portuguese');
             break;
         default:
             $tree->setPreference('SURNAME_TRADITION', 'paternal');
             break;
     }
     // Genealogy data
     // It is simpler to create a temporary/unimported GEDCOM than to populate all the tables...
     $john_doe = I18N::translate('John /DOE/');
     $note = I18N::translate('Edit this individual and replace their details with your own.');
     Database::prepare("INSERT INTO `##gedcom_chunk` (gedcom_id, chunk_data) VALUES (?, ?)")->execute(array($tree_id, "0 HEAD\n1 CHAR UTF-8\n0 @I1@ INDI\n1 NAME {$john_doe}\n1 SEX M\n1 BIRT\n2 DATE 01 JAN 1850\n2 NOTE {$note}\n0 TRLR\n"));
     // Update our cache
     self::$trees[$tree->tree_id] = $tree;
     return $tree;
 }