62 lines
2.1 KiB
Swift
62 lines
2.1 KiB
Swift
//
|
|
// StudentTableViewController.swift
|
|
// SchoolList8
|
|
//
|
|
// Created by Quentin Millardet on 14/10/2020.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class LightshowDownloadView: UITableViewController{
|
|
|
|
var model:LightshowModel?
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
model = (UIApplication.shared.delegate as! AppDelegate).model
|
|
}
|
|
|
|
// Return the number of rows for the table.
|
|
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
return model!.getStudentCount()
|
|
}
|
|
|
|
// Provide a cell object for each row.
|
|
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
// Fetch a cell of the appropriate type.
|
|
let cell = tableView.dequeueReusableCell(withIdentifier: "lightshowDownloadCell")
|
|
let model = model?.getStudentAtIndex(indexPath.row);
|
|
|
|
let isOk : Bool = model?.isOkFiles() ?? false;
|
|
|
|
(cell as! LightshowDownloadCell).LightshowName.text = model?.name
|
|
(cell as! LightshowDownloadCell).warningMessage.isHidden = isOk;
|
|
var alertText = ""
|
|
if (!isOk){
|
|
alertText = "(Le fichcier mp3 ou fseq n'a pas été reconnu)"
|
|
}
|
|
(cell as! LightshowDownloadCell).alertLabel.text = alertText
|
|
return cell!
|
|
}
|
|
|
|
|
|
// Permet de passer des informations à une vue avant que celle-ci ne soit créee
|
|
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
|
|
|
}
|
|
|
|
@IBAction func unwindFromCancel(_ unwindSegue: UIStoryboardSegue) {
|
|
//let sourceViewController : EditController = unwindSegue.source as! EditController
|
|
//NSLog(sourceViewController.nameField.text!)
|
|
// Use data from the view controller which initiated the unwind segue
|
|
}
|
|
|
|
@IBAction func unwindFromOk(_ unwindSegue: UIStoryboardSegue) {
|
|
//let sourceViewController : EditController = unwindSegue.source as! EditController
|
|
let newName : String = "sourceViewController.nameField.text!"
|
|
let row : Int = 1;
|
|
model?.setStudentAtIndex(row , withdraw: newName)
|
|
tableView.reloadData()
|
|
}
|
|
}
|