예제 #1
0
파일: logs.php 프로젝트: mrzarkovic/logz
 public function show($id = 0)
 {
     $log = new Log();
     $log = $log->fetchById($id);
     $log_entries = new Log_entry();
     $log_entries->fetchAllByFieldValue("parent_id", $id);
     $this->to_tpl['log'] = $log;
     $this->to_tpl['log_entries'] = $log_entries->list;
     $this->template = "log";
     return;
 }
예제 #2
0
 /**
  * Save the entry to a log
  * @param int $parent_id
  * @throws \Exception
  */
 public function add_entry($parent_id = 0)
 {
     $logText = $_POST['logText'];
     settype($logText, "string");
     $date = $_POST['date'];
     settype($date, "string");
     $log_entry = new Log_entry();
     $log_entry->text = $logText;
     $log_entry->parent_id = (int) $parent_id;
     $log_entry->date_added = new \DateTime($date);
     if ($id = $log_entry->saveToDb()) {
         $this->print_ajax($id);
     } else {
         $this->print_ajax("false");
     }
 }