コード例 #1
0
 /**
  * Delete the step.
  *
  * @param   int         $stepid     The ID of the step to remove.
  */
 protected function delete_step($stepid)
 {
     require_sesskey();
     $step = step::instance($stepid);
     $tour = $step->get_tour();
     $step->remove();
     redirect($tour->get_view_link());
 }
コード例 #2
0
ファイル: tour.php プロジェクト: dg711/moodle
 /**
  * Mark the specified toru step as shown for the current user.
  *
  * @param   int     $tourid     The ID of the tour.
  * @param   int     $context    The Context ID of the current page.
  * @param   string  $pageurl    The path of the current page.
  * @param   int     $stepid     The step id
  * @param   int     $stepindex  The step index
  * @return  array               As described in complete_tour_returns
  */
 public static function step_shown($tourid, $context, $pageurl, $stepid, $stepindex)
 {
     $params = self::validate_parameters(self::step_shown_parameters(), ['tourid' => $tourid, 'context' => $context, 'pageurl' => $pageurl, 'stepid' => $stepid, 'stepindex' => $stepindex]);
     $context = \context_helper::instance_by_id($params['context']);
     self::validate_context($context);
     $step = step::instance($params['stepid']);
     if ($step->get_tourid() != $params['tourid']) {
         throw new \moodle_exception('Incorrect tour specified.');
     }
     \tool_usertours\event\step_shown::create(['contextid' => $context->id, 'objectid' => $params['stepid'], 'other' => ['pageurl' => $params['pageurl'], 'tourid' => $params['tourid'], 'stepindex' => $params['stepindex']]])->trigger();
     return [];
 }