Skip to content

Instantly share code, notes, and snippets.

@priithansen
Created May 8, 2012 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save priithansen/2636918 to your computer and use it in GitHub Desktop.
Save priithansen/2636918 to your computer and use it in GitHub Desktop.
atk4 page
<?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