Next4Me
 All Classes Files Functions Variables
IndexController.php
1 <?php
2 
3 class IndexController extends Zend_Controller_Action
4 {
5 
6  public function init()
7  {
8  Zend_Registry::set('language', 'RO');
9  $this->db = $this->getInvokeArg("bootstrap")->getResource("db");
10  $this->Log = new Application_Model_Log();
11  $this->EntityType = new Application_Model_EntityType;
12  $this->Region = new Application_Model_Region;
13  $this->UserAccount = new Application_Model_UserAccount;
14  $this->Contact = new Application_Model_Contact;
15  $this->Address = new Application_Model_Address;
16  $this->Email = new Application_Model_Email;
17  $this->Phone = new Application_Model_Phone;
18  $this->Session = new Application_Model_Session;
19  $this->AssetProperty = new Application_Model_AssetProperty;
20  $this->Asset = new Application_Model_Asset;
21  $this->ContextCondition = new Application_Model_ContextCondition;
22  $this->ContextFactor = new Application_Model_ContextFactor;
23  $this->Context = new Application_Model_Context;
24  $this->MicroflowActionAlert = new Application_Model_MicroflowActionAlert;
25  $this->MicroflowActionProperty = new Application_Model_MicroflowActionProperty;
26  $this->MicroflowActionResult = new Application_Model_MicroflowActionResult;
27  $this->MicroflowAction = new Application_Model_MicroflowAction;
28  $this->MicroflowNextAction = new Application_Model_MicroflowNextAction;
29  $this->Microflow = new Application_Model_Microflow;
30  $this->TplActionTypeAlert = new Application_Model_TplActionTypeAlert;
31  $this->TplActionTypeNextAction = new Application_Model_TplActionTypeNextAction;
32  $this->TplActionTypeProperty = new Application_Model_TplActionTypeProperty;
33  $this->TplActionTypeResult = new Application_Model_TplActionTypeResult;
34  $this->TplActionType = new Application_Model_TplActionType;
35  $this->TplAssetPropertyMicroflow = new Application_Model_TplAssetPropertyMicroflow;
36  $this->TplAssetProperty = new Application_Model_TplAssetProperty;
37  $this->TplAsset = new Application_Model_TplAsset;
38  $this->TplContextCondition = new Application_Model_TplContextCondition;
39  $this->TplContextFactor = new Application_Model_TplContextFactor;
40  $this->TplContext = new Application_Model_TplContext;
41  $this->TplMicroflowActionResult = new Application_Model_TplMicroflowActionResult;
42  $this->TplMicroflowAction = new Application_Model_TplMicroflowAction;
43  $this->TplMicroflowNextAction = new Application_Model_TplMicroflowNextAction;
44  $this->TplMicroflow = new Application_Model_TplMicroflow;
45  $this->Paging = new Application_Model_Paging;
46  $this->CmplxAssetAndProperty = new Application_Model_CmplxAssetAndProperty;
47  $this->CmplxMicroflowAndDetail = new Application_Model_CmplxMicroflowAndDetail;
48  $this->CmplxContextAndDetail = new Application_Model_CmplxContextAndDetail;
49  $this->CmplxUserAccountAndDetail = new Application_Model_CmplxUserAccountAndDetail;
50  $this->CmplxContactAndDetail = new Application_Model_CmplxContactAndDetail;
51  $this->ChannelType = new Application_Model_ChannelType;
52  $this->Channel = new Application_Model_Channel;
53  $this->SendMail = new Application_Model_SendMail;
54  $this->CmplxTemplate = new Application_Model_CmplxTemplate;
55  $this->CmplxChannelAndDetail = new Application_Model_CmplxChannelAndDetail;
56  $this->Trigger = new Application_Model_Trigger;
57  $this->ControlSessionHistory = new Application_Model_ControlSessionHistory;
58  $this->Cron = new Application_Model_Cron;
59  $this->Language = new Application_Model_Language;
60 
61  $this->ErrorCode = new Application_Model_ErrorCode();
62 
63  }
64 
65  public function indexAction()
66  {
67  //echo "mama";
68  $resultId = 0;
69  $exception = 0;
70  if(($resultId == 0) && (!isset($_POST['content'])))
71  {
72  //echo "sunt pe chk content-><pre>"; print_r($_POST); echo "</pre>";
73  $this->Log->save('IndexControler.php','init','','Invalid data..','3');
74  $this->SendResponse(array("resultId"=>"1","resultCode"=>"Invalid content data."));
75  $resultId = 1;
76  }
77 
78  if(($resultId == 0) && (empty($_POST['content'])))
79  {
80  $this->Log->save('IndexControler.php','init','','Invalid data..','3');
81  $this->SendResponse(array("resultId"=>"1","resultCode"=>"Invalid hash data."));
82  $resultId = 1;
83  }
84 
85  if(($resultId == 0) && (empty($_POST['hash'])))
86  {
87  $this->Log->save('IndexControler.php','init','','Invalid data..','3');
88  $this->SendResponse(array("resultId"=>"1","resultCode"=>"Invalid hash data."));
89  $resultId = 1;
90  }
91 // echo stripcslashes($_POST['content'])."->".md5(stripcslashes($_POST['content']))."->".$_POST['hash'];
92  if(($resultId == 0) && (md5(stripcslashes($_POST['content'])) != $_POST['hash']))
93  {
94  $this->Log->save('IndexControler.php','init','','Invalid data..','3');
95  $this->SendResponse(array("resultId"=>"1","resultCode"=>"Invalid data of hash for content."));
96  $resultId = 1;
97  }
98  if($resultId == 0){
99  $this->data = Zend_Json::decode(stripcslashes($_POST['content']));
100  $this->action = $_POST['action'];
101  $this->token = $_POST['token'];
102  //echo $this->data."<br>";
103  //echo $this->action."<br>";
104  //echo $this->token."<br>";
105  }
106  if($resultId == 0){
107  switch($this->action){
108  case 'login':
109  $this->login();
110  $exception = 1;
111  break;
112  case 'newUserAccount':
113  $this->NewUserAccount();
114  $exception = 1;
115  break;
116  case 'Activate':
117  $this->AccountActivation();
118  $exception = 1;
119  break;
120  case "checkEmail":
121  //echo "hahahahhaha";
122  $this->checkEmail();
123  $exception = 1;
124  break;
125  case 'checkUserName':
126  $this->checkUserName();
127  $exception = 1;
128  break;
129  }
130  if(($resultId == 0) && ($exception == 0) && (empty($this->token)) )
131  {
132  $this->Log->save('IndexControler.php','indexAction','','Invalid data (missing token).','3');
133  $this->SendResponse(array("resultId"=>"1","resultCode"=>"Invalid data (missing token)."));
134  $resultId = 1;
135  }
136 
137  if(($resultId == 0) && ($exception == 0))
138  {
139  $session=$this->Session->checkSession($this->token);
140  if($session['IdUserAccount']<0){
141  $this->Log->save('IndexControler.php','indexAction','',$session['mesaj'],'3');
142  $this->SendResponse(array("resultId"=>"1","resultCode"=>$session['mesaj']));
143  $resultId = 1;
144  }
145  }
146  if(($resultId == 0) && ($exception == 0)){
147  switch($this->action){
148  case 'Cron':
149  $this->cron();
150  break;
151  case 'Atemporal':
152  $this->atemporal($this->data, $this->token);
153  break;
154  case 'Activate':
155  $this->AccountActivation($this->data);
156  break;
157  case 'trigger':
158  $this->trigger();
159  break;
160  case 'newUserAccount':
161  $this->newUserAccount();
162  break;
163  case 'login':
164  $this->login();
165  break;
166  case 'logout':
167  $this->logout();
168  break;
169  case 'EntityType':
170  $this->EntityType();
171  break;
172  case 'Region':
173  $this->Region();
174  break;
175  case 'UserAccount':
176  $this->UserAccount();
177  break;
178  case 'Contact':
179  $this->Contact();
180  break;
181  case 'Email':
182  $this->Email();
183  break;
184  case 'Phone':
185  $this->Phone();
186  break;
187  case 'Address':
188  $this->Address();
189  break;
190  case 'AssetProperty':
191  $this->AssetProperty();
192  break;
193  case 'Asset':
194  $this->Asset();
195  break;
196  case 'ContextCondition':
197  $this->ContextCondition();
198  break;
199  case 'ContextFactor':
200  $this->ContextFactor();
201  break;
202  case 'Context':
203  $this->Context();
204  break;
205  case 'MicroflowActionAlert':
206  $this->MicroflowActionAlert();
207  break;
208  case 'MicroflowActionProperty':
209  $this->MicroflowActionProperty();
210  break;
211  case 'MicroflowActionResult':
212  $this->MicroflowActionResult();
213  break;
214  case 'MicroflowAction':
215  $this->MicroflowAction();
216  break;
217  case 'MicroflowNextAction':
218  $this->MicroflowNextAction();
219  break;
220  case 'Microflow':
221  $this->Microflow();
222  break;
223  case 'TplActionTypeAlert':
224  $this->TplActionTypeAlert();
225  break;
226  case 'TplActionType':
227  $this->TplActionType();
228  break;
229  case 'TplActionTypeNextAction':
230  $this->TplActionTypeNextAction();
231  break;
232  case 'TplActionTypeProperty':
233  $this->TplActionTypeProperty();
234  break;
235  case 'TplActionTypeResult':
236  $this->TplActionTypeResult();
237  break;
238  case 'TplAsset':
239  $this->TplAsset();
240  break;
241  case 'TplAssetPropertyMicroflow':
242  $this->TplAssetPropertyMicroflow();
243  break;
244  case 'TplAssetProperty':
245  $this->TplAssetProperty();
246  break;
247  case 'TplContextCondition':
248  $this->TplContextCondition();
249  break;
250  case 'TplContextFactor':
251  $this->TplContextFactor();
252  break;
253  case 'TplContext':
254  $this->TplContext();
255  break;
256  case 'TplMicroflowActionResult':
257  $this->TplMicroflowActionResult();
258  break;
259  case 'TplMicroflowAction':
260  $this->TplMicroflowAction();
261  break;
262  case 'TplMicroflowNextAction':
263  $this->TplMicroflowNextAction();
264  break;
265  case 'TplMicroflow':
266  $this->TplMicroflow();
267  break;
268  case 'CmplxAssetAndProperty':
269  $this->CmplxAssetAndProperty();
270  break;
271  case 'CmplxMicroflowAndDetail':
272  $this->CmplxMicroflowAndDetail();
273  break;
274  case 'CmplxContextAndDetail':
275  $this->CmplxContextAndDetail();
276  break;
277  case 'CmplxUserAccountAndDetail':
278  $this->CmplxUserAccountAndDetail();
279  break;
280  case 'CmplxContactAndDetail':
281  $this->CmplxContactAndDetail();
282  break;
283  case 'ChannelType':
284  $this->ChannelType();
285  break;
286  case 'Channel':
287  $this->Channel();
288  break;
289  case 'CmplxTemplate':
290  $this->CmplxTemplate();
291  break;
292  case 'CmplxChannelAndDetail':
293  $this->CmplxChannelAndDetail();
294  break;
295  case 'Language':
296  $this->Language();
297  break;
298  default:
299  $this->NoAction();
300  }
301  }
302 
303  }
304  }
305 
306  //==== Start NoAction =================================================================
307  private function NoAction(){
308  $resultId = 0;
309  $page="IndexController.php";
310  $method="NoAction";
311  $result="";
312  $message="";
313  $type="1";
314  $resultId = 3124;
315  $r=$this->ErrorCode->getErrorCode($resultId,Zend_Registry::get('language'));
316  $resultCode=$r['Message'];
317  $message=$r['Message'];
318  $type=3;
319  $this->Log->save($page,$method,$result,$resultId.'=>'.json_encode($resultCode),$type);
320  $this->SendResponse(array("resultId"=>$resultId,"resultCode"=>$resultCode));
321  }
322 
323  //==== End NoAction ===================================================================
324  //==== Start Cron =====================================================================
325  private function cron($IdControlSession,$IdUserAccount,$Lat,$Long,$Device,$Activity,$Speed,$UserAccountType)
326  {
327  $this->Cron->action($IdControlSession,$IdUserAccount,$Lat,$Long,$Device,$Activity,$Speed,$UserAccountType);
328  }
329  //==== End Cron =======================================================================
330  //==== Start trigger ===================================================================
331  private function trigger(){
332  $method=$this->data['method'];
333  $entity=$this->data['entity'];
334  switch($method){
335  case 'speed':
336  $_trigger=$this->Trigger->speed($entity);
337  break;
338  case 'geofence':
339  $_trigger=$this->Trigger->geofence($entity);
340  break;
341  case 'timeStamp':
342  $_trigger=$this->Trigger->timeStamp($entity);
343  break;
344  case 'timeRepeating':
345  $_trigger=$this->Trigger->timeRepeating($entity);
346  break;
347  case 'device':
348  $_trigger=$this->Trigger->device($entity);
349  break;
350  case 'activity':
351  $_trigger=$this->Trigger->activity($entity);
352  break;
353  default:
354  $_trigger=$this->methodError(6037, $method);
355  }
356  }
357  //==== End trigger =====================================================================
358 
359  //==== Start login =========================================================================
368  private function login() {
369 
370  $UserAccount = new Application_Model_UserAccount();
371  $_user = $UserAccount->doLogin($this->data['username'],$this->data['password'],$this->data['chanel']);
372  $a=$_user['resultCode'];
373  //print_r($a);
374  if($a['IdUserAccount'] >0 ) {
375  //insert ControlSessions
376  $this->Session->doInsert($a['IdUserAccount'],$a['token'],$this->data['chanel']);
377  }
378 
379  $this->SendResponse($_user);
380 
381  }
382  //============ End login ==============================================================
383 
384  //==== Start Atemporal ================================================================
395  private function atemporal($content, $token)
396  {
397  $content['Token']=$token;
398  $result=$this->Session->updateAtemporal($content);
399 
400  $this->SendResponse($result);
401  }
402  //==== End Atemporal ==================================================================
403  //==== Start logout =========================================================================
410  private function logout(){
411 
412  //admin only
413  $_user = $this->Session->deleteSession($this->data);
414 
415 
416  $this->SendResponse($_user);
417 
418  }
419  //============ End logout ==============================================================
420  function methodError($resultId, $method){
421  $r=$this->ErrorCode->getErrorCode($resultId,Zend_Registry::get('language'));
422  $resultCode=$r['Message'];
423  $message=$r['Message'];
424  $type=3;
425  $this->Log->save($r['File'],$r['Method'],$method,$resultId.'=>'.json_encode($resultCode),$type);
426  return array("resultId"=>$resultId,"resultCode"=>$resultCode);
427  }
428 
429 
430  //============ Start AccountActivation =================================================
431  private function AccountActivation(){
432  if(isset($this->data['method'])){
433  if(isset($this->data['entity'])){
434  $method=$this->data['method'];
435  $entity=$this->data['entity'];
436  //$entity['key']=$key;
437  $entity['ip']=$this->getRequest()->getClientIp();
438  $_userAccount=$this->UserAccount->activateUserAccount($entity);
439  $this->SendResponse($_userAccount);
440 
441  }
442  }
443  }
444 
445  //============ End AccountActivation ===================================================
446  //============ Start checkUserName =====================================================
447  private function checkUserName()
448  {//echo "mmm";
449  $entity=$this->data['entity'];
450  $response=$this->UserAccount->checkUserName($entity);
451  $this->SendResponse($response);
452  }
453  //============ End checkUserName ======================================================
454  //============ Start checkEmail ========================================================
455  private function checkEmail()
456  {//echo "mmm2";
457  $entity=$this->data['entity'];
458  $response=$this->UserAccount->checkEmail($entity);
459  $this->SendResponse($response);
460  }
461  //============ End checkEmail ==========================================================
462  //============ Start NewUserAccount ====================================================
463  private function NewUserAccount(){
464  if(isset($this->data['method'])){
465  if(isset($this->data['entity'])){
466  $method=$this->data['method'];
467  $entity=$this->data['entity'];
468  $entity['IpAddress']=$this->getRequest()->getClientIp();
469  $this->db->beginTransaction();
470  try
471  {
472  $_userAccount=$this->UserAccount->newUserAccount($entity);
473  $commit=(int)$_userAccount['resultId'];
474  if($commit==0){
475  $this->db->commit();
476  }else{
477  $this->db->rollBack();
478  }
479 
480  }
481  catch(Exception $e)
482  {
483  $this->db->rollBack();
484 
485  $message = $e->getMessage();
486  $code = $e->getCode();
487  $_userAccount =array("resultId"=>"1","resultCode"=>$message."(".$code.")");
488  }
489  }
490  }
491  $this->SendResponse($_userAccount);
492  }
493  //============ End NewUserAccount ======================================================
494 
495 
496  //============ Start CmplxUserAccountAndDetail =======================================================
497 
498  private function CmplxUserAccountAndDetail(){
499  $session=$this->Session->checkSession($this->token);
500  if($session['IdUserAccount']<0) {
501  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
502  echo Zend_Json::encode($response);
503  exit;
504  }
505  if(isset($this->data['method'])){
506  if(isset($this->data['entity'])){
507  $method=$this->data['method'];
508  $entity=$this->data['entity'];
509  if($session['UserAccountType'] != "0"){
510  $entity['IdUserAccount']=$session['IdUserAccount'];
511  $entity['UserAccountType']=$session['UserAccountType'];
512  }
513  $this->db->beginTransaction();
514  try
515  {
516  switch($method){
517  case 'getUserAccountAndDetail':
518  $_userAccount=$this->CmplxUserAccountAndDetail->getUserAccountAndDetail($entity);
519  break;
520  case 'deleteUserAccountAndDetail':
521  $_userAccount=$this->CmplxUserAccountAndDetail->deleteUserAccountAndDetail($entity);
522  break;
523  case 'addEditUserAccountAndDetail':
524  $_userAccount=$this->CmplxUserAccountAndDetail->addEditUserAccountAndDetail($entity);
525  break;
526  default:
527  $_userAccount=$this->methodError(6037, $method);
528  }
529  $commit=(int)$_userAccount['commit'];
530  if($commit==1){
531  $this->db->commit();
532  }else{
533  $this->db->rollBack();
534  }
535  //$_CmplxAsset=$_result['entity'];
536  $_CmplxUserAccount=$_userAccount['entity'];
537 
538  }
539  catch(Exception $e)
540  {
541  $this->db->rollBack();
542 
543  $message = $e->getMessage();
544  $code = $e->getCode();
545  $_CmplxUserAccount =array("resultId"=>"1","resultCode"=>$message."(".$code.")");
546  }
547 
548  }
549  }
550  $this->Session->updateSession($session['Token']);
551  $this->SendResponse($_CmplxUserAccount);
552 
553 
554 
555 
556  }
557 
558  //============ End CmplxUserAccountAndDetail =========================================================
559 
560  //============ Start CmplxTemplate =======================================================
561 
562  private function CmplxTemplate(){
563  $session=$this->Session->checkSession($this->token);
564  if($session['IdUserAccount']<0) {
565  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
566  echo Zend_Json::encode($response);
567  exit;
568  }
569  if(isset($this->data['method'])){
570  if(isset($this->data['entity'])){
571  $method=$this->data['method'];
572  $entity=$this->data['entity'];
573  $entity['IdUserAccount']=$session['IdUserAccount'];
574  $entity['UserAccountType']=$session['UserAccountType'];
575  $this->db->beginTransaction();
576  try
577  {
578  switch($method){
579  case 'getTplContext':
580  $_template=$this->CmplxTemplate->getTplContext($entity);
581  break;
582  case 'getTplActionType':
583  $_template=$this->CmplxTemplate->getTplActionType($entity);
584  break;
585  case 'getTplAsset':
586  $_template=$this->CmplxTemplate->getTplAsset($entity);
587  break;
588  case 'getTplMicroflow':
589  $_template=$this->CmplxTemplate->getTplMicroflow($entity);
590  break;
591  default:
592  $_template=$this->methodError(6037, $method);
593  }
594  $commit=(int)$_template['commit'];
595  if($commit==1){
596  $this->db->commit();
597  }else{
598  $this->db->rollBack();
599  }
600  //$_CmplxAsset=$_result['entity'];
601  $_CmplxTemplate=$_template['entity'];
602 
603  }
604  catch(Exception $e)
605  {
606  $this->db->rollBack();
607 
608  $message = $e->getMessage();
609  $code = $e->getCode();
610  $_CmplxTemplate =array("resultId"=>"1","resultCode"=>$message."(".$code.")");
611  }
612 
613  }
614  }
615  $this->Session->updateSession($session['Token']);
616  $this->SendResponse($_CmplxTemplate);
617 
618 
619 
620 
621  }
622 
623  //============ End CmplxTemplate =========================================================
624 
625 
626  //============ Start CmplxContactAndDetail =======================================================
627 
628  private function CmplxContactAndDetail(){
629  $session=$this->Session->checkSession($this->token);
630  if($session['IdUserAccount']<0) {
631  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
632  echo Zend_Json::encode($response);
633  exit;
634  }
635  if(isset($this->data['method'])){
636  if(isset($this->data['entity'])){
637  $method=$this->data['method'];
638  $entity=$this->data['entity'];
639  $entity['IdUserAccount']=$session['IdUserAccount'];
640  $entity['UserAccountType']=$session['UserAccountType'];
641  $this->db->beginTransaction();
642  try
643  {
644  switch($method){
645  case 'getContactAndDetail':
646  $_contactAndDetail=$this->CmplxContactAndDetail->getContactAndDetail($entity);
647  break;
648  default:
649  $_contactAndDetail=$this->methodError(6037, $method);
650  }
651  $commit=(int)$_contactAndDetail['commit'];
652  if($commit==1){
653  $this->db->commit();
654  }else{
655  $this->db->rollBack();
656  }
657  //$_CmplxAsset=$_result['entity'];
658  $_CmplxContactAndDetail=$_contactAndDetail['entity'];
659 
660  }
661  catch(Exception $e)
662  {
663  $this->db->rollBack();
664 
665  $message = $e->getMessage();
666  $code = $e->getCode();
667  $_CmplxContactAndDetail =array("resultId"=>"1","resultCode"=>$message."(".$code.")");
668  }
669 
670  }
671  }
672  $this->Session->updateSession($session['Token']);
673  $this->SendResponse($_CmplxContactAndDetail);
674 
675 
676 
677 
678  }
679 
680  //============ End CmplxContactAndDetail =========================================================
681 
682 
683  //============ Start Contact =======================================================
684 
685  private function Contact(){
686  $session=$this->Session->checkSession($this->token);
687  if($session['IdUserAccount']<0) {
688  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
689  echo Zend_Json::encode($response);
690  exit;
691  }
692  if(isset($this->data['method'])){
693  if(isset($this->data['entity'])){
694  $method=$this->data['method'];
695  $entity=$this->data['entity'];
696  $entity['IdUserAccount']=$session['IdUserAccount'];
697  $entity['UserAccountType']=$session['UserAccountType'];
698  //echo "<pre>"; print_r($entity); echo "</pre>";
699  switch($method){
700  case 'getContact':
701  $_contact=$this->Contact->getContact($entity);
702  break;
703  case 'deleteContact':
704  $_contact=$this->Contact->deleteContact($entity);
705  break;
706  case 'addEditContact':
707  $_contact=$this->Contact->addEditContact($entity);
708  break;
709  default:
710  $_contact=$this->methodError(6003, $method);
711  }
712  }
713  }
714  $this->Session->updateSession($session['Token']);
715  $this->SendResponse($_contact);
716  }
717 
718  //============ End Contact =========================================================
719 
720  //============ Start Phone =======================================================
721 
722  private function Phone(){
723  $session=$this->Session->checkSession($this->token);
724  if($session['IdUserAccount']<0) {
725  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
726  $this->SendResponse($response);
727  exit;
728  }
729  if(isset($this->data['method'])){
730  if(isset($this->data['entity'])){
731  $method=$this->data['method'];
732  $entity=$this->data['entity'];
733  $entity['IdUserAccount']=$session['IdUserAccount'];
734  $entity['UserAccountType']=$session['UserAccountType'];
735 
736  switch($method){
737  case 'getPhone':
738  $_phone=$this->Phone->getPhone($entity);
739  break;
740  case 'deletePhone':
741  $_phone=$this->Phone->deletePhone($entity);
742  break;
743  case 'addEditPhone':
744  $_phone=$this->Phone->addEditPhone($entity);
745  break;
746  default:
747  $_phone=$this->methodError(6004, $method);
748  }
749 
750  }
751  }
752  $this->Session->updateSession($session['Token']);
753  $this->SendResponse($_phone);
754  }
755 
756  //============ End Phone =========================================================
757 
758  //============ Start Email =======================================================
759 
760  private function Email(){
761  $session=$this->Session->checkSession($this->token);
762  if($session['IdUserAccount']<0) {
763  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
764  $this->SendResponse($response);
765  exit;
766  }
767  if(isset($this->data['method'])){
768  if(isset($this->data['entity'])){
769  $method=$this->data['method'];
770  $entity=$this->data['entity'];
771  $entity['IdUserAccount']=$session['IdUserAccount'];
772  $entity['UserAccountType']=$session['UserAccountType'];
773 
774  switch($method){
775  case 'getEmail':
776  $_email=$this->Email->getEmail($entity);
777  break;
778  case 'deleteEmail':
779  $_email=$this->Email->deleteEmail($entity);
780  break;
781  case 'addEditEmail':
782  $_email=$this->Email->addEditEmail($entity);
783  break;
784  default:
785  $_email=$this->methodError(6005, $method);
786  }
787  }
788  }
789  $this->Session->updateSession($session['Token']);
790  $this->SendResponse($_email);
791  }
792 
793  //============ End Email =========================================================
794 
795  //============ Start Address =======================================================
796 
797  private function Address(){
798  $session=$this->Session->checkSession($this->token);
799  if($session['IdUserAccount']<0) {
800  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
801  $this->SendResponse($response);
802  exit;
803  }
804  if(isset($this->data['method'])){
805  if(isset($this->data['entity'])){
806  $method=$this->data['method'];
807  $entity=$this->data['entity'];
808  $entity['IdUserAccount']=$session['IdUserAccount'];
809  $entity['UserAccountType']=$session['UserAccountType'];
810 
811  switch($method){
812  case 'getAddress':
813  $_address=$this->Address->getAddress($entity);
814  break;
815  case 'deleteAddress':
816  $_address=$this->Address->deleteAddress($entity);
817  break;
818  case 'addEditAddress':
819  $_address=$this->Address->addEditAddress($entity);
820  break;
821  default:
822  $_address=$this->methodError(6001, $method);
823  }
824  }
825  }
826  $this->Session->updateSession($session['Token']);
827  $this->SendResponse($_address);
828  }
829 
830  //============ End Address =========================================================
831 
832 
833  //============ Start EntityType ==============================================================
841  private function EntityType(){
842  $session=$this->Session->checkSession($this->token);
843  if($session['IdUserAccount']<0){
844  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
845  $this->SendResponse($response);
846  exit;
847  }
848  if(isset($this->data['method'])){
849  if(isset($this->data['entity'])){
850  $method=$this->data['method'];
851  $entity=$this->data['entity'];
852  $entity['IdUserAccount']=$session['IdUserAccount'];
853  $entity['UserAccountType']=$session['UserAccountType'];
854 
855  switch($method){
856  case 'getEntityTypeById':
857  $_entity=$this->EntityType->getEntityTypeById($entity);
858  break;
859  case 'getEntityTypeByType':
860  $_entity=$this->EntityType->getEntityTypeByType($entity);
861  break;
862  case 'getEntityTypeByIdParent':
863  $_entity=$this->EntityType->getEntityTypeByIdParent($entity);
864  break;
865  case 'getEntityTypeByParentType':
866  $_entity=$this->EntityType->getEntityTypeByParentType($entity);
867  break;
868  case 'getEntityTypeTree':
869  $_entity=$this->EntityType->getEntityTypeTree((int)$entity['IdParent'],array(),array());
870  //echo "<pre>"; print_r($_entity); echo "</pre>";
871  break;
872  case 'addEditEntityType':
873  if($session['UserAccountType']=="0"){
874  $_entity=$this->EntityType->addEditEntityType($entity);
875  }else{
876  $_entity=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
877  }
878  break;
879  case 'deleteEntityType':
880  if($session['UserAccountType']=="0"){
881  $_entity=$this->EntityType->deleteEntityType($entity);
882  }else{
883  $_entity=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
884  }
885  break;
886  default:
887  $_entity=$this->methodError(6006, $method);
888  }
889 
890  }
891 
892  }
893 
894  //print_r($_entity);
895  $this->Session->updateSession($session['Token']);
896  $this->SendResponse($_entity);
897 
898  }
899 
900  //============ End EntityType ==============================================================
901 
902  //============ Start Region ==============================================================
910  private function Region(){
911  $session=$this->Session->checkSession($this->token);
912  if($session['IdUserAccount']<0) {
913  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
914  $this->SendResponse($response);
915  exit;
916  }
917  if(isset($this->data['method'])){
918  if(isset($this->data['entity'])){
919  $method=$this->data['method'];
920  $entity=$this->data['entity'];
921  $entity['IdUserAccount']=$session['IdUserAccount'];
922  $entity['UserAccountType']=$session['UserAccountType'];
923 
924  switch($method){
925  case 'getRegionById':
926  $_region=$this->region->getRegionById($entity);
927  break;
928  case 'getRegionByType':
929  $_region=$this->region->getRegionByType($entity);
930  break;
931  case 'getRegionByParent':
932  $_region=$this->region->getRegionByParent($entity);
933  break;
934  case 'getRegionRecursiveByParentId':
935  $_region=$this->region->getRegionRecursiveByParentId((int)$entity['IdParent'],array(),array());
936  break;
937  case 'addEditRegion':
938  if($session['UserAccountType']=="0"){
939  $_region=$this->region->addEditRegion($entity);
940  }else{
941  $_region=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
942  }
943  break;
944  case 'deleteRegion':
945  if($session['UserAccountType']=="0"){
946  $_region=$this->region->deleteRegion($entity);
947  }else{
948  $_region=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
949  }
950  break;
951  default:
952  $_region=$this->methodError(6007, $method);
953  }
954  }
955  }
956  $this->Session->updateSession($session['Token']);
957  $this->SendResponse($_region);
958  }
959  //============ End Region ==============================================================
960 
961 
962  //============ Start AssetProperty ==============================================================
970  private function AssetProperty(){
971  $session=$this->Session->checkSession($this->token);
972  if($session['IdUserAccount']<0) {
973  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
974  $this->SendResponse($response);
975  exit;
976  }
977  if(isset($this->data['method'])){
978  if(isset($this->data['entity'])){
979  $method=$this->data['method'];
980  $entity=$this->data['entity'];
981  $entity['IdUserAccount']=$session['IdUserAccount'];
982  $entity['UserAccountType']=$session['UserAccountType'];
983 
984  switch($method){
985  case 'addEditAssetProperty':
986  $_assetProperty=$this->AssetProperty->addEditAssetProperty($entity);
987  break;
988  case 'deleteAssetProperty':
989  $_assetProperty=$this->AssetProperty->deleteAssetProperty($entity);
990  break;
991  case 'getAssetProperty':
992  $_assetProperty=$this->AssetProperty->getAssetProperty($entity);
993  break;
994  default:
995  $_assetProperty=$this->methodError(6008, $method);
996  }
997  }
998  }
999  $this->Session->updateSession($session['Token']);
1000  $this->SendResponse($_assetProperty);
1001  }
1002  //============ End AssetProperty ==============================================================
1003  //
1004  //============ Start Asset ==============================================================
1012  private function Asset(){
1013  $session=$this->Session->checkSession($this->token);
1014  if($session['IdUserAccount']<0){
1015  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1016  $this->SendResponse($response);
1017  exit;
1018  }
1019  if(isset($this->data['method'])){
1020  if(isset($this->data['entity'])){
1021  $method=$this->data['method'];
1022  $entity=$this->data['entity'];
1023  $entity['IdUserAccount']=$session['IdUserAccount'];
1024  $entity['UserAccountType']=$session['UserAccountType'];
1025 
1026  switch($method){
1027  case 'addEditAsset':
1028  $_asset=$this->Asset->addEditAsset($entity);
1029  break;
1030  case 'deleteAsset':
1031  $_asset=$this->Asset->deleteAsset($entity);
1032  break;
1033  case 'getAsset':
1034  $_asset=$this->Asset->getAsset($entity);
1035  break;
1036  case 'getAssetCount':
1037  $_asset=$this->Asset->getAssetCount($entity);
1038  break;
1039  default:
1040  $_asset=$this->methodError(6009, $method);
1041  }
1042  }
1043  }
1044  $this->Session->updateSession($session['Token']);
1045  $this->SendResponse($_asset);
1046  }
1047  //============ End Asset ==============================================================
1048  //
1049  //============ Start ContextCondition ==============================================================
1057  private function ContextCondition(){
1058  $session=$this->Session->checkSession($this->token);
1059  if($session['IdUserAccount']<0) {
1060  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1061  $this->SendResponse($response);
1062  exit;
1063  }
1064  if(isset($this->data['method'])){
1065  if(isset($this->data['entity'])){
1066  $method=$this->data['method'];
1067  $entity=$this->data['entity'];
1068  $entity['IdUserAccount']=$session['IdUserAccount'];
1069  $entity['UserAccountType']=$session['UserAccountType'];
1070 
1071  switch($method){
1072  case 'addEditContextCondition':
1073  $_contextCondition=$this->ContextCondition->addEditContextCondition($entity);
1074  break;
1075  case 'deleteContextCondition':
1076  $_contextCondition=$this->ContextCondition->deleteContextCondition($entity);
1077  break;
1078  case 'getContextCondition':
1079  $_contextCondition=$this->ContextCondition->GetContextCondition($entity);
1080  break;
1081  default:
1082  $_contextCondition=$this->methodError(6010, $method);
1083  }
1084  }
1085  }
1086  $this->Session->updateSession($session['Token']);
1087  $this->SendResponse($_contextCondition);
1088  }
1089  //============ End ContextCondition ==============================================================
1090  //
1091  //============ Start ContextFactor ==============================================================
1099  private function ContextFactor(){
1100  $session=$this->Session->checkSession($this->token);
1101  if($session['IdUserAccount']<0){
1102  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1103  $this->SendResponse($response);
1104  exit;
1105  }
1106  if(isset($this->data['method'])){
1107  if(isset($this->data['entity'])){
1108  $method=$this->data['method'];
1109  $entity=$this->data['entity'];
1110  $entity['IdUserAccount']=$session['IdUserAccount'];
1111  $entity['UserAccountType']=$session['UserAccountType'];
1112 
1113  switch($method){
1114  case 'addEditContextFactor':
1115  $_contextFactor=$this->ContextFactor->addEditContextFactor($entity);
1116  break;
1117  case 'deleteContextFactor':
1118  $_contextFactor=$this->ContextFactor->deleteContextFactor($entity);
1119  break;
1120  case 'getContextFactor':
1121  $_contextFactor=$this->ContextFactor->getContextFactor($entity);
1122  break;
1123  default:
1124  $_contextFactor=$this->methodError(6011, $method);
1125  }
1126  }
1127  }
1128  $this->Session->updateSession($session['Token']);
1129  $this->SendResponse($_contextFactor);
1130  }
1131  //============ End ContextFactor ==============================================================
1132  //
1133  //============ Start Context ==============================================================
1141  private function Context(){
1142  $session=$this->Session->checkSession($this->token);
1143  if($session['IdUserAccount']<0){
1144  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1145  $this->SendResponse($response);
1146  exit;
1147  }
1148  if(isset($this->data['method'])){
1149  if(isset($this->data['entity'])){
1150  $method=$this->data['method'];
1151  $entity=$this->data['entity'];
1152  $entity['IdUserAccount']=$session['IdUserAccount'];
1153  $entity['UserAccountType']=$session['UserAccountType'];
1154 
1155  switch($method){
1156  case 'addEditContext':
1157  $_context=$this->Context->addEditContext($entity);
1158  break;
1159  case 'deleteContext':
1160  $_context=$this->Context->deleteContext($entity);
1161  break;
1162  case 'getContext':
1163  $_context=$this->Context->getContext($entity);
1164  break;
1165  default:
1166  $_context=$this->methodError(6012, $method);
1167  }
1168  }
1169  }
1170  $this->Session->updateSession($session['Token']);
1171 
1172  $this->SendResponse($_context);
1173  }
1174  //============ End Context ==============================================================
1175  //
1176  //============ Start MicroflowActionAlert ==============================================================
1184  private function MicroflowActionAlert(){
1185  $session=$this->Session->checkSession($this->token);
1186  if($session['IdUserAccount']<0){
1187  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1188  $this->SendResponse($response);
1189  exit;
1190  }
1191  if(isset($this->data['method'])){
1192  if(isset($this->data['entity'])){
1193  $method=$this->data['method'];
1194  $entity=$this->data['entity'];
1195  $entity['IdUserAccount']=$session['IdUserAccount'];
1196  $entity['UserAccountType']=$session['UserAccountType'];
1197 
1198  switch($method){
1199  case 'addEditMicroflowActionAlert':
1200  $_microflowActionAlert=$this->MicroflowActionAlert->addEditMicroflowActionAlert($entity);
1201  break;
1202  case 'deleteMicroflowActionAlert':
1203  $_microflowActionAlert=$this->MicroflowActionAlert->deleteMicroflowActionAlert($entity);
1204  break;
1205  case 'getMicroflowActionAlert':
1206  $_microflowActionAlert=$this->MicroflowActionAlert->getMicroflowActionAlert($entity);
1207  break;
1208  default:
1209  $_microflowActionAlert=$this->methodError(6013, $method);
1210  }
1211  }
1212  }
1213  $this->Session->updateSession($session['Token']);
1214  $this->SendResponse($_microflowActionAlert);
1215  }
1216  //============ End MicroflowActionAlert ==============================================================
1217  //
1218  //============ Start MicroflowActionProperty ==============================================================
1226  private function MicroflowActionProperty(){
1227  $session=$this->Session->checkSession($this->token);
1228  if($session['IdUserAccount']<0){
1229  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1230  $this->SendResponse($response);
1231  exit;
1232  }
1233  if(isset($this->data['method'])){
1234  if(isset($this->data['entity'])){
1235  $method=$this->data['method'];
1236  $entity=$this->data['entity'];
1237  $entity['IdUserAccount']=$session['IdUserAccount'];
1238  $entity['UserAccountType']=$session['UserAccountType'];
1239 
1240  switch($method){
1241  case 'addEditMicroflowActionProperty':
1242  $_microflowActionProperty=$this->MicroflowActionProperty->addEditMicroflowActionProperty($entity);
1243  break;
1244  case 'deleteMicroflowActionProperty':
1245  $_microflowActionProperty=$this->MicroflowActionProperty->deleteMicroflowActionProperty($entity);
1246  break;
1247  case 'getMicroflowActionProperty':
1248  $_microflowActionProperty=$this->MicroflowActionProperty->getMicroflowActionProperty($entity);
1249  break;
1250  default:
1251  $_microflowActionProperty=$this->methodError(6014, $method);
1252  }
1253  }
1254  }
1255  $this->Session->updateSession($session['Token']);
1256  $this->SendResponse($_microflowActionProperty);
1257  }
1258  //============ End MicroflowActionProperty ==============================================================
1259  //
1260  //============ Start MicroflowActionResult ==============================================================
1268  private function MicroflowActionResult(){
1269  $session=$this->Session->checkSession($this->token);
1270  if($session['IdUserAccount']<0){
1271  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1272  $this->SendResponse($response);
1273  exit;
1274  }
1275  if(isset($this->data['method'])){
1276  if(isset($this->data['entity'])){
1277  $method=$this->data['method'];
1278  $entity=$this->data['entity'];
1279  $entity['IdUserAccount']=$session['IdUserAccount'];
1280  $entity['UserAccountType']=$session['UserAccountType'];
1281 
1282  switch ($method){
1283  case 'addEditMicroflowActionResult':
1284  $_microflowActionResult=$this->MicroflowActionResult->addEditMicroflowActionResult($entity);
1285  break;
1286  case 'deleteMicroflowActionResult':
1287  $_microflowActionResult=$this->MicroflowActionResult->deleteMicroflowActionResult($entity);
1288  break;
1289  case 'getMicroflowActionResult':
1290  $_microflowActionResult=$this->MicroflowActionResult->getMicroflowActionResult($entity);
1291  break;
1292  default:
1293  $_microflowActionResult=$this->methodError(6015, $method);
1294  }
1295  }
1296  }
1297  $this->Session->updateSession($session['Token']);
1298  $this->SendResponse($_microflowActionResult);
1299  }
1300  //============ End MicroflowActionResult ==============================================================
1301  //
1302  //============ Start MicroflowAction ==============================================================
1310  private function MicroflowAction(){
1311  $session=$this->Session->checkSession($this->token);
1312  if($session['IdUserAccount']<0) {
1313  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1314  $this->SendResponse($response);
1315  exit;
1316  }
1317  if(isset($this->data['method'])){
1318  if(isset($this->data['entity'])){
1319  $method=$this->data['method'];
1320  $entity=$this->data['entity'];
1321  $entity['IdUserAccount']=$session['IdUserAccount'];
1322  $entity['UserAccountType']=$session['UserAccountType'];
1323 
1324  switch ($method){
1325  case 'addEditMicroflowAction':
1326  $_microflowAction=$this->MicroflowAction->addEditMicroflowAction($entity);
1327  break;
1328  case 'deleteMicroflowAction':
1329  $_microflowAction=$this->MicroflowAction->deleteMicroflowAction($entity);
1330  break;
1331  case 'getMicroflowAction':
1332  $_microflowAction=$this->MicroflowAction->getMicroflowAction($entity);
1333  break;
1334  default:
1335  $_microflowAction=$this->methodError(6016, $method);
1336  }
1337  }
1338  }
1339  $this->Session->updateSession($session['Token']);
1340  $this->SendResponse($_microflowAction);
1341  }
1342  //============ End MicroflowAction ==============================================================
1343  //
1344  //============ Start MicroflowNextAction ==============================================================
1352  private function MicroflowNextAction(){
1353  $session=$this->Session->checkSession($this->token);
1354  if($session['IdUserAccount']<0) {
1355  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1356  $this->SendResponse($response);
1357  exit;
1358  }
1359  if(isset($this->data['method'])){
1360  if(isset($this->data['entity'])){
1361  $method=$this->data['method'];
1362  $entity=$this->data['entity'];
1363  $entity['IdUserAccount']=$session['IdUserAccount'];
1364  $entity['UserAccountType']=$session['UserAccountType'];
1365 
1366  switch ($method){
1367  case 'addEditMicroflowNextAction':
1368  $_microflowNextAction=$this->MicroflowNextAction->addEditMicroflowNextAction($entity);
1369  break;
1370  case 'deleteMicroflowNextAction':
1371  $_microflowNextAction=$this->MicroflowNextAction->deleteMicroflowNextAction($entity);
1372  break;
1373  case 'getMicroflowNextAction':
1374  $_microflowNextAction=$this->MicroflowNextAction->getMicroflowNextAction($entity);
1375  break;
1376  default:
1377  $_microflowNextAction=$this->methodError(6017, $method);
1378  }
1379  }
1380  }
1381  $this->Session->updateSession($session['Token']);
1382  $this->SendResponse($_microflowNextAction);
1383  }
1384  //============ End MicroflowNextAction ==============================================================
1385  //
1386  //============ Start Microflow ==============================================================
1394  private function Microflow(){
1395  $session=$this->Session->checkSession($this->token);
1396  if($session['IdUserAccount']<0) {
1397  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1398  $this->SendResponse($response);
1399  exit;
1400  }
1401  if(isset($this->data['method'])){
1402  if(isset($this->data['entity'])){
1403  $method=$this->data['method'];
1404  $entity=$this->data['entity'];
1405  $entity['IdUserAccount']=$session['IdUserAccount'];
1406  $entity['UserAccountType']=$session['UserAccountType'];
1407 
1408  switch ($method){
1409  case 'addEditMicroflow':
1410  $_microflow=$this->Microflow->addEditMicroflow($entity);
1411  break;
1412  case 'deleteMicroflow':
1413  $_microflow=$this->Microflow->deleteMicroflow($entity);
1414  break;
1415  case 'getMicroflow':
1416  $_microflow=$this->Microflow->getMicroflow($entity);
1417  break;
1418  case 'getMicroflowCount':
1419  $_microflow=$this->Microflow->getMicroflowCount($entity);
1420  break;
1421  default:
1422  $_microflow=$this->methodError(6018, $method);
1423  }
1424  }
1425  }
1426  $this->Session->updateSession($session['Token']);
1427  $this->SendResponse($_microflow);
1428  }
1429  //============ End Microflow ==============================================================
1430  //
1431  //============ Start TplActionTypeAlert ==============================================================
1439  private function TplActionTypeAlert(){
1440  $session=$this->Session->checkSession($this->token);
1441  if($session['IdUserAccount']<0) {
1442  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1443  $this->SendResponse($response);
1444  exit;
1445  }
1446  if(isset($this->data['method'])){
1447  if(isset($this->data['entity'])){
1448  $method=$this->data['method'];
1449  $entity=$this->data['entity'];
1450  $entity['IdUserAccount']=$session['IdUserAccount'];
1451  $entity['UserAccountType']=$session['UserAccountType'];
1452 
1453  switch ($method){
1454  case 'addEditTplActionTypeAlert':
1455  if($session['UserAccountType']=="0"){
1456  $_TplActionTypeAlert=$this->TplActionTypeAlert->addEditTplActionTypeAlert($entity);
1457  }else{
1458  $_TplActionTypeAlert=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1459  }
1460  break;
1461  case 'deleteTplActionTypeAlert':
1462  if($session['UserAccountType']=="0"){
1463  $_TplActionTypeAlert=$this->TplActionTypeAlert->deleteTplActionTypeAlert($entity);
1464  }else{
1465  $_TplActionTypeAlert=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1466  }
1467  break;
1468  case 'getTplActionTypeAlert':
1469  $_TplActionTypeAlert=$this->TplActionTypeAlert->getTplActionTypeAlert($entity);
1470  break;
1471  default:
1472  $_TplActionTypeAlert=$this->methodError(6019, $method);
1473  }
1474  }
1475  }
1476  $this->Session->updateSession($session['Token']);
1477  $this->SendResponse($_TplActionTypeAlert);
1478  }
1479  //============ End TplActionTypeAlert ==============================================================
1480  //
1481  //============ Start TplActionType ==============================================================
1489  private function TplActionType(){
1490  $session=$this->Session->checkSession($this->token);
1491  if($session['IdUserAccount']<0) {
1492  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1493  $this->SendResponse($response);
1494  exit;
1495  }
1496  if(isset($this->data['method'])){
1497  if(isset($this->data['entity'])){
1498  $method=$this->data['method'];
1499  $entity=$this->data['entity'];
1500  $entity['IdUserAccount']=$session['IdUserAccount'];
1501  $entity['UserAccountType']=$session['UserAccountType'];
1502 
1503  switch ($method){
1504  case 'addEditTplActionType':
1505  if($session['UserAccountType']=="0"){
1506  $_TplActionType=$this->TplActionType->addEditTplActionType($entity);
1507  }else{
1508  $_TplActionType=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1509  }
1510  break;
1511  case 'deleteTplActionType':
1512  if($session['UserAccountType']=="0"){
1513  $_TplActionType=$this->TplActionType->deleteTplActionType($entity);
1514  }else{
1515  $_TplActionType=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1516  }
1517  break;
1518  case 'getTplActionType':
1519  $_TplActionType=$this->TplActionType->getTplActionType($entity);
1520  break;
1521  default:
1522  $_TplActionType=$this->methodError(6020, $method);
1523  }
1524  }
1525  }
1526  $this->Session->updateSession($session['Token']);
1527  $this->SendResponse($_TplActionType);
1528  }
1529  //============ End TplActionType ==============================================================
1530  //
1531  //============ Start TplActionTypeNextAction ==============================================================
1539  private function TplActionTypeNextAction(){
1540  $session=$this->Session->checkSession($this->token);
1541  if($session['IdUserAccount']<0) {
1542  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1543  $this->SendResponse($response);
1544  exit;
1545  }
1546  if(isset($this->data['method'])){
1547  if(isset($this->data['entity'])){
1548  $method=$this->data['method'];
1549  $entity=$this->data['entity'];
1550  $entity['IdUserAccount']=$session['IdUserAccount'];
1551  $entity['UserAccountType']=$session['UserAccountType'];
1552 
1553  switch ($method){
1554  case 'addEditTplActionTypeNextAction':
1555  if($session['UserAccountType']=="0"){
1556  $_TplActionTypeNextAction=$this->TplActionTypeNextAction->addEditTplActionTypeNextAction($entity);
1557  }else{
1558  $_TplActionTypeNextAction=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1559  }
1560  break;
1561  case 'deleteTplActionTypeNextAction':
1562  if($session['UserAccountType']=="0"){
1563  $_TplActionTypeNextAction=$this->TplActionTypeNextAction->deleteTplActionTypeNextAction($entity);
1564  }else{
1565  $_TplActionTypeNextAction=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1566  }
1567  break;
1568  case 'getTplActionTypeNextAction':
1569  $_TplActionTypeNextAction=$this->TplActionTypeNextAction->getTplActionTypeNextAction($entity);
1570  break;
1571  default:
1572  $_TplActionTypeNextAction=$this->methodError(6021, $method);
1573  }
1574  }
1575  }
1576  $this->Session->updateSession($session['Token']);
1577  $this->SendResponse($_TplActionTypeNextAction);
1578  }
1579  //============ End TplActionTypeNextAction ==============================================================
1580  //
1581  //============ Start TplActionTypeProperty ==============================================================
1589  private function TplActionTypeProperty(){
1590  $session=$this->Session->checkSession($this->token);
1591  if($session['IdUserAccount']<0) {
1592  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1593  $this->SendResponse($response);
1594  exit;
1595  }
1596  if(isset($this->data['method'])){
1597  if(isset($this->data['entity'])){
1598  $method=$this->data['method'];
1599  $entity=$this->data['entity'];
1600  $entity['IdUserAccount']=$session['IdUserAccount'];
1601  $entity['UserAccountType']=$session['UserAccountType'];
1602 
1603  switch ($method){
1604  case 'addEditTplActionTypeProperty':
1605  if($session['UserAccountType']=="0"){
1606  $_TplActionTypeProperty=$this->TplActionTypeProperty->addEditTplActionTypeProperty($entity);
1607  }else{
1608  $_TplActionTypeProperty=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1609  }
1610  break;
1611  case 'deleteTplActionTypeProperty':
1612  if($session['UserAccountType']=="0"){
1613  $_TplActionTypeProperty=$this->TplActionTypeProperty->deleteTplActionTypeProperty($entity);
1614  }else{
1615  $_TplActionTypeProperty=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1616  }
1617  break;
1618  case 'getTplActionTypeProperty':
1619  $_TplActionTypeProperty=$this->TplActionTypeProperty->getTplActionTypeProperty($entity);
1620  break;
1621  default:
1622  $_TplActionTypeProperty=$this->methodError(6022, $method);
1623  }
1624  }
1625  }
1626  $this->Session->updateSession($session['Token']);
1627  $this->SendResponse($_TplActionTypeProperty);
1628  }
1629  //============ End TplActionTypeProperty ==============================================================
1630  //
1631  //============ Start TplActionTypeResult ==============================================================
1639  private function TplActionTypeResult(){
1640  $session=$this->Session->checkSession($this->token);
1641  if($session['IdUserAccount']<0) {
1642  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1643  $this->SendResponse($response);
1644  exit;
1645  }
1646  if(isset($this->data['method'])){
1647  if(isset($this->data['entity'])){
1648  $method=$this->data['method'];
1649  $entity=$this->data['entity'];
1650  $entity['IdUserAccount']=$session['IdUserAccount'];
1651  $entity['UserAccountType']=$session['UserAccountType'];
1652 
1653  switch ($method){
1654  case 'addEditTplActionTypeResult':
1655  if($session['UserAccountType']=="0"){
1656  $_TplActionTypeResult=$this->TplActionTypeResult->addEditTplActionTypeResult($entity);
1657  }else{
1658  $_TplActionTypeResult=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1659  }
1660  break;
1661  case 'deleteTplActionTypeResult':
1662  if($session['UserAccountType']=="0"){
1663  $_TplActionTypeResult=$this->TplActionTypeResult->deleteTplActionTypeResult($entity);
1664  }else{
1665  $_TplActionTypeResult=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1666  }
1667  break;
1668  case 'getTplActionTypeResult':
1669  $_TplActionTypeResult=$this->TplActionTypeResult->getTplActionTypeResult($entity);
1670  break;
1671  default:
1672  $_TplActionTypeResult=$this->methodError(6023, $method);
1673  }
1674  }
1675  }
1676  $this->Session->updateSession($session['Token']);
1677  $this->SendResponse($_TplActionTypeResult);
1678  }
1679  //============ End TplActionTypeResult ==============================================================
1680  //
1681  //============ Start TplAssetPropertyMicroflow ==============================================================
1689  private function TplAssetPropertyMicroflow(){
1690  $session=$this->Session->checkSession($this->token);
1691  if($session['IdUserAccount']<0) {
1692  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1693  $this->SendResponse($response);
1694  exit;
1695  }
1696  if(isset($this->data['method'])){
1697  if(isset($this->data['entity'])){
1698  $method=$this->data['method'];
1699  $entity=$this->data['entity'];
1700  $entity['IdUserAccount']=$session['IdUserAccount'];
1701  $entity['UserAccountType']=$session['UserAccountType'];
1702 
1703  switch ($method){
1704  case 'addEditTplAssetPropertyMicroflow':
1705  if($session['UserAccountType']=="0"){
1706  $_TplAssetPropertyMicroflow=$this->TplAssetPropertyMicroflow->addEditTplAssetPropertyMicroflow($entity);
1707  }else{
1708  $_TplAssetPropertyMicroflow=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1709  }
1710  break;
1711  case 'deleteTplAssetPropertyMicroflow':
1712  if($session['UserAccountType']=="0"){
1713  $_TplAssetPropertyMicroflow=$this->TplAssetPropertyMicroflow->deleteTplAssetPropertyMicroflow($entity);
1714  }else{
1715  $_TplAssetPropertyMicroflow=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1716  }
1717  break;
1718  case 'getTplAssetPropertyMicroflow':
1719  $_TplAssetPropertyMicroflow=$this->TplAssetPropertyMicroflow->getTplAssetPropertyMicroflow($entity);
1720  break;
1721  default:
1722  $_TplAssetPropertyMicroflow=$this->methodError(6024, $method);
1723  }
1724  }
1725  }
1726  $this->Session->updateSession($session['Token']);
1727  $this->SendResponse($_TplAssetPropertyMicroflow);
1728  }
1729  //============ End TplAssetPropertyMicroflow ==============================================================
1730  //
1731  //============ Start TplAssetProperty ==============================================================
1739  private function TplAssetProperty(){
1740  $session=$this->Session->checkSession($this->token);
1741  if($session['IdUserAccount']<0) {
1742  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1743  $this->SendResponse($response);
1744  exit;
1745  }
1746  if(isset($this->data['method'])){
1747  if(isset($this->data['entity'])){
1748  $method=$this->data['method'];
1749  $entity=$this->data['entity'];
1750  $entity['IdUserAccount']=$session['IdUserAccount'];
1751  $entity['UserAccountType']=$session['UserAccountType'];
1752 
1753  switch ($method){
1754  case 'addEditTplAssetProperty':
1755  if($session['UserAccountType']=="0"){
1756  $_TplAssetProperty=$this->TplAssetProperty->addEditTplAssetProperty($entity);
1757  }else{
1758  $_TplAssetProperty=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1759  }
1760  break;
1761  case 'deleteTplAssetProperty':
1762  if($session['UserAccountType']=="0"){
1763  $_TplAssetProperty=$this->TplAssetProperty->deleteTplAssetProperty($entity);
1764  }else{
1765  $_TplAssetProperty=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1766  }
1767  break;
1768  case 'getTplAssetProperty':
1769  $_TplAssetProperty=$this->TplAssetProperty->getTplAssetProperty($entity);
1770  break;
1771  default:
1772  $_TplAssetProperty=$this->methodError(6025, $method);
1773  }
1774  }
1775  }
1776  $this->Session->updateSession($session['Token']);
1777  $this->SendResponse($_TplAssetProperty);
1778  }
1779  //============ End TplAssetProperty ==============================================================
1780  //
1781  //============ Start TplAsset ==============================================================
1789  private function TplAsset(){
1790  $session=$this->Session->checkSession($this->token);
1791  if($session['IdUserAccount']<0) {
1792  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1793  $this->SendResponse($response);
1794  exit;
1795  }
1796  if(isset($this->data['method'])){
1797  if(isset($this->data['entity'])){
1798  $method=$this->data['method'];
1799  $entity=$this->data['entity'];
1800  $entity['IdUserAccount']=$session['IdUserAccount'];
1801  $entity['UserAccountType']=$session['UserAccountType'];
1802 
1803  switch ($method){
1804  case 'addEditTplAsset':
1805  if($session['UserAccountType']=="0"){
1806  $_TplAsset=$this->TplAsset->addEditTplAsset($entity);
1807  }else{
1808  $_TplAsset=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1809  }
1810  break;
1811  case 'deleteTplAsset':
1812  if($session['UserAccountType']=="0"){
1813  $_TplAsset=$this->TplAsset->deleteTplAsset($entity);
1814  }else{
1815  $_TplAsset=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1816  }
1817  break;
1818  case 'getTplAsset':
1819  $_TplAsset=$this->TplAsset->getTplAsset($entity);
1820  break;
1821  default:
1822  $_TplAsset=$this->methodError(6026, $method);
1823  }
1824  }
1825  }
1826  $this->Session->updateSession($session['Token']);
1827  $this->SendResponse($_TplAsset);
1828  }
1829  //============ End TplAsset ==============================================================
1830  //
1831  //============ Start TplContextCondition ==============================================================
1839  private function TplContextCondition(){
1840  $session=$this->Session->checkSession($this->token);
1841  if($session['IdUserAccount']<0) {
1842  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1843  $this->SendResponse($response);
1844  exit;
1845  }
1846  if(isset($this->data['method'])){
1847  if(isset($this->data['entity'])){
1848  $method=$this->data['method'];
1849  $entity=$this->data['entity'];
1850  $entity['IdUserAccount']=$session['IdUserAccount'];
1851  $entity['UserAccountType']=$session['UserAccountType'];
1852 
1853  switch ($method){
1854  case 'addEditTplContextCondition':
1855  if($session['UserAccountType']=="0"){
1856  $_TplContextCondition=$this->TplContextCondition->addEditTplContextCondition($entity);
1857  }else{
1858  $_TplContextCondition=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1859  }
1860  break;
1861  case 'deleteTplContextCondition':
1862  if($session['UserAccountType']=="0"){
1863  $_TplContextCondition=$this->TplContextCondition->deleteTplContextCondition($entity);
1864  }else{
1865  $_TplContextCondition=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1866  }
1867  break;
1868  case 'getTplContextCondition':
1869  $_TplContextCondition=$this->TplContextCondition->getTplContextCondition($entity);
1870  break;
1871  default:
1872  $_TplContextCondition=$this->methodError(6027, $method);
1873  }
1874  }
1875  }
1876  $this->Session->updateSession($session['Token']);
1877  $this->SendResponse($_TplContextCondition);
1878  }
1879  //============ End TplContextCondition ==============================================================
1880  //
1881  //============ Start TplContextFactor ==============================================================
1889  private function TplContextFactor(){
1890  $session=$this->Session->checkSession($this->token);
1891  if($session['IdUserAccount']<0) {
1892  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1893  $this->SendResponse($response);
1894  exit;
1895  }
1896  if(isset($this->data['method'])){
1897  if(isset($this->data['entity'])){
1898  $method=$this->data['method'];
1899  $entity=$this->data['entity'];
1900  $entity['IdUserAccount']=$session['IdUserAccount'];
1901  $entity['UserAccountType']=$session['UserAccountType'];
1902 
1903  switch ($method){
1904  case 'addEditTplContextFactor':
1905  if($session['UserAccountType']=="0"){
1906  $_TplContextFactor=$this->TplContextFactor->addEditTplContextFactor($entity);
1907  }else{
1908  $_TplContextFactor=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1909  }
1910  break;
1911  case 'deleteTplContextFactor':
1912  if($session['UserAccountType']=="0"){
1913  $_TplContextFactor=$this->TplContextFactor->deleteTplContextFactor($entity);
1914  }else{
1915  $_TplContextFactor=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1916  }
1917  break;
1918  case 'getTplContextFactor':
1919  $_TplContextFactor=$this->TplContextFactor->getTplContextFactor($entity);
1920  break;
1921  default:
1922  $_TplContextFactor=$this->methodError(6028, $method);
1923  }
1924  }
1925  }
1926  $this->Session->updateSession($session['Token']);
1927  $this->SendResponse($_TplContextFactor);
1928  }
1929  //============ End TplContextFactor ==============================================================
1930  //
1931  //============ Start TplContext ==============================================================
1939  private function TplContext(){
1940  $session=$this->Session->checkSession($this->token);
1941  if($session['IdUserAccount']<0) {
1942  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1943  $this->SendResponse($response);
1944  exit;
1945  }
1946  if(isset($this->data['method'])){
1947  if(isset($this->data['entity'])){
1948  $method=$this->data['method'];
1949  $entity=$this->data['entity'];
1950  $entity['IdUserAccount']=$session['IdUserAccount'];
1951  $entity['UserAccountType']=$session['UserAccountType'];
1952 
1953  switch ($method){
1954  case 'addEditTplContext':
1955  if($session['UserAccountType']=="0"){
1956  $_TplContext=$this->TplContext->addEditTplContext($entity);
1957  }else{
1958  $_TplContext=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1959  }
1960  break;
1961  case 'deleteTplContext':
1962  if($session['UserAccountType']=="0"){
1963  $_TplContext=$this->TplContext->deleteTplContext($entity);
1964  }else{
1965  $_TplContext=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
1966  }
1967  break;
1968  case 'getTplContext':
1969  $_TplContext=$this->TplContext->getTplContext($entity);
1970  break;
1971  default:
1972  $_TplContext=$this->methodError(6029, $method);
1973  }
1974  }
1975  }
1976  $this->Session->updateSession($session['Token']);
1977  $this->SendResponse($_TplContext);
1978  }
1979  //============ End TplContext ==============================================================
1980  //
1981  //============ Start TplMicroflowActionResult ==============================================================
1989  private function TplMicroflowActionResult(){
1990  $session=$this->Session->checkSession($this->token);
1991  if($session['IdUserAccount']<0) {
1992  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
1993  $this->SendResponse($response);
1994  exit;
1995  }
1996  if(isset($this->data['method'])){
1997  if(isset($this->data['entity'])){
1998  $method=$this->data['method'];
1999  $entity=$this->data['entity'];
2000  $entity['IdUserAccount']=$session['IdUserAccount'];
2001  $entity['UserAccountType']=$session['UserAccountType'];
2002 
2003  switch ($method){
2004  case 'addEditTplMicroflowActionResult':
2005  if($session['UserAccountType']=="0"){
2006  $_TplMicroflowActionResult=$this->TplMicroflowActionResult->addEditTplMicroflowActionResult($entity);
2007  }else{
2008  $_TplMicroflowActionResult=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
2009  }
2010  break;
2011  case 'deleteTplMicroflowActionResult':
2012  if($session['UserAccountType']=="0"){
2013  $_TplMicroflowActionResult=$this->TplMicroflowActionResult->deleteTplMicroflowActionResult($entity);
2014  }else{
2015  $_TplMicroflowActionResult=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
2016  }
2017  break;
2018  case 'getTplMicroflowActionResult':
2019  $_TplMicroflowActionResult=$this->TplMicroflowActionResult->getTplMicroflowActionResult($entity);
2020  break;
2021  default:
2022  $_TplMicroflowActionResult=$this->methodError(6030, $method);
2023  }
2024  }
2025  }
2026  $this->Session->updateSession($session['Token']);
2027  $this->SendResponse($_TplMicroflowActionResult);
2028  }
2029  //============ End TplMicroflowActionResult ==============================================================
2030  //
2031  //============ Start TplMicroflowAction ==============================================================
2039  private function TplMicroflowAction(){
2040  $session=$this->Session->checkSession($this->token);
2041  if($session['IdUserAccount']<0) {
2042  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
2043  $this->SendResponse($response);
2044  exit;
2045  }
2046  if(isset($this->data['method'])){
2047  if(isset($this->data['entity'])){
2048  $method=$this->data['method'];
2049  $entity=$this->data['entity'];
2050  $entity['IdUserAccount']=$session['IdUserAccount'];
2051  $entity['UserAccountType']=$session['UserAccountType'];
2052 
2053  switch ($method){
2054  case 'addEditTplMicroflowAction':
2055  if($session['UserAccountType']=="0"){
2056  $_TplMicroflowAction=$this->TplMicroflowAction->addEditTplMicroflowAction($entity);
2057  }else{
2058  $_TplMicroflowAction=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
2059  }
2060  break;
2061  case 'deleteTplMicroflowAction':
2062  if($session['UserAccountType']=="0"){
2063  $_TplMicroflowAction=$this->TplMicroflowAction->deleteTplMicroflowAction($entity);
2064  }else{
2065  $_TplMicroflowAction=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
2066  }
2067  break;
2068  case 'getTplMicroflowAction':
2069  $_TplMicroflowAction=$this->TplMicroflowAction->getTplMicroflowAction($entity);
2070  break;
2071  default:
2072  $_TplMicroflowAction=$this->methodError(6031, $method);
2073  }
2074  }
2075  }
2076  $this->Session->updateSession($session['Token']);
2077  $this->SendResponse($_TplMicroflowAction);
2078  }
2079  //============ End TplMicroflowAction ==============================================================
2080  //
2081  //============ Start TplMicroflowNextAction ==============================================================
2089  private function TplMicroflowNextAction(){
2090  $session=$this->Session->checkSession($this->token);
2091  if($session['IdUserAccount']<0) {
2092  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
2093  $this->SendResponse($response);
2094  exit;
2095  }
2096  if(isset($this->data['method'])){
2097  if(isset($this->data['entity'])){
2098  $method=$this->data['method'];
2099  $entity=$this->data['entity'];
2100  $entity['IdUserAccount']=$session['IdUserAccount'];
2101  $entity['UserAccountType']=$session['UserAccountType'];
2102 
2103  switch ($method){
2104  case 'addEditTplMicroflowNextAction':
2105  if($session['UserAccountType']=="0"){
2106  $_TplMicroflowNextAction=$this->TplMicroflowNextAction->addEditTplMicroflowNextAction($entity);
2107  }else{
2108  $_TplMicroflowNextAction=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
2109  }
2110  break;
2111  case 'deleteTplMicroflowNextAction':
2112  if($session['UserAccountType']=="0"){
2113  $_TplMicroflowNextAction=$this->TplMicroflowNextAction->deleteTplMicroflowNextAction($entity);
2114  }else{
2115  $_TplMicroflowNextAction=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
2116  }
2117  break;
2118  case 'getTplMicroflowNextAction':
2119  $_TplMicroflowNextAction=$this->TplMicroflowNextAction->getTplMicroflowNextAction($entity);
2120  break;
2121  default:
2122  $_TplMicroflowNextAction=$this->methodError(6032, $method);
2123  }
2124  }
2125  }
2126  $this->Session->updateSession($session['Token']);
2127  $this->SendResponse($_TplMicroflowNextAction);
2128  }
2129  //============ End TplMicroflowNextAction ==============================================================
2130  //
2131  //============ Start TplMicroflow ==============================================================
2139  private function TplMicroflow(){
2140  $session=$this->Session->checkSession($this->token);
2141  if($session['IdUserAccount']<0) {
2142  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
2143  $this->SendResponse($response);
2144  exit;
2145  }
2146  if(isset($this->data['method'])){
2147  if(isset($this->data['entity'])){
2148  $method=$this->data['method'];
2149  $entity=$this->data['entity'];
2150  $entity['IdUserAccount']=$session['IdUserAccount'];
2151  $entity['UserAccountType']=$session['UserAccountType'];
2152 
2153  switch ($method){
2154  case 'addEditTplMicroflow':
2155  if($session['UserAccountType']=="0"){
2156  $_TplMicroflow=$this->TplMicroflow->addEditTplMicroflow($entity);
2157  }else{
2158  $_TplMicroflow=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
2159  }
2160  break;
2161  case 'deleteTplMicroflow':
2162  if($session['UserAccountType']=="0"){
2163  $_TplMicroflow=$this->TplMicroflow->deleteTplMicroflow($entity);
2164  }else{
2165  $_TplMicroflow=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
2166  }
2167  break;
2168  case 'getTplMicroflow':
2169  $_TplMicroflow=$this->TplMicroflow->getTplMicroflow($entity);
2170  break;
2171  default:
2172  $_TplMicroflow=$this->methodError(6033, $method);
2173  }
2174  }
2175  }
2176  $this->Session->updateSession($session['Token']);
2177  $this->SendResponse($_TplMicroflow);
2178  }
2179  //============ End TplMicroflow ==============================================================
2180 
2181  //============ Start Language ==============================================================
2189  private function Language(){
2190  $session=$this->Session->checkSession($this->token);
2191  if($session['IdUserAccount']<0) {
2192  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
2193  $this->SendResponse($response);
2194  exit;
2195  }
2196  if(isset($this->data['method'])){
2197  if(isset($this->data['entity'])){
2198  $method=$this->data['method'];
2199  $entity=$this->data['entity'];
2200  $entity['IdUserAccount']=$session['IdUserAccount'];
2201  $entity['UserAccountType']=$session['UserAccountType'];
2202 
2203  switch ($method){
2204  case 'addEditLanguage':
2205  if($session['UserAccountType']=="0"){
2206  $_Language=$this->Language->addEditLanguage($entity);
2207  }else{
2208  $_Language=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
2209  }
2210  break;
2211  case 'deleteLanguage':
2212  if($session['UserAccountType']=="0"){
2213  $_Language=$this->Language->deleteLanguage($entity);
2214  }else{
2215  $_Language=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
2216  }
2217  break;
2218  case 'getLanguage':
2219  $_Language=$this->Language->getLanguage($entity);
2220  break;
2221  default:
2222  $_Language=$this->methodError(6020, $method);
2223  }
2224  }
2225  }
2226  $this->Session->updateSession($session['Token']);
2227  $this->SendResponse($_Language);
2228  }
2229  //============ End Language ==============================================================
2230  //
2231  //============ Start CmplxAssetAndProperty ==============================================================
2238  private function CmplxAssetAndProperty(){
2239  $session=$this->Session->checkSession($this->token);
2240  if($session['IdUserAccount']<0) {
2241  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
2242  $this->SendResponse($response);
2243  exit;
2244  }
2245  if(isset($this->data['method'])){
2246  if(isset($this->data['entity'])){
2247  $method=$this->data['method'];
2248  $entity=$this->data['entity'];
2249  $entity['UserAccountType']=$session['UserAccountType'];
2250  $entity['IdUserAccount']=$session['IdUserAccount'];
2251  $this->db->beginTransaction();
2252  try
2253  {
2254  switch ($method){
2255  case 'addEditAssetAndProperty':
2256  $_result=$this->CmplxAssetAndProperty->addEditAssetAndProperty($entity);
2257  break;
2258  case 'deleteAssetAndProperty':
2259  $_result=$this->CmplxAssetAndProperty->deleteAssetAndProperty($entity);
2260  break;
2261  case 'getAssetAndProperty':
2262  $_result=$this->CmplxAssetAndProperty->getAssetAndProperty($entity);
2263  break;
2264  default:
2265  $_result=array("commit"=>"0", "entity"=>$this->methodError(6034, $method));
2266  }
2267  $commit=(int)$_result['commit'];
2268  if($commit==1){
2269  $this->db->commit();
2270  }else{
2271  $this->db->rollBack();
2272  }
2273  //$_CmplxAsset=$_result['entity'];
2274  $_CmplxAsset=$_result['entity'];
2275  }
2276  catch(Exception $e)
2277  {
2278  $this->db->rollBack();
2279 
2280  $message = $e->getMessage();
2281  $code = $e->getCode();
2282  $_CmplxAsset =array("resultId"=>"1","resultCode"=>$message."(".$code.")");
2283  }
2284  }
2285  }
2286  $this->Session->updateSession($session['Token']);
2287  $this->SendResponse($_CmplxAsset);
2288  }
2289  //============ End CmplxAssetAndProperty ======================================================
2290  //
2291  //============ Start CmplxContextAndDetail ==============================================================
2292  private function CmplxContextAndDetail(){
2293  $session=$this->Session->checkSession($this->token);
2294  if($session['IdUserAccount']<0) {
2295  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
2296  $this->SendResponse($response);
2297  exit;
2298  }
2299  if(isset($this->data['method'])){
2300  if(isset($this->data['entity'])){
2301  $method=$this->data['method'];
2302  $entity=$this->data['entity'];
2303  $entity['UserAccountType']=$session['UserAccountType'];
2304  $entity['IdUserAccount']=$session['IdUserAccount'];
2305  $this->db->beginTransaction();
2306  try
2307  {
2308  switch ($method){
2309  case 'addEditContextAndDetail':
2310  $_result=$this->CmplxContextAndDetail->addEditContextAndDetail($entity);
2311  break;
2312  case 'deleteContextAndDetail':
2313  $_result=$this->CmplxContextAndDetail->deleteContextAndDetail($entity);
2314  break;
2315  case 'getContextAndDetail':
2316  $_result=$this->CmplxContextAndDetail->getContextAndDetail($entity);
2317  break;
2318  default:
2319  $_result=array("commit"=>"0", "entity"=>$this->methodError(6035, $method));
2320 
2321  }
2322  $commit=(int)$_result['commit'];
2323  if($commit==1){
2324  $this->db->commit();
2325  }else{
2326  $this->db->rollBack();
2327  }
2328  //$_CmplxAsset=$_result['entity'];
2329  $_CmplxContext=$_result['entity'];
2330 
2331  }
2332  catch(Exception $e)
2333  {
2334  $this->db->rollBack();
2335 
2336  $message = $e->getMessage();
2337  $code = $e->getCode();
2338  $_CmplxContext =array("resultId"=>"1","resultCode"=>$message."(".$code.")");
2339  }
2340  }
2341  }
2342  $this->Session->updateSession($session['Token']);
2343  $this->SendResponse($_CmplxContext);
2344 
2345 
2346  }
2347  //============ End CmplxCondition ==============================================================
2348  //
2349  //============ Start CmplxMicroflow ==============================================================
2356  private function CmplxMicroflowAndDetail(){
2357  $session=$this->Session->checkSession($this->token);
2358  if($session['IdUserAccount']<0) {
2359  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
2360  $this->SendResponse($response);
2361  exit;
2362  }
2363  if(isset($this->data['method'])){
2364  if(isset($this->data['entity'])){
2365  $IdUserAccount=0;
2366  $method=$this->data['method'];
2367  $entity=$this->data['entity'];
2368  $entity['UserAccountType']=$session['UserAccountType'];
2369  $entity['IdUserAccount']=$session['IdUserAccount'];
2370  $this->db->beginTransaction();
2371  try
2372  {
2373  switch ($method){
2374  case 'addEditMicroflowAndDetail':
2375  $_result=$this->CmplxMicroflowAndDetail->addEditMicroflowAndDetail($entity);
2376  break;
2377  case 'deleteMicroflowAndDetail':
2378  $_result=$this->CmplxMicroflowAndDetail->deleteMicroflowAndDetail($entity);
2379  break;
2380  case 'getMicroflowAndDetail':
2381  $_result=$this->CmplxMicroflowAndDetail->getMicroflowAndDetail($entity);
2382  break;
2383  case 'getActionAndDetail':
2384  $_result=$this->CmplxMicroflowAndDetail->getActionAndDetail($entity);
2385  break;
2386  case 'getMicroflowAndDetailByAssetProperty':
2387  $_result=$this->CmplxMicroflowAndDetail->getMicroflowAndDetailByAssetProperty($entity);
2388  break;
2389  case 'getMicroflowAndDetailByAsset':
2390  $_result=$this->CmplxMicroflowAndDetail->getMicroflowAndDetailByAsset($entity);
2391  break;
2392  default:
2393  $_result=array("commit"=>"0", "entity"=>$this->methodError(6036, $method));
2394 
2395  }
2396  $commit=(int)$_result['commit'];
2397  if($commit==1){
2398  $this->db->commit();
2399  }else{
2400  $this->db->rollBack();
2401  }
2402  //$_CmplxAsset=$_result['entity'];
2403  $_CmplxMicroflow=$_result['entity'];
2404 
2405  }
2406  catch(Exception $e)
2407  {
2408  $this->db->rollBack();
2409 
2410  $message = $e->getMessage();
2411  $code = $e->getCode();
2412  $_CmplxMicroflow =array("resultId"=>"1","resultCode"=>$message."(".$code.")");
2413  }
2414  }
2415  }
2416  $this->Session->updateSession($session['Token']);
2417 
2418  $this->SendResponse($_CmplxMicroflow);
2419  }
2420  //============ End CmplxMicroflow =================================================================
2421 
2422  //============ Start ChannelType ==================================================================
2429  private function ChannelType(){
2430  $session=$this->Session->checkSession($this->token);
2431  if($session['IdUserAccount']<0) {
2432  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
2433  $this->SendResponse($response);
2434  exit;
2435  }
2436  if(isset($this->data['method'])){
2437  if(isset($this->data['entity'])){
2438  $method=$this->data['method'];
2439  $entity=$this->data['entity'];
2440  $entity['IdUserAccount']=$session['IdUserAccount'];
2441  $entity['UserAccountType']=$session['UserAccountType'];
2442 
2443  switch ($method){
2444  case 'addEditChannelType':
2445  if($session['UserAccountType']=="0"){
2446  $_ChannelType=$this->ChannelType->addEditChannelType($entity);
2447  }else{
2448  $_ChannelType=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
2449  }
2450  break;
2451  case 'deleteChannelType':
2452  if($session['UserAccountType']=="0"){
2453  $_ChannelType=$this->ChannelType->deleteChannelType($entity);
2454  }else{
2455  $_ChannelType=array("resultId"=>"7000", "resultCode"=>"Numai uitilizatorii de tip admin pot efectua aceasta operatie.");
2456  }
2457  break;
2458  case 'getChannelType':
2459  $_ChannelType=$this->ChannelType->getChannelType($entity);
2460  break;
2461  default:
2462  $_ChannelType=$this->methodError(6034, $method);
2463  }
2464  }
2465  }
2466  $this->Session->updateSession($session['Token']);
2467  $this->SendResponse($_ChannelType);
2468  }
2469  //============ End ChannelType ==================================================================
2470 
2471  //============ Start Channel ==================================================================
2478  private function Channel(){
2479  $session=$this->Session->checkSession($this->token);
2480  if($session['IdUserAccount']<0) {
2481  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
2482  $this->SendResponse($response);
2483  exit;
2484  }
2485  if(isset($this->data['method'])){
2486  if(isset($this->data['entity'])){
2487  $method=$this->data['method'];
2488  $entity=$this->data['entity'];
2489  $entity['IdUserAccount']=$session['IdUserAccount'];
2490  $entity['UserAccountType']=$session['UserAccountType'];
2491 
2492  switch ($method){
2493  case 'addEditChannel':
2494  $_Channel=$this->Channel->addEditChannel($entity);
2495  break;
2496  case 'deleteChannel':
2497  $_Channel=$this->Channel->deleteChannel($entity);
2498  break;
2499  case 'getChannel':
2500  $_Channel=$this->Channel->getChannel($entity);
2501  break;
2502  case 'getChannelCount':
2503  $_Channel=$this->Channel->getChannelCount($entity);
2504  break;
2505  default:
2506  $_Channel=$this->methodError(6034, $method);
2507  }
2508  }
2509  }
2510  $this->Session->updateSession($session['Token']);
2511  $this->SendResponse($_Channel);
2512  }
2513  //============ End Channel ==================================================================
2514 
2515  //============ Start CmplxChannelAndDetail ==================================================
2522  private function CmplxChannelAndDetail(){
2523  $session=$this->Session->checkSession($this->token);
2524  if($session['IdUserAccount']<0) {
2525  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
2526  $this->SendResponse($response);
2527  exit;
2528  }
2529  if(isset($this->data['method'])){
2530  if(isset($this->data['entity'])){
2531  $method=$this->data['method'];
2532  $entity=$this->data['entity'];
2533  $entity['IdUserAccount']=$session['IdUserAccount'];
2534  $entity['UserAccountType']=$session['UserAccountType'];
2535 
2536  switch ($method){
2537  case 'getChannelAndDetail':
2538  $_Channel=$this->CmplxChannelAndDetail->getChannelAndDetail($entity);
2539  break;
2540  default:
2541  $_Channel=$this->methodError(6034, $method);
2542  }
2543  }
2544  }
2545  $this->Session->updateSession($session['Token']);
2546  $this->SendResponse($_Channel['entity']);
2547  }
2548  //============ End CmplxChannelAndDetail ==================================================
2549 
2550  //============ Start UserAccount ==================================================
2557  private function UserAccount()
2558  {
2559  $session=$this->Session->checkSession($this->token);
2560  if($session['IdUserAccount']<0) {
2561  $response=array("resultId"=>"1","resultCode"=>$session['mesaj']);
2562  $this->SendResponse($response);
2563  exit;
2564  }
2565  if(isset($this->data['method'])){
2566  if(isset($this->data['entity'])){
2567  $method=$this->data['method'];
2568  $entity=$this->data['entity'];
2569  $entity['IdUserAccount']=$session['IdUserAccount'];
2570  $entity['UserAccountType']=$session['UserAccountType'];
2571 
2572  switch ($method){
2573  case 'addEditUserAccount':
2574  $_UserAccount=$this->UserAccount->addEditUserAccount($entity);
2575  break;
2576  case 'cleanUserAccount':
2577  $_UserAccount=$this->UserAccount->cleanUserAccount();
2578  break;
2579  case 'deleteUserAccount':
2580  $_UserAccount=$this->UserAccount->deleteUserAccount($entity);
2581  break;
2582  case 'getUserAccount':
2583  $_UserAccount=$this->UserAccount->getUserAccount($entity);
2584  break;
2585  default:
2586  $_UserAccount=$this->methodError(6034, $method);
2587  }
2588  }
2589  }
2590  $this->Session->updateSession($session['Token']);
2591  $this->SendResponse($_UserAccount);
2592  }
2593  //============ End UserAccount ==================================================
2594 
2595  //============ Start SendResponse ===========================================================
2596 
2597  public function SendResponse($response){
2598 
2599  $json=Zend_Json::encode($response);
2600  $this->view->content = $json;
2601  $hash=md5($json);
2602  $this->getResponse()->setHeader('hash', $hash)
2603  ->sendResponse();
2604 
2605  //
2606 
2607 
2608  }
2609  //============ End SendResponse =============================================================
2610 
2611 
2612 }
2613