Example #1
0
 function _action_submit_intervals()
 {
     // parse results from response
     $ruleId = _post('id');
     $rule = $this->getRuleManager()->getRule($ruleId);
     // new intervals object
     $intervals = new ReminderIntervals();
     $change = false;
     foreach (ReminderIntervalType::values() as $type) {
         foreach (ReminderIntervalRange::values() as $range) {
             $amtKey = $type->code . "-" . $range->code;
             $timeKey = $amtKey . "-timeunit";
             $amt = _post($amtKey);
             $timeUnit = TimeUnit::from(_post($timeKey));
             if ($amt && $timeUnit) {
                 $detail = new ReminderIntervalDetail($type, $range, $amt, $timeUnit);
                 $intervals->addDetail($detail);
                 $change = true;
             }
         }
     }
     if ($change) {
         $this->getRuleManager()->updateIntervals($rule, $intervals);
     }
     $this->redirect("index.php?action=detail!view&id={$ruleId}");
 }
Example #2
0
 function getTypes()
 {
     $types = array();
     foreach (array_keys($this->detailMap) as $code) {
         array_push($types, ReminderIntervalType::from($code));
     }
     return $types;
 }
Example #3
0
 /**
  * Creates a ReminderIntervals object from rows in the rule_reminder table,
  * and sets it in the supplied Rule.
  * @param Rule $rule
  */
 private function fillRuleReminderIntervals($rule)
 {
     $stmt = sqlStatement(self::SQL_RULE_REMINDER_INTERVAL, array($rule->id));
     $reminderInterval = new ReminderIntervals();
     for ($iter = 0; $row = sqlFetchArray($stmt); $iter++) {
         $amount = $row['value'];
         $unit = TimeUnit::from($row['method_detail']);
         $methodParts = explode('_', $row['method']);
         $type = ReminderIntervalType::from($methodParts[0]);
         $range = ReminderIntervalRange::from($methodParts[2]);
         if (!is_null($type) && !is_null($range) && !is_null($unit)) {
             $detail = new ReminderIntervalDetail($type, $range, $amount, $unit);
             $reminderInterval->addDetail($detail);
         }
     }
     $rule->setReminderIntervals($reminderInterval);
 }
Example #4
0
"/>

    <div class="intervals">
        <p>
            <span class="left_col colhead"><u><?php 
echo out(xl('Type'));
?>
</u></span>
            <span class="end_col colhead"><u><?php 
echo out(xl('Detail'));
?>
</u></span>
        </p>

    <?php 
foreach (ReminderIntervalType::values() as $type) {
    ?>
    <?php 
    foreach (ReminderIntervalRange::values() as $range) {
        ?>
    <?php 
        $first = true;
        $detail = $intervals->getDetailFor($type, $range);
        ?>
        <p>
            <span class="left_col <?php 
        echo $first ? "req" : "";
        ?>
" data-grp="<?php 
        echo out($type->code);
        ?>