diff options
| author | Antonio Gallo <tonicucoz@gmail.com> | 2011-10-09 21:03:50 +0000 | 
|---|---|---|
| committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-10-09 21:03:50 +0000 | 
| commit | 9e0955c96d888fc2e00014498d095a7d65ab48fb (patch) | |
| tree | 72a08e21be4d61b7ea2ec56891652355c22c5e2c /h-source/Application/Controllers | |
| parent | f8f3c572e55c90ae13253eb8c910a030bf175e09 (diff) | |
improved the way modules are taken from an xml configuration string
Diffstat (limited to 'h-source/Application/Controllers')
| -rw-r--r-- | h-source/Application/Controllers/BaseController.php | 24 | ||||
| -rw-r--r-- | h-source/Application/Controllers/GenericController.php | 20 | ||||
| -rw-r--r-- | h-source/Application/Controllers/HomeController.php | 10 | 
3 files changed, 22 insertions, 32 deletions
| diff --git a/h-source/Application/Controllers/BaseController.php b/h-source/Application/Controllers/BaseController.php index 13bbb66..2d8c0a7 100644 --- a/h-source/Application/Controllers/BaseController.php +++ b/h-source/Application/Controllers/BaseController.php @@ -168,6 +168,20 @@ class BaseController extends Controller  		return null;  	} +// 	get the HTML of a module from the xml configuration string +//	$xmlPath: array conitaining the path +	protected function getModule($xmlPath) +	{ +		$tracksHelpLabel = null; +		$xml = $this->getBox($xmlPath); +		if ($xml) +		{ +			$box_news = new BoxParser($xml); +			$tracksHelpLabel = $box_news->render(); +		} +		return $tracksHelpLabel; +	} +	  	protected function right($lang = 'en')  	{  		$hard = new HardwareModel(); @@ -179,14 +193,8 @@ class BaseController extends Controller  		$data['numbLogged'] = count($logged);  		//render the boxes inside the right column -		$data['htmlRightBox'] = null; -		$xml = $this->getBox(array('right_column')); -		if ($xml) -		{ -			$box_news = new BoxParser($xml); -			$data['htmlRightBox'] = $box_news->render(); -		} -		 +		$data['htmlRightBox'] = $this->getModule(array('right_column')); +  		$data['language_links'] = $this->buildLanguageLinks($this->lang);  		$data['lastModif'] = $this->m['HistoryModel'] diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php index f1f1d70..d466d61 100644 --- a/h-source/Application/Controllers/GenericController.php +++ b/h-source/Application/Controllers/GenericController.php @@ -130,7 +130,7 @@ class GenericController extends BaseController  			$data['submitName'] = "insertAction";  			$data['hiddenInput'] = null; -			$data['tracksHelpLabel'] = $this->getEntryLabel('it_tracks_users'); +			$data['tracksHelpLabel'] = $this->getModule(array('devices',$this->controller,'form','it_tracks_users'));  			$data['values'] = $this->m['HardwareModel']->getFormValues('insert','sanitizeHtml');  			$this->append($data); @@ -291,7 +291,7 @@ class GenericController extends BaseController  					$data['values'] = $this->m['HardwareModel']->getFormValues('update','sanitizeHtml');  					$data['hiddenInput'] = "<input type='hidden' name='id_hard' value='".$clean['id_hard']."'>\n"; -					$data['tracksHelpLabel'] = $this->getEntryLabel('it_tracks_users'); +					$data['tracksHelpLabel'] = $this->getModule(array('devices',$this->controller,'form','it_tracks_users'));  					$this->append($data); @@ -326,19 +326,6 @@ class GenericController extends BaseController  		}  	} -// 	get the help label for the "it_tracks_users" entry -	protected function getEntryLabel($entryName) -	{ -		$tracksHelpLabel = null; -		$xml = $this->getBox(array('devices',$this->controller,'form',$entryName)); -		if ($xml) -		{ -			$box_news = new BoxParser($xml); -			$tracksHelpLabel = $box_news->render(); -		} -		return $tracksHelpLabel; -	} -  	//get the preview of the description entry  	protected function getPreview()  	{ @@ -549,7 +536,8 @@ class GenericController extends BaseController  				$data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id_hard']);  				$data['isApproved'] = strcmp($data['table'][0]['hardware']['approved'],'yes') === 0 ? true : false; -				$data['tracksHelpLabel'] = $this->getEntryLabel('it_tracks_users'); +				$data['tracksHelpTop'] = $this->getModule(array('devices',$this->controller,'page','it_tracks_users')); +				$data['tracksHelpLabel'] = $this->getModule(array('devices',$this->controller,'form','it_tracks_users'));  				$this->passWhoAskedForDeletion($clean['id_hard']);  			} diff --git a/h-source/Application/Controllers/HomeController.php b/h-source/Application/Controllers/HomeController.php index 96479f3..eecb53f 100644 --- a/h-source/Application/Controllers/HomeController.php +++ b/h-source/Application/Controllers/HomeController.php @@ -37,14 +37,8 @@ class HomeController extends BaseController  	public function index($lang = 'en')  	{  // 		get the news container -		$data['htmlNewsBox'] = null; -		$xml = $this->getBox(array('top_news')); -		if ($xml) -		{ -			$box_news = new BoxParser($xml); -			$data['htmlNewsBox'] = $box_news->render(); -		} -		 +		$data['htmlNewsBox'] = $this->getModule(array('top_news')); +  		$this->append($data);  		$this->cleverLoad('left');  		$this->right($lang); | 
