@ -135,6 +135,61 @@ class TacticModel {
return $allTactics;
}
public function shareTacticToAccount(int $accountId, int $tacticId): int
{
return $this->users->shareTacticToAccount($accountId, $tacticId);
}
public function shareTacticToAccountMail(string $email, int $tacticId): ?int
{
$account = $this->users->getAccountFromMail($email);
var_dump($account);
$accountId = $account->getUser()->getId();
var_dump($accountId);
if(isset($accountId)) {
return $this->shareTacticToAccount($accountId, $tacticId);
}
return null;
}
public function unshareTactic(int $tacticId): int
{
return $this->users->unshareTactic($tacticId);
}
public function unshareTacticToAccount(int $tacticId, int $accountId): int
{
return $this->users->unshareTacticToAccount($tacticId, $accountId);
}
public function getOwnerIdTacticShared(int $tactidId, int $accountId) : ?array {
$ids = [];
$idT = $this->tactics->getOwnerIdTacticSharedTeam($tactidId, $accountId);
if(isset($idT)) {
foreach ($idT as $id) {
if(!in_array($id, $ids)) {
array_push($ids, $id);
}
}
}
$idA = $this->tactics->getOwnerIdTacticSharedAccount($tactidId, $accountId);
if(isset($idA)) {
foreach ($idA as $id) {
if(!in_array($id, $ids)) {
array_push($ids, $id);
}
}
}
if($ids != null) {
return $ids[0];
}
return null;
}
/**
* Update the name of a tactic
* @param int $id the tactic identifier
@ -165,32 +220,4 @@ class TacticModel {
}
return null;
}
public function shareTacticToAccount(int $accountId, int $tacticId): int
{
return $this->users->shareTacticToAccount($accountId, $tacticId);
}
public function shareTacticToAccountMail(string $email, int $tacticId): ?int
{
$account = $this->users->getAccountFromMail($email);
var_dump($account);
$accountId = $account->getUser()->getId();
var_dump($accountId);
if(isset($accountId)) {
return $this->shareTacticToAccount($accountId, $tacticId);
}
return null;
}
public function unshareTactic(int $tacticId): int
{
return $this->users->unshareTactic($tacticId);
}
public function unshareTacticToAccount(int $tacticId, int $accountId): int
{
return $this->users->unshareTacticToAccount($tacticId, $accountId);
}
}