Source for file tos.php

Documentation is available at tos.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Plugin
  4.  * @subpackage  User.profile
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM'or die;
  11.  
  12.  
  13. /**
  14.  * Provides input for TOS
  15.  *
  16.  * @package     Joomla.Plugin
  17.  * @subpackage  User.profile
  18.  * @since       2.5.5
  19.  */
  20. {
  21.     /**
  22.      * The form field type.
  23.      *
  24.      * @var    string 
  25.      * @since  2.5.5
  26.      */
  27.     protected $type = 'Tos';
  28.  
  29.     /**
  30.      * Method to get the field label markup.
  31.      *
  32.      * @return  string  The field label markup.
  33.      *
  34.      * @since   2.5.5
  35.      */
  36.     protected function getLabel()
  37.     {
  38.         $label '';
  39.  
  40.         if ($this->hidden)
  41.         {
  42.             return $label;
  43.         }
  44.  
  45.         // Get the label text from the XML element, defaulting to the element name.
  46.         $text $this->element['label'? (string) $this->element['label': (string) $this->element['name'];
  47.         $text $this->translateLabel ? JText::_($text$text;
  48.  
  49.         // Set required to true as this field is not displayed at all if not required.
  50.         $this->required = true;
  51.  
  52.         // Add CSS and JS for the TOS field
  53.         $doc JFactory::getDocument();
  54.         $css "#jform_profile_tos {width: 18em; margin: 0 !important; padding: 0 2px !important;}
  55.                 #jform_profile_tos input {margin:0 5px 0 0 !important; width:10px !important;}
  56.                 #jform_profile_tos label {margin:0 15px 0 0 !important; width:auto;}
  57.                 ";
  58.         $doc->addStyleDeclaration($css);
  59.         JHtml::_('behavior.modal');
  60.  
  61.         // Build the class for the label.
  62.         $class !empty($this->description'hasTip' '';
  63.         $class $class ' required';
  64.         $class !empty($this->labelClass$class ' ' $this->labelClass : $class;
  65.  
  66.         // Add the opening label tag and main attributes attributes.
  67.         $label .= '<label id="' $this->id . '-lbl" for="' $this->id . '" class="' $class '"';
  68.  
  69.         // If a description is specified, use it to build a tooltip.
  70.         if (!empty($this->description))
  71.         {
  72.             $label .= ' title="'
  73.                 . htmlspecialchars(
  74.                 trim($text':''::' ($this->translateDescription ? JText::_($this->description$this->description),
  75.                 ENT_COMPAT'UTF-8'
  76.             '"';
  77.         }
  78.  
  79.         $tosarticle $this->element['article'? (int) $this->element['article'1;
  80.         $link '<a class="modal" title="" href="index.php?option=com_content&amp;view=article&amp;layout=modal&amp;id=' $tosarticle '&amp;tmpl=component" rel="{handler: \'iframe\', size: {x:800, y:500}}">' $text '</a>';
  81.  
  82.         // Add the label text and closing tag.
  83.         $label .= '>' $link '<span class="star">&#160;*</span></label>';
  84.  
  85.         return $label;
  86.     }
  87. }

Documentation generated on Tue, 19 Nov 2013 15:15:55 +0100 by phpDocumentor 1.4.3