本文整理汇总了PHP中JObject::get方法的典型用法代码示例。如果您正苦于以下问题:PHP JObject::get方法的具体用法?PHP JObject::get怎么用?PHP JObject::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JObject
的用法示例。
在下文中一共展示了JObject::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItems
/**
* Method to get an array of data items.
*
* @return array An array of data items
*
* @since 12.2
*/
public function getItems()
{
jimport('joomla.filesystem.folder');
$items = array();
$files = JFolder::files(JDeveloperArchive::getArchiveDir());
$store = $this->getStoreId('getItems');
foreach ($files as $file) {
if (preg_match('/(^pkg_).*(.zip$)/', $file)) {
$item = new JObject();
$item->set('id', $file);
$item->set('name', $file);
$item->set('created', date("Y M d - H:i:s", filemtime(JDeveloperArchive::getArchiveDir() . DS . $file)));
$item->createDir = JDeveloperArchive::getArchiveDir() . "/" . JDeveloperArchive::getArchiveName("pkg_", $item->name, $item->get("version", "1.0.0"));
$content = array();
if (!($zip = zip_open(JDeveloperArchive::getArchiveDir() . DS . $file))) {
throw new Exception("Failed to open {$file}");
}
while ($zip_entry = zip_read($zip)) {
if (preg_match('/.zip$/', zip_entry_name($zip_entry))) {
$content[] = zip_entry_name($zip_entry);
}
}
$item->set('content', implode('<br>', $content));
$items[] = $item;
}
}
// Add the items to the internal cache.
$this->cache['packages'] = $items;
return $this->cache['packages'];
}
示例2: addToolbar
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
$input = JFactory::getApplication()->input;
$input->set('hidemainmenu', true);
$isNew = $this->item->id == 0;
JToolbarHelper::title(JText::_($isNew ? 'COM_MENUS_VIEW_NEW_MENU_TITLE' : 'COM_MENUS_VIEW_EDIT_MENU_TITLE'), 'list menu');
// If a new item, can save the item. Allow users with edit permissions to apply changes to prevent returning to grid.
if ($isNew && $this->canDo->get('core.create')) {
if ($this->canDo->get('core.edit')) {
JToolbarHelper::apply('menu.apply');
}
JToolbarHelper::save('menu.save');
}
// If user can edit, can save the item.
if (!$isNew && $this->canDo->get('core.edit')) {
JToolbarHelper::apply('menu.apply');
JToolbarHelper::save('menu.save');
}
// If the user can create new items, allow them to see Save & New
if ($this->canDo->get('core.create')) {
JToolbarHelper::save2new('menu.save2new');
}
if ($isNew) {
JToolbarHelper::cancel('menu.cancel');
} else {
JToolbarHelper::cancel('menu.cancel', 'JTOOLBAR_CLOSE');
}
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_MENUS_MENU_MANAGER_EDIT');
}
示例3: getState
/**
* Get property state value escaped.
*
* @param string $name property name
* @return mized
*/
public function getState($name)
{
if (isset($this->state)) {
return $this->escape($this->state->get($this->getStateName($name)));
}
return null;
}
示例4: test__construct
/**
* @todo Implement test__toString().
*/
public function test__construct() {
$this->object = new JObject(array('property1' => 'value1', 'property2' => 5));
$this->assertThat(
$this->object->get('property1'),
$this->equalTo('value1')
);
}
示例5: addToolbar
/**
* Display the toolbar.
*
* @return void
*
* @since 2.5
*/
protected function addToolbar()
{
$input = JFactory::getApplication()->input;
$input->set('hidemainmenu', 1);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
$canDo = UsersHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
JToolbarHelper::title(JText::_('COM_USERS_NOTES'), 'users user');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_users', 'core.create')))) {
JToolbarHelper::apply('note.apply');
JToolbarHelper::save('note.save');
}
if (!$checkedOut && count($user->getAuthorisedCategories('com_users', 'core.create'))) {
JToolbarHelper::save2new('note.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && count($user->getAuthorisedCategories('com_users', 'core.create')) > 0) {
JToolbarHelper::save2copy('note.save2copy');
}
if (empty($this->item->id)) {
JToolbarHelper::cancel('note.cancel');
} else {
if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) {
JToolbarHelper::versions('com_users.note', $this->item->id);
}
JToolbarHelper::cancel('note.cancel', 'JTOOLBAR_CLOSE');
}
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_USERS_USER_NOTES_EDIT');
}
示例6: display
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*
* @since 1.6
*/
public function display($tpl = null)
{
$user = JFactory::getUser();
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->modules = $this->get('Modules');
$this->levels = $this->get('ViewLevels');
$this->state = $this->get('State');
$this->canDo = JHelperContent::getActions('com_menus', 'menu', (int) $this->state->get('item.menutypeid'));
// Check if we're allowed to edit this item
// No need to check for create, because then the moduletype select is empty
if (!empty($this->item->id) && !$this->canDo->get('core.edit')) {
throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
if ($this->getLayout() == 'modal') {
// If we are forcing a language in modal (used for associations).
if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) {
// Set the language field to the forcedLanguage and disable changing it.
$this->form->setValue('language', null, $forcedLanguage);
$this->form->setFieldAttribute('language', 'readonly', 'true');
// Only allow to select categories with All language or with the forced language.
$this->form->setFieldAttribute('parent_id', 'language', '*,' . $forcedLanguage);
}
} elseif ($this->item->id && $this->form->getValue('language', null, '*') != '*' && JLanguageAssociations::isEnabled() && count($this->item->associations) > 0) {
$this->form->setFieldAttribute('language', 'readonly', 'true');
}
parent::display($tpl);
$this->addToolbar();
}
示例7: addToolbar
protected function addToolbar()
{
$state = $this->get('State');
JToolBarHelper::title(JText::_('COM_XMAP_SITEMAPS_TITLE'), 'list');
$canDo = JHelperContent::getActions('com_xmap', 'sitemap');
JToolBarHelper::addNew('sitemap.add');
JToolbarHelper::editList('sitemap.edit');
if ($canDo->get('core.edit.state')) {
JToolbarHelper::publish('sitemaps.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('sitemaps.unpublish', 'JTOOLBAR_UNPUBLISH', true);
}
if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
JToolbarHelper::deleteList('', 'sitemaps.delete', 'JTOOLBAR_EMPTY_TRASH');
} elseif ($canDo->get('core.edit.state')) {
JToolbarHelper::trash('sitemaps.trash');
}
if ($canDo->get('core.manage')) {
JToolbarHelper::custom('sitemaps.ping', 'heart', 'heart', JText::_('COM_XMAP_TOOLBAR_PING'));
}
if (JFactory::getUser()->authorise('core.admin')) {
JToolbarHelper::preferences('com_xmap');
}
if (JHelperContent::getActions('com_plugins')->get('core.edit.state')) {
JToolbarHelper::custom('sitemaps.plugins', 'power-cord', 'power-cord', JText::_('COM_XMAP_TOOLBAR_PLUGINS'), false);
}
JHtmlSidebar::setAction('index.php?option=com_xmap&view=sitemaps');
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', XmapHelper::getStateOptions(), 'value', 'text', $this->state->get('filter.state')));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')));
$this->sidebar = JHtmlSidebar::render();
}
示例8: display
/**
* @param null $tpl
*
* @return bool
* @throws Exception
*/
function display($tpl = null)
{
$this->state = $this->get('State');
$this->params = $this->state->get('params');
$this->item = $this->get('Item');
$this->items = $this->get('Items');
$this->sitemapItems = $this->get('SitemapItems');
$this->extensions = $this->get('Extensions');
$input = JFactory::getApplication()->input;
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
$app = JFactory::getApplication();
$app->clearHeaders();
$app->setHeader('Content-Type', 'application/xml; charset=UTF-8');
$app->sendHeaders();
$this->displayer = new XmapDisplayerXml($this->item, $this->items, $this->extensions);
$this->displayer->displayAsNews($input->getBool('news'));
$this->displayer->displayAsImages($input->getBool('images'));
$this->displayer->displayAsVideos($input->getBool('videos'));
$this->displayer->displayAsMobile($input->getBool('mobile'));
$this->displayer->setSitemapItems($this->sitemapItems);
parent::display($tpl);
$this->getModel()->hit($this->displayer->getCount());
$app->close();
}
示例9: addSidebar
protected function addSidebar() {
JHtmlSidebar::setAction('index.php?option=com_prp&view=tables');
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_AUTHOR'),
'filter_user',
JHtml::_(
'select.options',
$this->get('Users'),
'value',
'text',
$this->state->get('filter.user'),
false
)
);
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_PUBLISHED'),
'filter_state',
JHtml::_(
'select.options',
JHtml::_('jgrid.publishedOptions'),
'value',
'text',
$this->state->get('filter.state'),
true
)
);
return JHtmlSidebar::render();
}
示例10: canEdit
/**
* Complet access to edit. Can edit/can edit own/isn't checked.
*
* @param JObject $document has to contain id, created_by and checked_out paramters
* @return boolean
*/
public static function canEdit(&$document)
{
$canEdit = JoomDOCAccessDocument::edit($document->get('id'));
$canEditOwn = JoomDOCAccessDocument::editOwn($document->get('id'), $document->get('created_by'));
// document isn't checked or is checked by current user
$isNotChecked = $document->get('checked_out') == 0 || $document->get('checked_out') == JFactory::getUser()->id;
return ($canEdit || $canEditOwn) && $isNotChecked;
}
示例11: __construct
/**
* {@inheritdoc}
*
* @param mixed $data Field data
* @param bool $loadExtraData Load extra data flag
* @param bool $loadParent Load parent flag
* @param bool $fetchTranslations If the translation have to be loaded
*/
public function __construct($data, $loadExtraData = true, $loadParent = false, $fetchTranslations = false)
{
parent::__construct($data);
$data = new JObject($data);
if ($loadParent) {
$this->table = $data->get('table') == null ? NenoContentElementTable::load($data->get('tableId'), $loadExtraData, $loadParent) : $data->get('table');
}
$this->translations = null;
if (!$this->isNew() && $loadExtraData) {
$this->getWordCount();
}
}
示例12: display
/**
* Display page with licenses browse table.
*
* @param $tpl used template
* @return void
*/
public function display($tpl = null)
{
$mainframe = JFactory::getApplication();
/* @var $mainframe JAdministrator */
$this->getModel()->setState(JOOMDOC_FILTER_KEYWORDS, $mainframe->getUserStateFromRequest('joomdoc_licenses_filter', 'filter', '', 'string'));
$this->licenses = $this->get('items');
$this->state = $this->get('state');
$this->filter = $this->state->get('filter');
$this->pagination = new JPagination($this->get('total'), $this->state->get(JOOMDOC_FILTER_START), $this->state->get(JOOMDOC_FILTER_LIMIT));
$this->addToolbar();
JoomDOCHelper::setSubmenu(JOOMDOC_LICENSES);
parent::display($tpl);
}
示例13: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JToolbarHelper::title(JText::sprintf('COM_USERS_VIEW_DEBUG_GROUP_TITLE', $this->group->id, $this->group->title), 'users groups');
JToolbarHelper::help('JHELP_USERS_DEBUG_GROUPS');
JHtmlSidebar::setAction('index.php?option=com_users&view=debuggroup&user_id=' . (int) $this->state->get('filter.user_id'));
$option = '';
if (!empty($this->components)) {
$option = JHtml::_('select.options', $this->components, 'value', 'text', $this->state->get('filter.component'));
}
JHtmlSidebar::addFilter(JText::_('COM_USERS_OPTION_SELECT_COMPONENT'), 'filter_component', $option);
JHtmlSidebar::addFilter(JText::_('COM_USERS_OPTION_SELECT_LEVEL_START'), 'filter_level_start', JHtml::_('select.options', $this->levels, 'value', 'text', $this->state->get('filter.level_start')));
JHtmlSidebar::addFilter(JText::_('COM_USERS_OPTION_SELECT_LEVEL_END'), 'filter_level_end', JHtml::_('select.options', $this->levels, 'value', 'text', $this->state->get('filter.level_end')));
}
示例14: addToolbar
/**
* Display the toolbar.
*
* @return void
*
* @since 2.5
*/
protected function addToolbar()
{
$canDo = UsersHelper::getActions();
JToolBarHelper::title(JText::_('COM_USERS_VIEW_NOTES_TITLE'), 'user');
if ($canDo->get('core.create')) {
JToolBarHelper::addNew('note.add');
}
if ($canDo->get('core.edit')) {
JToolBarHelper::editList('note.edit');
}
if ($canDo->get('core.edit.state')) {
JToolBarHelper::divider();
JToolBarHelper::publish('notes.publish', 'JTOOLBAR_PUBLISH', true);
JToolBarHelper::unpublish('notes.unpublish', 'JTOOLBAR_UNPUBLISH', true);
JToolBarHelper::divider();
JToolBarHelper::archiveList('notes.archive');
JToolBarHelper::checkin('notes.checkin');
}
if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
JToolBarHelper::deleteList('', 'notes.delete', 'JTOOLBAR_EMPTY_TRASH');
JToolBarHelper::divider();
} elseif ($canDo->get('core.edit.state')) {
JToolBarHelper::trash('notes.trash');
JToolBarHelper::divider();
}
if ($canDo->get('core.admin')) {
JToolBarHelper::preferences('com_users');
JToolBarHelper::divider();
}
JToolBarHelper::help('JHELP_USERS_USER_NOTES');
}
示例15: getTitle
/**
* Get the alternate title for the module
*
* @param JObject $params The module parameters.
*
* @return string The alternate title for the module.
*/
public static function getTitle($params)
{
$who = $params->get('user_id');
$catid = (int) $params->get('catid');
if ($catid) {
$category = JCategories::getInstance('Content')->get($catid);
if ($category) {
$title = $category->title;
} else {
$title = JText::_('MOD_POPULAR_UNEXISTING');
}
} else {
$title = '';
}
return JText::plural('MOD_POPULAR_TITLE' . ($catid ? "_CATEGORY" : '') . ($who != '0' ? "_{$who}" : ''), (int) $params->get('count'), $title);
}