| Server IP : 37.9.174.138 / Your IP : 216.73.216.117 Web Server : Apache System : Linux vps6.backend.sk 6.12.100+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.100-1 (2026-07-30) x86_64 User : ftpuser ( 1001) PHP Version : 8.4.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/backend-accounting.sk/app/modules/gDriveWatchDog/code/ |
Upload File : |
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
namespace modules\gDriveWatchDog\code;
/**
* Description of WatchFolder
*
* @author pegas
*/
class WatchFolder extends \app\classes\PDOElement {
public static $dbTable = 'gdrive_watchdog';
public function __construct($folderId, $idColumn = 'auto') {
$this->uniqueColumn = ['folder_id', 'idn'];
if ($idColumn === 'auto') {
$idColumn = 'folder_id';
if (is_numeric($folderId)) {
$idColumn = 'id';
}
}
parent::__construct($folderId, 'gdrive_watchdog', array($idColumn => $folderId), $idColumn, false, false, true);
}
/**
* @return WatchFolder
*/
public static function add(array $data) {
$db = \app\classes\PDODatabase::getInstance();
$db->addRecord(self::$dbTable, $data);
return new WatchFolder($db->getLastInsertId());
}
public function getName() {
return $this->_get('folder_name') . ' (' . $this->getAccountant()?->getName() . ')';
}
/**
* @return ?\app\classes\BasicUser
*/
public function getAccountant() {
try {
return new \app\classes\BasicUser($this->_get('users_id'), true, true, true);
} catch (\Exception $ex) {
return null;
}
}
public function getNotificationEmails() {
$emails = [];
foreach ($this->_getSet('users_ids') as $id) {
try {
$user = new \app\classes\BasicUser($id, true, true, true);
if ($user->_get('state') === \app\constants\State::ACTIVE) {
$emails[] = $user->_get('email');
}
} catch (\Exception $ex) {
}
}
return $emails;
}
}