// // 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/>. /** * @package local_msaccount * @author Vinayak (Vin) Bhalerao (v-vibhal@microsoft.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @copyright Microsoft Open Technologies, Inc. */ require_once dirname(dirname(dirname(__FILE__))) . '/config.php'; if (!\local_msaccount\api::getinstance()->is_logged_in()) { // Upgrades token and then checks for success. throw new moodle_exception('Unable to log in to Microsoft Account.'); } $strhttpsbug = get_string('cannotaccessparentwin', 'local_msaccount'); $strrefreshnonjs = get_string('refreshnonjsfilepicker', 'local_msaccount'); $js = <<<EOD <html> <head> <script type="text/javascript"> if(window.opener){ try { window.opener.M.core_filepicker.active_filepicker.list(); } catch (ex) { alert("{$strhttpsbug}"); }
/** * Constructor. * * Initializes local_msaccount\api instance which is used to do moest of the underlying authentication and * REST API operations. This is a singleton class, do not use the constructor directly to create an instance. * Use the getinstance() method instead. */ protected function __construct() { $this->msaccountapi = \local_msaccount\api::getinstance(); $this->msaccountapi->is_logged_in(); }