本文整理汇总了PHP中Jfactory::getDocument方法的典型用法代码示例。如果您正苦于以下问题:PHP Jfactory::getDocument方法的具体用法?PHP Jfactory::getDocument怎么用?PHP Jfactory::getDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jfactory
的用法示例。
在下文中一共展示了Jfactory::getDocument方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildTreeview
/**
* Adds the dTree resources and builds up the neccessary javascript html output to
* show the category tree
*
* @param array $jgcat_rows
* @return string $script
*/
public function buildTreeview($jgcat_rows)
{
// Include dTree script, dTree and jgtreeview styles
$document = Jfactory::getDocument();
$document->addStyleSheet(JURI::root() . 'media/mod_jgtreeview/css/dtree.css');
$document->addStyleSheet(JURI::root() . 'media/mod_jgtreeview/css/jgtreeview.css');
$document->addScript(JURI::root() . 'media/mod_jgtreeview/js/dtree.js');
// Get current user object
$user = JFactory::getUser();
// Get module id
$modid = $this->getConfig('modid');
// Array to hold the valid parent categories
$validParentCats = array();
// Array with categories to filter
$blacklistCats = explode(',', $this->getConfig('blacklist_cats'));
// Get root category ID
$root_catid = $this->getConfig('root_catid');
// Create and configure dTree object
$script = " var jgTreeView" . $modid . "= new dTree('jgTreeView" . $modid . "', " . "'" . $this->getConfig('icon_theme_path') . "');" . "\n";
$script .= " jgTreeView" . $modid . ".config.useCookies = true;" . "\n";
$script .= " jgTreeView" . $modid . ".config.inOrder = true;" . "\n";
$script .= " jgTreeView" . $modid . ".config.useSelection = true;" . "\n";
$script .= " jgTreeView" . $modid . ".config.useLines = " . $this->getConfig('grid') . ";" . "\n";
$root_node_ok = false;
if ($root_catid == 1 && !$this->getConfig('usrmode')) {
// Prepare root node
$root_link = JRoute::_('index.php?option=com_joomgallery&view=gallery' . $this->getJoomId());
$root_name = $this->getConfig('name');
$root_locked = 'false';
$root_node_ok = true;
} else {
$rootRow = new stdClass();
if (!$this->getConfig('usrmode')) {
// Standard mode, find root node category specified in modul configuration
foreach ($jgcat_rows as $row) {
if ($row->cid == $root_catid) {
$rootRow = $row;
break;
}
}
} else {
// User mode, find the lowest level category node owned by the current user
$root_catid = 1;
$minLevel = PHP_INT_MAX;
foreach ($jgcat_rows as $row) {
if ($row->level < $minLevel && $user->get('id') && $row->owner == $user->get('id')) {
$rootRow = $row;
$root_catid = $row->cid;
$minLevel = $row->level;
}
}
}
// Prepare root node
if (isset($rootRow->cid) && $root_catid > 1) {
// Check if user is allowed to access the root category
$access = in_array($rootRow->access, $user->getAuthorisedViewLevels()) && isset($this->categories[$rootRow->cid]);
if (($this->getConfig('filter_cats') == false || $access || $this->allcategories[$rootRow->cid]->protected && ($rootRow->parent_id == 1 ? true : isset($this->categories[$rootRow->parent_id]))) && !in_array($root_catid, $blacklistCats) && !$this->hideCategory($rootRow->cid)) {
$protected = $this->allcategories[$rootRow->cid]->protected ? true : false;
$this->getTreeNodeNameAndLink($rootRow, $access, $protected, $root_name, $root_link);
$root_locked = $access ? 'false' : 'true';
$root_node_ok = true;
}
}
}
// Add root node
if ($root_node_ok == true) {
$script .= " jgTreeView" . $modid . ".add(" . $root_catid . ", -1, ";
$script .= "'" . $root_name . "', ";
$script .= "'" . $root_link . "', ";
$script .= "'" . $root_locked . "');" . "\n";
$validParentCats[$root_catid] = true;
}
foreach ($jgcat_rows as $row) {
// Check if user is allowed to access the category
$access = in_array($row->access, $user->getAuthorisedViewLevels()) && isset($this->categories[$row->cid]);
// Get treview node name and node link
$protected = $this->allcategories[$row->cid]->protected ? true : false;
$this->getTreeNodeNameAndLink($row, $access, $protected, $cat_name, $cat_link);
// Add nodes
if ($row->parent_id == $root_catid) {
if (($this->getConfig('filter_cats') == false || $access || $this->allcategories[$row->cid]->protected && ($row->parent_id == 1 ? true : isset($this->categories[$row->parent_id]))) && !in_array($row->cid, $blacklistCats) && $root_node_ok == true && !$this->hideCategory($row->cid)) {
// It is a parent node with node id = $root_catid
$script .= " jgTreeView" . $modid . ".add(" . $row->cid . ", " . $root_catid . ", ";
$script .= "'" . $cat_name . "', ";
$script .= "'" . $cat_link . "', ";
$script .= ($access ? 'false' : 'true') . ");" . "\n";
$validParentCats[$row->cid] = true;
}
} else {
if (($this->getConfig('filter_cats') == false || $access || $this->allcategories[$row->cid]->protected && ($row->parent_id == 1 ? true : isset($this->categories[$row->parent_id]))) && isset($validParentCats[$row->parent_id]) && !in_array($row->cid, $blacklistCats) && !$this->hideCategory($row->cid)) {
// It is a child node
$script .= " jgTreeView" . $modid . ".add(" . $row->cid . ", " . $row->parent_id . ", ";
$script .= "'" . $cat_name . "', ";
//.........这里部分代码省略.........
示例2: _opengraph
protected function _opengraph()
{
$app =& JFactory::getApplication();
$document =& Jfactory::getDocument();
$uri =& JFactory::getUri();
$params = $app->getParams('com_redevent');
$row = $this->row;
if ($params->get('fbadmin')) {
$document->addCustomTag('<meta property="fb:admins" content="' . $params->get('fbadmin') . '"/>');
}
$document->addScript('http://connect.facebook.net/en_US/all.js#xfbml=1');
}
示例3: defined
* briaskISS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* briaskISS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with briaskISS. If not, see <http://www.gnu.org/licenses/>.
* Created on 4 Mar 2008
*/
defined('_JEXEC') or die('Restricted access');
$doc =& Jfactory::getDocument();
$doc->addStyleSheet(JURI::root(true) . '/modules/mod_briaskISS/mod_briaskISS.css');
$doc->addScript(JURI::root(true) . '/modules/mod_briaskISS/mod_briaskISS.js');
?>
<noscript>
<div>ImageSlideShow requires Javascript</div>
</noscript>
<?php
include_once 'mod_briaskUtility.php';
briask_collectPics($params, $module);
?>
<script type="text/javascript">
var briaskPics<?php
echo $module->id;
示例4: save
function save()
{
// Check for request forgeries
JRequest::checkToken() or die('Invalid Token');
$task = JRequest::getVar('task');
// Sanitize
$post = JRequest::get('post', JREQUEST_ALLOWHTML);
$model = $this->getModel('value');
if ($row = $model->store($post)) {
switch ($task) {
case 'apply':
$link = 'index.php?option=com_redform&view=value&hidemainmenu=1&cid[]=' . $row->id;
break;
default:
$link = 'index.php?option=com_redform&view=values';
break;
}
$msg = JText::_('COM_REDFORM_VALUE_SAVED');
$cache =& JFactory::getCache('com_redform');
$cache->clean();
} else {
$msg = '';
$link = 'index.php?option=com_redform&view=values';
}
$model->checkin();
if (JRequest::getCmd('task') == 'ajaxsave') {
$doc =& Jfactory::getDocument();
$doc->addScriptDeclaration('
window.parent.newvalue();
window.parent.SqueezeBox.close();
');
return;
}
$this->setRedirect($link, $msg);
}
示例5: _displayPopulate
function _displayPopulate($tpl)
{
$app = JFactory::getApplication();
$document = Jfactory::getDocument();
$uri = JFactory::getURI();
$model = $this->getModel();
$projectws =& $this->get('Data', 'projectws');
$document->setTitle(JText::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TITLE'));
$version = urlencode(JoomleagueHelper::getVersion());
$document->addScript('components/com_joomleague/assets/js/populate.js?v=' . $version);
$lists = array();
$options = array(JHTML::_('select.option', 0, Jtext::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TYPE_SINGLE_ROUND_ROBIN')), JHTML::_('select.option', 1, Jtext::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TYPE_DOUBLE_ROUND_ROBIN')), JHTML::_('select.option', 2, Jtext::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TYPE_TOURNAMENT_ROUND_ROBIN')));
$lists['scheduling'] = JHTML::_('select.genericlist', $options, 'scheduling', '', 'value', 'text');
//TODO-add error message - what if there are no teams assigned to the project
$teams = $this->get('projectteams');
$options = array();
foreach ($teams as $t) {
$options[] = JHTML::_('select.option', $t->projectteam_id, $t->text);
}
$lists['teamsorder'] = JHTML::_('select.genericlist', $options, 'teamsorder[]', 'multiple="multiple" size="20"');
$this->assignRef('projectws', $projectws);
$this->assignRef('request_url', $uri->toString());
$this->assignRef('lists', $lists);
$this->addToolbar_Populate();
parent::display($tpl);
}