Location: PHPKode > projects > AModules3 > amodules-3.0.1/mini-apps/02-DBver_control/page/Script.php
<?php
/*
 * Created on 26.03.2006 by *Camper*
 */
class page_Script extends Page{
	function init(){
		parent::init();
		$this->api->memorize('application_id', $_GET['application_id']);
		$this->add('Text', null, 'Content')->set("<h2>Script list for '".
			$this->api->getAppName($_GET['application_id'])."', version ".
			$this->api->getCurrentVersion($_GET['application_id'])."</h2>");
		$this->add('ListScript', null, 'Content');
	}
	function defaultTemplate(){
		return array('shared', 'Content');
	}
}
class ListScript extends Grid{
	function init(){
		parent::init();
		$this
			->addColumn('text', 'number', 'No.')
			->addColumn('text,wrap', 'script', 'Script')
			->addColumn('text', 'type', 'Type')
			->addColumn('expander', 'edit', 'Edit')
			->addColumn('delete', 'delete', 'Delete')
			
			->setSource('script')
		;
		$this->dq->where('application_id', $_GET['application_id']);
		$this->dq->where('version_id', $this->api->getCurrentVersionId($_GET['application_id']));
		$this->addButton('Add script')->redirect('AddScript',
			array('application_id'=>$_GET['application_id'], 
				'ver'=>$this->api->getCurrentVersionId($_GET['application_id'])));
	}
	function format_delete($field){
		$this->current_row[$field] = "<a onclick=\"return confirm('Are sure want to delete it?')\" " .
			"href=".$this->api->getDestinationURL('Script_'.$field, array('id'=>$this->current_row['id'],
			'application_id'=>$_GET['application_id'])).">[Delete]</a>";
	}
}
?>
Return current item: AModules3