Example #1
0
 public function basvuruEkleriKaydet($evrak_pk, $tableName, $posted = true, $tip = null, $aciklamaKolon = 1)
 {
     $aciklamalar = $_POST["input" . $tableName . "-" . $aciklamaKolon];
     $ekId = "ek_id_";
     $ekAd = "filename_" . $tableName . "_0_";
     $ekPath = "path_" . $tableName . "_0_";
     $updated = 0;
     for ($i = 1; isset($_POST[$ekId . $i]); $i++) {
         $inpFileName = $ekAd . $i;
         $ek_id = $_POST[$ekId . $i];
         if ($ek_id != -1) {
             if (isset($_POST[$inpFileName])) {
                 // GUNCELLE
                 $aciklama = $aciklamalar[$updated];
                 $file = $_POST[$inpFileName];
                 $path = $_POST[$ekPath . $i];
                 $normalFile = FormFactory2::getNormalFilename($file);
                 if (!FormFactory2::basvuruEkiGuncelle($ek_id, $aciklama, $path, $normalFile)) {
                     return JText::_("VERI_GUNCELLE_HATA");
                 }
                 $updated++;
             } else {
                 // SIL
                 if (!FormFactory2::basvuruEkiSil($ek_id)) {
                     return JText::_("VERI_SIL_HATA");
                 }
             }
         } else {
             //Belgelendirme Basvuru Formu (ek2) / Aradaki ekleri ekle
             if (isset($_POST[$inpFileName])) {
                 $aciklama = $aciklamalar[$updated + $j];
                 if (isset($_POST[$ekPath . ($updated + $j + 1)])) {
                     $filePath = $_POST[$ekPath . ($updated + $j + 1)];
                     $fileName = FormFactory2::getNormalFilename($_POST[$ekAd . ($updated + $j + 1)]);
                     if (is_array($tip)) {
                         $ek_tip = $tip[$updated + $j];
                     } else {
                         $ek_tip = $tip;
                     }
                     if (!FormFactory2::basvuruEkiEkle($evrak_pk, $aciklama, $fileName, $filePath, $ek_tip)) {
                         return JText::_("VERI_EKLE_HATA");
                     }
                 }
             }
             $updated++;
         }
     }
     // GERISINI EKLE
     for ($j = 0; isset($_POST["input" . $tableName . "-1"][$updated + $j]); $j++) {
         $aciklama = $aciklamalar[$updated + $j];
         if (isset($_POST[$ekPath . ($updated + $j + 1)])) {
             $filePath = $_POST[$ekPath . ($updated + $j + 1)];
             $fileName = FormFactory2::getNormalFilename($_POST[$ekAd . ($updated + $j + 1)]);
             if (is_array($tip)) {
                 $ek_tip = $tip[$updated + $j];
             } else {
                 $ek_tip = $tip;
             }
             if (!FormFactory2::basvuruEkiEkle($evrak_pk, $aciklama, $fileName, $filePath, $ek_tip)) {
                 return JText::_("VERI_EKLE_HATA");
             }
         }
     }
     return JText::_("VERI_KAYDI_BASARILI");
 }