public
Last active

atk4 page

  • Download Gist
page_graafik
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
<?php
class page_graafik extends Page {
function initMainPage(){
$this->api->stickyGET('mac');
//Get the maja id from maja table based on mac
$maja = $this->setModel('maja');
$maja->tryLoadBy('mac','=',$_GET['mac']);
 
$jobs = $this->add('Grid');
$model= $this->add('Model_too');
 
$filter = $jobs->setModel($model,array('tahtaeg','firma','kirjeldus','file_id','tehtud'))->setOrder('tahtaeg', false);
// Only show current if mac set
if($_GET['mac'] != "") {
$filter->addCondition('maja_id', $maja['id']);
}
 
// Add button to show file
$jobs->addColumn('button','file_id','Joonis');
$jobs->addColumn('confirm','valmis');
$jobs->addColumn('html,wrap','kirjeldus');
 
// Mark job as complete
if($_GET['valmis']){
$model = $jobs->getModel()->loadData($_GET['valmis']);
$model->set('tehtud','Y')->update();
$this->js(null,$this->js()->univ()->successMessage($model->get('firma').' valmis!'))->reload()->execute();
}
 
// Open the file somehow???
if($_GET['file_id']){
 
$pdf = $this->add('filestore/Model_File');
 
}
 
// Quicksearch and automatic refresh
$jobs->addQuickSearch(array('firma','kirjeldus'));
$jobs->js(true)->univ()->setTimeout($jobs->js()->_enclose()->reload(), 15000);
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.