GemsTracker/gemstracker-library

View on GitHub
classes/Gems/Agenda/Filter/XandModelDependency.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
<?php

/**
 *
 * @package    Gems
 * @subpackage Agenda\Filter
 * @author     Matijs de Jong <mjong@magnafacta.nl>
 * @copyright  Copyright (c) 2020, Erasmus MC and MagnaFacta B.V.
 * @license    New BSD License
 */

namespace Gems\Agenda\Filter;

/**
 *
 * @package    Gems
 * @subpackage Agenda\Filter
 * @copyright  Copyright (c) 2020, Erasmus MC and MagnaFacta B.V.
 * @license    New BSD License
 * @since      Class available since version 1.8.8 03-Jun-2020 16:13:41
 */
class XandModelDependency extends AndModelDependency
{
    /**
     * A ModelAbstract->setOnSave() function that returns a string desrcibing the filter
     *
     * @see \MUtil_Model_ModelAbstract
     *
     * @param mixed $value The value being saved
     * @param boolean $isNew True when a new item is being saved
     * @param string $name The name of the current field
     * @param array $context Optional, the other values being saved
     * @return string
     */
    public function calcultateName($value, $isNew = false, $name = null, array $context = array())
    {
        $output = $this->calcultateNameOutput($value, $isNew, $name, $context);

        if ($output) {
            return sprintf($this->_('NOT (%s)'), ucfirst(implode($this->getGlue(), $output)));
        } else {
            return $this->_('empty filter');
        }
    }

    /**
     * Get the class name for the filters, the part after *_Agenda_Filter_
     *
     * @return string
     */
    public function getFilterClass()
    {
        return 'XandAppointmentFilter';
    }

    /**
     * Get the name for this filter class
     *
     * @return string
     */
    public function getFilterName()
    {
        return $this->_('NOT ALL (XAND) combination filter');
    }

}