예제 #1
0
 public static function page_upload_content()
 {
     $theme = new Theme();
     if (isset($_FILES['file'])) {
         $file = new FileObject();
         if ($file->uploadFile($_FILES['file'])) {
             Notification::statusNotify(t("Le fichier a bien été uploadé."), Notification::STATUS_SUCCESS);
         } else {
             Notification::statusNotify(t("Une erreur s'est produite lors de l'upload."), Notification::STATUS_ERROR);
         }
     }
     $f = new Form("POST", Page::url("/file/upload"));
     $f->setAttribute("enctype", "multipart/form-data");
     $t = new InputElement("file", t("Fichier : "), "", "file");
     $f->addElement($t);
     $t = new InputElement("submit-file", "", t("Charger"), "submit");
     $f->addElement($t);
     $formulaire = $theme->forming($f);
     $theme->set_title("Charger un fichier");
     $theme->add_to_body($formulaire);
     $theme->process_theme(Theme::STRUCT_ADMIN);
     return;
 }
예제 #2
0
 public static function page_set_avatar()
 {
     $theme = new Theme();
     if (isset($_FILES['file'])) {
         $file = new FileObject();
         if ($id_file = $file->uploadFile($_FILES['file'])) {
             $u = User::get_user_logged();
             $u->set_avatar($id_file);
             header("location: " . Page::url("/profile"));
             return;
         } else {
             Notification::statusNotify(t("Une erreur s'est produite lors de l'upload."), Notification::STATUS_ERROR);
         }
     }
     $f = new Form("POST", Page::url("/profile/settings/avatar"));
     $f->setAttribute("enctype", "multipart/form-data");
     $t = new InputElement("file", t("Fichier : "), "", "file");
     $f->addElement($t);
     $t = new InputElement("submit-file", "", t("Charger"), "submit");
     $f->addElement($t);
     $formulaire = $theme->forming($f);
     $theme->set_title("Changer mon avatar");
     $theme->add_to_body($formulaire);
     $theme->process_theme(Theme::STRUCT_ADMIN);
     return;
 }