Ejemplo n.º 1
0
 public function addAds(BasicAd $ad)
 {
     if (!$this instanceof AdsStore) {
         die('Нельзя использовать этот метод в конструкторе классов');
     }
     $this->ads[$ad->getId()] = $ad;
     //var_dump($this->ads);
 }
Ejemplo n.º 2
0
if (isset($_GET["id"])) {
    if (isset($_GET["del"])) {
        $main->delete_ad($_GET["id"]);
        //$firePHP->log($temp_array, 'ads $temp_array');
        unset($_GET["id"]);
        header('Location:' . $site_dir . '/' . $current_php_script . '.php');
    }
    if (isset($_GET["edit"])) {
        $main->writeOutOne($_GET['id']);
        //$post_edit = 1;
        //$ad->edit($_GET['id']);
    }
} elseif (count($_POST)) {
    if (isset($_POST['main_form'])) {
        if ($_POST['main_form'] == 'Добавить') {
            $ad = new BasicAd($_POST);
            $ad->save();
            //var_dump($ad);
        }
    }
    $main->getAllAdsFromDb();
    $main->writeOutAll();
}
$smarty->assign('checkedPrivate', $values_for_form['checkedPrivate']);
$smarty->assign('checkedCompany', $values_for_form['checkedCompany']);
$smarty->assign('seller_name', $values_for_form['seller_name']);
$smarty->assign('email', $values_for_form['email']);
$smarty->assign('checked_allow_mails', $values_for_form['allow_mails']);
$smarty->assign('phone', $values_for_form['phone']);
$smarty->assign('selected', $selected);
$smarty->assign('cities', $cities);