Exemplo n.º 1
0
 /**
  * Deletes a Display
  * @return 
  * @param $displayID int
  */
 public function Delete($displayID)
 {
     Debug::LogEntry('audit', 'IN', get_class(), __FUNCTION__);
     try {
         $dbh = PDOConnect::init();
         // Pass over to the DisplayGroup data class so that it can try and delete the
         // display specific group first (it is that group which is linked to schedules)
         $displayGroupObject = new DisplayGroup($this->db);
         // Do we also want to update the linked Display Groups name (seeing as that is what we will be presenting to everyone)
         if (!$displayGroupObject->DeleteDisplay($displayID)) {
             $this->ThrowError($displayGroupObject->GetErrorMessage(), $displayGroupObject->GetErrorMessage());
         }
         // Delete the blacklist
         $sth = $dbh->prepare('DELETE FROM blacklist WHERE DisplayID = :displayid');
         $sth->execute(array('displayid' => $displayID));
         // Now we know the Display Group is gone - and so are any links
         // delete the display
         $sth = $dbh->prepare('DELETE FROM display WHERE DisplayID = :displayid');
         $sth->execute(array('displayid' => $displayID));
         \Xibo\Helper\Log::audit('Display', $displayID, 'Display Deleted', array('displayId' => $displayID));
         return true;
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(25015, __('Unable to delete display record.'));
         }
         return false;
     }
 }
Exemplo n.º 2
0
 /**
  * Set the owner
  * @param int $layoutId
  * @param int $userId
  */
 public static function setOwner($layoutId, $userId)
 {
     $dbh = PDOConnect::init();
     $params = array('userId' => $userId, 'layoutId' => $layoutId);
     $sth = $dbh->prepare('UPDATE `layout` SET userId = :userId WHERE layoutId = :layoutId');
     $sth->execute($params);
     \Xibo\Helper\Log::audit('layout', $layoutId, 'Changing Ownership', $params);
 }
Exemplo n.º 3
0
 /**
  * Deletes a scheduled event
  * @return 
  * @param $eventID int
  */
 public function Delete($eventID)
 {
     Debug::LogEntry('audit', 'IN', 'Schedule', 'Delete');
     try {
         $dbh = PDOConnect::init();
         if (!$this->DeleteScheduleForEvent($eventID)) {
             throw new Exception("Error Processing Request", 1);
         }
         // Delete all Schedule records for this DisplayGroupID
         $sth = $dbh->prepare('DELETE FROM schedule WHERE eventID = :eventid');
         $sth->execute(array('eventid' => $eventID));
         \Xibo\Helper\Log::audit('Schedule', $eventID, 'Schedule Event Deleted', array('eventId' => $eventID));
         return true;
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(25016, __('Unable to delete schedule record for this Event.'));
         }
         return false;
     }
 }