当前位置: 首页>>代码示例>>PHP>>正文


PHP Filter::postInteger方法代码示例

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


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

示例1: update

 /**
  * Manage updates sent from the AdminConfig@index form.
  */
 protected function update()
 {
     if (Auth::isAdmin()) {
         $this->module->setSetting('MAJ_SHOW_CERT', Filter::post('MAJ_SHOW_CERT'));
         $this->module->setSetting('MAJ_SHOW_NO_WATERMARK', Filter::post('MAJ_SHOW_NO_WATERMARK'));
         if ($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) {
             $this->module->setSetting('MAJ_WM_DEFAULT', $MAJ_WM_DEFAULT);
         }
         if ($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) {
             $this->module->setSetting('MAJ_WM_FONT_MAXSIZE', $MAJ_WM_FONT_MAXSIZE);
         }
         // Only accept valid color for MAJ_WM_FONT_COLOR
         $MAJ_WM_FONT_COLOR = Filter::post('MAJ_WM_FONT_COLOR', '#([a-fA-F0-9]{3}){1,2}');
         if ($MAJ_WM_FONT_COLOR) {
             $this->module->setSetting('MAJ_WM_FONT_COLOR', $MAJ_WM_FONT_COLOR);
         }
         // Only accept valid folders for MAJ_CERT_ROOTDIR
         $MAJ_CERT_ROOTDIR = preg_replace('/[\\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR') . '/');
         if (substr($MAJ_CERT_ROOTDIR, 0, 1) === '/') {
             $MAJ_CERT_ROOTDIR = substr($MAJ_CERT_ROOTDIR, 1);
         }
         if ($MAJ_CERT_ROOTDIR) {
             if (is_dir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) {
                 $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR);
             } elseif (File::mkdir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) {
                 $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR);
                 FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'info');
             } else {
                 FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'danger');
             }
         }
         FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->module->getTitle()), 'success');
         return;
     }
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:38,代码来源:AdminConfigController.php

示例2: update

 /**
  * Saves Sosa's user preferences (root individual for the user).
  * 
  * @param BaseController $controller
  * @return bool True is saving successfull
  */
 protected function update(BaseController $controller)
 {
     global $WT_TREE;
     if ($this->canUpdate() && Filter::checkCsrf()) {
         $indi = Individual::getInstance(Filter::post('rootid'), $WT_TREE);
         $user = User::find(Filter::postInteger('userid', -1));
         if ($user && $indi) {
             $WT_TREE->setUserPreference($user, 'MAJ_SOSA_ROOT_ID', $indi->getXref());
             $controller->addInlineJavascript('
                 $( document ).ready(function() {
                     majComputeSosa(' . $user->getUserId() . ');
                 });');
             FlashMessages::addMessage(I18N::translate('The preferences have been updated.'));
             return true;
         }
     }
     FlashMessages::addMessage(I18N::translate('An error occurred while saving data...'), 'danger');
     return false;
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:25,代码来源:SosaConfigController.php

示例3: edit

    /**
     * Show and process a form to edit a story.
     */
    private function edit()
    {
        global $WT_TREE;
        if (Auth::isEditor($WT_TREE)) {
            if (Filter::postBool('save') && Filter::checkCsrf()) {
                $block_id = Filter::postInteger('block_id');
                if ($block_id) {
                    Database::prepare("UPDATE `##block` SET gedcom_id=?, xref=? WHERE block_id=?")->execute(array(Filter::postInteger('gedcom_id'), Filter::post('xref', WT_REGEX_XREF), $block_id));
                } else {
                    Database::prepare("INSERT INTO `##block` (gedcom_id, xref, module_name, block_order) VALUES (?, ?, ?, ?)")->execute(array(Filter::postInteger('gedcom_id'), Filter::post('xref', WT_REGEX_XREF), $this->getName(), 0));
                    $block_id = Database::getInstance()->lastInsertId();
                }
                $this->setBlockSetting($block_id, 'title', Filter::post('title'));
                $this->setBlockSetting($block_id, 'story_body', Filter::post('story_body'));
                $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 story'));
                    $title = $this->getBlockSetting($block_id, 'title');
                    $story_body = $this->getBlockSetting($block_id, 'story_body');
                    $xref = Database::prepare("SELECT xref FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
                } else {
                    $controller->setPageTitle(I18N::translate('Add a story'));
                    $title = '';
                    $story_body = '';
                    $xref = Filter::get('xref', WT_REGEX_XREF);
                }
                $controller->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();');
                if (Module::getModuleByName('ckeditor')) {
                    CkeditorModule::enableEditor($controller);
                }
                $individual = Individual::getInstance($xref, $WT_TREE);
                ?>
				<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 $this->getTitle();
                ?>
</a></li>
					<li class="active"><?php 
                echo $controller->getPageTitle();
                ?>
</li>
				</ol>

				<h1><?php 
                echo $controller->getPageTitle();
                ?>
</h1>

				<form 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;
                ?>
">
					<input type="hidden" name="gedcom_id" value="<?php 
                echo $WT_TREE->getTreeId();
                ?>
">

					<div class="form-group">
						<label for="title" class="col-sm-3 control-label">
							<?php 
                echo I18N::translate('Story title');
                ?>
						</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" name="title" id="title" value="<?php 
                echo Filter::escapeHtml($title);
                ?>
">
						</div>
					</div>

					<div class="form-group">
						<label for="story_body" class="col-sm-3 control-label">
//.........这里部分代码省略.........
开发者ID:tunandras,项目名称:webtrees,代码行数:101,代码来源:StoriesModule.php

示例4: saveConfig

 /**
  * {@inheritDoc}
  * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\ConfigurableTaskInterface::saveConfig()
  */
 public function saveConfig()
 {
     try {
         foreach (Tree::getAll() as $tree) {
             if (Auth::isManager($tree)) {
                 $tree_enabled = Filter::postInteger('HEALTHCHECK_ENABLED_' . $tree->getTreeId(), 0, 1);
                 $tree->setPreference('MAJ_AT_' . $this->getName() . '_ENABLED', $tree_enabled);
             }
         }
         return true;
     } catch (\Exception $ex) {
         Log::addErrorLog(sprintf('Error while updating the Admin Task "%s". Exception: %s', $this->getName(), $ex->getMessage()));
         return false;
     }
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:19,代码来源:HealthCheckEmailTask.php

示例5: save

 /**
  * Task@save
  */
 public function save()
 {
     $tmp_contrl = new PageController();
     $tmp_contrl->restrictAccess(Auth::isAdmin() && Filter::checkCsrf());
     $task_name = Filter::post('task');
     $frequency = Filter::postInteger('frequency');
     $is_limited = Filter::postInteger('is_limited', 0, 1);
     $nb_occur = Filter::postInteger('nb_occur');
     $task = $this->provider->getTask($task_name, false);
     $success = false;
     if ($task) {
         $task->setFrequency($frequency);
         if ($is_limited == 1) {
             $task->setRemainingOccurrences($nb_occur);
         } else {
             $task->setRemainingOccurrences(0);
         }
         $res = $task->save();
         if ($res) {
             if ($task instanceof MyArtJaub\Webtrees\Module\AdminTasks\Model\ConfigurableTaskInterface) {
                 $res = $task->saveConfig();
                 if (!$res) {
                     FlashMessages::addMessage(I18N::translate('An error occured while updating the specific settings of administrative task “%s”', $task->getTitle()), 'danger');
                     Log::addConfigurationLog('Module ' . $this->module->getName() . ' : AdminTask “' . $task->getName() . '” specific settings could not be updated. See error log.');
                 }
             }
             if ($res) {
                 FlashMessages::addMessage(I18N::translate('The administrative task “%s” has been successfully updated', $task->getTitle()), 'success');
                 Log::addConfigurationLog('Module ' . $this->module->getName() . ' : AdminTask “' . $task->getName() . '” has been updated.');
                 $success = true;
             }
         } else {
             FlashMessages::addMessage(I18N::translate('An error occured while updating the administrative task “%s”', $task->getTitle()), 'danger');
             Log::addConfigurationLog('Module ' . $this->module->getName() . ' : AdminTask “' . $task->getName() . '” could not be updated. See error log.');
         }
     }
     $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig';
     if (!$success) {
         $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@edit&task=' . $task->getName();
     }
     header('Location: ' . WT_BASE_URL . $redirection_url);
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:45,代码来源:TaskController.php

示例6: editSave

 /**
  * Action from the configuration page
  */
 private function editSave()
 {
     if (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));
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:19,代码来源:FrequentlyAskedQuestionsModule.php

示例7: header

         $tree->setPreference('keep_media', $keep_media);
         $tree->setPreference('GEDCOM_MEDIA_PATH', $GEDCOM_MEDIA_PATH);
         $tree->setPreference('WORD_WRAPPED_NOTES', $WORD_WRAPPED_NOTES);
         if (isset($_FILES['tree_name'])) {
             if ($_FILES['tree_name']['error'] == 0 && is_readable($_FILES['tree_name']['tmp_name'])) {
                 $tree->importGedcomFile($_FILES['tree_name']['tmp_name'], $_FILES['tree_name']['name']);
             }
         } else {
             FlashMessages::addMessage(I18N::translate('No GEDCOM file was received.'), 'danger');
         }
     }
     header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
     return;
 case 'replace_import':
     $basename = basename(Filter::post('tree_name'));
     $gedcom_id = Filter::postInteger('gedcom_id');
     $keep_media = Filter::post('keep_media', '1', '0');
     $GEDCOM_MEDIA_PATH = Filter::post('GEDCOM_MEDIA_PATH');
     $WORD_WRAPPED_NOTES = Filter::post('WORD_WRAPPED_NOTES', '1', '0');
     $tree = Tree::findById($gedcom_id);
     if (Filter::checkCsrf() && $tree) {
         $tree->setPreference('keep_media', $keep_media);
         $tree->setPreference('GEDCOM_MEDIA_PATH', $GEDCOM_MEDIA_PATH);
         $tree->setPreference('WORD_WRAPPED_NOTES', $WORD_WRAPPED_NOTES);
         if ($basename) {
             $tree->importGedcomFile(WT_DATA_DIR . $basename, $basename);
         } else {
             FlashMessages::addMessage(I18N::translate('No GEDCOM file was received.'), 'danger');
         }
     }
     header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
开发者ID:AlexSnet,项目名称:webtrees,代码行数:31,代码来源:admin_trees_manage.php

示例8: save

 /**
  * AdminConfig@save
  */
 public function save()
 {
     global $WT_TREE;
     $tmp_contrl = new PageController();
     $tmp_contrl->restrictAccess(Auth::isManager($WT_TREE) && Filter::checkCsrf());
     $ga_id = Filter::postInteger('ga_id');
     $description = Filter::post('description');
     $analysislevel = Filter::postInteger('analysislevel');
     $use_map = Filter::postBool('use_map');
     if ($use_map) {
         $map_file = base64_decode(Filter::post('map_file'));
         $map_top_level = Filter::postInteger('map_top_level');
     }
     $use_flags = Filter::postBool('use_flags');
     $gen_details = Filter::postInteger('gen_details');
     $success = false;
     if ($ga_id) {
         $ga = $this->provider->getGeoAnalysis($ga_id, false);
         if ($ga) {
             $ga->setTitle($description);
             $ga->setAnalysisLevel($analysislevel + 1);
             $options = $ga->getOptions();
             if ($options) {
                 $options->setUsingFlags($use_flags);
                 $options->setMaxDetailsInGen($gen_details);
                 if ($use_map) {
                     $options->setMap(new OutlineMap($map_file));
                     $options->setMapLevel($map_top_level + 1);
                 } else {
                     $options->setMap(null);
                 }
             }
             $res = $this->provider->updateGeoAnalysis($ga);
             if ($res) {
                 FlashMessages::addMessage(I18N::translate('The geographical dispersion analysis “%s” has been successfully updated', $res->getTitle()), 'success');
                 Log::addConfigurationLog('Module ' . $this->module->getName() . ' : Geo Analysis ID “' . $res->getId() . '” has been updated.');
                 $ga = $res;
                 $success = true;
             } else {
                 FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger');
                 Log::addConfigurationLog('Module ' . $this->module->getName() . ' : Geo Analysis ID “' . $ga->getId() . '” could not be updated. See error log.');
             }
         }
     } else {
         $ga = $this->provider->createGeoAnalysis($description, $analysislevel + 1, $use_map ? $map_file : null, $use_map ? $map_top_level + 1 : null, $use_flags, $gen_details);
         if ($ga) {
             FlashMessages::addMessage(I18N::translate('The geographical dispersion analysis “%s” has been successfully added.', $ga->getTitle()), 'success');
             Log::addConfigurationLog('Module ' . $this->module->getName() . ' : Geo Analysis ID “' . $ga->getId() . '” has been added.');
             $success = true;
         } else {
             FlashMessages::addMessage(I18N::translate('An error occured while adding the geographical dispersion analysis “%s”', $description), 'danger');
             Log::addConfigurationLog('Module ' . $this->module->getName() . ' : Geo Analysis “' . $description . '” could not be added. See error log.');
         }
     }
     $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl();
     if (!$success) {
         if ($ga) {
             $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id=' . $ga->getId() . '&ged=' . $WT_TREE->getNameUrl();
         } else {
             $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $WT_TREE->getNameUrl();
         }
     }
     header('Location: ' . WT_BASE_URL . $redirection_url);
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:67,代码来源:AdminConfigController.php

示例9: configureBlock

 /**
  * An HTML form to edit block settings
  *
  * @param int $block_id
  */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, 30, 7));
         $this->setBlockSetting($block_id, 'filter', Filter::postBool('filter'));
         $this->setBlockSetting($block_id, 'onlyBDM', Filter::postBool('onlyBDM'));
         $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
         $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $days = $this->getBlockSetting($block_id, 'days', '7');
     $filter = $this->getBlockSetting($block_id, 'filter', '1');
     $onlyBDM = $this->getBlockSetting($block_id, 'onlyBDM', '0');
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
     $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
     $block = $this->getBlockSetting($block_id, 'block', '1');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="', $days, '">';
     echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', 30, I18N::number(30)), '</em>';
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Show only events of living individuals');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('filter', $filter);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Show only births, deaths, and marriages');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('onlyBDM', $onlyBDM);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Sort order');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('sortStyle', array('alpha' => I18N::translate('sort by name'), 'anniv' => I18N::translate('sort by date')), null, $sortStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:53,代码来源:UpcomingAnniversariesModule.php

示例10: configureBlock

 /** {@inheritdoc} */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, self::MAX_DAYS));
         $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table'));
         $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'name|date_asc|date_desc'));
         $this->setBlockSetting($block_id, 'show_user', Filter::postBool('show_user'));
         $this->setBlockSetting($block_id, 'hide_empty', Filter::postBool('hide_empty'));
         $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
     }
     $days = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
     $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
     $show_user = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER);
     $block = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
     $hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="', $days, '">';
     echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', I18N::number(self::MAX_DAYS), I18N::number(self::MAX_DAYS)), '</em>';
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Sort order');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('sortStyle', array('name' => I18N::translate('sort by name'), 'date_asc' => I18N::translate('sort by date, oldest first'), 'date_desc' => I18N::translate('sort by date, newest first')), null, $sortStyle, '');
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Show the user who made the change');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('show_user', $show_user);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('block', $block);
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Should this block be hidden when it is empty');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::editFieldYesNo('hide_empty', $hide_empty);
     echo '</td></tr>';
     echo '<tr><td colspan="2" class="optionbox wrap">';
     echo '<span class="error">', I18N::translate('If you hide an empty block, you will not be able to change its configuration until it becomes visible by no longer being empty.'), '</span>';
     echo '</td></tr>';
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:52,代码来源:RecentChangesModule.php

示例11: SimpleController

use PDO;
/**
 * Defined in session.php
 *
 * @global Tree $WT_TREE
 */
global $WT_TREE;
define('WT_SCRIPT_NAME', 'editnews.php');
require './includes/session.php';
$controller = new SimpleController();
$controller->setPageTitle(I18N::translate('Add/edit a journal/news entry'))->restrictAccess(Auth::isMember($WT_TREE))->pageHeader();
$action = Filter::get('action', 'compose|save', 'compose');
$news_id = Filter::getInteger('news_id');
$user_id = Filter::get('user_id', WT_REGEX_INTEGER, Filter::post('user_id', WT_REGEX_INTEGER));
$gedcom_id = Filter::get('gedcom_id', WT_REGEX_INTEGER, Filter::post('gedcom_id', WT_REGEX_INTEGER));
$date = Filter::postInteger('date', 0, PHP_INT_MAX, WT_TIMESTAMP);
$title = Filter::post('title');
$text = Filter::post('text');
switch ($action) {
    case 'compose':
        if (Module::getModuleByName('ckeditor')) {
            CkeditorModule::enableEditor($controller);
        }
        echo '<h3>' . I18N::translate('Add/edit a journal/news entry') . '</h3>';
        echo '<form style="overflow: hidden;" name="messageform" method="post" action="editnews.php?action=save&news_id=' . $news_id . '">';
        if ($news_id) {
            $news = Database::prepare("SELECT SQL_CACHE news_id AS id, user_id, gedcom_id, UNIX_TIMESTAMP(updated) AS date, subject, body FROM `##news` WHERE news_id=?")->execute(array($news_id))->fetchOneRow(PDO::FETCH_ASSOC);
        } else {
            $news = array();
            $news['user_id'] = $user_id;
            $news['gedcom_id'] = $gedcom_id;
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:31,代码来源:editnews.php

示例12: configureBlock

    /**
     * An HTML form to edit block settings
     *
     * @param int $block_id
     */
    public function configureBlock($block_id)
    {
        if (Filter::postBool('save') && Filter::checkCsrf()) {
            $this->setBlockSetting($block_id, 'show_last_update', Filter::postBool('show_last_update'));
            $this->setBlockSetting($block_id, 'show_common_surnames', Filter::postBool('show_common_surnames'));
            $this->setBlockSetting($block_id, 'number_of_surnames', Filter::postInteger('number_of_surnames'));
            $this->setBlockSetting($block_id, 'stat_indi', Filter::postBool('stat_indi'));
            $this->setBlockSetting($block_id, 'stat_fam', Filter::postBool('stat_fam'));
            $this->setBlockSetting($block_id, 'stat_sour', Filter::postBool('stat_sour'));
            $this->setBlockSetting($block_id, 'stat_other', Filter::postBool('stat_other'));
            $this->setBlockSetting($block_id, 'stat_media', Filter::postBool('stat_media'));
            $this->setBlockSetting($block_id, 'stat_repo', Filter::postBool('stat_repo'));
            $this->setBlockSetting($block_id, 'stat_surname', Filter::postBool('stat_surname'));
            $this->setBlockSetting($block_id, 'stat_events', Filter::postBool('stat_events'));
            $this->setBlockSetting($block_id, 'stat_users', Filter::postBool('stat_users'));
            $this->setBlockSetting($block_id, 'stat_first_birth', Filter::postBool('stat_first_birth'));
            $this->setBlockSetting($block_id, 'stat_last_birth', Filter::postBool('stat_last_birth'));
            $this->setBlockSetting($block_id, 'stat_first_death', Filter::postBool('stat_first_death'));
            $this->setBlockSetting($block_id, 'stat_last_death', Filter::postBool('stat_last_death'));
            $this->setBlockSetting($block_id, 'stat_long_life', Filter::postBool('stat_long_life'));
            $this->setBlockSetting($block_id, 'stat_avg_life', Filter::postBool('stat_avg_life'));
            $this->setBlockSetting($block_id, 'stat_most_chil', Filter::postBool('stat_most_chil'));
            $this->setBlockSetting($block_id, 'stat_avg_chil', Filter::postBool('stat_avg_chil'));
        }
        $show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1');
        $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1');
        $number_of_surnames = $this->getBlockSetting($block_id, 'number_of_surnames', self::DEFAULT_NUMBER_OF_SURNAMES);
        $stat_indi = $this->getBlockSetting($block_id, 'stat_indi', '1');
        $stat_fam = $this->getBlockSetting($block_id, 'stat_fam', '1');
        $stat_sour = $this->getBlockSetting($block_id, 'stat_sour', '1');
        $stat_media = $this->getBlockSetting($block_id, 'stat_media', '1');
        $stat_repo = $this->getBlockSetting($block_id, 'stat_repo', '1');
        $stat_surname = $this->getBlockSetting($block_id, 'stat_surname', '1');
        $stat_events = $this->getBlockSetting($block_id, 'stat_events', '1');
        $stat_users = $this->getBlockSetting($block_id, 'stat_users', '1');
        $stat_first_birth = $this->getBlockSetting($block_id, 'stat_first_birth', '1');
        $stat_last_birth = $this->getBlockSetting($block_id, 'stat_last_birth', '1');
        $stat_first_death = $this->getBlockSetting($block_id, 'stat_first_death', '1');
        $stat_last_death = $this->getBlockSetting($block_id, 'stat_last_death', '1');
        $stat_long_life = $this->getBlockSetting($block_id, 'stat_long_life', '1');
        $stat_avg_life = $this->getBlockSetting($block_id, 'stat_avg_life', '1');
        $stat_most_chil = $this->getBlockSetting($block_id, 'stat_most_chil', '1');
        $stat_avg_chil = $this->getBlockSetting($block_id, 'stat_avg_chil', '1');
        ?>
		<tr>
			<td class="descriptionbox wrap width33">
				<label for="show-last-update">
					<?php 
        echo I18N::translate('Show date of last update');
        ?>
				</label>
			</td>
			<td class="optionbox">
				<input type="checkbox" value="yes" id="show-last-update" name="show_last_update" <?php 
        echo $show_last_update ? 'checked' : '';
        ?>
>
			</td>
		</tr>
		<tr>
			<td class="descriptionbox wrap width33">
				<?php 
        echo I18N::translate('Statistics');
        ?>
			</td>
			<td class="optionbox">
				<table>
					<tbody>
						<tr>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_indi" <?php 
        echo $stat_indi ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Individuals');
        ?>
								</label>
							</td>
							<td>
								<label>
									<input type="checkbox" value="yes" name="stat_first_birth" <?php 
        echo $stat_first_birth ? 'checked' : '';
        ?>
>
									<?php 
        echo I18N::translate('Earliest birth year');
        ?>
								</label>
							</td>
						</tr>
						<tr>
							<td>
								<label>
//.........这里部分代码省略.........
开发者ID:tronsmit,项目名称:webtrees,代码行数:101,代码来源:FamilyTreeStatisticsModule.php

示例13: configureBlock

 /**
  * An HTML form to edit block settings
  *
  * @param int $block_id
  */
 public function configureBlock($block_id)
 {
     if (Filter::postBool('save') && Filter::checkCsrf()) {
         $this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10));
         $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|array|table|tagcloud', 'table'));
     }
     $num = $this->getBlockSetting($block_id, 'num', '10');
     $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Number of surnames');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="num" size="2" value="', $num, '">';
     echo '</td></tr>';
     echo '<tr><td class="descriptionbox wrap width33">';
     echo I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('bullet list'), 'array' => I18N::translate('compact list'), 'table' => I18N::translate('table'), 'tagcloud' => I18N::translate('tag cloud')), null, $infoStyle, '');
     echo '</td></tr>';
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:24,代码来源:TopSurnamesModule.php

示例14: jsonTasksList

 /**
  * AdminConfig@jsonTasksList
  */
 public function jsonTasksList()
 {
     global $WT_TREE;
     $controller = new JsonController();
     $controller->restrictAccess(Auth::isAdmin());
     // Generate an AJAX/JSON response for datatables to load a block of rows
     $search = Filter::postArray('search');
     if ($search) {
         $search = $search['value'];
     }
     $start = Filter::postInteger('start');
     $length = Filter::postInteger('length');
     $order = Filter::postArray('order');
     $order_by_name = false;
     foreach ($order as $key => &$value) {
         switch ($value['column']) {
             case 3:
                 $order_by_name = true;
                 unset($order[$key]);
                 break;
             case 4:
                 $value['column'] = 'majat_last_run';
                 break;
             case 4:
                 $value['column'] = 'majat_last_result';
                 break;
             default:
                 unset($order[$key]);
         }
     }
     $list = $this->provider->getFilteredTasksList($search, $order, $start, $length);
     if ($order_by_name) {
         usort($list, function (AbstractTask $a, AbstractTask $b) {
             return I18N::strcasecmp($a->getTitle(), $b->getTitle());
         });
     }
     $recordsFiltered = count($list);
     $recordsTotal = $this->provider->getTasksCount();
     $data = array();
     foreach ($list as $task) {
         $datum = array();
         $datum[0] = '
             <div class="btn-group">
                 <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                     <i class="fa fa-pencil"></i><span class="caret"></span>
                 </button>
                 <ul class="dropdown-menu" role="menu">
                    <li>
                         <a href="#" onclick="return set_admintask_status(\'' . $task->getName() . '\', ' . ($task->isEnabled() ? 'false' : 'true') . ');">
                             <i class="fa fa-fw ' . ($task->isEnabled() ? 'fa-times' : 'fa-check') . '"></i> ' . ($task->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')) . '
                         </a>
                    </li>
                     <li>
                         <a href="module.php?mod=' . $this->module->getName() . '&mod_action=Task@edit&task=' . $task->getName() . '">
                             <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit') . '
                         </a>
                    </li>
                 </ul>
             </div>';
         $datum[1] = $task->getName();
         $datum[2] = $task->isEnabled() ? '<i class="fa fa-check"></i><span class="sr-only">' . I18N::translate('Enabled') . '</span>' : '<i class="fa fa-times"></i><span class="sr-only">' . I18N::translate('Disabled') . '</span>';
         $datum[3] = $task->getTitle();
         $date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s';
         $datum[4] = $task->getLastUpdated()->format($date_format);
         $datum[5] = $task->isLastRunSuccess() ? '<i class="fa fa-check"></i><span class="sr-only">' . I18N::translate('Yes') . '</span>' : '<i class="fa fa-times"></i><span class="sr-only">' . I18N::translate('No') . '</span>';
         $dtF = new \DateTime('@0');
         $dtT = new \DateTime('@' . $task->getFrequency() * 60);
         $datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m'));
         $datum[7] = $task->getRemainingOccurrences() > 0 ? I18N::number($task->getRemainingOccurrences()) : I18N::translate('Unlimited');
         $datum[8] = $task->isRunning() ? '<i class="fa fa-cog fa-spin fa-fw"></i><span class="sr-only">' . I18N::translate('Running') . '</span>' : '<i class="fa fa-times"></i><span class="sr-only">' . I18N::translate('Not running') . '</span>';
         if ($task->isEnabled() && !$task->isRunning()) {
             $datum[9] = '
 			    <button id="bt_runtask_' . $task->getName() . '" class="btn btn-primary" href="#" onclick="return run_admintask(\'' . $task->getName() . '\')">
 			         <div id="bt_runtasktext_' . $task->getName() . '"><i class="fa fa-cog fa-fw" ></i>' . I18N::translate('Run') . '</div>
 			    </button>';
         } else {
             $datum[9] = '';
         }
         $data[] = $datum;
     }
     $controller->pageHeader();
     $controller->encode(array('draw' => Filter::getInteger('draw'), 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data));
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:86,代码来源:AdminConfigController.php

示例15: modAction

 /** {@inheritdoc} */
 public function modAction($mod_action)
 {
     switch ($mod_action) {
         case 'admin_config':
             if (Filter::postBool('save') && Filter::checkCsrf()) {
                 $this->setSetting('FTV_PDF_ACCESS_LEVEL', Filter::postInteger('NEW_FTV_PDF_ACCESS_LEVEL'));
                 Log::addConfigurationLog($this->getTitle() . ' config updated');
             }
             $template = new AdminTemplate();
             return $template->pageContent();
         case 'full_pdf':
             echo $this->module()->printPage(0);
             break;
         case 'write_pdf':
             $tmp_dir = WT_DATA_DIR . 'ftv_pdf_tmp/';
             if (file_exists($tmp_dir)) {
                 File::delete($tmp_dir);
             }
             File::mkdir($tmp_dir);
             $template = new PdfTemplate();
             return $template->pageBody();
         case 'output_pdf':
             $file = WT_DATA_DIR . 'ftv_pdf_tmp/' . Filter::get('title') . '.pdf';
             if (file_exists($file)) {
                 ob_start();
                 header('Content-Description: File Transfer');
                 header('Content-Type: application/pdf');
                 header('Content-Disposition: attachment; filename="' . basename($file) . '"');
                 header('Content-Transfer-Encoding: binary');
                 header('Expires: 0');
                 header('Cache-Control: must-revalidate');
                 header('Pragma: public');
                 ob_clean();
                 ob_end_flush();
                 readfile($file);
                 File::delete(dirname($file));
             } else {
                 FlashMessages::addMessage(I18N::translate('The file %s could not be created.', basename($file)), 'danger');
                 Header('Location:' . WT_BASE_URL . 'module.php?mod=fancy_treeview&mod_action=page&rootid=' . Filter::get('rootid') . '&ged=' . Filter::get('ged'));
             }
             break;
         default:
             http_response_code(404);
             break;
     }
 }
开发者ID:JustCarmen,项目名称:fancy_treeview_pdf,代码行数:47,代码来源:module.php


注:本文中的Fisharebest\Webtrees\Filter::postInteger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。