//plik start.html.php w folderze templates
//to co było zamienić na
{if $typkonta=="Administrator"}<span class="delete" id="delete"><a type="button" id="{$data['id_samochod']}" class="btn btn-danger btn-xs" href="http://{$smarty.server.HTTP_HOST}{$subdir}Samochod/delete/{$data['id_samochod']}">usuń</a><span>{/if}
//plik Samochod.php w folderze Models
//zmieniamy wartość return jeśli success - bo ten numer 3 co był jest już zajęty, można to sprawdzić w Access.php - a dlaczego? bo w controlerze Samochod.php w funkcji delete odwołujesz się później do widoku Access, żeby wyświetlić stronę główną.
public function delete($id){
try
{
$stmt = $this->pdo->prepare('DELETE FROM `samochod` WHERE id_samochod=:id');
$stmt->bindValue(':id', $id, PDO::PARAM_INT);
if($stmt->execute())
return 28;
else
return 100;
}
catch(\PDOException $e)
{
echo 'Database connection error!';
exit(1);
}
}
//w pliku Access.php w folderze widok do tablicy $message dodajemy linijkę
28=>'Pomyślnie usuniętą samochód.',
//później fukcję index zmieniamy na:
public function index($result=null)
{
if(isset($result)){
if($result==28)
{
$this->set('message2', self::$messages[$result]);
}
else
{
if(array_key_exists($result, self::$messages))
$this->set('message', self::$messages[$result]);
else
$this->set('message', self::$messages[100]);
}
}
$model=$this->getModel("Samochod");
$this->set('allCars',$model->getAllSamochod());
$this->render('start');
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}