<?php
//============================================================================
// (c) 2002-2015, Go Albert - All Rights Reserved.
// This source code is the property of Go Albert. Its content may not be
// disclosed to third parties, copied or duplicated in any form, in whole
// or in part, without the prior written permission of Go Albert. Use,
// duplication, or disclosure of the technical data contained in this
// document is subject to restrictions as the software is patented.
//============================================================================
// Page extension

class Extension_page extends amiExtension{

	public function __construct(){
		parent::__construct();
		$this->_priority = 100;
	}

	function GetVersion() {	
		// 1.0 : first version
		return '1.0';
	}

	function HasFeature($feat) {
		switch($feat) {
			case 'source_mode': return true;
			case 'bm_local_index': return true;
			case 'bm_rd_only': 	return true;
			default: return false;
		}
	}
	
	function GetFamily() {
		return 'other';
	}

	function GetCustomUserSpaceables($modname) {
		// f_require_once($this->_path.'/myspace.class.inc.php');
		return false;
	}

	function GetUserSpaceables() {
		// f_require_once($this->_path.'/myspace.class.inc.php');
		return false;
	}

	function getModes() {   
		return array('page');
	}

	function SetBookmarkFromHTTPVar(&$bookmark){
		
		return parent::SetBookmarkFromHTTPVar($bookmark);
	}

	function Diagnose(){
		if ($this->HasFeature('source_mode')) {
			$extensionExists = false;
			$extensionHasFront = false;
			$script = $this->GetViewPath();
			if (file_exists($script)){
				$extensionHasFront = true;
			}
			if (!$extensionHasFront)
				return new DiagnosisResult('', 'error', _TF('diag_extension_no_source_script', $this->_key));
		}
		return new DiagnosisResult( $this->GetName(), 'ok', '');
	}
};
