示例#1
0
 public function Insert()
 {
     global $obj, $model;
     include_once 'Model/news.php';
     $model = new News();
     if (isset($_POST['btnSubmit'])) {
         foreach ($_POST as $key => $value) {
             try {
                 $model->{$key} = $value;
             } catch (Exception $ex) {
             }
         }
         $model->Image = $_FILES['Image']['name'];
         if ($model->Insert()) {
             if ($_FILES['Image']['name'] != "") {
                 $sp = $_FILES['Image']['tmp_name'];
                 $dp = "images/news_images/" . $model->Id . $_FILES['Image']['name'];
                 move_uploaded_file($sp, $dp);
             }
             print '<span class="success">News Created</span>';
             $model = new News();
         } else {
             print '<span class="error">' . $model->Error . '</span>';
         }
     }
     include_once 'View/News/insert.php';
 }
 public function actionInsert()
 {
     $news = new News();
     $news->title = 'BMW';
     $news->short_content = "tyuning bmw is very beautiful";
     $news->Insert();
     var_dump($news);
 }
示例#3
0
         $news_date = "";
         $news_text = "";
         $news_user_id = "";
     }
 }
 if ($action == 2) {
     $date = new Date();
     $date->SetConverted($news_date);
     $date->ConvertToFullDate();
     $news = new News();
     $news->SetDatabase($database);
     $news->SetTitle($news_title);
     $news->SetDate($date->GetDate());
     $news->SetText($news_text);
     $news->SetUser($news_user_id);
     if ($news->Insert()) {
         $message = $screen_module_name . " incluída com sucesso.";
         $news_id = "";
         $news_title = "";
         $news_date = $date->GetNowFull();
         $news_text = "";
         $news_user_id = "";
     } else {
         $message = "Problemas na operação.";
     }
 }
 if ($action == 3) {
     $date = new Date();
     $date->SetConverted($news_date);
     $date->ConvertToFullDate();
     $news = new News();