public function start_progress($description, $max = self::INDETERMINATE,
            $parentcount = 1) {
        if ($max != self::INDETERMINATE && $max < 0) {
            throw new \coding_exception(
                    'start_progress() max value cannot be negative');
        }
        if ($parentcount < 1) {
            throw new \coding_exception(
                    'start_progress() parent progress count must be at least 1');
        }
        if (!empty($this->descriptions)) {
            $prevmax = end($this->maxes);
            if ($prevmax !== self::INDETERMINATE) {
                $prevcurrent = end($this->currents);
                if ($prevcurrent + $parentcount > $prevmax) {
                    throw new \coding_exception(
                            'start_progress() parent progress would exceed max');
                }
            }
        } else {
            if ($parentcount != 1) {
                throw new \coding_exception(
                        'start_progress() progress count must be 1 when no parent');
            }
        }
        $this->descriptions[] = $description;
        $this->maxes[] = $max;
        $this->currents[] = 0;
        $this->parentcounts[] = $parentcount;
        $this->update_progress();
    }
public function start_progress($description, $max = self::INDETERMINATE,
            $parentcount = 1) {
        if ($max != self::INDETERMINATE && $max < 0) {
            throw new \coding_exception(
                    'start_progress() max value cannot be negative');
        }
        if ($parentcount < 1) {
            throw new \coding_exception(
                    'start_progress() parent progress count must be at least 1');
        }
        if (!empty($this->descriptions)) {
            $prevmax = end($this->maxes);
            if ($prevmax !== self::INDETERMINATE) {
                $prevcurrent = end($this->currents);
                if ($prevcurrent + $parentcount > $prevmax) {
                    throw new \coding_exception(
                            'start_progress() parent progress would exceed max');
                }
            }
        } else {
            if ($parentcount != 1) {
                throw new \coding_exception(
                        'start_progress() progress count must be 1 when no parent');
            }
        }
        $this->descriptions[] = $description;
        $this->maxes[] = $max;
        $this->currents[] = 0;
        $this->parentcounts[] = $parentcount;
        $this->update_progress();
    }
public function start_progress ( $ description , $ max = self :: INDETERMINATE , $ parentcount = 1 ) { if ( $ max != self :: INDETERMINATE && $ max < 0 ) { throw new \ coding_exception ( 'start_progress() max value cannot be negative' ) ; } if ( $ parentcount < 1 ) { throw new \ coding_exception ( 'start_progress() parent progress count must be at least 1' ) ; } if ( ! empty ( $ this -> descriptions ) ) { $ prevmax = end ( $ this -> maxes ) ; if ( $ prevmax !== self :: INDETERMINATE ) { $ prevcurrent = end ( $ this -> currents ) ; if ( $ prevcurrent + $ parentcount > $ prevmax ) { throw new \ coding_exception ( 'start_progress() parent progress would exceed max' ) ; } } } else { if ( $ parentcount != 1 ) { throw new \ coding_exception ( 'start_progress() progress count must be 1 when no parent' ) ; } } $ this -> descriptions [ ] = $ description ; $ this -> maxes [ ] = $ max ; $ this -> currents [ ] = 0 ; $ this -> parentcounts [ ] = $ parentcount ; $ this -> update_progress ( ) ; }
Marks the start of an operation that will display progress.

This can be called multiple times for nested progress sections. It must
be paired with calls to end_progress.

The progress maximum may be {@link self::INDETERMINATE} if the current operation has
an unknown number of steps. (This is default.)

Calling this function will always result in a new display, so this
should not be called exceedingly frequently.

When it is complete by calling {@link end_progress()}, each {@link start_progress} section
automatically adds progress to its parent, as defined by $parentcount.

@param string $description Description to display
@param int $max Maximum value of progress for this section
@param int $parentcount How many progress points this section counts for
@throws \coding_exception If max is invalid
Marks the start of an operation that will display progress .