Example #1
0
 /**
  * @see ProjectItemInterface::create_log_entry()
  * @return bool
  */
 public function create_log_entry()
 {
     global $transaction;
     if ($this->project_id and $this->item_id) {
         $transaction_id = $transaction->begin();
         if ($this->project_log_id) {
             $project_log_id = $this->project_log_id;
         } else {
             $project_log = new ProjectLog(null);
             if (($project_log_id = $project_log->create($this->project_id, null, false, false, md5(rand(0, 32768)))) == false) {
                 if ($transaction_id != null) {
                     $transaction->rollback($transaction_id);
                 }
                 return false;
             }
             $this->project_log_id = $project_log_id;
         }
         $project_log_has_item = new ProjectLogHasItem($project_log_id);
         if ($project_log_has_item->link_item($this->item_id) == false) {
             if ($transaction_id != null) {
                 $transaction->rollback($transaction_id);
             }
             return false;
         } else {
             if ($transaction_id != null) {
                 $transaction->commit($transaction_id);
             }
             return true;
         }
     } else {
         return false;
     }
 }
Example #2
0
 /**
  * @see ProjectLogInterface::list_items()
  * @return array
  */
 public function list_items()
 {
     if ($this->log_id and $this->log) {
         return ProjectLogHasItem::get_items_by_log_id($this->log_id);
     } else {
         return null;
     }
 }