Horde_Date_Recurrence::addCompletion PHP Method

addCompletion() public method

Adds a completion to a recurring event.
public addCompletion ( integer $year, integer $month, integer $mday )
$year integer The year of the exception.
$month integer The month of the exception.
$mday integer The day of the month of the completion.
    public function addCompletion($year, $month, $mday)
    {
        $this->completions[] = sprintf('%04d%02d%02d', $year, $month, $mday);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Toggles completion status of this task. Moves a recurring task
  * to the next occurence on completion.
  */
 public function toggleComplete()
 {
     if ($this->completed) {
         $this->completed_date = null;
         $this->completed = false;
         if ($this->recurs()) {
             /* What do we want do delete here? All completions?
              * The latest completion? Any completion in the
              * future?. */
             foreach ($this->recurrence->getCompletions() as $completion) {
                 $this->recurrence->deleteCompletion(substr($completion, 0, 4), substr($completion, 4, 2), substr($completion, 6, 2));
             }
         }
         return;
     }
     if ($this->recurs()) {
         /* Get current occurrence (task due date) */
         $current = $this->recurrence->nextActiveRecurrence(new Horde_Date($this->due));
         if ($current) {
             $this->recurrence->addCompletion($current->year, $current->month, $current->mday);
             /* Advance this occurence by a day to indicate that we
              * want the following occurence (Recurrence uses days
              * as minimal time duration between occurrences). */
             $current->mday++;
             /* Only mark this due date completed if there is another
              * occurence. */
             if ($next = $this->recurrence->nextActiveRecurrence($current)) {
                 $this->completed = false;
                 return;
             }
         }
     }
     $this->completed_date = time();
     $this->completed = true;
 }
All Usage Examples Of Horde_Date_Recurrence::addCompletion