本文整理汇总了PHP中Fisharebest\Webtrees\Controller\PageController::addInlineJavascript方法的典型用法代码示例。如果您正苦于以下问题:PHP PageController::addInlineJavascript方法的具体用法?PHP PageController::addInlineJavascript怎么用?PHP PageController::addInlineJavascript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Controller\PageController
的用法示例。
在下文中一共展示了PageController::addInlineJavascript方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* WelcomeBlock@index
*
* @param PageController $parent_controller
* @param Tree $tree
* @param string $block_id
* @param string $template
* @return $string
*/
public function index(PageController $parent_controller, Tree $tree, $block_id, $template)
{
$view_bag = new ViewBag();
if ($parent_controller && $tree) {
$view_bag->set('tree', $tree);
$view_bag->set('indi', $parent_controller->getSignificantIndividual());
$id = $this->module->getName() . $block_id;
$class = $this->module->getName() . '_block';
$parent_controller->addInlineJavascript('
jQuery("#maj-new_passwd").hide();
jQuery("#maj-passwd_click").click(function()
{
jQuery("#maj-new_passwd").slideToggle(100, function() {
jQuery("#maj-new_passwd_username").focus();
});
return false;
});
');
if (Auth::isAdmin()) {
$title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $tree->getNameHtml() . '&ctype=gedcom"></a>';
} else {
$title = '';
}
$title .= '<span dir="auto">' . $tree->getTitleHtml() . '</span>';
$piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false);
$view_bag->set('piwik_enabled', $piwik_enabled);
if ($piwik_enabled) {
$parent_controller->addInlineJavascript('$("#piwik_stats")
.load("module.php?mod=' . $this->module->getName() . '&mod_action=Piwik&block_id=' . $block_id . '");');
}
$content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial();
if ($template) {
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
}
}
示例2: index
/**
* Certificate@index
*/
public function index()
{
global $WT_TREE;
$controller = new PageController();
$controller->setPageTitle(I18N::translate('Certificate'))->restrictAccess($this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE));
$cid = Filter::get('cid');
$certificate = null;
if (!empty($cid) && strlen($cid) > 22) {
$certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider);
}
$data = new ViewBag();
$data->set('title', $controller->getPageTitle());
$data->set('has_certif', false);
if ($certificate) {
$controller->restrictAccess($certificate->canShow());
$data->set('title', $certificate->getTitle());
$data->set('has_certif', true);
$data->set('certificate', $certificate);
$data->set('url_certif_city', 'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . '&mod_action=Certificate@listAll' . '&ged=' . $WT_TREE->getNameUrl() . '&city=' . Functions::encryptToSafeBase64($certificate->getCity()));
$controller->addInlineJavascript('
jQuery("#certificate-tabs").tabs();
jQuery("#certificate-tabs").css("visibility", "visible");
');
$data->set('has_linked_indis', false);
$data->set('has_linked_fams', false);
$linked_indis = $certificate->linkedIndividuals();
$linked_fams = $certificate->linkedFamilies();
if ($linked_indis && count($linked_indis) > 0) {
$data->set('has_linked_indis', true);
$data->set('linked_indis', $linked_indis);
}
if (!empty($linked_fams)) {
$data->set('has_linked_fams', true);
$data->set('linked_fams', $linked_fams);
}
}
ViewFactory::make('Certificate', $this, $controller, $data)->render();
}
示例3: index
/**
* SosaList@index
*/
public function index()
{
global $WT_TREE;
$controller = new PageController();
$controller->setPageTitle(I18N::translate('Sosa Ancestors'));
$this->view_bag->set('title', $controller->getPageTitle());
if ($this->view_bag->get('is_setup', false)) {
$this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0);
$this->view_bag->set('url_module', $this->module->getName());
$this->view_bag->set('url_action', 'SosaList');
$this->view_bag->set('url_ged', $WT_TREE->getNameUrl());
$this->view_bag->set('min_gen', 1);
if ($this->view_bag->get('has_sosa', false)) {
$controller->addInlineJavascript('
jQuery("#sosalist-tabs").tabs();
jQuery("#sosalist-tabs").css("visibility", "visible");
jQuery.get(
"module.php",
{
"mod" : "' . $this->module->getName() . '",
"mod_action": "SosaList@sosalist",
"ged" : "' . $WT_TREE->getNameUrl() . '",
"type" : "indi",
"gen" : "' . $this->generation . '"
},
"html"
).success(
function(data){
if(data){
jQuery("#sosalist-indi-data").html(data);
/* datatablesosaindi(); */
}
jQuery("#loading-indi").hide();
}
).error(
function(){
jQuery("#sosalist-indi-data").html("' . Filter::escapeJs('<p class="warning">' . I18N::translate('An error occurred while retrieving data...') . '</p>') . '");
jQuery("#loading-indi").hide();
}
);
jQuery.get(
"module.php",
{
"mod" : "' . $this->module->getName() . '",
"mod_action": "SosaList@sosalist",
"ged" : "' . $WT_TREE->getNameUrl() . '",
"type" : "fam",
"gen" : "' . $this->generation . '"
},
"html"
).success(
function(data){
if(data){
jQuery("#sosalist-fam-data").html(data);
}
jQuery("#loading-fam").hide();
}
).error(
function(){
jQuery("#sosalist-fam-data").html("' . Filter::escapeJs('<p class="warning">' . I18N::translate('An error occurred while retrieving data...') . '</p>') . '");
jQuery("#loading-fam").hide();
}
);
');
}
}
ViewFactory::make('SosaList', $this, $controller, $this->view_bag)->render();
}
示例4:
// The third row shows an optional progress bar and a list of maintenance options
$importing = Database::prepare("SELECT 1 FROM `##gedcom_chunk` WHERE gedcom_id = ? AND imported = '0' LIMIT 1")->execute(array($tree->getTreeId()))->fetchOne();
if ($importing) {
?>
<div id="import<?php
echo $tree->getTreeId();
?>
" class="col-xs-12">
<div class="progress">
<?php
echo I18N::translate('Calculating…');
?>
</div>
</div>
<?php
$controller->addInlineJavascript('jQuery("#import' . $tree->getTreeId() . '").load("import.php?gedcom_id=' . $tree->getTreeId() . '");');
}
?>
<div class="row<?php
echo $importing ? ' hidden' : '';
?>
" id="actions<?php
echo $tree->getTreeId();
?>
">
<div class="col-sm-6 col-md-3">
<h3>
<a href="index.php?ctype=gedcom&ged=<?php
echo $tree->getNameUrl();
?>
">
示例5: header
}
$order = Filter::post('order-' . $module->getName());
Database::prepare("UPDATE `##module` SET sidebar_order = ? WHERE module_name = ?")->execute(array($order, $module->getName()));
}
header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
return;
}
$controller->addInlineJavascript('
jQuery("#module_table").sortable({
items: ".sortme",
forceHelperSize: true,
forcePlaceholderSize: true,
opacity: 0.7,
cursor: "move",
axis: "y",
update: function(event, ui) {
jQuery("input", jQuery(this)).each(
function (index, element) {
element.value = index + 1;
}
);
}
});
')->pageHeader();
?>
<ol class="breadcrumb small">
<li><a href="admin.php"><?php
echo I18N::translate('Control panel');
?>
</a></li>
<li><a href="admin_modules.php"><?php
示例6: Array
list3.selectedIndex = -1;
}
if (list_name=="available_select") {
list1.selectedIndex = -1;
list3.selectedIndex = -1;
}
if (list_name=="right_select") {
list1.selectedIndex = -1;
list2.selectedIndex = -1;
}
}
var block_descr = new Array();
');
// Load Block Description array for use by javascript
foreach ($all_blocks as $block_name => $block) {
$controller->addInlineJavascript('block_descr["' . $block_name . '"] = "' . Filter::escapeJs($block->getDescription()) . '";');
}
$controller->addInlineJavascript('block_descr["advice1"] = "' . I18N::translate('Select a block and use the arrows to move it.') . '";');
?>
<h2><?php
echo $controller->getPageTitle();
?>
</h2>
<form name="config_setup" method="post" action="index_edit.php?action=update" onsubmit="select_options();" >
<input type="hidden" name="user_id" value="<?php
echo $user_id;
?>
">
<input type="hidden" name="gedcom_id" value="<?php
示例7: foreach
}
if ($blocks['main']) {
if ($blocks['side']) {
echo '<div id="index_main_blocks">';
} else {
echo '<div id="index_full_blocks">';
}
foreach ($blocks['main'] as $block_id => $module_name) {
if (array_key_exists($module_name, $active_blocks)) {
if (Auth::isSearchEngine() || !$active_blocks[$module_name]->loadAjax()) {
// Load the block directly
echo $active_blocks[$module_name]->getBlock($block_id);
} else {
// Load the block asynchronously
echo '<div id="block_', $block_id, '"><div class="loading-image"> </div></div>';
$controller->addInlineJavascript('jQuery("#block_' . $block_id . '").load("index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '");');
}
}
}
echo '</div>';
}
if ($blocks['side']) {
if ($blocks['main']) {
echo '<div id="index_small_blocks">';
} else {
echo '<div id="index_full_blocks">';
}
foreach ($blocks['side'] as $block_id => $module_name) {
if (array_key_exists($module_name, $active_blocks)) {
if (Auth::isSearchEngine() || !$active_blocks[$module_name]->loadAjax()) {
// Load the block directly
示例8: Array
list3.selectedIndex = -1;
}
if (list_name=="available_select") {
list1.selectedIndex = -1;
list3.selectedIndex = -1;
}
if (list_name=="right_select") {
list1.selectedIndex = -1;
list2.selectedIndex = -1;
}
}
var block_descr = new Array();
');
// Load Block Description array for use by javascript
foreach ($all_blocks as $block_name => $block) {
$controller->addInlineJavascript('block_descr["' . $block_name . '"] = "' . Filter::escapeJs($block->getDescription()) . '";');
}
$controller->addInlineJavascript('block_descr["advice1"] = "' . I18N::translate('Highlight a block name and then click on one of the arrow icons to move that highlighted block in the indicated direction.') . '";');
?>
<h2><?php
echo $controller->getPageTitle();
?>
</h2>
<form name="config_setup" method="post" action="index_edit.php?action=update" onsubmit="select_options();" >
<input type="hidden" name="user_id" value="<?php
echo $user_id;
?>
">
<input type="hidden" name="gedcom_id" value="<?php
示例9: array
$myfamlist = array();
$positions = Database::prepare("SELECT DISTINCT pl_gid FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?")->execute(array($place_id, $WT_TREE->getTreeId()))->fetchOneColumn();
foreach ($positions as $position) {
$record = GedcomRecord::getInstance($position, $WT_TREE);
if ($record && $record->canShow()) {
if ($record instanceof Individual) {
$myindilist[] = $record;
}
if ($record instanceof Family) {
$myfamlist[] = $record;
}
}
}
echo '<br>';
//-- display results
$controller->addInlineJavascript('jQuery("#places-tabs").tabs();')->addInlineJavascript('jQuery("#places-tabs").css("visibility", "visible");')->addInlineJavascript('jQuery(".loading-image").css("display", "none");');
echo '<div class="loading-image"> </div>';
echo '<div id="places-tabs"><ul>';
if ($myindilist) {
echo '<li><a href="#places-indi"><span id="indisource">', I18N::translate('Individuals'), '</span></a></li>';
}
if ($myfamlist) {
echo '<li><a href="#places-fam"><span id="famsource">', I18N::translate('Families'), '</span></a></li>';
}
echo '</ul>';
if ($myindilist) {
echo '<div id="places-indi">', FunctionsPrintLists::individualTable($myindilist), '</div>';
}
if ($myfamlist) {
echo '<div id="places-fam">', FunctionsPrintLists::familyTable($myfamlist), '</div>';
}