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;
 }
 /**
  * Method to get certain otherwise inaccessible properties from the form field object.
  *
  * @param   string  $name  The property name for which to the the value.
  *
  * @return  mixed  The property value or null.
  *
  * @since   2.0
  */
 public function __get($name)
 {
     switch ($name) {
         case 'static':
             if (empty($this->static)) {
                 $this->static = $this->getStatic();
             }
             return $this->static;
             break;
         case 'repeatable':
             if (empty($this->repeatable)) {
                 $this->repeatable = $this->getRepeatable();
             }
             return $this->static;
             break;
         default:
             return parent::__get($name);
     }
 }
Beispiel #4
0
 /**
  * Method to get certain otherwise inaccessible properties from the form field object.
  *
  * @param   string  $name  The property name for which to the the value.
  *
  * @return  mixed  The property value or null.
  *
  * @since   2.0
  */
 public function __get($name)
 {
     switch ($name) {
         // ATTENTION: Redirected getInput() to getStatic()
         case 'input':
             if (empty($this->static)) {
                 $this->static = $this->getStatic();
             }
             return $this->static;
             break;
         case 'repeatable':
             if (empty($this->repeatable)) {
                 $this->repeatable = $this->getRepeatable();
             }
             return $this->repeatable;
             break;
         default:
             return parent::__get($name);
     }
 }
	/**
	 * Test...
	 *
	 * @return void
	 */
	public function getInput()
	{
		parent::getInput();
	}
 /**
  * Test the getInput method.
  *
  * @return void
  */
 public function testGetInput()
 {
     $form = new JFormInspector('form1');
     $this->assertThat($form->load('<form><field name="calendar" type="calendar" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $field = new JFormFieldCalendar($form);
     $this->assertThat($field->setup($form->getXml()->field, 'value'), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true.');
     $this->markTestIncomplete('Problems encountered in next assertion');
     $this->assertThat(strlen($field->input), $this->greaterThan(0), 'Line:' . __LINE__ . ' The getInput method should return something without error.');
     // TODO: Should check all the attributes have come in properly.
 }
Beispiel #7
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);
 }
 /**
  * Test the getInput method.
  *
  * @return void
  */
 public function testGetInputWithStringValue()
 {
     $form = new JForm('form1');
     $this->assertThat($form->load('<form><field name="calendar" type="calendar" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     // The calendar form field depends on having the time zone available. Easiest way is to
     // mock it in the config
     $testConfig = $this->getMockConfig();
     $testConfig->expects($this->any())->method('get')->will($this->returnValue('Europe/London'));
     JFactory::$config = $testConfig;
     $field = new JFormFieldCalendar($form);
     $this->assertThat($field->setup($form->getXml()->field, 'June 2015'), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true.');
     $this->assertThat(strlen($field->input), $this->greaterThan(0), 'Line:' . __LINE__ . ' The getInput method should return something without error.');
     // TODO: Should check all the attributes have come in properly.
 }
Beispiel #9
0
 public function getInput()
 {
     JLoader::register('JEVHelper', JPATH_SITE . "/components/com_jevents/libraries/helper.php");
     JEVHelper::ConditionalFields($this->element, $this->form->getName());
     parent::getInput();
 }
 public function getInput()
 {
     echo 'here';
     parent::getInput();
 }