コード例 #1
0
ファイル: toolssettings.php プロジェクト: alanaipe2015/moodle
    if ($action == 'reject' || $action == 'delete') {
        lti_set_state_for_type($id, LTI_TOOL_STATE_REJECTED);
        redirect($redirect);
    }
}
if (lti_request_is_using_ssl() && !empty($type->lti_secureicon)) {
    $type->oldicon = $type->lti_secureicon;
} else {
    $type->oldicon = $type->lti_icon;
}
$form = new mod_lti_edit_types_form($pageurl, (object) array('isadmin' => true, 'istool' => true));
if ($data = $form->get_data()) {
    $type = new stdClass();
    if (!empty($id)) {
        $type->id = $id;
        lti_update_type($type, $data);
    } else {
        $type->state = LTI_TOOL_STATE_CONFIGURED;
        lti_add_type($type, $data);
    }
    redirect($redirect);
} else {
    if ($form->is_cancelled()) {
        redirect($redirect);
    }
}
$PAGE->set_title(format_string($SITE->shortname) . ': ' . get_string('toolsetup', 'lti'));
$PAGE->navbar->add(get_string('lti_administration', 'lti'), $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=modsettinglti');
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('toolsetup', 'lti'));
echo $OUTPUT->box_start('generalbox');
コード例 #2
0
ファイル: external.php プロジェクト: evltuma/moodle
 /**
  * Update a tool type.
  *
  * @param int $id The id of the tool type to update
  * @param string $name The name of the tool type
  * @param string $description The name of the tool type
  * @param int $state The state of the tool type
  * @return array updated tool type
  * @since Moodle 3.1
  * @throws moodle_exception
  */
 public static function update_tool_type($id, $name, $description, $state)
 {
     $params = self::validate_parameters(self::update_tool_type_parameters(), array('id' => $id, 'name' => $name, 'description' => $description, 'state' => $state));
     $id = $params['id'];
     $name = $params['name'];
     $description = $params['description'];
     $state = $params['state'];
     $context = context_system::instance();
     self::validate_context($context);
     require_capability('moodle/site:config', $context);
     $type = lti_get_type($id);
     if (empty($type)) {
         throw new moodle_exception('unabletofindtooltype', 'mod_lti', '', array('id' => $id));
     }
     if (!empty($name)) {
         $type->name = $name;
     }
     if (!empty($description)) {
         $type->description = $description;
     }
     if (!empty($state)) {
         // Valid state range.
         if (in_array($state, array(1, 2, 3))) {
             $type->state = $state;
         } else {
             throw new moodle_exception("Invalid state: {$state} - must be 1, 2, or 3");
         }
     }
     lti_update_type($type, new stdClass());
     return serialise_tool_type($type);
 }