CodeStyle again

This commit is contained in:
zero-24 2016-08-01 19:47:09 +02:00 committed by Yves Hoppe
parent d09319ad78
commit 4332a3d7b4
8 changed files with 152 additions and 166 deletions

View File

@ -21,6 +21,7 @@ $listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$canOrder = $user->authorise('core.edit.state', 'com_weblinks.category');
$saveOrder = $listOrder == 'a.ordering';
if ($saveOrder)
{
$saveOrderingUrl = 'index.php?option=com_weblinks&task=weblinks.saveOrderAjax&tmpl=component';
@ -80,27 +81,21 @@ if ($saveOrder)
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) :
$ordering = ($listOrder == 'a.ordering');
$item->cat_link = JRoute::_('index.php?option=com_categories&extension=com_weblinks&task=edit&type=other&cid[]='. $item->catid);
$canCreate = $user->authorise('core.create', 'com_weblinks.category.' . $item->catid);
$canEdit = $user->authorise('core.edit', 'com_weblinks.category.' . $item->catid);
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0;
$canChange = $user->authorise('core.edit.state', 'com_weblinks.category.' . $item->catid) && $canCheckin;
?>
<?php foreach ($this->items as $i => $item) : ?>
<?php $ordering = ($listOrder == 'a.ordering'); ?>
<?php $item->cat_link = JRoute::_('index.php?option=com_categories&extension=com_weblinks&task=edit&type=other&cid[]=' . $item->catid); ?>
<?php $canCreate = $user->authorise('core.create', 'com_weblinks.category.' . $item->catid); ?>
<?php $canEdit = $user->authorise('core.edit', 'com_weblinks.category.' . $item->catid); ?>
<?php $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0; ?>
<?php $canChange = $user->authorise('core.edit.state', 'com_weblinks.category.' . $item->catid) && $canCheckin; ?>
<tr class="row<?php echo $i % 2; ?>" sortable-group-id="<?php echo $item->catid; ?>">
<td class="order nowrap center hidden-phone">
<?php
$iconClass = '';
if (!$canChange)
{
$iconClass = ' inactive';
}
elseif (!$saveOrder)
{
$iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
}
?>
<?php $iconClass = ''; ?>
<?php if (!$canChange) : ?>
<?php $iconClass = ' inactive'; ?>
<?php elseif (!$saveOrder) : ?>
<?php $iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); ?>
<?php endif; ?>
<span class="sortable-handler<?php echo $iconClass ?>">
<i class="icon-menu"></i>
</span>
@ -114,14 +109,12 @@ if ($saveOrder)
<td class="center">
<div class="btn-group">
<?php echo JHtml::_('jgrid.published', $item->state, $i, 'weblinks.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?>
<?php // Create dropdown items and render the dropdown list.
if ($canChange)
{
JHtml::_('actionsdropdown.' . ((int) $item->state === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'weblinks');
JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'weblinks');
echo JHtml::_('actionsdropdown.render', $this->escape($item->title));
}
?>
<?php // Create dropdown items and render the dropdown list. ?>
<?php if ($canChange) : ?>
<?php JHtml::_('actionsdropdown.' . ((int) $item->state === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'weblinks'); ?>
<?php JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'weblinks'); ?>
<?php echo JHtml::_('actionsdropdown.render', $this->escape($item->title)); ?>
<?php endif; ?>
</div>
</td>
<td class="nowrap has-context">

View File

@ -32,9 +32,11 @@ class WeblinksController extends JControllerLegacy
// Huh? Why not just put that in the constructor?
$cacheable = true;
// Set the default view name and format from the Request.
// Note we are using w_id to avoid collisions with the router and the return page.
// Frontend is a bit messier than the backend.
/**
* Set the default view name and format from the Request.
* Note we are using w_id to avoid collisions with the router and the return page.
* Frontend is a bit messier than the backend.
*/
$id = $this->input->getInt('w_id');
$vName = $this->input->get('view', 'categories');
$this->input->set('view', $vName);

View File

@ -180,7 +180,7 @@ abstract class WeblinksHelperRoute
/**
* Find items per given $needles
*
* @params array $needles
* @param array $needles
*
* @return void
*/
@ -223,9 +223,11 @@ abstract class WeblinksHelperRoute
if (isset($item->query['id']))
{
// Here it will become a bit tricky
// language != * can override existing entries
// language == * cannot override existing entries
/**
* Here it will become a bit tricky
* language != * can override existing entries
* language == * cannot override existing entries
*/
if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*')
{
self::$lookup[$language][$view][$item->query['id']] = $item->id;

View File

@ -34,8 +34,6 @@ class WeblinksViewForm extends JViewLegacy
public function display($tpl = null)
{
$user = JFactory::getUser();
// Get the application
$app = JFactory::getApplication();
// Get model data.
$this->state = $this->get('State');
@ -62,11 +60,13 @@ class WeblinksViewForm extends JViewLegacy
if (!empty($this->item))
{
// Override the base weblink data with any data in the session.
$temp = (array) $app->getUserState('com_weblinks.edit.weblink.data', array());
$temp = (array) JFactory::getApplication()->getUserState('com_weblinks.edit.weblink.data', array());
foreach ($temp as $k => $v)
{
$this->item->$k = $v;
}
$this->form->bind($this->item);
}

View File

@ -9,25 +9,21 @@
defined('_JEXEC') or die;
?>
<?php
if($params->get('groupby', 0)) :
$cats = array();
$cols = $params->get('groupby_columns', 3);
foreach ($list as $l)
$cats[] = array('catid' => $l->catid, 'title' => $l->category_title);
$cats = array_values(array_map('unserialize', array_unique(array_map('serialize', $cats))));
foreach ($cats as $k => $cat) :
$items = array();
foreach ($list as $item)
if ($item->catid == $cat['catid'])
$items[] = $item;
?>
<?php if ($params->get('groupby', 0)) : ?>
<?php $cats = array(); ?>
<?php $cols = $params->get('groupby_columns', 3); ?>
<?php foreach ($list as $l) : ?>
<?php $cats[] = array('catid' => $l->catid, 'title' => $l->category_title); ?>
<?php endforeach; ?>
<?php $cats = array_values(array_map('unserialize', array_unique(array_map('serialize', $cats)))); ?>
<?php foreach ($cats as $k => $cat) : ?>
<?php $items = array(); ?>
<?php foreach ($list as $item) : ?>
<?php if ($item->catid == $cat['catid']) : ?>
<?php $items[] = $item; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php if ($cols > 1) : ?>
<?php if ($k % $cols == 0) : ?>
<div class="row row-fluid">
@ -35,14 +31,13 @@ if($params->get('groupby', 0)) :
<div class="span<?php echo (12 / $cols); ?>">
<?php endif; ?>
<?php if ($params->get('groupby_showtitle', 1)) : ?>
<h4><?php echo htmlspecialchars($cat['title']); ?></h4>
<h4><?php echo htmlspecialchars($cat['title'], ENT_COMPAT, 'UTF-8')); ?></h4>
<?php endif; ?>
<ul class="weblinks<?php echo $moduleclass_sfx; ?>">
<?php foreach ($items as $item) : ?>
<li>
<?php $link = $item->link; ?>
<?php
$link = $item->link;
switch ($item->params->get('target', 3))
{
case 1:
@ -63,17 +58,14 @@ if($params->get('groupby', 0)) :
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
break;
}
if ($params->get('description', 0))
{
echo nl2br($item->description);
}
if ($params->get('hits', 0))
{
echo '(' . $item->hits . ' ' . JText::_('MOD_WEBLINKS_HITS') . ')';
}
?>
<?php if ($params->get('description', 0)) : ?>
<?php echo nl2br($item->description); ?>
<?php endif; ?>
<?php if ($params->get('hits', 0)) : ?>
<?php echo '(' . $item->hits . ' ' . JText::_('MOD_WEBLINKS_HITS') . ')'; ?>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
@ -88,9 +80,8 @@ if($params->get('groupby', 0)) :
<ul class="weblinks<?php echo $moduleclass_sfx; ?>">
<?php foreach ($list as $item) : ?>
<li>
<?php $link = $item->link; ?>
<?php
$link = $item->link;
switch ($item->params->get('target', 3))
{
case 1:
@ -111,17 +102,15 @@ if($params->get('groupby', 0)) :
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
break;
}
if ($params->get('description', 0))
{
echo nl2br($item->description);
}
if ($params->get('hits', 0))
{
echo '(' . $item->hits . ' ' . JText::_('MOD_WEBLINKS_HITS') . ')';
}
?>
<?php if ($params->get('description', 0)) : ?>
<?php echo nl2br($item->description); ?>
<?php endif; ?>
<?php if ($params->get('hits', 0)) : ?>
<?php echo '(' . $item->hits . ' ' . JText::_('MOD_WEBLINKS_HITS') . ')'; ?>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>