<?php

class update_View extends View {

	// display list of available updates
	// install new module
	// remove module?
	// refresh catalog.  Last update check on: xxxxx
	
	public function update_summary() {
		hook_execute('component.add', FALSE, 'datatables');
		$html = <<<BLOCK
<h3>{{page_title}}</h3>

<table>
<tr><td>Last Check for Updates:</td><td>{{lastcheck}} &nbsp; <button class="json-request" href="/admin/update/check-now">Check Now</button></td></tr>
<tr><td>PHP Version:</td><td>{{version}}</td></tr>
<tr><td>Modules</td><td><a href="/admin/settings">link</a></td></tr>
</table>

<br>
<h4>Install a Module</h4>
<table class="display data-class">
<thead>
<tr><td>Module</td><td>Name</td><td>Version</td></tr>
</thead>
</table>


BLOCK;
		// display list of available updates<br>
		// remove module?<br>

		$this('update_summary')->html($html)->title('Module Updates');
	}
	
	// popup iframe
	public function update_install() {
		$html = <<<BLOCK
<iframe style="width:100%;height:300px" frameborder="0" src="/~/update/install/{{module}}?auth={{encode auth}}" marginheight="0" marginwidth="0">
</iframe>
BLOCK;
		$this('update_install')->html($html);
		
	}
	
}