Code Duplication    Length = 53-54 lines in 2 locations

include/class_field.php 2 locations

@@ 543-596 (lines=54) @@
540
/**
541
 * Class TextBox
542
 */
543
class TextBox extends Field
544
{
545
    /**
546
     * @param $parentObject
547
     * @param $animalObject
548
     */
549
    public function __construct($parentObject, $animalObject)
550
    {
551
        $this->fieldnumber  = $parentObject->getId();
552
        $this->fieldname    = $parentObject->fieldname;
553
        $this->value        = $animalObject->{'user' . $this->fieldnumber};
554
        $this->defaultvalue = $parentObject->defaultvalue;
555
        $this->lookuptable  = $parentObject->lookuptable;
556
        if ($this->lookuptable == '1') {
557
            new Systemmessage('No lookuptable may be specified for userfield' . $this->fieldnumber);
558
        }
559
        if ($parentObject->ViewInAdvanced == '1') {
560
            new Systemmessage('userfield' . $this->fieldnumber . ' cannot be shown in advanced info');
561
        }
562
        if ($parentObject->ViewInPie == '1') {
563
            new Systemmessage('A Pie-chart cannot be specified for userfield' . $this->fieldnumber);
564
        }
565
    }
566
567
    /**
568
     * @return XoopsFormText
569
     */
570
    public function editField()
571
    {
572
        $textbox = new XoopsFormText('<b>' . $this->fieldname . '</b>', 'user' . $this->fieldnumber, $size = 50, $maxsize = 50, $value = $this->value);
573
574
        return $textbox;
575
    }
576
577
    /**
578
     * @param string $name
579
     *
580
     * @return XoopsFormText
581
     */
582
    public function newField($name = '')
583
    {
584
        $textbox = new XoopsFormText('<b>' . $this->fieldname . '</b>', $name . 'user' . $this->fieldnumber, $size = 50, $maxsize = 50, $value = $this->defaultvalue);
585
586
        return $textbox;
587
    }
588
589
    /**
590
     * @return string
591
     */
592
    public function getSearchString()
593
    {
594
        return '&amp;o=naam&amp;l=1';
595
    }
596
}
597
598
/**
599
 * Class TextArea
@@ 601-653 (lines=53) @@
598
/**
599
 * Class TextArea
600
 */
601
class TextArea extends Field
602
{
603
    /**
604
     * @param $parentObject
605
     * @param $animalObject
606
     */
607
    public function __construct($parentObject, $animalObject)
608
    {
609
        $this->fieldnumber  = $parentObject->getId();
610
        $this->fieldname    = $parentObject->fieldname;
611
        $this->value        = $animalObject->{'user' . $this->fieldnumber};
612
        $this->defaultvalue = $parentObject->defaultvalue;
613
        if ($parentObject->LookupTable == '1') {
614
            new Systemmessage('No lookuptable may be specified for userfield' . $this->fieldnumber);
615
        }
616
        if ($parentObject->ViewInAdvanced == '1') {
617
            new Systemmessage('userfield' . $this->fieldnumber . ' cannot be shown in advanced info');
618
        }
619
        if ($parentObject->ViewInPie == '1') {
620
            new Systemmessage('A Pie-chart cannot be specified for userfield' . $this->fieldnumber);
621
        }
622
    }
623
624
    /**
625
     * @return XoopsFormTextArea
626
     */
627
    public function editField()
628
    {
629
        $textarea = new XoopsFormTextArea('<b>' . $this->fieldname . '</b>', 'user' . $this->fieldnumber, $value = $this->value, $rows = 5, $cols = 50);
630
631
        return $textarea;
632
    }
633
634
    /**
635
     * @param string $name
636
     *
637
     * @return XoopsFormTextArea
638
     */
639
    public function newField($name = '')
640
    {
641
        $textarea = new XoopsFormTextArea('<b>' . $this->fieldname . '</b>', $name . 'user' . $this->fieldnumber, $value = $this->defaultvalue, $rows = 5, $cols = 50);
642
643
        return $textarea;
644
    }
645
646
    /**
647
     * @return string
648
     */
649
    public function getSearchString()
650
    {
651
        return '&amp;o=naam&amp;l=1';
652
    }
653
}
654
655
/**
656
 * Class DataSelect