本文整理汇总了PHP中Fisharebest\Webtrees\Module类的典型用法代码示例。如果您正苦于以下问题:PHP Module类的具体用法?PHP Module怎么用?PHP Module使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Module类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getEditMenu
/**
* 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;
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:34,代码来源:RepositoryController.php
示例2: getEditMenu
/**
* 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;
}
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:29,代码来源:NoteController.php
示例3: getEditMenu
/**
* 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;
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:29,代码来源:MediaController.php
示例4: upgrade
/**
* 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')");
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:10,代码来源:Migration34.php
示例5: validatePrerequisites
/**
* {@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;
}
开发者ID:jon48,项目名称:webtrees-lib,代码行数:13,代码来源:GeoDispersionModule.php
示例6: upgrade
/**
* 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');
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:50,代码来源:Migration0.php
示例7: getTitles
/**
* 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;
}
开发者ID:jon48,项目名称:webtrees-lib,代码行数:22,代码来源:Individual.php
示例8: getPossibleHooks
/**
* {@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;
}
开发者ID:jon48,项目名称:webtrees-lib,代码行数:44,代码来源:HookProvider.php
示例9: getBlock
/**
* 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 . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('My pedigree') . '</a></td>';
}
$content .= '<td><a href="individual.php?pid=' . $gedcomid . '&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;
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:UserWelcomeModule.php
示例10: getEditMenu
/**
* 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;
}
开发者ID:tunandras,项目名称:webtrees,代码行数:41,代码来源:MediaController.php
示例11: isOperational
/**
* {@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];
}
开发者ID:jon48,项目名称:webtrees-lib,代码行数:27,代码来源:ModuleManager.php
示例12: getBlock
/**
* 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 . '&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 . '&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;
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:32,代码来源:WelcomeBlockModule.php
示例13: getEditMenu
/**
* 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&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;
}
开发者ID:josefpavlik,项目名称:webtrees,代码行数:40,代码来源:SourceController.php
示例14: getTabContent
/**
* 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
|
请发表评论