// Modules to control application life and create native browser window
const {app, BrowserWindow, session, screen} = require('electron')
const { protocol } = require('electron')
const path = require('path')
const url = require('url')
const PROTOCOL_PREFIX = 'myApp';
const displays = null;
let mainWindow;
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
webviewTag: true,
nodeIntegration: true,
contextIsolation: false,
},
fullscreen: true,
movable: false,
alwaysOnTop: true,
});
// Open the DevTools.
mainWindow.webContents.openDevTools();
mainWindow.setIcon(path.join(__dirname, '/assets/mac.png'));
mainWindow.maximize();
mainWindow.loadFile('./pages/index.html')
const displays = screen.getAllDisplays();
console.log(displays);
setTimeout(() => {
console.log("sending message from main process")
mainWindow.webContents.send("displays", displays)
}, 3000)
logEverywhere('test')
protocol.registerHttpProtocol(PROTOCOL_PREFIX, (req, cb) => {
const fullUrl = req.url
logEverywhere('full url to open ' + fullUrl)
})
mainWindow.on('blur', () => {
console.log("blured");
mainWindow.webContents.send("blured", "blured")
});
mainWindow.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
}
app.on('ready', () => {
createWindow();
})
app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow();
}
});
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})
if (!app.isDefaultProtocolClient(PROTOCOL_PREFIX)) {
// Define custom protocol handler. Deep linking works on packaged versions of the application!
app.setAsDefaultProtocolClient(PROTOCOL_PREFIX)
}
app.on('will-finish-launching', function() {
// Protocol handler for osx
app.on('open-url', function(event, url) {
event.preventDefault()
deeplinkingUrl = url
logEverywhere('open-url# ' + deeplinkingUrl)
})
})
// Log both at dev console and at running node console instance
function logEverywhere(s) {
console.log(s)
if (mainWindow && mainWindow.webContents) {
mainWindow.webContents.executeJavaScript(`console.log("${s}")`)
}
}
$query = BannerCourseQuestionsCheckList::find();
$query->joinWith('course', true, 'RIGHT JOIN');
$query->select(['`mdl_banner_courses`.*','`mdl_banner_course_questions_check_list`.*']);
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'course.course_id',
],
'added',
'user_added',
'add_time',
'verified',
'user_verified',
'verify_time',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
[
'attribute' => 'c_id',
'value' => function($data){
return $data->course->course_id;
}
],
public function getcourse(){
return $this->hasOne(BannerCourses::className(), ['course_id' => 'course_id']);
}
буду изучать