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