Next4Me
 All Classes Files Functions Variables
ErrorCode.php
Go to the documentation of this file.
1 <?php
2 
19 class Application_Model_ErrorCode extends Zend_Db_Table_Abstract {
20  //put your code here
21  protected $_name="ErrorCode";
22  protected $_primary="IdErrorCode";
23 
24  //==== Start ErrorCode =========================================================================
33  function getErrorCode($ErrorCode, $Language) {
34  // function implementation
35 
36  $cfg=Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOptions();
37  $logPath=$cfg['global']['logPath'];
38  $writer = new Zend_Log_Writer_Stream($logPath);
39  $format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL;
40  $formatter = new Zend_Log_Formatter_Simple($format);
41  $writer->setFormatter($formatter);
42  $logger = new Zend_Log();
43  $logger->addWriter($writer);
44 
45  try{
46 
47 
48  $rows = $this->fetchRow($this->select()->setIntegrityCheck(false)
49  ->from("ErrorCode","*")
50  ->where("Code=?",$ErrorCode)
51  ->where("Language=?", $Language)
52  );
53 
54  if($rows==null){
55  $result=array("ErrorCode"=>$ErrorCode,"Message"=>"Eroare ne definita","Language"=>"RO");
56  $logger->log(' ErrorCode.php getErrorCode ErrorCode='.$ErrorCode.' Nu exista nici o inregistrare in DB aferenta ErrorCode primit.',3);
57  }else{
58 
59  $result=array("ErrorCode"=>$rows->Code,
60  "Message" => $rows->Message,
61  "Language" => $rows->Language,
62  "File" => $rows->File,
63  "Class" => $rows->Class,
64  "Method" => $rows->Method);
65 
66  }
67  $response = $result;
68 
69 
70  }
71  catch(Exception $e){
72  $logger->log(' ErrorCode.php getErrorCode ErrorCode='.$ErrorCode.' eror: '.$e->getMessage().' '.$e,3);
73  $response = array("resultId"=>"1","resultCode"=>$e->getMessage());
74 
75  }
76  return $response;
77 
78  }
79  //============ End getErrorCode ==============================================================
80 
81 }
82 ?>