# Technical Support: Forum - http://www.percha.com/ -------------------------------------------------------------------------*/ ?> <?php defined('_JEXEC') or die('Restricted access'); // no direct access ?> <?php // get the parameter values $moduleclass_sfx = $params->get('moduleclass_sfx'); $function = $params->get('function'); if (!empty($moduleclass_sfx)) { ?> <div class="<?php echo $moduleclass_sfx; ?> "> <?php } if (ModHCSwitch::hcCheck($id) == 'clinic') { echo ModHCSwitch::getBacklink($id); } elseif (ModHCSwitch::hcCheck($id) == 'hospital') { echo ModHCSwitch::getLink($id); } if (!empty($moduleclass_sfx)) { ?> </div> <?php }
/*------------------------------------------------------------------------ # mod_insertfieldsattach # ------------------------------------------------------------------------ # author Cristian Grañó (percha.com) # copyright Copyright (C) 2010 percha.com. All Rights Reserved. # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # Websites: http://www.percha.com # Technical Support: Forum - http://www.percha.com/ -------------------------------------------------------------------------*/ //no direct access defined('_JEXEC') or die('Direct Access to this location is not allowed.'); // include the helper file require_once dirname(__FILE__) . DS . 'helper.php'; $sitepath = JPATH_BASE; JLoader::register('fieldattach', $sitepath . 'components/com_fieldsattach/helpers/fieldattach.php'); $args['id'] = $params->get('id'); $type = ModHCSwitch::getType($args); $type = JRequest::getVar('view'); $id = JRequest::getVar("id", 0); if (!Is_int($id)) { $tmp = explode(":", $id); $id = $tmp[0]; } JPluginHelper::importPlugin('fieldsattachment'); // very important $function = "echo plgfieldsattachment_" . $type . "::getHTML(" . $id . "," . $args['id'] . ");"; // Initialize module parameters. $params->def('function', $function); //$item = ModInsertarticle::getArticles($args); // include the template for display require JModuleHelper::getLayoutPath('mod_hcswitch', $params->get('layout', 'default'));
function getBacklink($id) { $db =& JFactory::getDBO(); //For Articles $db->setQuery($query = "SELECT articleid from #__fieldsattach_values WHERE (value LIKE '%," . $id . ",%' OR value LIKE '" . $id . ",%' OR value LIKE '%," . $id . "' OR value LIKE '" . $id . "') AND fieldsid = 33"); $articles = $db->loadObjectList(); // For Categories $db->setQuery("SELECT catid from #__fieldsattach_categories_values WHERE (value LIKE '%," . $id . ",%' OR value LIKE '" . $id . ",%' OR value LIKE '%," . $id . "' OR value LIKE '" . $id . "') AND fieldsid = 32"); $categories = $db->loadObjectList(); if (count($articles) + count($categories)) { $function = '<ul>'; $function .= '<li class="active"><span>В Поликлинике</span></li>'; if (count($articles) + count($categories) == 1) { $single = true; } else { $function .= '<li><span>В Стационаре</span>'; $function .= '<ul class="popup">'; } foreach ($categories as $item) { $parent = ModHCSwitch::getParent($item->catid); if ($single) { $function .= '<li><a href="' . ContentHelperRoute::getCategoryRoute($item->catid, $parent) . '">В Стационаре</a></li>'; } else { $function .= '<li><a href="' . ContentHelperRoute::getCategoryRoute($item->catid, $parent) . '">' . ModHCSwitch::getTitle($item->catid, 1) . '</a></li>'; } } foreach ($articles as $item) { $parent = ModHCSwitch::getParent(ModHCSwitch::getCategory($item->articleid)); if ($single) { $function .= '<li><a href="' . ContentHelperRoute::getArticleRoute($item->articleid, $parent) . '">В Стационаре</a></li>'; } else { $function .= '<li><a href="' . ContentHelperRoute::getArticleRoute($item->articleid, $parent) . '">' . ModHCSwitch::getTitle($item->articleid, 0) . '</a></li>'; } } if (!$single) { $function .= '</ul>'; $function .= '</li>'; } $function .= '</ul>'; } else { return; } return $function; }