Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
HusseinBader2002 committed Dec 9, 2024
2 parents 9d9916c + b037ae8 commit 9352072
Show file tree
Hide file tree
Showing 9 changed files with 566 additions and 362 deletions.
54 changes: 30 additions & 24 deletions Core/Frameworks/Baikal/Model/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,37 +30,43 @@
use Symfony\Component\Yaml\Yaml;

class Calendar extends \Flake\Core\Model\Db {
const DATATABLE = "calendarinstances";
const DATATABLE = "calendars";
const PRIMARYKEY = "id";
const LABELFIELD = "displayname";
const LABELFIELD = "components";

protected $aData = [
"principaluri" => "",
"displayname" => "",
"uri" => "",
"description" => "",
"calendarorder" => 0,
"calendarcolor" => "",
"timezone" => null,
"calendarid" => 0,
"access" => 1,
"share_invitestatus" => 2,
"components" => "",
];
protected $oCalendar; # Baikal\Model\Calendar\Calendar

function __construct($sPrimary = false) {
parent::__construct($sPrimary);
try {
$config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml");
$this->set("timezone", $config['system']["timezone"]);
} catch (\Exception $e) {
error_log('Error reading baikal.yaml file : ' . $e->getMessage());

public function getComponents() {
return $this->aData['components'];
}

public function setComponents($components) {
$this->aData['components'] = $components;
}

function hasInstances() {
$rSql = $GLOBALS["DB"]->exec_SELECTquery(
"count(*) as count",
"calendarinstances",
"calendarid='" . $this->aData["id"] . "'"
);

if (($aRs = $rSql->fetch()) === false) {
return false;
} else {
reset($aRs);

return $aRs["count"] > 1;
}
}

protected function initFloating() {
parent::initFloating();
$this->oCalendar = new Calendar\Calendar();
function destroy() {
if ($this->hasInstances()) {
throw new \Exception("Trying to destroy a calendar with instances");
}
parent::destroy();
}

protected function initByPrimary($sPrimary) {
Expand Down
24 changes: 24 additions & 0 deletions Core/Frameworks/Baikal/Model/Principal.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,28 @@ class Principal extends \Flake\Core\Model\Db {
"displayname" => "",
"email" => "",
];

public function getUri() {
return $this->aData['uri'];
}

public function setUri($uri) {
$this->aData['uri'] = $uri;
}

public function getDisplayName() {
return $this->aData['displayname'];
}

public function setDisplayName($displayname) {
$this->aData['displayname'] = $displayname;
}

public function getEmail() {
return $this->aData['email'];
}

public function setEmail($email) {
$this->aData['email'] = $email;
}
}
20 changes: 20 additions & 0 deletions Core/Frameworks/Baikal/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@

namespace Baikal\Model;

<?php

namespace Baikal\Model;

use Symfony\Component\Yaml\Yaml;

class User extends \Flake\Core\Model\Db {
Expand All @@ -41,6 +45,22 @@ class User extends \Flake\Core\Model\Db {

protected $oIdentityPrincipal;

public function getUsername() {
return $this->aData['username'];
}

public function setUsername($username) {
$this->aData['username'] = $username;
}

public function getDigesta1() {
return $this->aData['digesta1'];
}

public function setDigesta1($digesta1) {
$this->aData['digesta1'] = $digesta1;
}

function initByPrimary($sPrimary) {
parent::initByPrimary($sPrimary);

Expand Down
Loading

0 comments on commit 9352072

Please sign in to comment.