Skip to content
Snippets Groups Projects
Select Git revision
  • 8554b74bb2cc62bda4bdeb8ba6b081fde5f619ce
  • main default protected
  • studip-rector
  • ci-opt
  • course-members-export-as-word
  • data-vue-app
  • pipeline-improvements
  • webpack-optimizations
  • rector
  • icon-renewal
  • http-client-and-factories
  • jsonapi-atomic-operations
  • vueify-messages
  • tic-2341
  • 135-translatable-study-areas
  • extensible-sorm-action-parameters
  • sorm-configuration-trait
  • jsonapi-mvv-routes
  • docblocks-for-magic-methods
19 results

DataFieldTimeEntry.class.php

Blame
  • Forked from Stud.IP / Stud.IP
    2174 commits behind the upstream repository.
    user avatar
    Jan-Hendrik Willms authored
    a3da1483
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    DataFieldTimeEntry.class.php 1.15 KiB
    <?php
    # Lifter002: DONE
    # Lifter007: TEST
    
    /**
     * @author  Jan-Hendrik Willms <tleilax+studip@gmail.com>
     * @author  Marcus Lunzenauer <mlunzena@uos.de>
     * @author  Martin Gieseking  <mgieseki@uos.de>
     * @license GPL2 or any later version
     */
    class DataFieldTimeEntry extends DataFieldEntry
    {
        protected $template = 'time.php';
    
        /**
         * Sets the value from a post request
         *
         * @param mixed $submitted_value The value from request
         */
        public function setValueFromSubmit($value)
        {
            if ($value) {
                parent::setValueFromSubmit($value);
            }
        }
    
        /**
         * Checks if the datafield is empty (was not set)
         *
         * @return bool true if empty, else false
         */
        public function isEmpty()
        {
            return $this->getValue() == ':';
        }
    
        /**
         * Returns whether the datafield contents are valid
         *
         * @return boolean indicating whether the datafield contents are valid
         */
        public function isValid()
        {
            $parts = explode(':', $this->value);
    
            return parent::isValid()
                && $parts[0] >= 0 && $parts[0] <= 24
                && $parts[1] >= 0 && $parts[1] <= 59;
        }
    }