A web-based flash-card learning tool based on PHP,Doctrine and Smarty
PHP Other
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
controller fixes Jan 22, 2013
css css Jan 21, 2013
exampleCards blubb Jan 22, 2013
js Fix: links are deleted properly Jan 22, 2013
lib idiot Jan 16, 2013
manager json im/export Jan 18, 2013
model better statistics Jan 22, 2013
nbproject cleanup and tags can be deleted Jan 8, 2013
view blubb Jan 22, 2013
.gitignore cleanup and tags can be deleted Jan 8, 2013
README fix Jan 22, 2013
bootstrap.php fixes Jan 17, 2013
exampleData.php also save resized elements Jan 17, 2013
index.php codierung Jan 16, 2013


======= LearnFlash =============
===== Copyright 2013 by:   =====
=== * Lidia Lang           =====
=== * Francis Engelmann    =====
=== * Thomas Oster         =====
=== * Gildas Tambo         =====
=== * Tuan Dung Nguyen     =====

* A live demo can be seen here:
  username and password "test"
* The easiest way is to install NetBeans
  with PHP support, configure PHP to
  use pdo_sqlite (php.ini) and run
  the project with NetBeans internal
* You will need PHP >= 5.3 with enabled
  pdo_sqlite extension
* The "tmp" folder in the application root
  has to be writable from the webserver.
  it will be created if it does not exist
  and filled with example content
* An example user with username and password
  "test" will be created everytime the tmp
  folder is deleted.

The Application consists of Controllers
with Actions. Each request references
exactly one Controller/Action pair with
an arbitrary number of Parameters.

---- bootstrap.php ------
The bootstrap.php sets up the used Libraries,
namely Doctrine for Database-Access and
Smarty as Template engine.

---- index.php ----------
The index.php then extracts the important
variables from the request: $controller (name
of the controller) $action (name of the action)
and $ajax (true if request is done via jQuery Ajax.

Then it instanciates the class in the "controller"
folder which has the same name like the $controller

If the controller has a method called load$action,
index.php tries to fill all parameters of this
methods from the GET and POST parameters (and the
$ajax variable) and calls that method.

If the method did not call the dontRender() method,
after running, index.php will look for a template
called "view/$controller/$action.tpl" and
call Smarty to display that template.

---- workflow ----------
The usual workflow: A controller's action
method is used, to call some Managers (classes
from the "managers" folder) to provide information
for the template with the assignToView() method.
The Managers interact with Doctrine in order to
read and write in the Database.
In the template, all objects the controller assigned
are available for creating the display HTML.

If an action is for writing in the database,
it usually does this and then calls "redirect", which
outputs a redirect-header to the browser and then
calls dontRender(), so no templates exist for
such mehtods.

---- ajax ------------
in order to re-use the templates and not specify
html once in PHP and once again in JavaScript,
dynamic pages usually load content also via 
calling a controller's load$action mehtod.
The templates in this case don't inerhit from
main.tpl (which contains the whole site structure)
but only include the HTML for the to-load content.
The advantage is, that the very same template can
be used in other templates via {include}, so that
the HTML is the same, no matter if prefilled on
the initial request or re-loaded via ajax.

If you have problems or quesions, please contact: