design patterns - How to implement use case controller in a php(and javascript) project -



design patterns - How to implement use case controller in a php(and javascript) project -

i'm beginner in php , design patterns. i'm having problem implementing utilize case controller in application containing javascript , php. i'm trying create project of pupil profile manager. have utilize case of "upload marks" in teacher uploads students' marks of particular section. , have assigned responsibility of scheme operations in utilize case class named uploadmarkseventhandler. have mentioned methods , attributes , not supposed produce output yet. here code: class uploadmarkshandler{ private $section; private $central_storage; private $students = array(); private $cookie_name; private isselectsection = false; function __construct(){ } function login($teacher_id, $password){ $password_temp=$this.centr/al_storage.getteacherpassword($teacher_id); if($password_temp==$password){ //set cookies setcookie($teacher_id, $password, time()+(60), "/"); } else{ echo "incorrect password"; } } function selectsection($section){ //check cookies $this->section=$this->central_storage.getsection($section); $this->is_section_selected=true; $this->students=$this->central_storage.getstudents($this->section); } function uploadmarks($student_id, $marks){ //check cookies } function display_students(){ //check cookies //display $this->students } function endusecase(){ //logout //destroy central storage object //destroy section object //destroy students object //destroy object } } ?>

the above code application logic layer. user ui layer perform operations such login($teacher_id, $password), uploadmarks($student_id, $marks), e.t.c. , each of these operations given responsibilities controller class uploadmarkshandler. problem is, user generate operations ui layer, i'm planning code in jquery. suppose user presses button on browser, named "upload marks". utilize ajax create uploadmarkshandler object. in file main.php used purpose of mapping ui layer onto application logic layer.

$upload_marks = new uploadmarkshandler(); //this in main.php, called through ajax

after instantiating $upload_marks object responsible handling "upload marks" utilize case, application should hear next scheme operation in ui layer. suppose user presses button named "login". when command moves server-side client-side, $upload_marks object deleted , hence state lost.

i have searched applying mvc , controller in php found no luck regarding problem. should utilize mvc framework? help appreciated.

suppose user presses button named "login". when command moves server-side client-side, $upload_marks object deleted , hence state lost.

when user triggers uploadmarks event, create object tracks state of workflow. @ end of request, persist current state of workflow database. whenever user clicks on uploadmarks again, fetch state , resume workflow.

i have searched applying mvc , controller in php found no luck regarding problem. should utilize mvc framework?

the best advice can give mvc not worry it. mvc has gotten lot of undue attending on recent years. got hyped holy grail when it's tiny detail in app.

php design-patterns controller ooad grasp

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -