| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: view.html.php 14401 2010-01-26 14:10:00Z louis $ 4 * @package Joomla 5 * @subpackage Contact 6 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 7 * @license GNU/GPL, see LICENSE.php 8 * Joomla! is free software. This version may have been modified pursuant to the 9 * GNU General Public License, and as distributed it includes or is derivative 10 * of works licensed under the GNU General Public License or other free or open 11 * source software licenses. See COPYRIGHT.php for copyright notices and 12 * details. 13 */ 14 15 // Check to ensure this file is included in Joomla! 16 defined('_JEXEC') or die( 'Restricted access' ); 17 18 jimport('joomla.application.component.view'); 19 20 /** 21 * @package Joomla 22 * @subpackage Contacts 23 */ 24 class ContactViewContact extends JView 25 { 26 function display($tpl = null) 27 { 28 global $mainframe; 29 30 $user = &JFactory::getUser(); 31 $pathway = &$mainframe->getPathway(); 32 $document = & JFactory::getDocument(); 33 $model = &$this->getModel(); 34 35 // Get the parameters of the active menu item 36 $menus = &JSite::getMenu(); 37 $menu = $menus->getActive(); 38 39 $pparams = &$mainframe->getParams('com_contact'); 40 41 // Push a model into the view 42 $model = &$this->getModel(); 43 $modelCat = &$this->getModel( 'Category' ); 44 45 // Selected Request vars 46 // ID may come from the contact switcher 47 if (!($contactId = JRequest::getInt( 'contact_id', 0 ))) { 48 $contactId = JRequest::getInt( 'id', $contactId ); 49 } 50 51 // query options 52 $options['id'] = $contactId; 53 $options['aid'] = $user->get('aid', 0); 54 55 $contact = $model->getContact( $options ); 56 57 // check if we have a contact 58 if (!is_object( $contact )) { 59 JError::raiseError( 404, 'Contact not found' ); 60 return; 61 } 62 63 // check if access is registered/special 64 if (($contact->access > $user->get('aid', 0)) || ($contact->category_access > $user->get('aid', 0))) { 65 $uri = JFactory::getURI(); 66 $return = $uri->toString(); 67 68 $url = 'index.php?option=com_user&view=login'; 69 $url .= '&return='.base64_encode($return); 70 71 $mainframe->redirect($url, JText::_('You must login first') ); 72 73 } 74 75 $options['category_id'] = $contact->catid; 76 $options['order by'] = 'cd.default_con DESC, cd.ordering ASC'; 77 78 $contacts = $modelCat->getContacts( $options ); 79 80 // Set the document page title 81 // because the application sets a default page title, we need to get it 82 // right from the menu item itself 83 if (is_object( $menu ) && isset($menu->query['view']) && $menu->query['view'] == 'contact' && isset($menu->query['id']) && $menu->query['id'] == $contact->id) { 84 $menu_params = new JParameter( $menu->params ); 85 if (!$menu_params->get( 'page_title')) { 86 $pparams->set('page_title', $contact->name); 87 } 88 } else { 89 $pparams->set('page_title', $contact->name); 90 } 91 $document->setTitle( $pparams->get( 'page_title' ) ); 92 93 //set breadcrumbs 94 if (isset( $menu ) && isset($menu->query['view']) && $menu->query['view'] != 'contact'){ 95 $pathway->addItem($contact->name, ''); 96 } 97 98 // Adds parameter handling 99 $contact->params = new JParameter($contact->params); 100 101 $pparams->merge($contact->params); 102 103 // Handle component/menu overides for some contact parameters if set 104 /* 105 $contact->params->def('contact_icons', $pparams->get('contact_icons')); 106 $contact->params->def('icon_address', $pparams->get('icon_address')); 107 $contact->params->def('icon_email', $pparams->get('icon_email')); 108 $contact->params->def('icon_telephone', $pparams->get('icon_telephone')); 109 $contact->params->def('icon_fax', $pparams->get('icon_fax')); 110 $contact->params->def('icon_misc', $pparams->get('icon_misc')); 111 $contact->params->def('show_position', $pparams->get('show_position')); 112 $contact->params->def('show_email', $pparams->get('show_email')); 113 $contact->params->def('show_telephone', $pparams->get('show_telephone')); 114 $contact->params->def('show_mobile', $pparams->get('show_mobile')); 115 $contact->params->def('show_fax', $pparams->get('show_fax')); 116 $contact->params->def('allow_vcard', $pparams->get('allow_vcard')); 117 */ 118 119 // Handle email cloaking 120 if ($contact->email_to && $contact->params->get('show_email')) { 121 $contact->email_to = JHTML::_('email.cloak', $contact->email_to); 122 } 123 124 if ($contact->params->get('show_street_address') || $contact->params->get('show_suburb') || $contact->params->get('show_state') || $contact->params->get('show_postcode') || $contact->params->get('show_country')) 125 { 126 if (!empty ($contact->address) || !empty ($contact->suburb) || !empty ($contact->state) || !empty ($contact->country) || !empty ($contact->postcode)) { 127 $contact->params->set('address_check', 1); 128 } 129 } else { 130 $contact->params->set('address_check', 0); 131 } 132 133 // Manage the display mode for contact detail groups 134 switch ($contact->params->get('contact_icons')) 135 { 136 case 1 : 137 // text 138 $contact->params->set('marker_address', JText::_('Address').": "); 139 $contact->params->set('marker_email', JText::_('Email').": "); 140 $contact->params->set('marker_telephone', JText::_('Telephone').": "); 141 $contact->params->set('marker_fax', JText::_('Fax').": "); 142 $contact->params->set('marker_mobile', JText::_('Mobile').": "); 143 $contact->params->set('marker_misc', JText::_('Information').": "); 144 $contact->params->set('column_width', '100'); 145 break; 146 147 case 2 : 148 // none 149 $contact->params->set('marker_address', ''); 150 $contact->params->set('marker_email', ''); 151 $contact->params->set('marker_telephone', ''); 152 $contact->params->set('marker_mobile', ''); 153 $contact->params->set('marker_fax', ''); 154 $contact->params->set('marker_misc', ''); 155 $contact->params->set('column_width', '0'); 156 break; 157 158 default : 159 // icons 160 $image1 = JHTML::_('image.site', 'con_address.png', '/images/M_images/', $contact->params->get('icon_address'), '/images/M_images/', JText::_('Address').": "); 161 $image2 = JHTML::_('image.site', 'emailButton.png', '/images/M_images/', $contact->params->get('icon_email'), '/images/M_images/', JText::_('Email').": "); 162 $image3 = JHTML::_('image.site', 'con_tel.png', '/images/M_images/', $contact->params->get('icon_telephone'), '/images/M_images/', JText::_('Telephone').": "); 163 $image4 = JHTML::_('image.site', 'con_fax.png', '/images/M_images/', $contact->params->get('icon_fax'), '/images/M_images/', JText::_('Fax').": "); 164 $image5 = JHTML::_('image.site', 'con_info.png', '/images/M_images/', $contact->params->get('icon_misc'), '/images/M_images/', JText::_('Information').": "); 165 $image6 = JHTML::_('image.site', 'con_mobile.png', '/images/M_images/', $contact->params->get('icon_mobile'), '/images/M_images/', JText::_('Mobile').": "); 166 167 $contact->params->set('marker_address', $image1); 168 $contact->params->set('marker_email', $image2); 169 $contact->params->set('marker_telephone', $image3); 170 $contact->params->set('marker_fax', $image4); 171 $contact->params->set('marker_misc', $image5); 172 $contact->params->set('marker_mobile', $image6); 173 $contact->params->set('column_width', '40'); 174 break; 175 } 176 177 JHTML::_('behavior.formvalidation'); 178 179 $this->assignRef('contact', $contact); 180 $this->assignRef('contacts', $contacts); 181 $this->assignRef('params', $pparams); 182 183 parent::display($tpl); 184 } 185 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |