Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Plg parentassociations #17881

Closed
Closed
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
93316f8
Update joomla.sql
christianboulbi Aug 31, 2017
4b84f8a
Update joomla.sql
christianboulbi Aug 31, 2017
ee85e1a
Update default.php
christianboulbi Aug 31, 2017
8abb641
Update AssociationsHelper.php
christianboulbi Aug 31, 2017
c0260e2
First Version of parentassociations plugin
christianboulbi Sep 1, 2017
95ca61c
Restore sample testing files
christianboulbi Sep 1, 2017
a9c17f9
Update articleassociations.xml
christianboulbi Sep 6, 2017
4042619
Update default.php
christianboulbi Sep 6, 2017
0d76dcb
Update default.php
christianboulbi Sep 6, 2017
a74c77c
Update articleassociations.xml
christianboulbi Sep 6, 2017
eec4a61
Update default.php
christianboulbi Sep 6, 2017
44412c3
Update default.php
christianboulbi Sep 6, 2017
cb73dc6
Update AssociationsHelper.php
christianboulbi Sep 6, 2017
501ed15
Update joomla.sql
christianboulbi Sep 6, 2017
2340d12
Update joomla.sql
christianboulbi Sep 6, 2017
78801f5
Update articleassociations.php
christianboulbi Sep 6, 2017
26ac16b
Update AssociationsHelper.php
christianboulbi Sep 6, 2017
e6e9114
Update articleassociations.xml
christianboulbi Sep 6, 2017
3c46478
Update articleassociations.xml
christianboulbi Sep 6, 2017
bedfca9
Update articleassociations.php
christianboulbi Sep 6, 2017
3511d68
Update joomla.sql
christianboulbi Sep 6, 2017
9ec58f5
Update default.php
christianboulbi Sep 6, 2017
6aba9f7
Update AssociationsHelper.php
christianboulbi Sep 6, 2017
5b760b4
Update articleassociations.xml
christianboulbi Sep 6, 2017
0424019
Update AssociationsHelper.php
christianboulbi Sep 6, 2017
38825cc
Update articleassociations.php
christianboulbi Sep 6, 2017
4eb770a
Update joomla.sql
christianboulbi Sep 6, 2017
2168e1e
Update joomla.sql
christianboulbi Sep 6, 2017
0c1d977
Update articleassociations.php
christianboulbi Sep 6, 2017
b21e025
Update articleassociations.php
christianboulbi Sep 6, 2017
239c66a
Update articleassociations.php
christianboulbi Sep 6, 2017
ff4e41d
Update articleassociations.php
christianboulbi Sep 6, 2017
c5f3b63
Update articleassociations.php
christianboulbi Sep 6, 2017
8bd1af9
Update articleassociations.php
christianboulbi Sep 6, 2017
f2dd35d
Update articleassociations.php
christianboulbi Sep 6, 2017
538442b
Update articleassociations.php
christianboulbi Sep 6, 2017
d3555e8
Update articleassociations.php
christianboulbi Sep 6, 2017
542522f
Update articleassociations.php
christianboulbi Sep 6, 2017
e291013
Update articleassociations.php
christianboulbi Sep 6, 2017
82fe241
Update articleassociations.php
christianboulbi Sep 6, 2017
57bf3c7
Update articleassociations.php
christianboulbi Sep 6, 2017
23ba4a4
Update articleassociations.php
christianboulbi Sep 6, 2017
bc8b651
Update articleassociations.php
christianboulbi Sep 6, 2017
0a527e8
Update articleassociations.php
christianboulbi Sep 6, 2017
45798f7
Update articleassociations.php
christianboulbi Sep 6, 2017
39f1cd2
Update AssociationsHelper.php
christianboulbi Sep 6, 2017
6ad1f44
Update AssociationsHelper.php
christianboulbi Sep 6, 2017
e1814dd
Update AssociationsHelper.php
christianboulbi Sep 6, 2017
fa2d94c
Update AssociationsHelper.php
christianboulbi Sep 6, 2017
47f444e
Update AssociationsHelper.php
christianboulbi Sep 6, 2017
a9c6fdf
Update AssociationsHelper.php
christianboulbi Sep 6, 2017
48a8b27
Update AssociationsHelper.php
christianboulbi Sep 6, 2017
b7a819a
Update AssociationsHelper.php
christianboulbi Sep 6, 2017
a0e7ad2
Update default.php
christianboulbi Sep 6, 2017
a7a1377
Update default.php
christianboulbi Sep 6, 2017
6a55daa
Update Association.php
perrez Sep 6, 2017
2049c8a
Update Association.php
perrez Sep 6, 2017
eccae50
Update Html.php
perrez Sep 6, 2017
9fda340
Update edit.php
perrez Sep 6, 2017
a64fbf0
Update en-GB.com_associations.ini
perrez Sep 6, 2017
d8becf2
Update Association.php
perrez Sep 7, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update AssociationsHelper.php
  • Loading branch information
christianboulbi committed Aug 31, 2017
commit 8abb641580a0a81c407a163425c4c57099a6cdee
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,11 @@ public static function getAssociationHtmlList($extensionName, $typeName, $itemId
$additional = '<strong>' . \JText::sprintf('COM_MENUS_MENU_SPRINTF', $menutype_title) . '</strong><br>';
}

$labelClass = 'badge-secondary';
$labelClass = 'badge-association';
$target = $langCode . ':' . $items[$langCode]['id'] . ':edit';
$allow = $canEditReference
&& self::allowEdit($extensionName, $typeName, $items[$langCode]['id'])
&& self::canCheckinItem($extensionName, $typeName, $items[$langCode]['id']);
&& self::allowEdit($extensionName, $typeName, $items[$langCode]['id'])
&& self::canCheckinItem($extensionName, $typeName, $items[$langCode]['id']);

$additional .= $addLink && $allow ? \JText::_('COM_ASSOCIATIONS_EDIT_ASSOCIATION') : '';
}
Expand Down Expand Up @@ -279,11 +279,173 @@ public static function getAssociationHtmlList($extensionName, $typeName, $itemId
$text = strtoupper($language->sef);

$tooltip = htmlspecialchars($title, ENT_QUOTES, 'UTF-8') . '<br><br>' . $additional;
$classes = 'hasPopover badge ' . $labelClass;
$classes = 'hasPopover badge ' . $labelClass . ' badge-' . $language->sef;

$items[$langCode]['link'] = '<a href="' . $url . '" title="' . $language->title . '" class="' . $classes
. '" data-content="' . $tooltip . '" data-placement="top">'
. $text . '</a>';
. '" data-content="' . $tooltip . '" data-placement="top">'
. $text . '</a>';
}

\JHtml::_('bootstrap.popover');
return LayoutHelper::render('joomla.content.associations', $items);
}

public static function getAssociationHtmlList1($extensionName, $typeName, $itemId, $itemLanguage, $addLink = true, $associationMode)
{

// enthält alle Verbindungen von Item
// Get the associations list for this item.
$items = self::getAssociationList($extensionName, $typeName, $itemId);
//var_dump($items);
$titleFieldName = self::getTypeFieldName($extensionName, $typeName, 'title');

// Alle Sprachen die aktiviert sind
// Get all content languages.
$languages = self::getContentLanguages();

$canEditReference = self::allowEdit($extensionName, $typeName, $itemId);
$canCreate = self::allowAdd($extensionName, $typeName);

// Create associated items list.
foreach ($languages as $langCode => $language)
{
if ($langCode == $itemLanguage)
{
continue;
}
$approved = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new lines before and after $approved = null;

if(isset($items[$langCode])){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(isset($items[$langCode])){ change to:

if (isset($items[$langCode]))
{

$db = \JFactory::getDbo();
$id = $items[$langCode]['id'];
$query = $db->getQuery(true)
->select($db->quoteName('approved'))
->from($db->quoteName('#__item_associations'))
->where($db->quoteName('id') . ' = ' . $db->quote($id));

$db->setQuery($query);
$approved = $db->loadResult();
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty line


// FALL: Verbunden und approved
if (($associationMode == 1) )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove space between ) )

{
if(!isset($items[$langCode])){
Copy link
Member

@C-Lodder C-Lodder Sep 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spacing and put curly brace on new line

continue;
}
if($approved == 0){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • add new line to separate if statements
  • curly brace on new line
  • if( >> if (

unset($items[$langCode]);
continue;
}

}

// FALL: Verbunden und nicht approved
if ($associationMode == 2)
{
if(!isset($items[$langCode])){
continue;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line to separate if statements

if($approved == 1){
unset($items[$langCode]);
continue;
}
}

// FALL: Nicht verbunden
if (($associationMode == 0) && isset($items[$langCode]))
{
unset($items[$langCode]);
continue;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty line


// Get html parameters.
if (isset($items[$langCode]))
{
$title = $items[$langCode][$titleFieldName];
$additional = '';

if (isset($items[$langCode]['catid']))
{
$db = \JFactory::getDbo();

// Get the category name
$query = $db->getQuery(true)
->select($db->quoteName('title'))
->from($db->quoteName('#__categories'))
->where($db->quoteName('id') . ' = ' . $db->quote($items[$langCode]['catid']));

$db->setQuery($query);
$category_title = $db->loadResult();

$additional = '<strong>' . \JText::sprintf('JCATEGORY_SPRINTF', $category_title) . '</strong> <br />';
}
elseif (isset($items[$langCode]['menutype']))
{
$db = \JFactory::getDbo();

// Get the menutype name
$query = $db->getQuery(true)
->select($db->quoteName('title'))
->from($db->quoteName('#__menu_types'))
->where($db->quoteName('menutype') . ' = ' . $db->quote($items[$langCode]['menutype']));

$db->setQuery($query);
$menutype_title = $db->loadResult();

$additional = '<strong>' . \JText::sprintf('COM_MENUS_MENU_SPRINTF', $menutype_title) . '</strong><br />';
}
if($approved == 0){
$labelClass = 'badge-warning';
}else{
$labelClass = 'badge-success';
}

$target = $langCode . ':' . $items[$langCode]['id'] . ':edit';
$allow = $canEditReference
&& self::allowEdit($extensionName, $typeName, $items[$langCode]['id'])
&& self::canCheckinItem($extensionName, $typeName, $items[$langCode]['id']);

$additional .= $addLink && $allow ? \JText::_('COM_ASSOCIATIONS_EDIT_ASSOCIATION') : '';
}
else
{
$items[$langCode] = array();

$title = \JText::_('COM_ASSOCIATIONS_NO_ASSOCIATION');
$additional = $addLink ? \JText::_('COM_ASSOCIATIONS_ADD_NEW_ASSOCIATION') : '';
$labelClass = 'badge-association';
$target = $langCode . ':0:add';
$allow = $canCreate;
}

// Generate item Html.
$options = array(
'option' => 'com_associations',
'view' => 'association',
'layout' => 'edit',
'itemtype' => $extensionName . '.' . $typeName,
'task' => 'association.edit',
'id' => $itemId,
'target' => $target,
);

$url = \JRoute::_('index.php?' . http_build_query($options));
$url = $allow && $addLink ? $url : '';
$text = strtoupper($language->sef);
if($approved === 1 || $approved === 0){
$tooltip = htmlspecialchars($title, ENT_QUOTES, 'UTF-8') . '<br /><br />' . $additional . '<br /><br />' .'Approved:' . $approved . '<br /><br />';
}else{
$tooltip = htmlspecialchars($title, ENT_QUOTES, 'UTF-8') . '<br /><br />' . $additional . '<br /><br />';

}
$classes = 'hasPopover badge ' . $labelClass . ' ´badge-' . $language->sef;

$items[$langCode]['link'] = '<a href="' . $url . '" title="' . $language->title . '" class="' . $classes
. '" data-content="' . $tooltip . '" data-placement="top">'
. $text . '</a>';

}

\JHtml::_('bootstrap.popover');
Expand Down