• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Webtrees\Tree类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Fisharebest\Webtrees\Tree的典型用法代码示例。如果您正苦于以下问题:PHP Tree类的具体用法?PHP Tree怎么用?PHP Tree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Tree类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: applyWatermark

/**
 * The media firewall passes in an image
 * this function can manipulate the image however it wants
 * before returning it back to the media firewall
 *
 * @param resource $im
 * @param Tree     $tree
 *
 * @return resource
 */
function applyWatermark($im, Tree $tree)
{
    // text to watermark with
    $word1_text = $tree->getTitle();
    // maximum font size for “word1” ; will be automaticaly reduced to fit in the image
    $word1_maxsize = 100;
    // rgb color codes for text
    $word1_color = '0,0,0';
    // ttf font file to use
    $word1_font = WT_ROOT . Config::FONT_DEJAVU_SANS_TTF;
    // vertical position for the text to past; possible values are: top, middle or bottom, across
    $word1_vpos = 'across';
    // horizontal position for the text to past in media file; possible values are: left, right, top2bottom, bottom2top
    // this value is used only if $word1_vpos=across
    $word1_hpos = 'left';
    $word2_text = $_SERVER['HTTP_HOST'];
    $word2_maxsize = 20;
    $word2_color = '0,0,0';
    $word2_font = WT_ROOT . Config::FONT_DEJAVU_SANS_TTF;
    $word2_vpos = 'top';
    $word2_hpos = 'top2bottom';
    embedText($im, $word1_text, $word1_maxsize, $word1_color, $word1_font, $word1_vpos, $word1_hpos);
    embedText($im, $word2_text, $word2_maxsize, $word2_color, $word2_font, $word2_vpos, $word2_hpos);
    return $im;
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:35,代码来源:mediafirewall.php


示例2: send

 /**
  * Send an external email message
  * Caution! gmail may rewrite the "From" header unless you have added the address to your account.
  *
  * @param Tree   $tree
  * @param string $to_email
  * @param string $to_name
  * @param string $replyto_email
  * @param string $replyto_name
  * @param string $subject
  * @param string $message
  *
  * @return bool
  */
 public static function send(Tree $tree, $to_email, $to_name, $replyto_email, $replyto_name, $subject, $message)
 {
     try {
         $mail = Swift_Message::newInstance()->setSubject($subject)->setFrom(Site::getPreference('SMTP_FROM_NAME'), $tree->getPreference('title'))->setTo($to_email, $to_name)->setReplyTo($replyto_email, $replyto_name)->setBody($message, 'text/html')->addPart(Filter::unescapeHtml($message), 'text/plain');
         Swift_Mailer::newInstance(self::transport())->send($mail);
     } catch (Exception $ex) {
         Log::addErrorLog('Mail: ' . $ex->getMessage());
         return false;
     }
     return true;
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:25,代码来源:Mail.php


示例3: send

 /**
  * Send an external email message
  * Caution! gmail may rewrite the "From" header unless you have added the address to your account.
  *
  * @param Tree   $tree
  * @param string $to_email
  * @param string $to_name
  * @param string $replyto_email
  * @param string $replyto_name
  * @param string $subject
  * @param string $message
  *
  * @return bool
  */
 public static function send(Tree $tree, $to_email, $to_name, $replyto_email, $replyto_name, $subject, $message)
 {
     try {
         $mail = new Zend_Mail('UTF-8');
         $mail->setSubject($subject)->setBodyHtml($message)->setBodyText(Filter::unescapeHtml($message))->setFrom(Site::getPreference('SMTP_FROM_NAME'), $tree->getPreference('title'))->addTo($to_email, $to_name)->setReplyTo($replyto_email, $replyto_name)->send(self::transport());
     } catch (\Exception $ex) {
         Log::addErrorLog('Mail: ' . $ex->getMessage());
         return false;
     }
     return true;
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:25,代码来源:Mail.php


示例4: upgrade

 /** {@inheritDoc} */
 public function upgrade()
 {
     // add key 'LINK' to FTV_SETTINGS
     // change options to multidimensional array with array key = tree id.
     $module_settings = 'FTV_SETTINGS';
     $ftv_settings = Database::prepare("SELECT setting_value FROM `##module_setting` WHERE setting_name=?")->execute(array($module_settings))->fetchOne();
     $settings = unserialize($ftv_settings);
     if (!empty($settings)) {
         foreach ($settings as $setting) {
             if (!array_key_exists('LINK', $setting)) {
                 $setting['LINK'] = I18N::translate('Descendants of the %s family', $setting['SURNAME']);
                 $new_settings[] = $setting;
             }
         }
         if (isset($new_settings)) {
             Database::prepare("UPDATE `##module_setting` SET setting_value=? WHERE setting_name=?")->execute(array(serialize($new_settings), $module_settings));
         }
         unset($new_settings);
     }
     $module_options = 'FTV_OPTIONS';
     $ftv_options = Database::prepare("SELECT setting_value FROM `##module_setting` WHERE setting_name=?")->execute(array($module_options))->fetchOne();
     $options = unserialize($ftv_options);
     if (!empty($options)) {
         $show_places = array_key_exists('SHOW_PLACES', $options) ? $options['SHOW_PLACES'] : '1';
         $country = array_key_exists('COUNTRY', $options) ? $options['COUNTRY'] : '';
         $show_occu = array_key_exists('SHOW_OCCU', $options) ? $options['SHOW_OCCU'] : '1';
         foreach (Tree::getAll() as $tree) {
             $new_options[$tree->getTreeId()] = array('SHOW_PLACES' => $show_places, 'COUNTRY' => $country, 'SHOW_OCCU' => $show_occu);
         }
         if (isset($new_options)) {
             Database::prepare("UPDATE `##module_setting` SET setting_value=? WHERE setting_name=?")->execute(array(serialize($new_options), $module_options));
         }
         unset($new_options);
     }
 }
开发者ID:bxbroze,项目名称:webtrees,代码行数:36,代码来源:Migration0.php


示例5: getPlacesHierarchyFromData

 /**
  * Returns an array of the place hierarchy, based on a random example of place within the GEDCOM.
  * It will look for the longest hierarchy in the tree.
  * The places are reversed compared to normal GEDCOM structure.
  * 
  * @return array
  */
 protected function getPlacesHierarchyFromData()
 {
     $nb_levels = 0;
     //Select all '2 PLAC ' tags in the file and create array
     $places_list = array();
     $ged_data = Database::prepare('SELECT i_gedcom AS gedcom' . ' FROM `##individuals`' . ' WHERE i_gedcom LIKE :gedcom AND i_file = :gedcom_id' . ' UNION ALL' . 'SELECT f_gedcom AS gedcom' . ' FROM `##families`' . ' WHERE f_gedcom LIKE :gedcom AND f_file = :gedcom_id')->execute(array('gedcom' => '%\\n2 PLAC %', 'gedcom_id' => $this->tree->getTreeId()))->fetchOneColumn();
     foreach ($ged_data as $ged_datum) {
         $matches = null;
         preg_match_all('/\\n2 PLAC (.+)/', $ged_datum, $matches);
         foreach ($matches[1] as $match) {
             $places_list[$match] = true;
         }
     }
     // Unique list of places
     $places_list = array_keys($places_list);
     //sort the array, limit to unique values, and count them
     usort($places_list, array('I18N', 'strcasecmp'));
     //calculate maximum no. of levels to display
     $has_found_good_example = false;
     foreach ($places_list as $place) {
         $levels = explode(",", $place);
         $parts = count($levels);
         if ($parts >= $nb_levels) {
             $nb_levels = $parts;
             if (!$has_found_good_example) {
                 $random_place = $place;
                 if (min(array_map('strlen', $levels)) > 0) {
                     $has_found_good_example = true;
                 }
             }
         }
     }
     return array_reverse(array_map('trim', explode(',', $random_place)));
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:41,代码来源:GeoAnalysisProvider.php


示例6: load

 /**
  * Sometimes, we'll know in advance that we need to load a set of records.
  * Typically when we load families and their members.
  *
  * @param Tree  $tree
  * @param string[] $xrefs
  */
 public static function load(Tree $tree, array $xrefs)
 {
     $args = array('tree_id' => $tree->getTreeId());
     $placeholders = array();
     foreach (array_unique($xrefs) as $n => $xref) {
         if (!isset(self::$gedcom_record_cache[$tree->getTreeId()][$xref])) {
             $placeholders[] = ':x' . $n;
             $args['x' . $n] = $xref;
         }
     }
     if (!empty($placeholders)) {
         $rows = Database::prepare("SELECT i_id AS xref, i_gedcom AS gedcom" . " FROM `##individuals`" . " WHERE i_file = :tree_id AND i_id IN (" . implode(',', $placeholders) . ")")->execute($args)->fetchAll();
         foreach ($rows as $row) {
             self::getInstance($row->xref, $tree, $row->gedcom);
         }
     }
 }
开发者ID:bmhm,项目名称:webtrees,代码行数:24,代码来源:Individual.php


示例7: load

 /**
  * Sometimes, we'll know in advance that we need to load a set of records.
  * Typically when we load families and their members.
  *
  * @param Tree  $tree
  * @param string[] $xrefs
  */
 public static function load(Tree $tree, array $xrefs)
 {
     $sql = '';
     $args = array('tree_id' => $tree->getTreeId());
     foreach (array_unique($xrefs) as $n => $xref) {
         if (!isset(self::$gedcom_record_cache[$tree->getTreeId()][$xref])) {
             $sql .= ($n ? ',:x' : ':x') . $n;
             $args['x' . $n] = $xref;
         }
     }
     if (count($args) > 1) {
         $rows = Database::prepare("SELECT i_id AS xref, i_gedcom AS gedcom" . " FROM `##individuals`" . " WHERE i_file = :tree_id AND i_id IN (" . $sql . ")")->execute($args)->fetchAll();
         foreach ($rows as $row) {
             self::getInstance($row->xref, $tree, $row->gedcom);
         }
     }
 }
开发者ID:jflash,项目名称:webtrees,代码行数:24,代码来源:Individual.php


示例8: getAncestorDispersionForGen

 /**
  * Return a computed array of statistics about the dispersion of ancestors across the ancestors
  * at a specified generation.
  * This statistics cannot be used for generations above 11, as it would cause a out of range in MySQL
  * 
  * Format: 
  *  - key : a base-2 representation of the ancestor at generation G for which exclusive ancestors have been found,
  *          -1 is used for shared ancestors
  *          For instance base2(0100) = base10(4) represent the maternal grand father
  *  - values: number of ancestors exclusively in the ancestors of the ancestor in key
  *  
  *  For instance a result at generation 3 could be :
  *      array (   -1        =>  12      -> 12 ancestors are shared by the grand-parents
  *                base10(1) =>  32      -> 32 ancestors are exclusive to the paternal grand-father
  *                base10(2) =>  25      -> 25 ancestors are exclusive to the paternal grand-mother
  *                base10(4) =>  12      -> 12 ancestors are exclusive to the maternal grand-father
  *                base10(8) =>  30      -> 30 ancestors are exclusive to the maternal grand-mother
  *            )
  *  
  * @param int $gen Reference generation
  * @return array
  */
 public function getAncestorDispersionForGen($gen)
 {
     if (!$this->is_setup || $gen > 11) {
         return array();
     }
     // Going further than 11 gen will be out of range in the query
     return Database::prepare('SELECT branches, count(i_id)' . ' FROM (' . '   SELECT i_id,' . '       CASE' . '           WHEN CEIL(LOG2(SUM(branch))) = LOG2(SUM(branch)) THEN SUM(branch)' . '           ELSE -1' . '       END branches' . '   FROM (' . '       SELECT DISTINCT majs_i_id i_id,' . '           POW(2, FLOOR(majs_sosa / POW(2, (majs_gen - :gen))) - POW(2, :gen -1)) branch' . '       FROM `##maj_sosa`' . '       WHERE majs_gedcom_id = :tree_id AND majs_user_id = :user_id' . '           AND majs_gen >= :gen' . '   ) indistat' . '   GROUP BY i_id' . ') grouped' . ' GROUP BY branches')->execute(array('tree_id' => $this->tree->getTreeId(), 'user_id' => $this->user->getUserId(), 'gen' => $gen))->fetchAssoc() ?: array();
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:30,代码来源:SosaProvider.php


示例9: getActiveModulesByComponent

 /**
  * Get a list of modules which (a) provide a specific function and (b) we have permission to see.
  *
  * We cannot currently use auto-loading for modules, as there may be user-defined
  * modules about which the auto-loader knows nothing.
  *
  * @param Tree   $tree
  * @param string $component The type of module, such as "tab", "report" or "menu"
  *
  * @return AbstractModule[]
  */
 private static function getActiveModulesByComponent(Tree $tree, $component)
 {
     $module_names = Database::prepare("SELECT SQL_CACHE module_name" . " FROM `##module`" . " JOIN `##module_privacy` USING (module_name)" . " WHERE gedcom_id = :tree_id AND component = :component AND status = 'enabled' AND access_level >= :access_level" . " ORDER BY CASE component WHEN 'menu' THEN menu_order WHEN 'sidebar' THEN sidebar_order WHEN 'tab' THEN tab_order ELSE 0 END, module_name")->execute(array('tree_id' => $tree->getTreeId(), 'component' => $component, 'access_level' => Auth::accessLevel($tree)))->fetchOneColumn();
     $array = array();
     foreach ($module_names as $module_name) {
         $interface = '\\Fisharebest\\Webtrees\\Module\\Module' . ucfirst($component) . 'Interface';
         $module = self::getModuleByName($module_name);
         if ($module instanceof $interface) {
             $array[$module_name] = $module;
         }
     }
     // The order of menus/sidebars/tabs is defined in the database. Others are sorted by name.
     if ($component !== 'menu' && $component !== 'sidebar' && $component !== 'tab') {
         uasort($array, function (AbstractModule $x, AbstractModule $y) {
             return I18N::strcasecmp($x->getTitle(), $y->getTitle());
         });
     }
     return $array;
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:30,代码来源:Module.php


示例10: upgrade

 /**
  * Upgrade to to the next version
  */
 public function upgrade()
 {
     // - changes to the values for the gedcom setting SHOW_RELATIVES_EVENTS
     $settings = Database::prepare("SELECT gedcom_id, setting_value FROM `##gedcom_setting` WHERE setting_name='SHOW_RELATIVES_EVENTS'")->fetchAssoc();
     foreach ($settings as $gedcom_id => $setting) {
         // Delete old settings
         $setting = preg_replace('/_(BIRT|MARR|DEAT)_(COUS|MSIB|FSIB|GGCH|NEPH|GGPA)/', '', $setting);
         $setting = preg_replace('/_FAMC_(RESI_EMIG)/', '', $setting);
         // Rename settings
         $setting = preg_replace('/_MARR_(MOTH|FATH|FAMC)/', '_MARR_PARE', $setting);
         $setting = preg_replace('/_DEAT_(MOTH|FATH)/', '_DEAT_PARE', $setting);
         // Remove duplicates
         preg_match_all('/[_A-Z]+/', $setting, $match);
         // And save
         Tree::findById($gedcom_id)->setPreference('SHOW_RELATIVES_EVENTS', implode(',', array_unique($match[0])));
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:20,代码来源:Migration5.php


示例11: gedcomHeader

 /**
  * Create a header for a (newly-created or already-imported) gedcom file.
  *
  * @param Tree $tree
  *
  * @return string
  */
 public static function gedcomHeader(Tree $tree)
 {
     // Default values for a new header
     $HEAD = "0 HEAD";
     $SOUR = "\n1 SOUR " . WT_WEBTREES . "\n2 NAME " . WT_WEBTREES . "\n2 VERS " . WT_VERSION;
     $DEST = "\n1 DEST DISKETTE";
     $DATE = "\n1 DATE " . strtoupper(date("d M Y")) . "\n2 TIME " . date("H:i:s");
     $GEDC = "\n1 GEDC\n2 VERS 5.5.1\n2 FORM Lineage-Linked";
     $CHAR = "\n1 CHAR UTF-8";
     $FILE = "\n1 FILE " . $tree->getName();
     $LANG = "";
     $PLAC = "\n1 PLAC\n2 FORM City, County, State/Province, Country";
     $COPR = "";
     $SUBN = "";
     $SUBM = "\n1 SUBM @SUBM@\n0 @SUBM@ SUBM\n1 NAME " . Auth::user()->getUserName();
     // The SUBM record is mandatory
     // Preserve some values from the original header
     $record = GedcomRecord::getInstance('HEAD', $tree);
     if ($fact = $record->getFirstFact('PLAC')) {
         $PLAC = "\n1 PLAC\n2 FORM " . $fact->getAttribute('FORM');
     }
     if ($fact = $record->getFirstFact('LANG')) {
         $LANG = $fact->getValue();
     }
     if ($fact = $record->getFirstFact('SUBN')) {
         $SUBN = $fact->getValue();
     }
     if ($fact = $record->getFirstFact('COPR')) {
         $COPR = $fact->getValue();
     }
     // Link to actual SUBM/SUBN records, if they exist
     $subn = Database::prepare("SELECT o_id FROM `##other` WHERE o_type=? AND o_file=?")->execute(array('SUBN', $tree->getTreeId()))->fetchOne();
     if ($subn) {
         $SUBN = "\n1 SUBN @{$subn}@";
     }
     $subm = Database::prepare("SELECT o_id FROM `##other` WHERE o_type=? AND o_file=?")->execute(array('SUBM', $tree->getTreeId()))->fetchOne();
     if ($subm) {
         $SUBM = "\n1 SUBM @{$subm}@";
     }
     return $HEAD . $SOUR . $DEST . $DATE . $GEDC . $CHAR . $FILE . $COPR . $LANG . $PLAC . $SUBN . $SUBM . "\n";
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:48,代码来源:FunctionsExport.php


示例12: AjaxController

    http_response_code(403);
    return;
}
$controller = new AjaxController();
$controller->pageHeader();
// Don't allow the user to cancel the request.  We do not want to be left
// with an incomplete transaction.
ignore_user_abort(true);
// Run in a transaction
Database::beginTransaction();
// Only allow one process to import each gedcom at a time
Database::prepare("SELECT * FROM `##gedcom_chunk` WHERE gedcom_id=? FOR UPDATE")->execute(array($gedcom_id));
// What is the current import status?
$row = Database::prepare("SELECT" . " SUM(IF(imported, LENGTH(chunk_data), 0)) AS import_offset," . " SUM(LENGTH(chunk_data))                  AS import_total" . " FROM `##gedcom_chunk` WHERE gedcom_id=?")->execute(array($gedcom_id))->fetchOneRow();
if ($row->import_offset == $row->import_total) {
    Tree::findById($gedcom_id)->setPreference('imported', '1');
    // Finished?  Show the maintenance links, similar to admin_trees_manage.php
    Database::commit();
    $controller->addInlineJavascript('jQuery("#import' . $gedcom_id . '").addClass("hidden");' . 'jQuery("#actions' . $gedcom_id . '").removeClass("hidden");');
    return;
}
// Calculate progress so far
$progress = $row->import_offset / $row->import_total;
?>
<div class="progress" id="progress<?php 
echo $gedcom_id;
?>
">
	<div
		class="progress-bar"
		role="progressbar"
开发者ID:tunandras,项目名称:webtrees,代码行数:31,代码来源:import.php


示例13: header

/**
 * Defined in session.php
 *
 * @global Tree $WT_TREE
 */
global $WT_TREE;
use Fisharebest\Webtrees\Controller\PageController;
use Fisharebest\Webtrees\Module\CkeditorModule;
define('WT_SCRIPT_NAME', 'block_edit.php');
require './includes/session.php';
$block_id = Filter::getInteger('block_id');
$block = Database::prepare("SELECT SQL_CACHE * FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOneRow();
// Check access.  (1) the block must exist and be enabled, (2) gedcom blocks require
// managers, (3) user blocks require the user or an admin
$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);
开发者ID:tunandras,项目名称:webtrees,代码行数:31,代码来源:block_edit.php


示例14: adminPlaces


//.........这里部分代码省略.........

		<ul class="nav nav-tabs nav-justified" role="tablist">
			<li role="presentation">
				<a href="?mod=googlemap&amp;mod_action=admin_config" role="tab">
					<?php 
        echo I18N::translate('Google Maps™ preferences');
        ?>
				</a>
			</li>
			<li role="presentation" class="active">
				<a href="#">
					<?php 
        echo I18N::translate('Geographic data');
        ?>
				</a>
			</li>
			<li role="presentation">
				<a href="?mod=googlemap&amp;mod_action=admin_placecheck">
					<?php 
        echo I18N::translate('Place check');
        ?>
				</a>
			</li>
		</ul>

		<h2><?php 
        echo I18N::translate('Geographic data');
        ?>
</h2>
		<?php 
        if ($action == 'ImportGedcom') {
            $placelist = array();
            $j = 0;
            $gedcom_records = Database::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?")->execute(array($WT_TREE->getTreeId(), $WT_TREE->getTreeId()))->fetchOneColumn();
            foreach ($gedcom_records as $gedrec) {
                $i = 1;
                $placerec = Functions::getSubRecord(2, '2 PLAC', $gedrec, $i);
                while (!empty($placerec)) {
                    if (preg_match("/2 PLAC (.+)/", $placerec, $match)) {
                        $placelist[$j] = array();
                        $placelist[$j]['place'] = trim($match[1]);
                        if (preg_match("/4 LATI (.*)/", $placerec, $match)) {
                            $placelist[$j]['lati'] = trim($match[1]);
                            if ($placelist[$j]['lati'][0] != 'N' && $placelist[$j]['lati'][0] != 'S') {
                                if ($placelist[$j]['lati'] < 0) {
                                    $placelist[$j]['lati'][0] = 'S';
                                } else {
                                    $placelist[$j]['lati'] = 'N' . $placelist[$j]['lati'];
                                }
                            }
                        } else {
                            $placelist[$j]['lati'] = null;
                        }
                        if (preg_match("/4 LONG (.*)/", $placerec, $match)) {
                            $placelist[$j]['long'] = trim($match[1]);
                            if ($placelist[$j]['long'][0] != 'E' && $placelist[$j]['long'][0] != 'W') {
                                if ($placelist[$j]['long'] < 0) {
                                    $placelist[$j]['long'][0] = 'W';
                                } else {
                                    $placelist[$j]['long'] = 'E' . $placelist[$j]['long'];
                                }
                            }
                        } else {
                            $placelist[$j]['long'] = null;
                        }
                        $j = $j + 1;
开发者ID:bxbroze,项目名称:webtrees,代码行数:67,代码来源:GoogleMapsModule.php


示例15:

echo I18N::translate('User');
?>
			</label>
			<?php 
echo FunctionsEdit::selectEditControl('user', $users_array, '', $user, 'class="form-control"');
?>
		</div>

		<div class="form-group col-xs-6 col-md-3">
			<label for="gedc">
				<?php 
echo I18N::translate('Family tree');
?>
			</label>
			<?php 
echo FunctionsEdit::selectEditControl('gedc', Tree::getNameList(), '', $gedc, Auth::isAdmin() ? 'class="form-control"' : 'disabled class="form-control"');
?>
		</div>
	</div>

	<div class="row text-center">
		<button type="submit" class="btn btn-primary">
			<?php 
echo I18N::translate('Filter');
?>
		</button>

		<button type="submit" class="btn btn-primary" onclick="document.logs.action.value='export';return true;" <?php 
echo $action === 'show' ? '' : 'disabled';
?>
>
开发者ID:tunandras,项目名称:webtrees,代码行数:31,代码来源:admin_site_change.php


示例16: search

 /**
  * Search for individuals in a tree.
  *
  * @param Tree   $tree  Search this tree
  * @param string $query Search for this text
  *
  * @return string
  */
 private function search(Tree $tree, $query)
 {
     if (strlen($query) < 2) {
         return '';
     }
     $rows = Database::prepare("SELECT i_id AS xref, i_gedcom AS gedcom" . " FROM `##individuals`, `##name`" . " WHERE (i_id LIKE CONCAT('%', :query_1, '%') OR n_sort LIKE CONCAT('%', :query_2, '%'))" . " AND i_id = n_id AND i_file = n_file AND i_file = :tree_id" . " ORDER BY n_sort COLLATE :collation" . " LIMIT 50")->execute(array('query_1' => $query, 'query_2' => $query, 'tree_id' => $tree->getTreeId(), 'collation' => I18N::collation()))->fetchAll();
     $out = '<ul>';
     foreach ($rows as $row) {
         $person = Individual::getInstance($row->xref, $tree, $row->gedcom);
         if ($person->canShowName()) {
             $out .= '<li><a href="' . $person->getHtmlUrl() . '">' . $person->getSexImage() . ' ' . $person->getFullName() . ' ';
             if ($person->canShow()) {
                 $bd = $person->getLifeSpan();
                 if (!empty($bd)) {
                     $out .= ' (' . $bd . ')';
                 }
             }
             $out .= '</a></li>';
         }
     }
     $out .= '</ul>';
     return $out;
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:31,代码来源:IndividualSidebarModule.php


示例17:

								<?php 
    echo I18N::translate('After creating the family tree, you will be able to import data from a GEDCOM file.');
    ?>
							</p>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<?php 
}
?>
	<!-- display link to PhpGedView-WT transfer wizard on first visit to this page, before any GEDCOM is loaded -->
	<?php 
if (count(Tree::GetAll()) === 0 && count(User::all()) === 1) {
    ?>
	<div class="panel panel-default">
		<div class="panel-heading">
			<h2 class="panel-title">
			<i class="fa fa-fw fa-magic"></i>
			<a data-toggle="collapse" data-parent="#accordion" href="#pgv-import-wizard">
				<?php 
    echo I18N::translate('PhpGedView to webtrees transfer wizard');
    ?>
			</a>
		</h2>
		</div>
		<div id="pgv-import-wizard" class="panel-collapse collapse">
			<div class="panel-body">
				<p>
开发者ID:AlexSnet,项目名称:webtrees,代码行数:31,代码来源:admin_trees_manage.php


示例18: searchAndReplace

 /**
  * Performs a search and replace
  *
  * @param Tree $tree
  */
 private function searchAndReplace(Tree $tree)
 {
     $this->generalSearch();
     //-- don't try to make any changes if nothing was found
     if (!$this->myindilist && !$this->myfamlist && !$this->mysourcelist && !$this->mynotelist) {
         return;
     }
     Log::addEditLog("Search And Replace old:" . $this->query . " new:" . $this->replace);
     $adv_name_tags = preg_split("/[\\s,;: ]+/", $tree->getPreference('ADVANCED_NAME_FACTS'));
     $name_tags = array_unique(array_merge(Config::standardNameFacts(), $adv_name_tags));
     $name_tags[] = '_MARNM';
     $records_updated = 0;
     foreach ($this->myindilist as $id => $record) {
         $old_record = $record->getGedcom();
         $new_record = $old_record;
         if ($this->replaceAll) {
             $new_record = preg_replace("~" . $this->query . "~i", $this->replace, $new_record);
         } else {
             if ($this->replaceNames) {
                 foreach ($name_tags as $tag) {
                     $new_record = preg_replace("~(\\d) " . $tag . " (.*)" . $this->query . "(.*)~i", "\$1 " . $tag . " \$2" . $this->replace . "\$3", $new_record);
                 }
             }
             if ($this->replacePlaces) {
                 if ($this->replacePlacesWord) {
                     $new_record = preg_replace('~(\\d) PLAC (.*)([,\\W\\s])' . $this->query . '([,\\W\\s])~i', "\$1 PLAC \$2\$3" . $this->replace . "\$4", $new_record);
                 } else {
                     $new_record = preg_replace("~(\\d) PLAC (.*)" . $this->query . "(.*)~i", "\$1 PLAC \$2" . $this->replace . "\$3", $new_record);
                 }
             }
         }
         //-- if the record changed replace the record otherwise remove it from the search results
         if ($new_record !== $old_record) {
             $record->updateRecord($new_record, true);
             $records_updated++;
         } else {
             unset($this->myindilist[$id]);
         }
     }
     if ($records_updated) {
         FlashMessages::addMessage(I18N::plural('%s individual has been updated.', '%s individuals have been updated.', $records_updated, I18N::number($records_updated)));
     }
     $records_updated = 0;
     foreach ($this->myfamlist as $id => $record) {
         $old_record = $record->getGedcom();
         $new_record = $old_record;
         if ($this->replaceAll) {
             $new_record = preg_replace("~" . $this->query . "~i", $this->replace, $new_record);
         } else {
             if ($this->replacePlaces) {
                 if ($this->replacePlacesWord) {
                     $new_record = preg_replace('~(\\d) PLAC (.*)([,\\W\\s])' . $this->query . '([,\\W\\s])~i', "\$1 PLAC \$2\$3" . $this->replace . "\$4", $new_record);
                 } else {
                     $new_record = preg_replace("~(\\d) PLAC (.*)" . $this->query . "(.*)~i", "\$1 PLAC \$2" . $this->replace . "\$3", $new_record);
                 }
             }
         }
         //-- if the record changed replace the record otherwise remove it from the search results
         if ($new_record !== $old_record) {
             $record->updateRecord($new_record, true);
             $records_updated++;
         } else {
             unset($this->myfamlist[$id]);
         }
     }
     if ($records_updated) {
         FlashMessages::addMessage(I18N::plural('%s family has been updated.', '%s families have been updated.', $records_updated, I18N::number($records_updated)));
     }
     $records_updated = 0;
     foreach ($this->mysourcelist as $id => $record) {
         $old_record = $record->getGedcom();
         $new_record = $old_record;
         if ($this->replaceAll) {
             $new_record = preg_replace("~" . $this->query . "~i", $this->replace, $new_record);
         } else {
             if ($this->replaceNames) {
                 $new_record = preg_replace("~(\\d) TITL (.*)" . $this->query . "(.*)~i", "\$1 TITL \$2" . $this->replace . "\$3", $new_record);
                 $new_record = preg_replace("~(\\d) ABBR (.*)" . $this->query . "(.*)~i", "\$1 ABBR \$2" . $this->replace . "\$3", $new_record);
             }
             if ($this->replacePlaces) {
                 if ($this->replacePlacesWord) {
                     $new_record = preg_replace('~(\\d) PLAC (.*)([,\\W\\s])' . $this->query . '([,\\W\\s])~i', "\$1 PLAC \$2\$3" . $this->replace . "\$4", $new_record);
                 } else {
                     $new_record = preg_replace("~(\\d) PLAC (.*)" . $this->query . "(.*)~i", "\$1 PLAC \$2" . $this->replace . "\$3", $new_record);
                 }
             }
         }
         //-- if the record changed replace the record otherwise remove it from the search results
         if ($new_record !== $old_record) {
             $record->updateRecord($new_record, true);
             $records_updated++;
         } else {
             unset($this->mysourcelist[$id]);
         }
     }
//.........这里部分代码省略.........
开发者ID:bmhm,项目名称:webtrees,代码行数:101,代码来源:SearchController.php


示例19: config

    /**
     * Provide a form to manage the FAQs.
     */
    private function config()
    {
        global $WT_TREE;
        $controller = new PageController();
        $controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Frequently asked questions'))->pageHeader();
        $faqs = Database::prepare("SELECT block_id, block_order, gedcom_id, bs1.setting_value AS header, bs2.setting_value AS faqbody" . " FROM `##block` b" . " JOIN `##block_setting` bs1 USING (block_id)" . " JOIN `##block_setting` bs2 USING (block_id)" . " WHERE module_name = :module_name" . " AND bs1.setting_name = 'header'" . " AND bs2.setting_name = 'faqbody'" . " AND IFNULL(gedcom_id, :tree_id_1) = :tree_id_2" . " ORDER BY block_order")->execute(array('module_name' => $this->getName(), 'tree_id_1' => $WT_TREE->getTreeId(), 'tree_id_2' => $WT_TREE->getTreeId()))->fetchAll();
        $min_block_order = Database::prepare("SELECT MIN(block_order) FROM `##block` WHERE module_name = 'faq' AND (gedcom_id = :tree_id OR gedcom_id IS NULL)")->execute(array('tree_id' => $WT_TREE->getTreeId()))->fetchOne();
        $max_block_order = Database::prepare("SELECT MAX(block_order) FROM `##block` WHERE module_name = 'faq' AND (gedcom_id = :tree_id OR gedcom_id IS NULL)")->execute(array('tree_id' => $WT_TREE->getTreeId()))->fetchOne();
        ?>
		<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 $controller->getPageTitle();
        ?>
</li>
		</ol>
		<h2><?php 
        echo $controller->getPageTitle();
        ?>
</h2>
		<p>
			<?php 
        echo I18N::translate('FAQs are lists of questions and answers, which allow you to explain the site’s rules, policies, and procedures to your visitors.  Questions are typically concerned with privacy, copyright, user-accounts, unsuitable content, requirement for source-citations, etc.');
        ?>
			<?php 
        echo I18N::translate('You may use HTML to format the answer and to add links to other websites.');
        ?>
		</p>
		<form class="form form-inline">
			<label for="ged" class="sr-only">
				<?php 
        echo I18N::translate('Family tree');
        ?>
			</label>
			<input type="hidden" name="mod" value="<?php 
        echo $this->getName();
        ?>
">
			<input type="hidden" name="mod_action" value="admin_config">
			<?php 
        echo FunctionsEdit::selectEditControl('ged', Tree::getNameList(), null, $WT_TREE->getName(), 'class="form-control"');
        ?>
			<input type="submit" class="btn btn-primary" value="<?php 
        echo I18N::translate('show');
        ?>
">
		</form>

		<p>
			<a href="module.php?mod=<?php 
        echo $this->getName();
        ?>
&amp;mod_action=admin_edit" class="btn btn-default">
				<i class="fa fa-plus"></i>
				<?php 
        echo I18N::translate('Add an FAQ item');
        ?>
			</a>
		</p>

		<?php 
        echo '<table class="table table-bordered">';
        if (empty($faqs)) {
            echo '<tr><td class="error center" colspan="5">', I18N::translate('The FAQ list is empty.'), '</td></tr></table>';
        } else {
            foreach ($faqs as $faq) {
                // NOTE: Print the position of the current item
                echo '<tr class="faq_edit_pos"><td>';
                echo I18N::translate('#%s', $faq->block_order + 1), ' ';
                if ($faq->gedcom_id === null) {
                    echo I18N::translate('All');
                } else {
                    echo $WT_TREE->getTitleHtml();
                }
                echo '</td>';
                // NOTE: Print the edit options of the current item
                echo '<td>';
                if ($faq->block_order == $min_block_order) {
                    echo '&nbsp;';
                } else {
                    echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_moveup&amp;block_id=', $faq->block_id, '"><i class="fa fa-arrow-up"></i></i> ', I18N::translate('Move up'), '</a>';
                }
                echo '</td><td>';
                if ($faq->block_order == $max_block_order) {
                    echo '&nbsp;';
                } else {
                    echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_movedown&amp;block_id=', $faq->block_id, '"><i class="fa fa-arrow-down"></i></i> ', I18N::translate('Move down'), '</a>';
                }
                echo '</td><td>';
                echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit&amp;block_id=', $faq->block_id, '"><i class="fa fa-pencil"></i> ', I18N::translate('Edit'), '</a>';
//.........这里部分代码省略.........
开发者ID:tunandras,项目名称:webtrees,代码行数:101,代码来源:FrequentlyAskedQuestionsModule.php


示例20: getRecentChanges

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Controller\PageController类代码示例发布时间:2022-05-23
下一篇:
PHP Webtrees\Theme类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap