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