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


PHP PageController::addExternalJavascript方法代码示例

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


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

示例1: index

    /**
     * GeoAnalysis@index
     */
    public function index()
    {
        $controller = new PageController();
        $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion'));
        $data = new ViewBag();
        $data->set('title', $controller->getPageTitle());
        $data->set('has_analysis', false);
        $ga_id = Filter::getInteger('ga_id');
        if ($ga_id && ($ga = $this->provider->getGeoAnalysis($ga_id))) {
            $data->set('has_analysis', true);
            $data->set('geoanalysis', $ga);
            $controller->addExternalJavascript(Constants::WT_RAPHAEL_JS_URL())->addInlineJavascript('
                jQuery("#geodispersion-tabs").tabs();
                jQuery("#geodispersion-tabs").css("visibility", "visible");
                
                jQuery.get(
					"module.php",
					{
                        "mod" : "' . $this->module->getName() . '",  
                        "mod_action": "GeoAnalysis@dataTabs",
                        "ga_id" : "' . $ga_id . '"
                    },
					function(data){
						if(data){	    
							jQuery("#geodisp-data-general").html(data.generaltab);
							jQuery("#geodisp-data-generations").html(data.generationstab);
					    }
					    jQuery(".loading-image").hide();				    		
					},
					"json"
				);
            ');
        }
        ViewFactory::make('GeoAnalysis', $this, $controller, $data)->render();
    }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:38,代码来源:GeoAnalysisController.php

示例2: missing

 /**
  * SosaList@missing
  */
 public function missing()
 {
     global $WT_TREE;
     $controller = new PageController();
     $controller->setPageTitle(I18N::translate('Missing Ancestors'));
     $this->view_bag->set('title', $controller->getPageTitle());
     if ($this->view_bag->get('is_setup', false)) {
         $this->view_bag->set('url_module', $this->module->getName());
         $this->view_bag->set('url_action', 'SosaList@missing');
         $this->view_bag->set('url_ged', $WT_TREE->getNameUrl());
         $this->view_bag->set('min_gen', 2);
         $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation);
         $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0);
         $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation - 1));
         $this->view_bag->set('perc_sosa', $perc_sosa);
         if ($this->view_bag->get('has_missing', false)) {
             $table_id = 'table-sosa-missing-' . Uuid::uuid4();
             $this->view_bag->set('table_id', $table_id);
             $controller->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addInlineJavascript('
 				/* Initialise datatables */
 				jQuery.fn.dataTableExt.oSort["unicode-asc"  ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))};
 				jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))};
 				jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);};
 				jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);};
                 
 				jQuery("#' . $table_id . '").dataTable( {
                     dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\',
 					' . I18N::datatablesI18N() . ',
 					jQueryUI: true,
 					autoWidth:false,
 					processing: true,
 					retrieve: true,
 					columns: [
 						/* 0-Sosa */  		{ type: "num", class: "center" },
 		                /* 1-ID */ 			{ class: "center" },
 		                /* 2-givn */ 		{ dataSort: 4,  class: "left"},
 						/* 3-surn */ 		{ dataSort: 5},
 						/* 4-GIVN,SURN */ 	{ type: "unicode", visible: false},
 						/* 5-SURN,GIVN */ 	{ type: "unicode", visible: false},
 		                /* PERSO Modify table to include IsSourced module */
 		                /* 6-INDI_SOUR */	{ dataSort : 7, class: "center", visible: ' . (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME) ? 'true' : 'false') . ' },
 	                	/* 7-SORT_INDISC */	{ visible : false},
 		                /* 8-Father */		{ class: "center"},
 		                /* 9-Mother */		{ class: "center"},
 		                /* 10-Birth */		{ dataSort : 11 , class: "center"},
 		                /* 11-SORT_BIRT */	{ visible : false},
 		                /* 12-BIRT_PLAC */	{ type: "unicode", class: "center"},
 		                /* 13-BIRT_SOUR */	{ dataSort : 14, class: "center", visible: ' . (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME) ? 'true' : 'false') . ' },
 	                	/* 14-SORT_BIRTSC */{ visible : false},
 		                /* 15-SEX */		{ visible : false}
 		                /* END PERSO */
 					],
 		            sorting: [[0,"asc"]],
 					displayLength: 20,
 					pagingType: "full_numbers"
 			   });
 			
 				jQuery("#' . $table_id . '")
 				/* Filter buttons in table header */
 				.on("click", "button[data-filter-column]", function() {
 					var btn = jQuery(this);
 					// De-activate the other buttons in this button group
 					btn.siblings().removeClass("ui-state-active");
 					// Apply (or clear) this filter
 					var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column"));
 					if (btn.hasClass("ui-state-active")) {
 						btn.removeClass("ui-state-active");
 						col.search("").draw();
 					} else {
 						btn.addClass("ui-state-active");
 						col.search(btn.data("filter-value")).draw();
 					}
 				});
                 
 				jQuery(".smissing-list").css("visibility", "visible");
 				jQuery(".loading-image").css("display", "none");
 			');
             $unique_indis = array();
             $sum_missing_different = 0;
             $sum_missing_different_without_hidden = 0;
             foreach ($missing_list as $num => $missing_tab) {
                 if (isset($unique_indis[$missing_tab['indi']])) {
                     unset($missing_list[$num]);
                     continue;
                 }
                 $sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother'];
                 $person = Individual::getInstance($missing_tab['indi'], $WT_TREE);
                 if (!$person || !$person->canShowName()) {
                     unset($missing_list[$num]);
                     continue;
                 }
                 $sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother'];
                 $unique_indis[$person->getXref()] = true;
                 $missing_tab['indi'] = $person;
                 $missing_list[$num] = $missing_tab;
             }
             $this->view_bag->set('missing_list', $missing_list);
//.........这里部分代码省略.........
开发者ID:jon48,项目名称:webtrees-lib,代码行数:101,代码来源:SosaListController.php

示例3: PageController

 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
namespace Fisharebest\Webtrees;

/**
 * Defined in session.php
 *
 * @global Tree $WT_TREE
 */
global $WT_TREE;
use Fisharebest\Webtrees\Controller\PageController;
define('WT_SCRIPT_NAME', 'admin_trees_manage.php');
require './includes/session.php';
$controller = new PageController();
$controller->addExternalJavascript(WT_ADMIN_JS_URL)->restrictAccess(Auth::isAdmin() || Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Manage family trees'));
// Show a reduced page when there are more than a certain number of trees
$multiple_tree_threshold = Site::getPreference('MULTIPLE_TREE_THRESHOLD') ?: 500;
// Note that glob() returns false instead of an empty array when open_basedir_restriction
// is in force and no files are found.  See PHP bug #47358.
if (defined('GLOB_BRACE')) {
    $gedcom_files = glob(WT_DATA_DIR . '*.{ged,Ged,GED}', GLOB_NOSORT | GLOB_BRACE) ?: array();
} else {
    $gedcom_files = array_merge(glob(WT_DATA_DIR . '*.ged', GLOB_NOSORT) ?: array(), glob(WT_DATA_DIR . '*.Ged', GLOB_NOSORT) ?: array(), glob(WT_DATA_DIR . '*.GED', GLOB_NOSORT) ?: array());
}
// Process POST actions
switch (Filter::post('action')) {
    case 'delete':
        $gedcom_id = Filter::postInteger('gedcom_id');
        if (Filter::checkCsrf() && $gedcom_id) {
            $tree = Tree::findById($gedcom_id);
开发者ID:AlexSnet,项目名称:webtrees,代码行数:31,代码来源:admin_trees_manage.php

示例4: index

    /**
     * AdminConfig@index
     */
    public function index()
    {
        global $WT_TREE;
        HookProvider::getInstance()->updateHooks();
        $action = Filter::post('action');
        if ($action == 'update' && Filter::checkCsrf()) {
            $this->update();
        }
        Theme::theme(new AdministrationTheme())->init($WT_TREE);
        $ctrl = new PageController();
        $ctrl->restrictAccess(Auth::isAdmin())->setPageTitle($this->module->getTitle());
        $table_id = 'table-installedhooks-' . Uuid::uuid4();
        $view_bag = new ViewBag();
        $view_bag->set('title', $ctrl->getPageTitle());
        $view_bag->set('table_id', $table_id);
        $view_bag->set('hook_list', HookProvider::getInstance()->getRawInstalledHooks());
        $ctrl->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)->addInlineJavascript('
		  	jQuery(document).ready(function() {
				jQuery("#' . $table_id . '").dataTable( {
					' . I18N::datatablesI18N() . ',		
					sorting: [[ 2, "asc" ], [ 3, "asc" ]],
					displayLength: 10,
					pagingType: "full_numbers",
					columns: [
						/* 0 Enabled 		*/	{ dataSort: 1, class: "center" },
						/* 1 Enabled sort	*/	{ visible: false},
						/* 2 Hook function	*/	null,
						/* 3 Hook context	*/	null,
						/* 4 Module name	*/	null,
						/* 5 Priority		*/	{ dataSort: 6, class: "center" },
						/* 6 Priority sort	*/	{ type: "num", visible: false}
					]
			  });
			});
		');
        ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render();
    }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:40,代码来源:AdminConfigController.php

示例5: listAll

 /**
  * Certificate@listAll
  */
 public function listAll()
 {
     global $WT_TREE;
     $controller = new PageController();
     $controller->setPageTitle(I18N::translate('Certificates'))->restrictAccess($this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE));
     $city = Filter::get('city');
     if (!empty($city) && strlen($city) > 22) {
         $city = Functions::decryptFromSafeBase64($city);
         $controller->setPageTitle(I18N::translate('Certificates for %s', $city));
     }
     $data = new ViewBag();
     $data->set('title', $controller->getPageTitle());
     $data->set('url_module', $this->module->getName());
     $data->set('url_action', 'Certificate@listAll');
     $data->set('url_ged', $WT_TREE->getNameUrl());
     $data->set('cities', $this->provider->getCitiesList());
     $data->set('selected_city', $city);
     $data->set('has_list', false);
     if (!empty($city)) {
         $table_id = 'table-certiflist-' . Uuid::uuid4();
         $certif_list = $this->provider->getCertificatesList($city);
         if (!empty($certif_list)) {
             $data->set('has_list', true);
             $data->set('table_id', $table_id);
             $data->set('certificate_list', $certif_list);
             $controller->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addInlineJavascript('
                     /* Initialise datatables */
     				jQuery.fn.dataTableExt.oSort["unicode-asc"  ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))};
     				jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))};
     				jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);};
     				jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);};
                     
                     jQuery("#' . $table_id . '").dataTable( {
     					dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\',
 					    ' . I18N::datatablesI18N() . ',
 					    jQueryUI: true,
     					autoWidth: false,
     					processing: true,
     					columns: [
     		                    /* 0-Date */  			{ dataSort: 1, width: "15%", class: "center" },
     							/* 1-DateSort */		{ type: "unicode", visible : false },
     		                    /* 2-Type */ 			{ width: "5%", searchable: false, class: "center"},
     		                    /* 3-CertificateSort */ { type: "unicode", visible : false },
     		                    /* 4-Certificate */     { dataSort: 3, class: "left" }
     		                ],
     		            sorting: [[0,"asc"], [2,"asc"]],
     					displayLength: 20,
     					pagingType: "full_numbers"
     			   });
     				jQuery(".certificate-list").css("visibility", "visible");
     				jQuery(".loading-image").css("display", "none");
                 ');
         }
     }
     ViewFactory::make('CertificatesList', $this, $controller, $data)->render();
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:59,代码来源:CertificateController.php


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