Frameworks and libs

Frameworks and libs which can ease PFA apps development.

PFAf

TODO

GuiHelper class

<?php
 
 
/**********************************************************
*
*	 @author: Raul Tierno <raultmAT_NOSP_AMgmail.com>
*
*
***********************************************************/
 
 
 
class GUIHelper{
 
	private $_droid;
 
 
	//Constructor
 
	public function __construct($droid=NULL){
 
		if($droid != NULL){
			$this->_droid = $droid;
		}else{
			$this->_droid = new Android;
		}
    }
 
 
	/***************************************************************************************
	*
	*	createAlertYN
	*
	*	Create an Alert with (title, content) and Yes No Buttons, with optional Neutral Button
	*
	*	return Example
	*		array (
	*			 'id' => 4,
	*			 'result' =>
	*			 stdClass::__set_state(array(
	*			    'which' => 'positive',
	*			 )),
	*			 'error' => NULL,
	*		)
	*		
	*	Get the user selected option: $return['result']->which;
	*	Values [positive, negative, neutral]
	*
	****************************************************************************************/
 
	public function confirm($text ,$title = "Titulo", $yes = "Yes", $no = "No", $neutral = ""){
 
 
		$this->_droid->dialogCreateAlert($title,$text);
 
		$this->_droid->dialogSetPositiveButtonText($yes);
		$this->_droid->dialogSetNegativeButtonText($no);
 
		if($neutral != ""){
			$this->_droid->dialogSetNeutralButtonText($neutral);
		}
 
		$this->_droid->dialogShow();
 
		$result = $this->_droid->dialogGetResponse();
 
		return $result;
 
	}
 
	/**********************************************
	*
	*	select
	*
	*
	*	array (
	*		 'id' => 14,
	*		 'result' =>
	*		 stdClass::__set_state(array(
	*		    'item' => 3,
	*		 )),
	*		 'error' => NULL,
	*	)
	*
	*	Get the user selected option $return['result']->item (Index of the array)
	*	
	*
	***********************************************/
 
	public function select($array ,$title = "Titulo"){
 
 
		if(count($array) < 0){
			$this->_droid->makeToast("Empty Array");
			return -1;
		}
 
		$this->_droid->dialogCreateAlert($title);
		$this->_droid->dialogSetItems($array);
		$this->_droid->dialogShow();
 
		$result = $this->_droid->dialogGetResponse();
 
		return $result;
 
	}
 
}
 
 
 
 
 
?>



 
manual/en/libs.txt · Last modified: 2010/07/25 18:41 by raul   Back to top
Powered by DokuWiki RSS: cambios recientes Irontec