Time element

  • Views Views: 13,856
  • Last updated Last updated:

Navigation

      Access element (+)
      Birthday element
      Button element
      Calculation element
      Captcha element
      Checkbox element
      Colour Picker element
      Count element (+)
      Database join element
      Date element
      Digg element
      Display text element
      Dropdown element
      Facebook Like element
      Field element
      File Upload element
      Folder element
      Google Map element
      Image element
         Image databese join
      Internal id element
      IP element
      J!Date element
      Kaltura element
      Link element
      Notes element
      OpenStreetMap element
      Picklist element
      Radio Button element
      Rating element
      Sequence element
      Slider element
      Tags element
      Textarea element
      Thumbs element
      Time element
      Timer element
      Timestamp element
      Total element
      User element
      User group element
      Video element
      View level element
      YesNo element
      Youtube element
      Akismet validation
      Is Email validation
      Is Not validation
      Is Numeric validation
      Not empty validation
      PHP validation
      Rsa id
  • Time element is useful if you need just a time value (as time of day or duration). This is derived from birthday element. While birthday uses database field type DATE instead DATETIME, time element uses TIME field type. The two together are useful when using Fabrik for manipulating data of such event management components as EventList where date and time fields are separate fields and empty fields should have NULL value.

    Time data is submitted with dropdowns, by default they are three - hours, minutes and seconds.

    Admin form allows you choose time formatting - all 3 parts, hours and minutes or minutes and seconds. Additionally you can choose which separator should be between hours, minutes and seconds (it's : by default)

    Element-time.png


    PHP validation Example​

    Check if 'endtime' element is set to be 2 hours after 'starttime' element:


    PHP:

    $app = JFactory::getApplication();
    $input = $app->input;
    $startTime = $input->get('multipage___starttime_raw', array(), 'array');
    $endTime = $input->get('multipage___endtime_raw', array(), 'array');
    $startSeconds = ($startTime[0] * 60 * 60) + ($startTime[1] * 60) + $startTime[2];
    $endSeconds = ($endTime[0] * 60 * 60) + ($endTime[1] * 60) + $endTime[2];

    if ($endSeconds - (2 * 60 * 60) < $startSeconds)
    {
    return false;
    }
    else
    {
    return true;
    }
Back
Top