本文整理汇总了PHP中JFactory::getApplication方法的典型用法代码示例。如果您正苦于以下问题:PHP JFactory::getApplication方法的具体用法?PHP JFactory::getApplication怎么用?PHP JFactory::getApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFactory
的用法示例。
在下文中一共展示了JFactory::getApplication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save()
{
$mainframe =& JFactory::getApplication();
$row =& JTable::getInstance('K2UserGroup', 'Table');
if (!$row->bind(JRequest::get('post'))) {
$mainframe->redirect('index.php?option=com_k2&view=userGroups', $row->getError(), 'error');
}
if (!$row->check()) {
$mainframe->redirect('index.php?option=com_k2&view=userGroup&cid=' . $row->id, $row->getError(), 'error');
}
if (!$row->store()) {
$mainframe->redirect('index.php?option=com_k2&view=userGroups', $row->getError(), 'error');
}
$cache =& JFactory::getCache('com_k2');
$cache->clean();
switch (JRequest::getCmd('task')) {
case 'apply':
$msg = JText::_('Changes to User Group saved');
$link = 'index.php?option=com_k2&view=userGroup&cid=' . $row->id;
break;
case 'save':
default:
$msg = JText::_('User Group Saved');
$link = 'index.php?option=com_k2&view=userGroups';
break;
}
$mainframe->redirect($link, $msg);
}
示例2: addToolbar
/**
* Add the page title and toolbar.
*/
protected function addToolbar()
{
JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
if (isset($this->item->checked_out)) {
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
} else {
$checkedOut = false;
}
$canDo = SomosmaestrosHelper::getActions();
JToolBarHelper::title(JText::_('COM_SOMOSMAESTROS_TITLE_FORMACION'), 'formacion.png');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
JToolBarHelper::apply('formacion.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('formacion.save', 'JTOOLBAR_SAVE');
}
if (!$checkedOut && $canDo->get('core.create')) {
JToolBarHelper::custom('formacion.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::custom('formacion.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('formacion.cancel', 'JTOOLBAR_CANCEL');
} else {
JToolBarHelper::cancel('formacion.cancel', 'JTOOLBAR_CLOSE');
}
}
示例3: addToolbar
/**
* Add the page title and toolbar.
*/
protected function addToolbar()
{
JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
$canDo = SibdietHelper::getActions();
JToolBarHelper::title(JText::_('COM_SIBDIET_MANAGER_ERRAND'), 'database errands');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
JToolBarHelper::apply('errand.apply');
JToolBarHelper::save('errand.save');
}
if (!$checkedOut && $canDo->get('core.create')) {
JToolbarHelper::save2new('errand.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolbarHelper::save2copy('errand.save2copy');
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('errand.cancel');
} else {
JToolBarHelper::cancel('errand.cancel', 'JTOOLBAR_CLOSE');
}
}
示例4: delete
public function delete()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// Get items to remove from the request.
$cid = JFactory::getApplication()->input->get('cid', array(), 'array');
if (!is_array($cid) || count($cid) < 1) {
JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror');
} else {
// Get the model.
$model = $this->getModel();
// Make sure the item ids are integers
jimport('joomla.utilities.arrayhelper');
JArrayHelper::toInteger($cid);
// Remove the items.
if ($model->delete($cid)) {
$this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
} else {
$this->setMessage($model->getError());
}
}
$version = new JVersion();
if ($version->isCompatible('3.0')) {
// Invoke the postDelete method to allow for the child class to access the model.
$this->postDeleteHook($model, $cid);
}
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
}
示例5: display
function display($tpl = null)
{
JToolBarHelper::title(JText::_('COM_REDSOCIALSTREAM_CONFIGURE'), 'configure.png');
JToolBarHelper::apply();
JToolBarHelper::cancel('cancel', 'COM_REDSOCIALSTREAM_CLOSE');
//DEVNOTE: set document title
$document = JFactory::getDocument();
$document->setTitle(JText::_('COM_REDSOCIALSTREAM_REDSOCIALSTREAMS'));
$mainframe = JFactory::getApplication();
$context = "config";
$model = $this->getModel('configure');
$db = JFactory::getDbo();
$q = "SELECT * FROM #__redsocialstream_settings";
$db->setQuery($q);
$this->settingsrows = $db->loadObjectList();
$typelist = $this->get('type_list_sorted');
$pagination = $this->get('Pagination');
//DEVNOTE:give me ordering from request
$filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'ordering');
$filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
$this->assignRef('lists', $lists);
$this->assignRef("typelist", $typelist);
$this->assignRef('pagination', $pagination);
parent::display($tpl);
}
示例6: _getAllEvents
private function _getAllEvents()
{
$mainframe = JFactory::getApplication();
$rows = $this->model->getEvents();
$items = array();
foreach ($rows as $row) {
$item = new stdClass();
$table =& JTable::getInstance('Event', 'CTable');
$table->bind($row);
$table->thumbnail = $table->getThumbAvatar();
$table->avatar = $table->getAvatar();
$author = CFactory::getUser($table->creator);
$item->id = $row->id;
$item->created = $row->created;
$item->creator = CStringHelper::escape($author->getDisplayname());
$item->title = $row->title;
$item->description = CStringHelper::escape($row->description);
$item->location = CStringHelper::escape($row->location);
$tiem->startdate = $row->startdate;
$item->enddate = $row->enddate;
$item->thumbnail = $table->thumbnail;
$tiem->avatar = $table->avatar;
$item->ticket = $row->ticket;
$item->invited = $row->invitedcount;
$item->confirmed = $row->confirmedcount;
$item->declined = $row->declinedcount;
$item->maybe = $row->maybecount;
$item->latitude = $row->latitude;
$item->longitude = $row->longitude;
$items[] = $item;
}
return $items;
}
示例7: delete
public function delete()
{
// Get items to remove from the request and reverse the order to delete child albums first
$cid = JFactory::getApplication()->input->get('cid', array(), 'array');
JFactory::getApplication()->input->set('cid', array_reverse($cid));
parent::delete();
}
示例8: __construct
/**
* Constructor.
*
* @param Registry $options JOAuth2Client options object
* @param JHttp $http The HTTP client object
* @param JInput $input The input object
* @param JApplicationWeb $application The application object
*
* @since 12.3
*/
public function __construct(Registry $options = null, JHttp $http = null, JInput $input = null, JApplicationWeb $application = null)
{
$this->options = isset($options) ? $options : new Registry();
$this->http = isset($http) ? $http : new JHttp($this->options);
$this->input = isset($input) ? $input : JFactory::getApplication()->input;
$this->application = isset($application) ? $application : new JApplicationWeb();
}
示例9: getMultiProfiles
/**
* Returns multi profiles
*
**/
public function getMultiProfiles()
{
$mainframe = JFactory::getApplication();
static $fields;
if (isset($fields)) {
return $fields;
}
// Initialize variables
$db = JFactory::getDBO();
// Get the limit / limitstart
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
$limitstart = $mainframe->getUserStateFromRequest('com_community.multiprofile.limitstart', 'limitstart', 0, 'int');
// In case limit has been changed, adjust limitstart accordingly
$limitstart = $limit != 0 ? $limitstart / $limit * $limit : 0;
// Get the total number of records for pagination
$query = 'SELECT COUNT(*) FROM ' . $db->quoteName('#__community_profiles');
$db->setQuery($query);
$total = $db->loadResult();
jimport('joomla.html.pagination');
// Get the pagination object
$this->_pagination = new JPagination($total, $limitstart, $limit);
$query = 'SELECT * FROM ' . $db->quoteName('#__community_profiles') . ' ' . 'ORDER BY ' . $db->quoteName('ordering');
$db->setQuery($query, $this->_pagination->limitstart, $this->_pagination->limit);
$fields = $db->loadObjectList();
return $fields;
}
示例10: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
JHtml::_('jquery.framework');
$itemid = JFactory::getApplication()->input->getInt('id', 0);
$document = JFactory::getDocument();
$document->addScript(JUri::root() . 'administrator/components/com_dzproduct/assets/js/customfield.js');
JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_ERROR_NO_FIELDS');
JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_ERROR_LOAD_FIELDS');
JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_BTN_EDIT_GROUP');
$html = '<div
id="' . $this->id . '"
class="form-horizontal customfield"
data-fieldname="' . $this->fieldname . '"
data-controller="' . $this->element['controller'] . '"
data-itemid="' . $itemid . '">
<div class="form-container"></div>
<img class="img-loading" src="' . JUri::root() . '/media/system/images/modal/spinner.gif" />
<div class="control-group">
<div class="controls">
<button class="btn btn-primary btn-reload"><span class="icon-refresh"></span> ' . JText::_('COM_DZPRODUCT_RELOAD_FIELDS') . '</button>
</div>
</div>
</div>';
return $html;
}
示例11: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
// Adjust the context to support modal layouts.
if ($layout = $app->input->get('layout')) {
$this->context .= '.' . $layout;
}
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access);
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
$this->setState('filter.published', $published);
$categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id');
$this->setState('filter.category_id', $categoryId);
$language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
// Force a language.
$forcedLanguage = $app->input->get('forcedLanguage');
if (!empty($forcedLanguage)) {
$this->setState('filter.language', $forcedLanguage);
$this->setState('filter.forcedLanguage', $forcedLanguage);
}
$tag = $this->getUserStateFromRequest($this->context . '.filter.tag', 'filter_tag', '');
$this->setState('filter.tag', $tag);
// List state information.
parent::populateState('a.name', 'asc');
}
示例12: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$checkedOut = !true;
// Since we don't track these assets at the item level, use the category id.
JToolbarHelper::title(JText::_('COM_HTRAININGLOGS_MANAGER_H_TR_SESSION'), 'link h_tr_sessions');
// If not checked out, can save the item.
if (!$checkedOut || count($user->getAuthorisedCategories('com_htraininglogs', 'core.create'))) {
JToolbarHelper::apply('h_tr_session.apply');
JToolbarHelper::save('h_tr_session.save');
}
if (!$checkedOut && count($user->getAuthorisedCategories('com_htraininglogs', 'core.create'))) {
JToolbarHelper::save2new('h_tr_session.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && count($user->getAuthorisedCategories('com_htraininglogs', 'core.create')) > 0) {
JToolbarHelper::save2copy('h_tr_session.save2copy');
}
if (empty($this->item->id)) {
JToolbarHelper::cancel('h_tr_session.cancel');
} else {
if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) {
JToolbarHelper::versions('com_htraininglogs.h_tr_session', $this->item->id);
}
JToolbarHelper::cancel('h_tr_session.cancel', 'JTOOLBAR_CLOSE');
}
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_COMPONENTS_H_tr_sessionS_LINKS_EDIT');
}
示例13: tag
function tag()
{
$doc = JFactory::getDocument();
$doc->addStyleSheet(ACYMAILING_CSS . 'frontendedition.css?v=' . filemtime(ACYMAILING_MEDIA . 'css' . DS . 'frontendedition.css'));
JPluginHelper::importPlugin('acymailing');
$dispatcher = JDispatcher::getInstance();
$tagsfamilies = $dispatcher->trigger('acymailing_getPluginType');
$defaultFamily = reset($tagsfamilies);
$app = JFactory::getApplication();
$fctplug = $app->getUserStateFromRequest(ACYMAILING_COMPONENT . ".tag", 'fctplug', $defaultFamily->function, 'cmd');
ob_start();
$defaultContents = $dispatcher->trigger($fctplug);
$defaultContent = ob_get_clean();
$js = 'function insertTag(){if(window.parent.insertTag(window.document.getElementById(\'tagstring\').value)) {acymailing_js.closeBox(true);}}';
$js .= 'function setTag(tagvalue){window.document.getElementById(\'tagstring\').value = tagvalue;}';
$js .= 'function showTagButton(){window.document.getElementById(\'insertButton\').style.display = \'inline\'; window.document.getElementById(\'tagstring\').style.display=\'inline\';}';
$js .= 'function hideTagButton(){}';
$js .= 'try{window.parent.previousSelection = window.parent.getPreviousSelection(); }catch(err){window.parent.previousSelection=false; }';
$doc->addScriptDeclaration($js);
$this->assignRef('fctplug', $fctplug);
$type = JRequest::getString('type', 'news');
$this->assignRef('type', $type);
$this->assignRef('defaultContent', $defaultContent);
$this->assignRef('tagsfamilies', $tagsfamilies);
$app = JFactory::getApplication();
$this->assignRef('app', $app);
$ctrl = JRequest::getString('ctrl');
$this->assignRef('ctrl', $ctrl);
}
示例14: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
// Built the actions for new and existing records.
$canDo = JHelperContent::getActions('com_testyourself');
JToolBarHelper::title(JText::_('COM_TESTYOURSELF_MANAGER_QUESTION'), 'question questions');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
JToolBarHelper::apply('question.apply');
JToolBarHelper::save('question.save');
}
if (!$checkedOut && $canDo->get('core.create')) {
JToolbarHelper::save2new('question.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolbarHelper::save2copy('question.save2copy');
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('question.cancel');
} else {
JToolBarHelper::cancel('question.cancel', 'JTOOLBAR_CLOSE');
}
}
示例15: render
/**
* Display the view
*
* @return string The rendered view.
*
* @since 3.2
*/
public function render()
{
$lang = JFactory::getApplication()->getLanguage();
$lang->load('', JPATH_ADMINISTRATOR, $lang->getTag());
$lang->load('com_modules', JPATH_ADMINISTRATOR, $lang->getTag());
return parent::render();
}