File "morganizers.php"

Full Path: /home/ichhrkpd/public_html/application/examples/scripts/morganizers.php
File size: 5.24 KB
MIME-type: text/x-php
Charset: utf-8

<?php 
			
/**
 * Version 1.0.0
 * Creation date: 02/Dec/2017
 * @Written By: S.M. Sarwar Hasan
 *     Genuity Systems
 */						
class Morganizers extends GSModel{	
	var $organizer_id;
	var $eid;
	var $organizer_name;
	var $organizer_email;
	var $password;
	var $status;


		function __construct() {
			parent::__construct ();
			$this->SetValidation();	
			$this->tableName="organizers";
			$this->primaryKey="organizer_id";
		}
			
	 function Reset(){
		$this->organizer_id=$this->eid=$this->organizer_name=$this->organizer_email=$this->password=null;
		$this->status=null;

	}



	function SetValidation(){
		$this->validations=array(
			"organizer_id"=>array("Text"=>"organizer_id", "Rule"=>"required|xss_clean"),
			"eid"=>array("Text"=>"eid", "Rule"=>"required|xss_clean"),
			"organizer_name"=>array("Text"=>"organizer_name", "Rule"=>"required|xss_clean"),
			"organizer_email"=>array("Text"=>"organizer_email", "Rule"=>"required|xss_clean"),
			"password"=>array("Text"=>"password", "Rule"=>"required|xss_clean"),
			"status"=>array("Text"=>"status", "Rule"=>"")
			
		);
	}
	
	public function authenticate($email="", $password=""){
		$this->organizer_email($email);
		if($this->Select()){
			if($this->password==md5($password) && $this->status=="A"){
				$this->SetMultipleSession();
				return true;
			}
		}
		//echo GSModel::GetTotalQueries();die;
		return false;
	}	
	
	
	function SetMultipleSession($data=null,$isLoggedIn=true){
		if(empty($data)){
			$data=$this;
		}
	
		$adses=new MultipleSession();
		$adses->organizer_id=$data->organizer_id;
		$adses->eid=$data->eid;
		$adses->organizer_name=$data->organizer_name;
		$adses->organizer_email=$data->organizer_email;
		$adses->creation_date=$data->creation_date;
		$adses->status=$data->status;
		$adses->LoggedIn=$isLoggedIn;
		$this->session->SetMultipleData($adses);
	
	}
	
	
	 function GetAddForm($label_col=5,$input_col=7,$mainobj=null){
		
				if(!$mainobj){
				$mainobj=$this;
				}
					?>
			 <div class="form-group">
		      	<label class="control-label col-md-<?php echo $label_col;?>" for="organizer_id"><?php _e("Organizer Id"); ?></label>
		      	<div class="col-md-<?php echo $input_col;?>">                   			     	
		      		<input type="text" maxlength="11"  value="<?php echo  $mainobj->GetPostValue("organizer_id");?>" class="form-control" id="organizer_id" name="organizer_id" placeholder="Organizer Id" data-bv-notempty="true" 	data-bv-notempty-message="<?php  _e("Organizer Id is required");?>">
		      	</div>
		      </div> 
			
			 <div class="form-group">
		      	<label class="control-label col-md-<?php echo $label_col;?>" for="eid"><?php _e("Eid"); ?></label>
		      	<div class="col-md-<?php echo $input_col;?>">                   			     	
		      		<input type="text" maxlength="11"  value="<?php echo  $mainobj->GetPostValue("eid");?>" class="form-control" id="eid" name="eid" placeholder="Eid" data-bv-notempty="true" 	data-bv-notempty-message="<?php  _e("Eid is required");?>">
		      	</div>
		      </div> 
			
			 <div class="form-group">
		      	<label class="control-label col-md-<?php echo $label_col;?>" for="organizer_name"><?php _e("Organizer Name"); ?></label>
		      	<div class="col-md-<?php echo $input_col;?>">                   			     	
		      		<input type="text" maxlength="100"  value="<?php echo  $mainobj->GetPostValue("organizer_name");?>" class="form-control" id="organizer_name" name="organizer_name" placeholder="Organizer Name" data-bv-notempty="true" 	data-bv-notempty-message="<?php  _e("Organizer Name is required");?>">
		      	</div>
		      </div> 
			
			 <div class="form-group">
		      	<label class="control-label col-md-<?php echo $label_col;?>" for="organizer_email"><?php _e("Organizer Email"); ?></label>
		      	<div class="col-md-<?php echo $input_col;?>">                   			     	
		      		<input type="text" maxlength="100"  value="<?php echo  $mainobj->GetPostValue("organizer_email");?>" class="form-control" id="organizer_email" name="organizer_email" placeholder="Organizer Email" data-bv-notempty="true" 	data-bv-notempty-message="<?php  _e("Organizer Email is required");?>">
		      	</div>
		      </div> 
			
			 <div class="form-group">
		      	<label class="control-label col-md-<?php echo $label_col;?>" for="password"><?php _e("Password"); ?></label>
		      	<div class="col-md-<?php echo $input_col;?>">                   			     	
		      		<input type="text" maxlength="32"  value="<?php echo  $mainobj->GetPostValue("password");?>" class="form-control" id="password" name="password" placeholder="Password" data-bv-notempty="true" 	data-bv-notempty-message="<?php  _e("Password is required");?>">
		      	</div>
		      </div> 
			
			 <div class="form-group">
		      	<label class="control-label col-md-<?php echo $label_col;?>" for="status"><?php _e("Status"); ?></label>
		      	<div class="col-md-<?php echo $input_col;?>">                   			     	
		      		<input type="text" maxlength="1"  value="<?php echo  $mainobj->GetPostValue("status");?>" class="form-control" id="status" name="status" placeholder="Status" data-bv-notempty="true" 	data-bv-notempty-message="<?php  _e("Status is required");?>">
		      	</div>
		      </div> 
			
			<?php 
	}



}
?>