Next4Me
 All Data Structures Files Functions Variables
application/models/tplMicroflowNextActions.php
Go to the documentation of this file.
00001 <?php 
00015 class TplMicroflowNextActions   extends Zend_Db_Table_Abstract {
00016         protected $_name="tplMicroflowNextActions"; 
00017         protected $_primary="IdTplMicroflowNextAction"; 
00018         //==== Start AddEditTplMicroflowNextActions =========================================================================
00033         function AddEditTplMicroflowNextActions($entity) {
00034                         // function implementation
00035             $resultId = 0;
00036             $page="tplMicroflowNextActions.php";
00037             $method="AddEditTplMicroflowNextActions";
00038             $result=json_encode($entity);
00039             $message="";
00040             $type="1";
00041             $this->ErrorCode = new ErrorCode;
00042             $this->Log = new Log;
00043 
00044             try{
00045                 if ($entity['IdTplMicroflowNextAction']=="0"){
00046                     $k=$this->insert($entity);
00047                     $k=$this->getAdapter()->lastInsertId();
00048                     $resultCode=$k;
00049                 }else{
00050                     $rows = $this->fetchRow($this->select()->setIntegrityCheck(false)
00051                             ->from("tplMicroflowNextActions","*")
00052                             ->where("IdTplMicroflowNextAction=?",$entity['IdTplMicroflowNextAction'])
00053                     );
00054                 if($rows!=null){
00055                     $IdTplMicroflowAction=$rows->IdTplMicroflowAction;
00056                     if($IdTplMicroflowAction==$entity['IdTplMicroflowAction']){
00057                     $this->update(array(
00058                         "IdTplMicroflowAction" => $entity['IdTplMicroflowAction'], 
00059                         "Name" => $entity['Name'], 
00060                         "Description" => $entity['Description'], 
00061                         "IsRecursive" => $entity['IsRecursive'], 
00062                         "IdTplActionTypeNextAction" => $entity['IdTplActionTypeNextAction'], 
00063                     ),$this->getAdapter()->quoteInto('IdTplMicroflowNextAction=?',$entity['IdTplMicroflowNextAction']));
00064                     $k=$entity['IdTplMicroflowNextAction'];
00065                     $resultCode=$k;
00066                     }else{
00067                         $resultId = 5019;
00068                         $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00069                         $resultCode=$r['Message'];
00070                         $message=$r['Message'];
00071                         $type=3;    
00072                 }
00073                 }else{
00074                     $resultId = 3076;
00075                     $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00076                     $resultCode=$r['Message'];
00077                     $message=$r['Message'];
00078                     $type=3;    
00079                 }
00080                 
00081                 }
00082                 
00083             }
00084             catch(Exception $e){
00085                 $resultCode=$e->getMessage();
00086                 $resultId=101;       
00087                 $type=3;
00088             }
00089                 $this->Log->save($page,$method,$result,$resultId.'=>'.$resultCode,$type);
00090                 $response=array("resultId"=>$resultId,"resultCode"=>$resultCode);
00091          return $response;
00092         }
00093         //============ End AddEditTplMicroflowNextActions ==============================================================
00094 
00095 
00096         //==== Start DeleteTplMicroflowNextActions =========================================================================
00104         function DeleteTplMicroflowNextActions($entity) {
00105                         // function implementation
00106             $resultId = 0;
00107             $page="tplMicroflowNextActions.php";
00108             $method="DeleteTplMicroflowNextActions";
00109             $result=json_encode($entity);
00110             $message="";
00111             $type="1";
00112             $this->ErrorCode = new ErrorCode;
00113             $this->Log = new Log;
00114 
00115             try{
00116                 $rows = $this->fetchRow($this->select()->setIntegrityCheck(false)
00117                             ->from("tplMicroflowNextActions","*")
00118                             ->where("IdTplMicroflowNextAction=?",$entity['IdTplMicroflowNextAction'])
00119                     );
00120                 if($rows==null){
00121                     $resultId = 3077;
00122                     $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00123                     $resultCode=$r['Message'];
00124                     $message=$r['Message'];
00125                     $type=3;    
00126                 }else{
00127                 $k=$this->delete($this->getAdapter()->quoteInto("IdTplMicroflowNextAction=?",$entity['IdTplMicroflowNextAction']));
00128                 $resultCode="Date sterse";
00129                 }
00130             }
00131             catch(Exception $e){
00132                 $resultCode=$e->getMessage();
00133                 $resultId=101;       
00134                 $type=3;
00135             }
00136                 $this->Log->save($page,$method,$result,$resultId.'=>'.$resultCode,$type);
00137                 $response=array("resultId"=>$resultId,"resultCode"=>$resultCode);
00138             return $response;
00139         }
00140         //============ End DeleteTplMicroflowNextActions ==============================================================
00141 
00142 
00143         //==== Start GetTplMicroflowNextActions =========================================================================
00151         function GetTplMicroflowNextActions($entity) {
00152                         // function implementation
00153             $resultId = 0;
00154             $page="tplMicroflowNextActions.php";
00155             $method="GetTplMicroflowNextActions";
00156             $result=json_encode($entity);
00157             $message="";
00158             $type="1";
00159             $this->ErrorCode = new ErrorCode;
00160             $this->Log = new Log;
00161 
00162             try{
00163                  $rows = $this->fetchAll($this->select()->setIntegrityCheck(false)
00164                             ->from("tplMicroflowNextActions","*")
00165                             ->where("IdTplMicroflowNextAction=?",$entity['IdTplMicroflowNextAction'])
00166                             ->orWhere("0=?", $entity['IdTplMicroflowNextAction'])
00167                     );
00168             if(count($rows)!=0){
00169                 foreach($rows as $row){
00170                     $resultCode[]=array("IdTplMicroflowNextAction" => $row->IdTplMicroflowNextAction,
00171                         "IdTplMicroflowAction" => $row->IdTplMicroflowAction, 
00172                         "Name" => $row->Name, 
00173                         "Description" => $row->Description, 
00174                         "IsRecursive" => $row->IsRecursive, 
00175                         "IdTplActionTypeNextAction" => $row->IdTplActionTypeNextAction, );
00176                 }
00177             }else{
00178                 $resultId = 3078;
00179                 $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00180                 $resultCode=$r['Message'];
00181                 $message=$r['Message'];
00182                 $type=3;    
00183             }
00184             }
00185             catch(Exception $e){
00186                 $resultCode=$e->getMessage();
00187                 $resultId=101;       
00188                 $type=3;
00189             }
00190                 $this->Log->save($page,$method,$result,$resultId.'=>'.json_encode($resultCode),$type);
00191                 $response=array("resultId"=>$resultId,"resultCode"=>$resultCode);
00192          return $response;
00193         }
00194         //============ End GetTplMicroflowNextActions ==============================================================
00195 
00196 }
00197