From 4332a3d7b41ad812bbe0a28223f0e6ca6c21c6af Mon Sep 17 00:00:00 2001 From: zero-24 Date: Mon, 1 Aug 2016 19:47:09 +0200 Subject: [PATCH] CodeStyle again --- .../components/com_weblinks/controller.php | 6 +- .../views/weblinks/tmpl/default.php | 47 ++-- src/components/com_weblinks/controller.php | 14 +- src/components/com_weblinks/helpers/route.php | 20 +- .../com_weblinks/models/categories.php | 2 +- .../com_weblinks/models/category.php | 14 +- .../com_weblinks/views/form/view.html.php | 12 +- src/modules/mod_weblinks/tmpl/default.php | 203 +++++++++--------- 8 files changed, 152 insertions(+), 166 deletions(-) diff --git a/src/administrator/components/com_weblinks/controller.php b/src/administrator/components/com_weblinks/controller.php index a9e274c..6a8d24d 100644 --- a/src/administrator/components/com_weblinks/controller.php +++ b/src/administrator/components/com_weblinks/controller.php @@ -19,9 +19,9 @@ class WeblinksController extends JControllerLegacy /** * Method to display a view. * - * @param boolean $cacheable If true, the view output will be cached - * @param array $urlparams An array of safe url parameters and their variable types, - * for valid values see {@link JFilterInput::clean()}. + * @param boolean $cacheable If true, the view output will be cached + * @param array $urlparams An array of safe url parameters and their variable types, + * for valid values see {@link JFilterInput::clean()}. * * @return JControllerLegacy This object to support chaining. * diff --git a/src/administrator/components/com_weblinks/views/weblinks/tmpl/default.php b/src/administrator/components/com_weblinks/views/weblinks/tmpl/default.php index c102846..e0d443e 100644 --- a/src/administrator/components/com_weblinks/views/weblinks/tmpl/default.php +++ b/src/administrator/components/com_weblinks/views/weblinks/tmpl/default.php @@ -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) - 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; - ?> + items as $i => $item) : ?> + + cat_link = JRoute::_('index.php?option=com_categories&extension=com_weblinks&task=edit&type=other&cid[]=' . $item->catid); ?> + authorise('core.create', 'com_weblinks.category.' . $item->catid); ?> + authorise('core.edit', 'com_weblinks.category.' . $item->catid); ?> + authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0; ?> + authorise('core.edit.state', 'com_weblinks.category.' . $item->catid) && $canCheckin; ?> - + + + + + + @@ -114,14 +109,12 @@ if ($saveOrder)
state, $i, 'weblinks.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?> - 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)); - } - ?> + + + state === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'weblinks'); ?> + state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'weblinks'); ?> + escape($item->title)); ?> +
diff --git a/src/components/com_weblinks/controller.php b/src/components/com_weblinks/controller.php index 7756342..5e2b047 100644 --- a/src/components/com_weblinks/controller.php +++ b/src/components/com_weblinks/controller.php @@ -19,9 +19,9 @@ class WeblinksController extends JControllerLegacy /** * Method to display a view. * - * @param boolean $cacheable If true, the view output will be cached - * @param array $urlparams An array of safe url parameters and their variable types, - * for valid values see {@link JFilterInput::clean()}. + * @param boolean $cacheable If true, the view output will be cached + * @param array $urlparams An array of safe url parameters and their variable types, + * for valid values see {@link JFilterInput::clean()}. * * @return WeblinksController This object to support chaining. * @@ -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); diff --git a/src/components/com_weblinks/helpers/route.php b/src/components/com_weblinks/helpers/route.php index 72d1db9..685bd21 100644 --- a/src/components/com_weblinks/helpers/route.php +++ b/src/components/com_weblinks/helpers/route.php @@ -45,7 +45,7 @@ abstract class WeblinksHelperRoute { $needles['category'] = array_reverse($category->getPath()); $needles['categories'] = $needles['category']; - $link .= '&catid='.$catid; + $link .= '&catid=' . $catid; } } @@ -62,7 +62,7 @@ abstract class WeblinksHelperRoute if ($item = self::_findItem($needles)) { - $link .= '&Itemid='.$item; + $link .= '&Itemid=' . $item; } return $link; @@ -155,7 +155,7 @@ abstract class WeblinksHelperRoute /** * Do a language lookup * - * @return void + * @return void */ protected static function buildLanguageLookup() { @@ -180,9 +180,9 @@ abstract class WeblinksHelperRoute /** * Find items per given $needles * - * @params array $needles + * @param array $needles * - * @return void + * @return void */ protected static function _findItem($needles = null) { @@ -195,7 +195,7 @@ abstract class WeblinksHelperRoute { self::$lookup[$language] = array(); - $component = JComponentHelper::getComponent('com_weblinks'); + $component = JComponentHelper::getComponent('com_weblinks'); $attributes = array('component_id'); $values = array($component->id); @@ -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; diff --git a/src/components/com_weblinks/models/categories.php b/src/components/com_weblinks/models/categories.php index 5450bae..a4bdf59 100644 --- a/src/components/com_weblinks/models/categories.php +++ b/src/components/com_weblinks/models/categories.php @@ -70,7 +70,7 @@ class WeblinksModelCategories extends JModelList * different modules that might need different sets of data or different * ordering requirements. * - * @param string $id A prefix for the store id. + * @param string $id A prefix for the store id. * * @return string A store id. */ diff --git a/src/components/com_weblinks/models/category.php b/src/components/com_weblinks/models/category.php index 2a9dc8b..3441885 100644 --- a/src/components/com_weblinks/models/category.php +++ b/src/components/com_weblinks/models/category.php @@ -121,19 +121,19 @@ class WeblinksModelCategory extends JModelList // Filter by category. if ($categoryId = $this->getState('category.id')) { - // Group by subcategory + // Group by subcategory if ($this->getState('category.group', 0)) { $query->select('c.title AS category_title') - ->where('c.parent_id = ' . (int) $categoryId) - ->join('LEFT', '#__categories AS c ON c.id = a.catid') - ->where('c.access IN (' . $groups . ')'); + ->where('c.parent_id = ' . (int) $categoryId) + ->join('LEFT', '#__categories AS c ON c.id = a.catid') + ->where('c.access IN (' . $groups . ')'); } else { $query->where('a.catid = ' . (int) $categoryId) - ->join('LEFT', '#__categories AS c ON c.id = a.catid') - ->where('c.access IN (' . $groups . ')'); + ->join('LEFT', '#__categories AS c ON c.id = a.catid') + ->where('c.access IN (' . $groups . ')'); } // Filter by published category @@ -188,7 +188,7 @@ class WeblinksModelCategory extends JModelList } // If grouping by subcategory, add the subcategory list ordering clause. - if($this->getState('category.group', 0)) + if ($this->getState('category.group', 0)) { $query->order( $db->escape($this->getState('category.ordering', 'c.lft')) . ' ' . diff --git a/src/components/com_weblinks/views/form/view.html.php b/src/components/com_weblinks/views/form/view.html.php index 0022830..5506c3e 100644 --- a/src/components/com_weblinks/views/form/view.html.php +++ b/src/components/com_weblinks/views/form/view.html.php @@ -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); } @@ -98,9 +98,9 @@ class WeblinksViewForm extends JViewLegacy */ protected function _prepareDocument() { - $app = JFactory::getApplication(); - $menus = $app->getMenu(); - $title = null; + $app = JFactory::getApplication(); + $menus = $app->getMenu(); + $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself diff --git a/src/modules/mod_weblinks/tmpl/default.php b/src/modules/mod_weblinks/tmpl/default.php index 8cf54fa..f3c9c1b 100644 --- a/src/modules/mod_weblinks/tmpl/default.php +++ b/src/modules/mod_weblinks/tmpl/default.php @@ -9,120 +9,109 @@ defined('_JEXEC') or die; ?> -get('groupby', 0)) : - $cats = array(); - $cols = $params->get('groupby_columns', 3); +get('groupby', 0)) : ?> + + get('groupby_columns', 3); ?> + + $l->catid, 'title' => $l->category_title); ?> + + + $cat) : ?> + + + catid == $cat['catid']) : ?> + + + + 1) : ?> + +
+ +
+ + get('groupby_showtitle', 1)) : ?> +

+ + + 1) : ?> +
+ +
+ + + -