Beispiel #1
0
 /**
  * Method to get the field label markup.
  *
  * @return  string  The field label markup.
  *
  * @since   3.3.7
  */
 protected function getLabel()
 {
     $label = parent::getLabel();
     // Get the info text from the XML element, defaulting to empty.
     $text = $this->element['info'] ? (string) $this->element['info'] : '';
     $text = $this->translateLabel ? JText::_($text) : $text;
     if ($text) {
         $layout = new JLayoutFile('plugins.user.profile.fields.dob');
         $info = $layout->render(array('text' => $text));
         $label = $info . $label;
     }
     return $label;
 }
Beispiel #2
0
 /**
  * Method to get the field label markup.
  *
  * @return  string  The field label markup.
  *
  * @since   3.3.7
  */
 protected function getLabel()
 {
     $label = parent::getLabel();
     // Get the info text from the XML element, defaulting to empty.
     $text = $this->element['info'] ? (string) $this->element['info'] : '';
     $text = $this->translateLabel ? JText::_($text) : $text;
     if ($text) {
         $app = JFactory::getApplication();
         $layout = new JLayoutFile('plugins.user.profile.fields.dob');
         $view = $app->input->getString('view', '');
         // Only display the tip when editing profile
         if ($app->isAdmin() || $view == 'profile' || $view == 'registration') {
             $layout = new JLayoutFile('plugins.user.profile.fields.dob');
             $info = $layout->render(array('text' => $text));
             $label = $info . $label;
         }
     }
     return $label;
 }
Beispiel #3
0
 /**
  * Method to get the field input markup.
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     JHtml::_('jquery.framework');
     $script = "jQuery(document).ready(function()\n{\n\tjQuery('#" . $this->id . "_fieldset select').change(function()\n\t{\n\t\tselector = '#" . $this->id . "';\n\t\tbirthday = jQuery(selector+'_0').val() + '-' + jQuery(selector+'_1').val() + '-' + jQuery(selector+'_2').val();\n\t\tjQuery(selector).val(birthday);\n\t})\n})\n";
     $document = JFactory::getDocument();
     $document->addScriptDeclaration($script);
     $class = $this->class;
     $this->class = '';
     // Orginal hidden Calendar Field
     $calendar = '<span style="display:none">' . parent::getInput() . '</span>';
     // Birthday Field with 3 input
     $birthday = $this->value ? explode('-', JHtml::_('date', $this->value, 'Y-m-d')) : array('', '', '');
     $thisid = $this->id;
     $labelclass = $this->labelclass;
     $this->labelclass = 'hide';
     // Year
     $this->class = $class;
     $this->title = JText::_('COM_SIBDIET_YEAR');
     $this->name = $this->fieldname . '_0';
     $this->id = $thisid . '_0';
     $this->value = (int) $birthday[0];
     $this->element['step'] = -1;
     $this->element['first'] = JHTML::_('date', JFactory::getDate(), 'Y');
     $this->element['last'] = $this->element['first'] - 100;
     $yearLabel = parent::getLabel();
     $yearField = $this->getBirthdayInput();
     $this->element['first'] = 1;
     $this->element['step'] = 1;
     // Month
     $this->title = JText::_('COM_SIBDIET_MONTH');
     $this->name = $this->fieldname . '_1';
     $this->id = $thisid . '_1';
     $this->value = (int) $birthday[1];
     $this->element['last'] = 12;
     $monthLabel = parent::getLabel();
     $monthField = $this->getBirthdayInput();
     // Day
     $this->title = JText::_('COM_SIBDIET_DAY');
     $this->name = $this->fieldname . '_2';
     $this->id = $thisid . '_2';
     $this->value = (int) $birthday[2];
     $this->element['last'] = 31;
     $dayLabel = parent::getLabel();
     $dayField = $this->getBirthdayInput();
     $html = array();
     $html[] = '<span id="' . $thisid . '_fieldset">';
     if (JFactory::getLanguage()->isRTL()) {
         $html = array_merge($html, array($dayLabel, $dayField, $monthLabel, $monthField, $yearLabel, $yearField, $calendar));
     } else {
         $html = array_merge($html, array($yearLabel, $yearField, $monthLabel, $monthField, $dayField, $dayLabel, $calendar));
     }
     $html[] = '</span>';
     /*$html[] = '<a href="#convertDateModal" title="' . JText::_('COM_SIBDIET_DATE_CONVERTER') . '" role="button" class="btn hasTooltip" data-toggle="modal"><i class="icon-calendar"></i></a>';
     		
     		$html[] = '<div id="convertDateModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="convertDateModalLabel" aria-hidden="true">
     	<div class="modal-header">
     		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
     		<h3 id="convertDateModalLabel">' . JText::_('COM_SIBDIET_DATE_CONVERTER') . '</h3>
     	</div>
     	<div class="modal-body text-center">
     		<script type="text/javascript" src="http://1abzar.ir/abzar/tools/convert-date/?color=333333&bg=F4EFE8&kc=EDAB55&kadr=1"></script>
     	</div>
     </div>';*/
     $this->labelclass = $labelclass;
     return implode($html);
 }