SLT::getSLTTime PHP Method

getSLTTime() public method

Get computed resolution time
public getSLTTime ( ) : resolution
return resolution time
    function getSLTTime()
    {
        if (isset($this->fields['id'])) {
            if ($this->fields['definition_time'] == "minute") {
                return $this->fields['number_time'] * MINUTE_TIMESTAMP;
            }
            if ($this->fields['definition_time'] == "hour") {
                return $this->fields['number_time'] * HOUR_TIMESTAMP;
            }
            if ($this->fields['definition_time'] == "day") {
                return $this->fields['number_time'] * DAY_TIMESTAMP;
            }
        }
        return 0;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Show the rule
  *
  * @param $ID              ID of the rule
  * @param $options   array of possible options
  *
  * @return nothing
  **/
 function showForm($ID, $options = array())
 {
     $canedit = $this->can('sla', UPDATE);
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Active') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("is_active", $this->fields["is_active"]);
     echo "</td></tr>\n";
     $slt = new SLT();
     $slt->getFromDB($this->fields['slts_id']);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . SLT::getTypeName(1) . "</td>";
     echo "<td>" . $slt->getLink() . "</td>";
     echo "<td>" . __('Execution') . "</td>";
     echo "<td>";
     $delay = $slt->getSLTTime();
     self::dropdownExecutionTime('execution_time', array('max_time' => $delay, 'used' => self::getAlreadyUsedExecutionTime($slt->fields['id']), 'value' => $this->fields['execution_time']));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Logical operator') . "</td>";
     echo "<td>";
     $this->dropdownRulesMatch(array('value' => $this->fields["match"]));
     echo "</td>";
     echo "<td colspan='2'>&nbsp;</td></tr>";
     $this->showFormButtons($options);
 }