Example #1
0
//classes loading end
session_start();
$_SESSION['source_page'] = $_SERVER['PHP_SELF'];
if (isset($_SESSION['utilisateur'])) {
    include_once '../include/meta_header_loged.php';
    ?>
<div id="mainBody">
		<div class="container">
			<div class="row">
				<?php 
    include_once '../include/meta_sidebar.php';
    ?>
				<div class="span9">	
					<?php 
    $db = $pdo;
    $annoncesManager = new AnnonceManager($db);
    ?>
					<ul class="breadcrumb">
						<li class="active">Mes Annonces<span class="divider">/</span></li></li>
						<li><a href="myprofil.php">Mon compte</a>
					</ul>
					<h4>Mes annonces</h4>
					<?php 
    if (isset($_SESSION['addinfo'])) {
        ?>
					<div class="alert alert-success">
						<p style="font-size:14px;"><?php 
        echo $_SESSION['addinfo'];
        ?>
</p>
					</div>
<!-- featured products begin -->
<?php 
include_once 'config.php';
$db = $pdo;
$annoncesManager = new AnnonceManager($db);
$arrayElements = $annoncesManager->getCount();
?>
<div class="well well-small">
	<h4>Top annonces</h4>
	<div class="row-fluid">
		<div id="featured" class="carousel slide">
			<div class="carousel-inner">
				<?php 
/*
in this carousel div we've encountered a problem of display
you must know that the <ul> list in this section can 
take just 4 <li> element, and after this we should open
another <ul> and on and on.....
*/
//begin : php code resolve the problem of featured products
$listCounter = 4;
//used to know where we go to place div & ul
$className = '';
//used for class="item active" or class="item"
foreach ($annoncesManager->getMostViewed() as $annonce) {
    if ($listCounter == 4) {
        //it's used for the first div
        $className = 'item active';
    } else {
        //it's used for the others div
        $className = 'item';
//classes loading begin
function classLoad($myClass)
{
    if (file_exists('../model/' . $myClass . '.class.php')) {
        include '../model/' . $myClass . '.class.php';
    } elseif (file_exists('../controller/' . $myClass . '.class.php')) {
        include '../controller/' . $myClass . '.class.php';
    }
}
spl_autoload_register("classLoad");
include '../view/config.php';
session_start();
//classes loading end
//get the list of ads by categorie process begin
$db = $pdo;
$annonceManager = new AnnonceManager($db);
$categorieManager = new CategorieManager($db);
$categories = array();
$categoriesNames = array();
foreach ($categorieManager->getCategorieDetailsList() as $categorie) {
    $categories[] = $categorie->detail();
}
foreach ($categorieManager->getCategorieNames() as $categorie) {
    $categoriesNames[] = $categorie->nom();
}
/*$categories = $categorieManager->getCategorieDetailsList()->detail();*/
/*array('technologie', 'vetement', 'informatique', 'telefon', 'audiovideo', 
		'vetementhomme', 'immobilier', 'santebeaute', 'automoto', 'maisonjardins', 'emploiservice',
		'vetementfemme', 'vetementenfant', 'chaussurehomme', 'chaussurefemme',
		'chaussureenfant', 'maison', 'appartement', 'villa', 'terrain',
		'colocation', 'boutique', 'parfum', 'cosmetic', 'paramedical',
<?php

/*
	Author                      : AASSOU Abdelilah.
	Creation Date               : 13/11/2013
*/
//classes loading begin
function classLoad($myClass)
{
    if (file_exists('../model/' . $myClass . '.class.php')) {
        include '../model/' . $myClass . '.class.php';
    } elseif (file_exists('../controller/' . $myClass . '.class.php')) {
        include '../controller/' . $myClass . '.class.php';
    }
}
spl_autoload_register("classLoad");
include '../view/image_processing.php';
include '../view/config.php';
//classes loading end
session_start();
$db = $pdo;
$annoncesManager = new AnnonceManager($db);
$annoncesManager->delete($_GET['id'], $_SESSION['utilisateur']->id());
header('Location:../view/myads.php');
Example #5
0
<?php

//classes loading begin
function classLoad($myClass)
{
    if (file_exists('../model/' . $myClass . '.class.php')) {
        include '../model/' . $myClass . '.class.php';
    } elseif (file_exists('../controller/' . $myClass . '.class.php')) {
        include '../controller/' . $myClass . '.class.php';
    }
}
spl_autoload_register("classLoad");
//classes loading end
include '../view/config.php';
session_start();
try {
    $db = $pdo;
    $annonceManager = new AnnonceManager($db);
    $annonceManager->signalAbuse($_SESSION['annonce']->id());
    header('Location:../view/cont_detailproduit.php');
} catch (Exception $e) {
    die('Error : ' . $e . getMessage());
}
*/
//classes loading begin
function classLoad($myClass)
{
    if (file_exists('../model/' . $myClass . '.class.php')) {
        include '../model/' . $myClass . '.class.php';
    } elseif (file_exists('../controller/' . $myClass . '.class.php')) {
        include '../controller/' . $myClass . '.class.php';
    }
}
spl_autoload_register("classLoad");
include "../view/config.php";
session_start();
//classes loading end
$db = $pdo;
$annoncesManager = new AnnonceManager($db);
$utilisateurManager = new UtilisateurManager($db);
//get the unique annonce by id begin
$id = 0;
if (isset($_GET['id'])) {
    if ($_GET['id'] > 0 and $_GET['id'] <= $annoncesManager->getLastId()) {
        $id = $_GET['id'];
    } else {
        $id = 1;
    }
    //$annoncesManager->addOneToPriority($id);
    $_SESSION['annonce'] = $annoncesManager->getAnnonceById($id);
    $idCat = $_SESSION['annonce']->idCategorie();
    $idAnnonce = $_SESSION['annonce']->id();
    $_SESSION['advertiser'] = $utilisateurManager->getUtilisateur2($_SESSION['annonce']->idUtilisateur());
    $_SESSION['annoncesim'] = $annoncesManager->getSimilarAnnonce($idCat, $idAnnonce);
Example #7
0
<?php

//classes loading begin
function classLoad($myClass)
{
    if (file_exists('../model/' . $myClass . '.class.php')) {
        include '../model/' . $myClass . '.class.php';
    } elseif (file_exists('../controller/' . $myClass . '.class.php')) {
        include '../controller/' . $myClass . '.class.php';
    }
}
spl_autoload_register("classLoad");
//classes loading end
include '../view/config.php';
session_start();
$var = "" . $_SESSION['annonce']->id() . "";
if ($_SESSION[$var]['likeClick'] == 0) {
    try {
        $db = $pdo;
        $annonceManager = new AnnonceManager($db);
        $annonceManager->addOneToPriority($_SESSION['annonce']->id());
        $_SESSION["{$var}"]['likeClick'] = 1;
        header('Location:../view/cont_detailproduit.php');
    } catch (Exception $e) {
        die('Error : ' . $e . getMessage());
    }
} else {
    header('Location:../view/cont_detailproduit.php');
}
Example #8
0
<?php

//classes loading begin
function classLoad($myClass)
{
    if (file_exists('../model/' . $myClass . '.class.php')) {
        include '../model/' . $myClass . '.class.php';
    } elseif (file_exists('../controller/' . $myClass . '.class.php')) {
        include '../controller/' . $myClass . '.class.php';
    }
}
spl_autoload_register("classLoad");
include '../view/config.php';
//classes loading end
session_start();
try {
    $db = $pdo;
    $annonceManager = new AnnonceManager($db);
    $annonceManager->adSelled($_GET['id'], $_SESSION['utilisateur']->id());
    header('Location:../view/myads.php');
} catch (Exception $e) {
    die('Error : ' . $e . getMessage());
}
Example #9
0
/*
	Author                      : AASSOU Abdelilah.
	Creation Date               : 08/10/2013
*/
//*********************** autoload begin *****************************
function classLoad($myClass)
{
    if (file_exists('../model/' . $myClass . '.class.php')) {
        include '../model/' . $myClass . '.class.php';
    } elseif (file_exists('../controller/' . $myClass . '.class.php')) {
        include '../controller/' . $myClass . '.class.php';
    }
}
spl_autoload_register("classLoad");
//*********************** autoload end ********************************
include '../view/config.php';
session_start();
//search processing begin
$ville = "";
$recherche = "";
if (!empty($_POST['srchVille']) or !empty($_POST['recherche'])) {
    $ville = htmlspecialchars($_POST['srchVille']);
    $recherche = htmlspecialchars($_POST['recherche']);
    $db = $pdo;
    $annonceManager = new AnnonceManager($db);
    $_SESSION['resultat_recherche'] = $annonceManager->getAnnoncesBySearch($recherche, $ville);
    header('Location:../view/resultat_recherche.php');
} else {
    $link = $_SESSION['source_page'];
    header("Location:" . $link);
}
$image2 = "";
$image3 = "";
$image1 = imageProcessing($_FILES['image_upload1']);
if ($image1 == "../view/themes/images/logo_bootshop.png") {
    $image1 = $_SESSION['image1_' . $_GET['id']];
}
$image2 = imageProcessing($_FILES['image_upload2']);
if ($image2 == "../view/themes/images/logo_bootshop.png") {
    $image2 = $_SESSION['image2_' . $_GET['id']];
}
$image3 = imageProcessing($_FILES['image_upload3']);
if ($image3 == "../view/themes/images/logo_bootshop.png") {
    $image3 = $_SESSION['image3_' . $_GET['id']];
}
// $image1 = "../view/themes/images/logo_bootshop.png";
// $image2 = "../view/themes/images/logo_bootshop.png";
// $image3 = "../view/themes/images/logo_bootshop.png";
if (isset($_POST['srchCat']) and isset($_POST['srchVille']) and isset($_POST['titre']) and isset($_POST['description']) and isset($_POST['prix'])) {
    $categorie = $_POST['srchCat'];
    $ville = $_POST['srchVille'];
    $titre = htmlspecialchars($_POST['titre']);
    $description = htmlspecialchars($_POST['description']);
    $prix = (int) $_POST['prix'];
    $idAnnonce = (int) $_GET['id'];
    $idUtilisateur = $_SESSION['utilisateur']->id();
    $annonce = new Annonce(array('id' => $idAnnonce, 'idUtilisateur' => $idUtilisateur, 'idCategorie' => $categorie, 'ville' => $ville, 'titre' => $titre, 'description' => $description, 'prix' => $prix, 'image' => $image1, 'image2' => $image2, 'image3' => $image3));
    $db = $pdo;
    $annonceManager = new AnnonceManager($db);
    $annonceManager->update($annonce);
}
header('Location:../view/myads.php');
Example #11
0
													<label class="right-label-max"></label>
													<button type="submit" class="btn btn-warning" aria-hidden="true">Modifier</button>
													<button class="btn" data-dismiss="modal"aria-hidden="true">Annuler</button>
												</div>
											</form>
										</div>
									</div>
								<br />
						</div>
						</div>
						<div class="span9">
							<h4>Les informations de mes annonces</h4>
							<div class="well">
							<?php 
$db = $pdo;
$annonceManager = new AnnonceManager($db);
?>
							
								<form><br/>
									<div class="control-group">
										<div class="controls">
											<label class="span3">Total de mes annonces&nbsp;</label>
											<input class="span2"  type="text" name="mesannonce" value="<?php 
echo $annonceManager->getCountByUserId($_SESSION['utilisateur']->id());
?>
" disabled>
										</div>
									</div>
								</form>
							</div>
						</div>
Example #12
0
<!-- latest products begin -->
<?php 
//testing php db features
include_once 'includes/db_connexion.php';
$db = new PDO('mysql:host=localhost;dbname=sodblodbmodb', 'root', '');
$annoncesManager = new AnnonceManager($db);
?>
<h4>Dernières annonces </h4>
	  <ul class="thumbnails">
	    <?php 
foreach ($annoncesManager->getAnnonces() as $annonce) {
    ?>
		<li class="span3">
		  <div class="thumbnail">
			<a  href="../controller/DetailAnnonceController.php?id=<?php 
    echo $annonce->id();
    ?>
"><img style="width:160px;height:160px;" src="<?php 
    echo $annonce->image();
    ?>
" alt=""></a>
			<div class="caption">
				<h5><?php 
    echo ucfirst($annonce->titre());
    ?>
</h5>
				<p> 
					<?php 
    $datePublication = new DateTime($annonce->datePublication());
    echo "Publié le : " . $datePublication->format('d-M-Y');
    ?>
Example #13
0
//include config file
include "../model/AnnonceManager.class.php";
include "../model/Annonce.class.php";
if ($_POST) {
    //sanitize post value
    $group_number = filter_var($_POST["group_no"], FILTER_SANITIZE_NUMBER_INT, FILTER_FLAG_STRIP_HIGH);
    //throw HTTP error if group number is not valid
    if (!is_numeric($group_number)) {
        header('HTTP/1.1 500 Invalid number!');
        exit;
    }
    //get current starting point of records
    $position = $group_number * $items_per_group;
    //Limit our results within a specified range.
    $results = $pdo->query("SELECT * FROM annonce ORDER BY id ASC LIMIT {$position}, {$items_per_group}");
    $annoncesManager = new AnnonceManager($pdo);
    $annonces = $annoncesManager->getAnnoncesByLimit($position, $items_per_group);
    //$mysqli->query("SELECT id,titre,prix FROM annonce ORDER BY id ASC LIMIT $position, $items_per_group");
    if ($results) {
        //output results from database
        foreach ($annonces as $annonce) {
            ?>
		<li class="span3">
		  <div class="thumbnail" style="background-color:#f5f5f5">
			<a  href="../controller/DetailAnnonceController.php?id=<?php 
            echo $annonce->id();
            ?>
"><img style="width:100px;height:100px;" src="<?php 
            echo $annonce->image();
            ?>
" alt=""></a>