Created
May 8, 2012 16:21
-
-
Save priithansen/2636918 to your computer and use it in GitHub Desktop.
atk4 page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment