rendered paste body<?phpclass urunler extends R_Core { public function __construct() { R_Core::__construct(); $this->resimler_klasoru = '../urunResimleri'; } public function index() { $this->eklemeFormu(); } public function duzenlemeFormu($urun_id) { session_start('urunEkleForm'); $form = new form("urunEkleForm"); $form->setAttributes(array('width'=>750, 'action'=>'urunler/ekle', 'enc-type'=>'multipart/form-data')); $form->setAttributes(array('jsIncludesPath'=>'/panel/rohanrhu-framework/php-form-builder-class/includes')); self::$db->select('kategoriler', 'id, adi'); $form->addTextBox('Ürün', 'adi'); $form->addSelect('Ürün Kategorisi', 'kategori', '', self::$db->get_2d('id', 'adi'), array('multiple'=>'multiple')); $form->addWebEditor('Ürün İçeriği', 'icerik', ''); $form->addFile('Resim', 'resim[]', array('multiple'=>'multiple')); $form->addButton('Ekle'); $form->render(); } public function eklemeFormu($urun_id=false) { /*$urunEkle_template = new R_Template('templates/urunEkle.html'); $urunEkle_template->display();*/ session_start('urunEkleForm'); $form = new form("urunEkleForm"); $form->setAttributes(array('width'=>750, 'action'=>'urunler/ekle', 'enc-type'=>'multipart/form-data')); $form->setAttributes(array('jsIncludesPath'=>'/panel/rohanrhu-framework/php-form-builder-class/includes')); self::$db->select('kategoriler', 'id, adi'); $form->addTextBox('Ürün', 'adi'); $form->addSelect('Ürün Kategorisi', 'kategori', '', self::$db->get_2d('id', 'adi'), array('multiple'=>'multiple')); $form->addWebEditor('Ürün İçeriği', 'icerik', ''); $form->addFile('Resim', 'resim[]', array('multiple'=>'multiple')); $form->addButton('Ekle'); $form->render(); } public function listele($kategori=false) { if ($kategori) { self::$db->where(array('kategori'=>(int)$kategori), 'urunler'); } self::$db->select('urunler'); $urunler = self::$db->get_array(); $liste = new R_Template(); echo '<table class="urunListesi" style="width: 100%;">'; echo '<tr class="listeBaslik"><td>Ürün Adı</td><td>Eklenme Tarihi</td><td>Düzenle</td><td>Sil</td></tr>'; foreach ($urunler as $urun) { $liste->assign($urun); $liste->display('templates/tema/urunListesi.php'); } echo '</table>'; } public function ekle() { $urun_id = self::$db->insert('urunler', array('adi'=>$_POST['adi'], 'kategori'=>(int)$_POST['kategori'][0], 'icerik'=>$_POST['icerik'], 'tarih'=>'NOW()', 'sira'=>self::$db->get_max('urunler', 'sira')+1 )); if (!$urun_id) { $this->r_error_print('Ürün eklenirken bir sorun oluştu'); } $resimler = $_FILES['resim']; for ($i=0; $i < count($resimler['name']); $i++) { if (!strstr($resimler['type'][$i], 'image')) { $this->r_error_print('<b>Desteklenmeyen dosya türü:</b> '.$resimler['name'][$i]); continue; } $resim_yukleme_sonucu = copy($resimler['tmp_name'][$i], 'c:\\wamp\\www\\panel\\urunResimleri\\'.$resimler['name'][$i]); $sonuc = self::$db->insert('resimler', array('resim'=>$resimler['name'][$i], 'parent'=>$urun_id )); } if ($sonuc) { echo "Ürün başarıyla eklendi."; } else { echo mysql_error(); } }}?>