Пример #1
0
 public function getSCategory()
 {
     if (!$this->category) {
         $sCategoryManager = new SCategoryManager($this->db);
         $this->sCategory = $sCategoryManager->findById($this->id_scategory);
     }
     return $this->sCategory;
 }
Пример #2
0
                } catch (Exception $e) {
                    $errors = $e->getMessage();
                }
            } else {
                throw new Exception("Categorie inéxistance");
            }
        }
    } else {
        if ($action == 'updateSCategory') {
            if (isset($_POST['title'], $_POST['content'])) {
                $manager = new CategoryManager($db);
                $category = $manager->findById($_GET['id']);
                $idCategory = $category['id'];
                if (isset($idCategory)) {
                    $manager = new SCategoryManager($db);
                    $sCategory = $manager->findById($_GET['id']);
                    if ($category->getIdAuthor() == $currentUser->getId()) {
                        $id = intval($_GET['id']);
                        $sCategory->setTitle($_POST['title']);
                        $sCategory->setContent($_POST['content']);
                        $retour->{$manager}->update($sCategory);
                    } else {
                        $user = $retour;
                        header('Location : index.php?page=home');
                        exit;
                    }
                }
            }
        }
    }
}