/**
  * Constructor
  * 
  * @param string $id template id
  */
 public function __construct($id)
 {
     parent::__construct('template_not_found', 'id = ' . $id);
 }
Exemplo n.º 2
0
 /**
  * Constructor
  * 
  * Logs all info to server log
  * 
  * @param string $msg_code message code to be used to present error
  * @param mixed $internal_details details to log
  * @param mixed $public_details details to give to the user (logged as well)
  */
 public function __construct($msg_code, $internal_details = null, $public_details = null)
 {
     $this->uid = uniqid();
     // Build data
     $this->details = $public_details;
     if (!$internal_details) {
         $internal_details = array();
     }
     if (!is_array($internal_details)) {
         $internal_details = array($internal_details);
     }
     if ($public_details) {
         if (!is_array($public_details)) {
             $public_details = array($public_details);
         }
         $internal_details = array_merge($public_details, $internal_details);
     }
     $log = array('exception' => $msg_code, 'trace' => explode("\n", $this->getTraceAsString()), 'details' => array());
     // Cast to string(s)
     foreach ($internal_details as $key => $detail) {
         $key = is_int($key) ? '' : $key . ' = ';
         if (is_scalar($detail)) {
             $log['details'][] = $key . $detail;
         } else {
             foreach (explode("\n", print_r($detail, true)) as $line) {
                 $log['details'][] = $key . $line;
             }
         }
     }
     parent::__construct($msg_code, $log);
 }
 /**
  * Write the entryItem to the Log. The entryItem is written to the Log
  * using the format type and priority type explicitly set by the
  * application or the implementation default.
  * 
  * @param object mixed $entryItem (original type: java.io.Serializable)
  * 
  * @throws object LoggingException An exception with one of the
  *		   following messages defined in org.osid.logging.LoggingException
  *		   may be thrown:	{@link
  *		   org.osid.logging.LoggingException#UNIMPLEMENTED UNIMPLEMENTED},
  *		   {@link org.osid.logging.LoggingException#OPERATION_FAILED
  *		   OPERATION_FAILED}, {@link
  *		   org.osid.logging.LoggingException#CONFIGURATION_ERROR
  *		   CONFIGURATION_ERROR}, {@link
  *		   org.osid.logging.LoggingException#PERMISSION_DENIED
  *		   PERMISSION_DENIED}, {@link
  *		   org.osid.logging.LoggingException#PRIORITY_TYPE_NOT_SET
  *		   PRIORITY_TYPE_NOT_SET}, {@link
  *		   org.osid.logging.LoggingException#FORMAT_TYPE_NOT_SET
  *		   FORMAT_TYPE_NOT_SET}, {@link
  *		   org.osid.logging.LoggingException#NULL_ARGUMENT NULL_ARGUMENT}
  * 
  * @access public
  */
 function appendLog($entryItem)
 {
     if (!$entryItem) {
         throwError(new Error(LoggingException::NULL_ARGUMENT(), "HarmoniWritableLog"));
     }
     if (!isset($this->_formatType)) {
         throwError(new Error(LoggingException::FORMAT_TYPE_NOT_SET(), "HarmoniWritableLog"));
     }
     if (!isset($this->_priorityType)) {
         throwError(new Error(LoggingException::PRIORITY_TYPE_NOT_SET(), "HarmoniWritableLog"));
     }
     $this->appendLogWithTypes($entryItem, $this->_formatType, $this->_priorityType);
 }