Restructured plugins for Moodle overlay

This commit is contained in:
James McQuillan 2014-10-27 17:42:19 -04:00
Коммит ab9352105c
14 изменённых файлов: 1794 добавлений и 0 удалений

30
db/access.php Normal file
Просмотреть файл

@ -0,0 +1,30 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Capability definitions for skydrive repository
*
* @package repository_onenote
*/
$capabilities = array(
'repository/onenote:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'user' => CAP_ALLOW
)
)
);

29
db/caches.php Normal file
Просмотреть файл

@ -0,0 +1,29 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Cache definitions.
*
* @package repository_onenote
*/
defined('MOODLE_INTERNAL') || die();
$definitions = array(
'foldername' => array(
'mode' => cache_store::MODE_SESSION,
)
);

39
db/install.php Normal file
Просмотреть файл

@ -0,0 +1,39 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Installation file for the wikimedia repository
*
* @package repository_wikimedia
* @category repository
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Create a default instance of the wikimedia repository
*
* @return bool A status indicating success or failure
*/
function xmldb_repository_onenote_install() {
global $CFG;
$result = true;
require_once($CFG->dirroot.'/repository/lib.php');
$onenoteplugin = new repository_type('onenote', array(), true);
if(!$id = $onenoteplugin->create(true)) {
$result = false;
}
return $result;
}

41
db/install.xml Normal file
Просмотреть файл

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="repository/onenote/db" VERSION="20140930" COMMENT="XMLDB file for Moodle repository/onenote"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="repository_onenote" COMMENT="Default comment for repository_onenote, please edit me">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="course_user_ext" COMMENT="to store user id, course id and onenote section id relationship">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="user_id" TYPE="int" LENGTH="5" NOTNULL="false" SEQUENCE="false" COMMENT="user id"/>
<FIELD NAME="course_id" TYPE="int" LENGTH="5" NOTNULL="false" SEQUENCE="false" COMMENT="Course id of the enrolled course"/>
<FIELD NAME="section_id" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="Section id of the Onenote section"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="assign_user_ext" COMMENT="to store OneNote page id's for submissions and fedbacks for student's assignments">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="user_id" TYPE="int" LENGTH="5" NOTNULL="false" SEQUENCE="false" COMMENT="user id"/>
<FIELD NAME="assign_id" TYPE="int" LENGTH="5" NOTNULL="false" SEQUENCE="false" COMMENT="assignment id"/>
<FIELD NAME="submission_student_page_id" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="OneNote page id for stodent's copy of student's submission"/>
<FIELD NAME="feedback_student_page_id" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="OneNote page id for student's copy of teacher's feedback"/>
<FIELD NAME="submission_teacher_page_id" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="OneNote page id for teacher's copy of student's submission"/>
<FIELD NAME="feedback_teacher_page_id" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="OneNote page id for teacher's copy of teacher's feedback"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
</TABLES>
</XMLDB>

103
db/upgrade.php Normal file
Просмотреть файл

@ -0,0 +1,103 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @param int $oldversion the version we are upgrading from
* @return bool result
*/
function xmldb_repository_onenote_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2014101601) {
// Define table repository_onenote to be created.
$table = new xmldb_table('repository_onenote');
// Adding fields to table repository_onenote.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
// Adding keys to table repository_onenote.
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
// Conditionally launch create table for repository_onenote.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// Define table course_user_ext to be created.
$table = new xmldb_table('course_user_ext');
// Adding fields to table course_user_ext.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('user_id', XMLDB_TYPE_INTEGER, '5', null, null, null, null);
$table->add_field('course_id', XMLDB_TYPE_INTEGER, '5', null, null, null, null);
$table->add_field('section_id', XMLDB_TYPE_CHAR, '100', null, null, null, null);
// Adding keys to table course_user_ext.
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
// create table for course_user_ext.
if ($dbman->table_exists($table))
$dbman->drop_table($table);
$dbman->create_table($table);
// Define table assign_user_ext to be created.
$table = new xmldb_table('assign_user_ext');
// Adding fields to table course_user_ext.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('user_id', XMLDB_TYPE_INTEGER, '5', null, null, null, null);
$table->add_field('assign_id', XMLDB_TYPE_INTEGER, '5', null, null, null, null);
$table->add_field('submission_student_page_id', XMLDB_TYPE_CHAR, '100', null, null, null, null);
$table->add_field('feedback_student_page_id', XMLDB_TYPE_CHAR, '100', null, null, null, null);
$table->add_field('submission_teacher_page_id', XMLDB_TYPE_CHAR, '100', null, null, null, null);
$table->add_field('feedback_teacher_page_id', XMLDB_TYPE_CHAR, '100', null, null, null, null);
// Adding keys to table course_user_ext.
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
// create table for assign_user_ext.
if ($dbman->table_exists($table))
$dbman->drop_table($table);
$dbman->create_table($table);
// Onenote savepoint reached.
upgrade_plugin_savepoint(true, 2014101601, 'repository', 'onenote');
}
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
return true;
}

Просмотреть файл

@ -0,0 +1,29 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Language file definitions for OneNote repository
*
* @package repository_onenote
*/
$string['cachedef_foldername'] = 'Folder name cache';
$string['clientid'] = 'Client ID';
$string['configplugin'] = 'Configure Microsoft OneNote';
$string['oauthinfo'] = '<p>To use this plugin, you must register your site <a href="https://account.live.com/developers/applications">with Microsoft</a>.<p>As part of the registration process, you will need to enter the following URL as \'Redirect domain\':</p><p>{$a->callbackurl}</p>Once registered, you will be provided with a client ID and secret which can be entered here.</p>';
$string['pluginname'] = 'Microsoft OneNote';
$string['secret'] = 'Secret';
$string['onenote:view'] = 'View OneNote Notebooks';

205
lib.php Normal file
Просмотреть файл

@ -0,0 +1,205 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Microsoft OneNote Repository Plugin
*
* @package repository_onenote
*/
defined('MOODLE_INTERNAL') || die();
require_once('onenote_api.php');
/**
* Microsoft OneNote repository plugin.
*
* @package repository_onenote
*/
class repository_onenote extends repository {
/** @var microsoft_onenote onenote oauth2 api helper object */
private $onenote = null;
/**
* Constructor
*
* @param int $repositoryid repository instance id.
* @param int|stdClass $context a context id or context object.
* @param array $options repository options.
*/
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
parent::__construct($repositoryid, $context, $options);
$clientid = get_config('onenote', 'clientid');
$secret = get_config('onenote', 'secret');
$returnurl = new moodle_url('/repository/repository_callback.php');
$returnurl->param('callback', 'yes');
$returnurl->param('repo_id', $this->id);
$returnurl->param('sesskey', sesskey());
$this->onenote = new microsoft_onenote($clientid, $secret, $returnurl);
$this->check_login();
}
/**
* Checks whether the user is logged in or not.
*
* @return bool true when logged in
*/
public function check_login() {
return $this->onenote->is_logged_in();
}
/**
* Print the login form, if required
*
* @return array of login options
*/
public function print_login() {
$url = $this->onenote->get_login_url();
if ($this->options['ajax']) {
$popup = new stdClass();
$popup->type = 'popup';
$popup->url = $url->out(false);
return array('login' => array($popup));
} else {
echo '<a target="_blank" href="'.$url->out(false).'">'.get_string('login', 'repository').'</a>';
}
}
/**
* Given a path, and perhaps a search, get a list of files.
*
* See details on {@link http://docs.moodle.org/dev/Repository_plugins}
*
* @param string $path identifier for current path
* @param string $page the page number of file list
* @return array list of files including meta information as specified by parent.
*/
public function get_listing($path='', $page = '') {
$ret = array();
$ret['dynload'] = true;
$ret['nosearch'] = true;
$ret['manage'] = 'https://onenote.com/';
$fileslist = $this->onenote->get_items_list($path);
// Filter list for accepted types. Hopefully this will be done by core some day.
$fileslist = array_filter($fileslist, array($this, 'filter'));
$ret['list'] = $fileslist;
// Generate path bar, always start with the plugin name.
$ret['path'] = array();
$ret['path'][] = array('name'=> $this->name, 'path'=>'');
// Now add each level folder.
$trail = '';
if (!empty($path)) {
$parts = explode('/', $path);
foreach ($parts as $folderid) {
if (!empty($folderid)) {
$trail .= ('/'.$folderid);
$ret['path'][] = array('name' => $this->onenote->get_item_name($folderid),
'path' => $trail);
}
}
}
return $ret;
}
/**
* Downloads a repository file and saves to a path.
*
* @param string $id identifier of file
* @param string $filename to save file as
* @return array with keys:
* path: internal location of the file
* url: URL to the source
*/
public function get_file($id, $filename = '') {
$path = $this->prepare_file($filename);
return $this->onenote->download_page($id, $path);
}
/**
* Return names of the options to display in the repository form
*
* @return array of option names
*/
public static function get_type_option_names() {
return array('clientid', 'secret', 'pluginname');
}
/**
* Setup repistory form.
*
* @param moodleform $mform Moodle form (passed by reference)
* @param string $classname repository class name
*/
public static function type_config_form($mform, $classname = 'repository') {
$a = new stdClass;
$a->callbackurl = microsoft_onenote::callback_url()->out(false);
$mform->addElement('static', null, '', get_string('oauthinfo', 'repository_onenote', $a));
parent::type_config_form($mform);
$strrequired = get_string('required');
$mform->addElement('text', 'clientid', get_string('clientid', 'repository_onenote'));
$mform->addElement('text', 'secret', get_string('secret', 'repository_onenote'));
$mform->addRule('clientid', $strrequired, 'required', null, 'client');
$mform->addRule('secret', $strrequired, 'required', null, 'client');
$mform->setType('clientid', PARAM_RAW_TRIMMED);
$mform->setType('secret', PARAM_RAW_TRIMMED);
}
/**
* Logout from repository instance and return
* login form.
*
* @return page to display
*/
public function logout() {
$this->onenote->log_out();
return $this->print_login();
}
/**
* This repository doesn't support global search.
*
* @return bool if supports global search
*/
public function global_search() {
return false;
}
/**
* This repoistory supports any filetype.
*
* @return string '*' means this repository support any files
*/
public function supported_filetypes() {
return '*';
}
/**
* This repostiory only supports internal files
*
* @return int return type bitmask supported
*/
public function supported_returntypes() {
return FILE_INTERNAL;
}
}

1037
onenote_api.php Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Двоичные данные
pix/icon.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.5 KiB

8
styles.css Normal file
Просмотреть файл

@ -0,0 +1,8 @@
.onenote_linkbutton
{
background-color: #80397B;
color: #fff;
display: inline-block;
padding: 4px 10px;
margin: 5px 0px;
}

64
tests/events_test.php Normal file
Просмотреть файл

@ -0,0 +1,64 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Tests for notes events.
*
* @package core_notes
* @copyright 2013 Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot.'/lib/oauthlib.php');
require_once($CFG->dirroot.'/repository/onenote/onenote_api.php');
/**
* Class microsoft_onenote_testcase
*
*/
class microsoft_onenote_testcase extends advanced_testcase {
/** @var stdClass A note object. */
private $onenote_test;
public function setup() {
$returnurl = new moodle_url('/repository/repository_callback.php');
$this->onenote_test = new microsoft_onenote(get_config('onenote', 'clientid'), get_config('onenote', 'secret'), $returnurl);
//$onenote_api = microsoft_onenote::get_onenote_api();
//$onenote_token = $onenote_api->get_accesstoken();
}
public function test_microsoftinstance() {
/*$returnurl = new moodle_url('/repository/repository_callback.php');
$this->onenote_test = new microsoft_onenote('', '', $returnurl);*/
$onenote_api = $this->onenote_test->get_onenote_api();
//$onenote_api = microsoft_onenote::get_onenote_api();
}
public function test_getitemname() {
}
/*public function test_getMicrosoftOnenoteapi() {
$onenote_api = microsoft_onenote::get_onenote_api();
$onenote_token = $onenote_api->get_accesstoken();
}*/
}

58
tests/generator/lib.php Normal file
Просмотреть файл

@ -0,0 +1,58 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Flickr repository data generator
*
* @package repository_flickr
* @category test
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Flickr repository data generator class
*
* @package repository_flickr
* @category test
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class repository_onenote_generator extends testing_repository_generator {
/**
* Fill in type record defaults.
*
* @param array $record
* @return array
*/
protected function prepare_type_record(array $record) {
$record = parent::prepare_type_record($record);
if (!isset($record['clientid'])) {
$record['clientid'] = 'clientid';
}
if (!isset($record['secret'])) {
$record['secret'] = 'secret';
}
return $record;
}
}

124
tests/onenoteapi_test.php Normal file
Просмотреть файл

@ -0,0 +1,124 @@
<?php
//use MyProject\Proxies\__CG__\OtherProject\Proxies\__CG__\stdClass;
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Tests for notes events.
*
* @package core_notes
* @copyright 2013 Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot.'/lib/oauthlib.php');
require_once($CFG->dirroot.'/repository/onenote/onenote_api.php');
require_once($CFG->dirroot . '/mod/assign/tests/base_test.php');
/**
* Class microsoft_onenote_testcase
*
*/
class microsoft_onenote_testcase extends advanced_testcase {
/** @var stdClass A note object. */
private $onenote_api;
private $accesstoken;
/** @var stdClass $user A user to submit an assignment. */
protected $user;
/** @var stdClass $course New course created to hold the assignment activity. */
protected $course1;
protected $course2;
/** @var stdClass $cm A context module object. */
protected $cm;
/** @var stdClass $context Context of the assignment activity. */
protected $context;
/** @var stdClass $assign The assignment object. */
protected $assign;
public function setup() {
global $DB;
$this->resetAfterTest(true);
$this->user = $this->getDataGenerator()->create_user();
$this->course1 = $this->getDataGenerator()->create_course();
$this->course2 = $this->getDataGenerator()->create_course();
//setting user and enrolling to the courses created with teacher role.
$this->setUser($this->user->id);
$c1ctx = context_course::instance($this->course1->id);
$c2ctx = context_course::instance($this->course2->id);
$this->getDataGenerator()->enrol_user($this->user->id, $this->course1->id,4);
$this->getDataGenerator()->enrol_user($this->user->id, $this->course2->id,4);
$this->assertCount(1, get_enrolled_users($c1ctx));
$this->assertCount(1, get_enrolled_users($c2ctx));
$this->assertCount(2, enrol_get_my_courses());
$courses = enrol_get_my_courses();
$this->onenote_api = microsoft_onenote::get_onenote_api();
// error_log("incourse");
// error_log(print_r($courses,true));
// error_log("inenrolcourse");
/*$token = new stdClass();
$token->token = "EwB4Aq1DBAAUGCCXc8wU/zFu9QnLdZXy+YnElFkAAbJ035V/2j8ddS2CiJoMRf938a1DxEtErYcOSNmU8FF8lN10sdICPX2s6o42PTR3G1TE0cVGLGGUs1/nzRWjlx3HRKYW7bGBUPCba8XExfLsjs2FVLZBMG0gUHAA1e54xqp3qI1nYHzN9P16u9O6oHuDTP6njK6GCoamsVL1naxoSCCWMRs/2t1CHiSUB1WQ2zMo5g5dRzvxp+4SCISIo5UcSBuzzsKVX/pPR1JoxZTQLbFrogQYxc2YrPtoUX8riw0OiosOVgSUyQDKRDtQEZwdNGKR2NijNc6EDf35ljo3b29FVYT7RQahG6M5I7h50eXYK4CvUoQO6ZRAwwHnqSADZgAACKfRC9CAJ+LoSAFtg/G8N7RlRlQvkgjyULJaDa34gWN+Wex/CrUF16SF/hgOB56G8kziTs5ub8wK4cI5yE57vNQ3Xc7BfHFkBKLH2UR0lSc9pm+wu7WKBEC5T2th4JcqrqpK1vqWcqOxQFTwj6UM6mPu+zsQJ2QjE4NYyd6HdpqHdk8iNbc3phvdW/oXflH/Tl8QJY7Gu7WWjy/nk//h0ZG5G3//kbFWzF+zO+tdtMbPxGjmxw5FNRsxKg956pt8IEsl9UhZvWa/tSh219gFgqn+xyLpejmaho6Of0zkaPSu2NLMq6hzJM+NI6dHM+eL3Y3OhcDg9616wGFwj2unwCl8PD893TrCIDHN1PUrxgDOLFr1WJC06ZavYMtApHB8XkaiGxhJJR0/zItmtILK7GnJDKLlSsWBsnJ+m9KHZZILrSKPgVQFvye44/93NUDwAOfPZAE=";
$token->expires = "1413460546";
$this->setAccessToken($token);
*/
//$onenote_token = $this->onenote_api->get_onenote_token
}
/* public function setAccessToken($token) {
$this->accesstoken = $token;
}*/
public function test_getmicrosoft_repo() {
$onenote_id = $this->onenote_api->get_onenote_repo_id();
$this->assertNotEmpty($onenote_id,"No value");
}
public function test_getitemlist() {
$item_list = $this->onenote_api->get_items_list();
$this->assertNotEmpty($item_list,"No value");
}
public function test_getpage() {
$item_list = $this->onenote_api->get_items_list();
$generator = $this->getDataGenerator()->get_plugin_generator('mod_assign');
$params['course'] = $this->course1->id;
$instance = $generator->create_instance($params);
$this->cm = get_coursemodule_from_instance('assign', $instance->id);
$this->context = context_module::instance($this->cm->id);
$this->assign = new testable_assign($this->context, $this->cm, $this->course1);
$assign_details = $this->assign->get_instance();
$assign_id = $assign_details->id;
$save_assigment = $this->onenote_api->get_page($assign_id,false);
print_r($save_assigment);
}
}

27
version.php Normal file
Просмотреть файл

@ -0,0 +1,27 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Version details for OneNote repository
*
* @package repository_noenote
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014101601; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014050800; // Requires this Moodle version.
$plugin->component = 'repository_onenote'; // Full name of the plugin (used for diagnostics).