page_data=globalfunc::getMessage($parent,$parent->lang,'report'); if(count($parent->params)==0) { //$this->assessmentfunc($parent); }else { $qry_params=explode ("?",$parent->params[0]); $parameter_val=strtolower($qry_params[0]); switch($parameter_val){ case "registration": $this->$parameter_val($parent ); break; default: $this->assessmentfunc($parent); break; } } $parent->response(array('response'=>'failed', 'message' => 'PAGE NOT FOUND'), 404); } /* /////////////////////////////// REGISTRATION //////////////////////////////////////////////// */ private function registration($parent) { globalfunc::checkMethodType($parent,array('POST')); globalfunc::checkParamCount($parent,2); globalfunc::checkAuthrozation($parent,array('type'=>'user')); $qry_params=explode ("?",$parent->params[1]); $type=strtolower($qry_params[0]); $REQUEST_KEYS=array('from_date'=>'date|Y-m-d','to_date'=>'date|Y-m-d'); globalfunc::mandatoryKey($parent,$REQUEST_KEYS); $user_cond=""; switch($type) { case "zm": if($parent->current_user_role=='3') { $REQUEST_KEYS=array('zmemail'=>'string'); globalfunc::mandatoryKey($parent,$REQUEST_KEYS); $emailid = escape_str($parent->_request["zmemail"]); if($emailid!='all') { $user_cond.=" AND u.dealer_code IN (SELECT dealer_code FROM ".DMS_DEALER." WHERE zm_email='". $emailid."')"; }else { $user_cond.=""; } }else { $parent->response(array('response'=>'failed', 'message'=>'Sorry No access'), 401); } break; case "rm": if($parent->current_user_role<'7') { if($parent->current_user_role=='5') { $REQUEST_KEYS=array('rmemail'=>'string'); globalfunc::mandatoryKey($parent,$REQUEST_KEYS); $emailid = escape_str($parent->_request["rmemail"]); if($emailid=='all') { $get_trainer_str = "SELECT h.* FROM ".DMS_HOUSER." h JOIN ".TABLE_USER." u ON u.emp_code=h.emp_code WHERE u.userid='".$parent->current_user_id."' AND u.role='5' LIMIT 1"; $trainer_arr=$parent->getQueryValue($get_trainer_str); $zone_cond.=(count($trainer_arr)>0)?" zone='".$trainer_arr[0]->zone."'":" zone='0'"; $user_cond.=" AND u.dealer_code IN (SELECT dealer_code FROM ".DMS_DEALER." WHERE ".$zone_cond.")"; }else { $user_cond.=" AND u.dealer_code IN (SELECT dealer_code FROM ".DMS_DEALER." WHERE rm_email='".$emailid."')"; } }else { $REQUEST_KEYS=array('rmemail'=>'string'); globalfunc::mandatoryKey($parent,$REQUEST_KEYS); $emailid = escape_str($parent->_request["rmemail"]); if($emailid=='all') { $REQUEST_KEYS=array('zmemail'=>'string'); globalfunc::mandatoryKey($parent,$REQUEST_KEYS); $emailid = escape_str($parent->_request["zmemail"]); $user_cond.=" AND u.dealer_code IN (SELECT dealer_code FROM ".DMS_DEALER." WHERE zm_email='". $emailid."')"; }else { $user_cond.=" AND u.dealer_code IN (SELECT dealer_code FROM ".DMS_DEALER." WHERE rm_email='".$emailid."')"; } } }else { $parent->response(array('response'=>'failed', 'message'=>'Sorry No access'), 401); } break; case "am": if($parent->current_user_role=='14') { $dealer_code_cond=" dealer_code='".$parent->current_user_data->dealer_code."'"; }else { $REQUEST_KEYS=array('amemail'=>'string'); globalfunc::mandatoryKey($parent,$REQUEST_KEYS); $emailid = escape_str($parent->_request["amemail"]); if($emailid=='all') { $REQUEST_KEYS=array('rmemail'=>'string'); globalfunc::mandatoryKey($parent,$REQUEST_KEYS); $emailid = escape_str($parent->_request["rmemail"]); $dealer_code_cond=" rm_email='".$emailid."'"; }else { $dealer_code_cond=" am_email='".$emailid."'"; } } $user_cond.=" AND u.dealer_code IN (SELECT dealer_code FROM ".DMS_DEALER." WHERE ".$dealer_code_cond.")"; break; default: $parent->response(array('response'=>'failed', 'message'=>'Sorry No access'), 401); break; } $data_arr=array('label'=>range('A', 'Z'),'label_arr'=>range(100,126)); $parent->response(array('response'=>'success','data'=>$data_arr, 'message'=>$this->page_data['success1'] ),200); } /* //////////////////////////////////////////////////////////////////////////////////////////// */ } ?>