You've already forked joomla_test
first commit
This commit is contained in:
89
administrator/components/com_contact/helpers/contact.php
Normal file
89
administrator/components/com_contact/helpers/contact.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Contact component helper.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_contact
|
||||
* @since 1.6
|
||||
*/
|
||||
class ContactHelper
|
||||
{
|
||||
/**
|
||||
* Configure the Linkbar.
|
||||
*
|
||||
* @param string $vName The name of the active view.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
public static function addSubmenu($vName)
|
||||
{
|
||||
JHtmlSidebar::addEntry(
|
||||
JText::_('COM_CONTACT_SUBMENU_CONTACTS'),
|
||||
'index.php?option=com_contact&view=contacts',
|
||||
$vName == 'contacts'
|
||||
);
|
||||
JHtmlSidebar::addEntry(
|
||||
JText::_('COM_CONTACT_SUBMENU_CATEGORIES'),
|
||||
'index.php?option=com_categories&extension=com_contact',
|
||||
$vName == 'categories'
|
||||
);
|
||||
|
||||
if ($vName == 'categories')
|
||||
{
|
||||
JToolbarHelper::title(
|
||||
JText::sprintf('COM_CATEGORIES_CATEGORIES_TITLE', JText::_('com_contact')),
|
||||
'contact-categories');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of the actions that can be performed.
|
||||
*
|
||||
* @param integer The category ID.
|
||||
* @param integer The contact ID.
|
||||
*
|
||||
* @return JObject
|
||||
* @since 1.6
|
||||
*/
|
||||
public static function getActions($categoryId = 0, $contactId = 0)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$result = new JObject;
|
||||
|
||||
if (empty($contactId) && empty($categoryId))
|
||||
{
|
||||
$assetName = 'com_contact';
|
||||
$level = 'component';
|
||||
}
|
||||
elseif (empty($contactId))
|
||||
{
|
||||
$assetName = 'com_contact.category.'.(int) $categoryId;
|
||||
$level = 'category';
|
||||
}
|
||||
else
|
||||
{
|
||||
$assetName = 'com_contact.contact.'.(int) $contactId;
|
||||
$level = 'category';
|
||||
}
|
||||
|
||||
$actions = JAccess::getActions('com_contact', $level);
|
||||
|
||||
foreach ($actions as $action)
|
||||
{
|
||||
$result->set($action->name, $user->authorise($action->name, $assetName));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
116
administrator/components/com_contact/helpers/html/contact.php
Normal file
116
administrator/components/com_contact/helpers/html/contact.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JLoader::register('ContactHelper', JPATH_ADMINISTRATOR . '/components/com_contact/helpers/contact.php');
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_contact
|
||||
*/
|
||||
abstract class JHtmlContact
|
||||
{
|
||||
/**
|
||||
* Get the associated language flags
|
||||
*
|
||||
* @param int $contactid The item id to search associations
|
||||
*
|
||||
* @return string The language HTML
|
||||
*/
|
||||
public static function association($contactid)
|
||||
{
|
||||
// Defaults
|
||||
$html = '';
|
||||
|
||||
// Get the associations
|
||||
if ($associations = JLanguageAssociations::getAssociations('com_contact', '#__contact_details', 'com_contact.item', $contactid))
|
||||
{
|
||||
foreach ($associations as $tag => $associated)
|
||||
{
|
||||
$associations[$tag] = (int) $associated->id;
|
||||
}
|
||||
|
||||
// Get the associated contact items
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('c.id, c.name as title')
|
||||
->select('l.sef as lang_sef')
|
||||
->from('#__contact_details as c')
|
||||
->select('cat.title as category_title')
|
||||
->join('LEFT', '#__categories as cat ON cat.id=c.catid')
|
||||
->where('c.id IN (' . implode(',', array_values($associations)) . ')')
|
||||
->join('LEFT', '#__languages as l ON c.language=l.lang_code')
|
||||
->select('l.image')
|
||||
->select('l.title as language_title');
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$items = $db->loadObjectList('id');
|
||||
}
|
||||
catch (runtimeException $e)
|
||||
{
|
||||
throw new Exception($e->getMessage(), 500);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($items)
|
||||
{
|
||||
foreach ($items as &$item)
|
||||
{
|
||||
$text = strtoupper($item->lang_sef);
|
||||
$url = JRoute::_('index.php?option=com_contact&task=contact.edit&id=' . (int) $item->id);
|
||||
$tooltipParts = array(
|
||||
JHtml::_('image', 'mod_languages/' . $item->image . '.gif',
|
||||
$item->language_title,
|
||||
array('title' => $item->language_title),
|
||||
true
|
||||
),
|
||||
$item->title,
|
||||
'(' . $item->category_title . ')'
|
||||
);
|
||||
|
||||
$item->link = JHtml::_('tooltip', implode(' ', $tooltipParts), null, null, $text, $url, null, 'hasTooltip label label-association label-' . $item->lang_sef);
|
||||
}
|
||||
}
|
||||
|
||||
$html = JLayoutHelper::render('joomla.content.associations', $items);
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $value The featured value
|
||||
* @param int $i
|
||||
* @param bool $canChange Whether the value can be changed or not
|
||||
*
|
||||
* @return string The anchor tag to toggle featured/unfeatured contacts.
|
||||
* @since 1.6
|
||||
*/
|
||||
public static function featured($value = 0, $i, $canChange = true)
|
||||
{
|
||||
// Array of image, task, title, action
|
||||
$states = array(
|
||||
0 => array('disabled.png', 'contacts.featured', 'COM_CONTACT_UNFEATURED', 'COM_CONTACT_TOGGLE_TO_FEATURE'),
|
||||
1 => array('featured.png', 'contacts.unfeatured', 'JFEATURED', 'COM_CONTACT_TOGGLE_TO_UNFEATURE'),
|
||||
);
|
||||
$state = JArrayHelper::getValue($states, (int) $value, $states[1]);
|
||||
$html = JHtml::_('image', 'admin/'.$state[0], JText::_($state[2]), null, true);
|
||||
if ($canChange)
|
||||
{
|
||||
$html = '<a href="#" onclick="return listItemTask(\'cb'.$i.'\',\''.$state[1].'\')" title="'.JText::_($state[3]).'">'
|
||||
. $html .'</a>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
1
administrator/components/com_contact/helpers/index.html
Normal file
1
administrator/components/com_contact/helpers/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
Reference in New Issue
Block a user