예제 #1
0
 /**
  * Reports an area action with dependencies to the log
  * @param Area $area The area being manipulated
  * @param Enums\Action $action The operation executed on the area
  */
 function ReportAreaAction(Area $area, Enums\Action $action)
 {
     $logItem = $this->CreateLogItem(Enums\ObjectType::Area(), $action);
     if (!$action->Equals(Enums\Action::Delete())) {
         $logArea = new LogArea();
         $logArea->SetLogItem($logItem);
         $logArea->SetArea($area);
         $logArea->Save();
     } else {
         $this->ReportLayoutAction($area->GetLayout(), Enums\Action::ChildDelete());
     }
 }
예제 #2
0
 /**
  * The last log item that is directly related to the area
  * @param Area $area The area
  * @return LogItem Returns the log item
  */
 static function LastAreaLog(Area $area)
 {
     $tblLogArea = LogArea::Schema()->Table();
     $tblLogItem = LogItem::Schema()->Table();
     $sql = Access::SqlBuilder();
     $orderBy = $sql->OrderList($sql->OrderDesc($tblLogItem->Field('Changed')));
     $joinCond = $sql->Equals($tblLogArea->Field('LogItem'), $tblLogItem->Field('ID'));
     $where = $sql->Equals($tblLogArea->Field('Area'), $sql->Value($area->GetID()));
     return LogItem::Schema()->First($where, $orderBy, null, $sql->Join($tblLogArea), JoinType::Inner(), $joinCond);
 }