Преглед на файлове

Add ContactBundle fixes

jmontoya преди 9 години
родител
ревизия
66b3285895

+ 0 - 180
main/inc/lib/formvalidator/Element/DatePicker.php

@@ -1,180 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * Form element to select a date.
- *
- * Class DatePicker
- */
-class DatePicker extends HTML_QuickForm_text
-{
-    /**
-     * @param string $elementName
-     * @param string $elementLabel
-     * @param array  $attributes
-     */
-    public function __construct($elementName = null, $elementLabel = null, $attributes = null)
-    {
-        if (!isset($attributes['id'])) {
-            $attributes['id'] = $elementName;
-        }
-        $attributes['class'] = 'form-control';
-
-        parent::__construct($elementName, $elementLabel, $attributes);
-        $this->_appendName = true;
-        $this->_type = 'date_picker';
-    }
-
-    /**
-    * HTML code to display this datepicker
-     *
-     * @return string
-    */
-    public function toHtml()
-    {
-        if ($this->_flagFrozen) {
-            return $this->getFrozenHtml();
-        }
-
-        $id = $this->getAttribute('id');
-        $value = $this->getValue();
-        $label = $this->getLabel();
-
-        if (!empty($value)) {
-            $value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H);
-        }
-
-        return $this->getElementJS() . '
-            <div class="input-group">
-                <span class="input-group-addon">
-                    <input ' . $this->_getAttrString($this->_attributes) . '>
-                </span>
-                <input class="form-control" type="text" readonly id="' . $id . '_alt" value="' . $value . '">
-            </div>
-        ';
-    }
-
-    /**
-     * @param string $value
-     */
-    public function setValue($value)
-    {
-        $value = substr($value, 0, 16);
-        $this->updateAttributes(
-            array(
-                'value' => $value
-            )
-        );
-    }
-
-    /**
-     * Get the necessary javascript for this datepicker
-     * @return string
-     */
-    private function getElementJS()
-    {
-        $js = null;
-        $id = $this->getAttribute('id');
-
-        $js .= "<script>
-            $(function() {
-                $('#$id').hide().datepicker({
-                    defaultDate: '" . $this->getValue() . "',
-                    dateFormat: 'yy-mm-dd',
-                    altField: '#{$id}_alt',
-                    altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\",
-                    showOn: 'both',
-                    buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "',
-                    buttonImageOnly: true,
-                    buttonText: '" . get_lang('SelectDate') . "',
-                    changeMonth: true,
-                    changeYear: true,
-                    yearRange: 'c-60y:c+5y'
-                });
-            });
-        </script>";
-
-        return $js;
-    }
-
-    /**
-     * @param string $layout
-     *
-     * @return string
-     */
-    public function getTemplate($layout)
-    {
-        $size = $this->getColumnsSize();
-        $id = $this->getAttribute('id');
-        $value = $this->getValue();
-
-        if (empty($size)) {
-            $sizeTemp = $this->getInputSize();
-            if (empty($size)) {
-                $sizeTemp = 8;
-            }
-            $size = array(2, $sizeTemp, 2);
-        } else {
-            if (is_array($size)) {
-                if (count($size) != 3) {
-                    $sizeTemp = $this->getInputSize();
-                    if (empty($size)) {
-                        $sizeTemp = 8;
-                    }
-                    $size = array(2, $sizeTemp, 2);
-                }
-                // else just keep the $size array as received
-            } else {
-                $size = array(2, intval($size), 2);
-            }
-        }
-
-        if (!empty($value)) {
-            $value = api_format_date($value, DATE_FORMAT_LONG_NO_DAY);
-        }
-
-        switch ($layout) {
-            case FormValidator::LAYOUT_INLINE:
-                return '
-                <div class="form-group {error_class}">
-                    <label {label-for} >
-                        <!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
-                        {label}
-                    </label>
-
-                    {element}
-                </div>';
-                break;
-            case FormValidator::LAYOUT_HORIZONTAL:
-                return '
-                <div class="form-group {error_class}">
-                    <label {label-for} class="col-sm-'.$size[0].' control-label" >
-                        <!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
-                        {label}
-                    </label>
-                    <div class="col-sm-'.$size[1].'">
-                        {icon}
-
-                        {element}
-
-                        <!-- BEGIN label_2 -->
-                            <p class="help-block">{label_2}</p>
-                        <!-- END label_2 -->
-
-                        <!-- BEGIN error -->
-                            <span class="help-inline">{error}</span>
-                        <!-- END error -->
-                    </div>
-                    <div class="col-sm-'.$size[2].'">
-                        <!-- BEGIN label_3 -->
-                            {label_3}
-                        <!-- END label_3 -->
-                    </div>
-                </div>';
-                break;
-            case FormValidator::LAYOUT_BOX_NO_LABEL:
-                return '{element}';
-                break;
-        }
-    }
-}

+ 2 - 0
src/Chamilo/ContactBundle/Admin/CategoryAdmin.php

@@ -19,6 +19,7 @@ class CategoryAdmin
     {
         $formMapper
             ->add('name')
+            ->add('email')
         ;
     }
 
@@ -29,6 +30,7 @@ class CategoryAdmin
     {
         $datagridMapper
             ->add('name')
+            ->add('email')
         ;
     }
 }

+ 1 - 1
src/Chamilo/ContactBundle/Controller/ContactController.php

@@ -67,7 +67,7 @@ class ContactController extends Controller
         return $this->render(
             '@ContactBundle/index.html.twig',
             array(
-                'form'       => $form->createView()
+                'form' => $form->createView()
             )
         );
     }

+ 0 - 2
src/Chamilo/ContactBundle/Resources/views/index.html.twig

@@ -2,8 +2,6 @@
 
 {% block page_content %}
 
-    qsdqsd
-
     {{ form_widget(form) }}
 
 {% endblock %}