| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | 	namespace core\contenus; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | 	use core\App; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | 	use core\RedirectError; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | 	class Contenus { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | 		//pour la table page | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | 		protected $id_page; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | 		protected $titre; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | 		protected $contenu; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | 		protected $url; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | 		protected $meta_description; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | 		protected $balise_title; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | 		protected $parent; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | 		//-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------// | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | 		public function __construct($url) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 			$dbc = \core\App::getDb(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | 			 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | 			$query = $dbc->select()->from("page")->where("url", "=", $url)->get(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | 			 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | 			if (RedirectError::testRedirect404($query, $url) === true) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 				foreach ($query as $obj) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | 					App::setValues(["contenus" => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | 						"id_page" => $this->id_page = $obj->ID_page, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 						"meta_description" => $this->meta_description = $obj->meta_description, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 						"balise_title" => $this->balise_title = $obj->balise_title, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 						"url" => $this->url = $obj->url, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 						"titre" => $this->titre = $obj->titre, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 						"contenu" => $this->contenu = $obj->contenu, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 						"parent" => $this->parent = $obj->parent, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 					]]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 		//-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------// | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 		//-------------------------- GETTER ----------------------------------------------------------------------------// | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 		//pour la table page | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 		public function getIdPage() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 			return $this->id_page; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 		public function getTitre() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 			return $this->titre; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 		public function getContenu() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 			return $this->contenu; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 		public function getUrl() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 			return $this->url; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 57 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 58 |  |  | 		public function getMetaDescription() { | 
            
                                                                        
                            
            
                                    
            
            
                | 59 |  |  | 			return $this->meta_description; | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 		public function getBaliseTitle() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 			return $this->balise_title; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  | 		public function getParent() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 			return $this->parent; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  | 		//-------------------------- FIN GETTER ----------------------------------------------------------------------------// | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 		//-------------------------- SETTER ----------------------------------------------------------------------------// | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 72 |  |  | 		//-------------------------- FIN SETTER ----------------------------------------------------------------------------// | 
            
                                                        
            
                                    
            
            
                | 73 |  |  | 	} |