Exemple #1
0
     /**
      * get the user name from post
      */
     if (empty($_POST['Sefer_Name'])) {
         $errors[] = "sefer should be filled";
     } else {
         $sefer_name = $_POST['Sefer_Name'];
     }
     if (empty($_POST["Sefer_Name_Amharic"])) {
         $errors[] = "Sefer name in amharic should be filled";
     } else {
         $sefer_name_amharic = $_POST['Sefer_Name_Amharic'];
     }
     if (empty($errors)) {
         $sefer = new Sefer($sefer_name, $sefer_name_amharic);
         if ($encoder_con->Sefer_Exists($sefer)) {
             encoder_place_redirect(Error_Type::SAME_USER_NAME);
         }
         $added = $encoder_con->Add_Sefer($sefer);
         /**
          * inform the encoder about the result
          */
         if ($added) {
             encoder_redirect_success($sefer);
         } else {
             encoder_place_redirect(Error_Type::DATA_BASE);
         }
     } else {
         encoder_place_redirect(Error_Type::FORM);
     }
 }