Skip to content
Snippets Groups Projects
Tutorial.rst 52.5 KiB
Newer Older
Carsten  Rose's avatar
Carsten Rose committed
      }
    }

Since everything should be clear in this query I am not going to explain it in detail. But you should still read it and
try to understand it. Even better: try it yourself without copying my code.

Next we want that the applicant can upload his CV and his letter of motivation. Now we run into a problem:
Unfortunately we only have one row named pathFileName in the table Application. So if we want that the user can upload 1
single file, we are fine. The reason: We can save the path in the row pathFileName. Now we want that the user can upload
2 different files. A CV and the letter of motivation. So you could add a new row and call the one pathFileNameCV and the
other one pathFileNameLetterOfMotivation. But what if one day a third upload file should be handed in. For example
certificate of employment or language certificates. In this case it is a bad idea to just create a new row for every
single upload.
We will do it way more dynamic. We will create a new Table named Ggroup. In this Ggroup we are going to save all path.

To create that now Table named Ggroup paste in the following query into the SQL prompt: ::

    CREATE TABLE  `Ggroup`
    (
        `id` INTEGER NOT NULL AUTO_INCREMENT ,
        `grId` INTEGER( 11 ) ,
        `name` VARCHAR( 255 ) ,
        `value` VARCHAR( 255 ) ,
        `reference` VARCHAR( 100 ) ,
        `ord` INT( 11 ) ,
        `modified` DATETIME ,
        `created` DATETIME ,
        PRIMARY KEY `id`(`id`)
    ) ENGINE = INNODB DEFAULT CHARSET = utf8

and add the uploads to the Ggroup: ::

    INSERT INTO `Ggroup` (`id`, `grId`, `name`, `value`, `reference`, `ord`, `modified`, `created`) VALUES (NULL, NULL, NULL, NULL, 'ort_upload_cv', NULL, NULL, NULL);

and: ::

    INSERT INTO `Ggroup` (`id`, `grId`, `name`, `value`, `reference`, `ord`, `modified`, `created`) VALUES (NULL, NULL, NULL, NULL, 'ort_upload_further', NULL, NULL, NULL);

Moreover we should rename the column uploadPath to grIdUploadPath: ::

    ALTER TABLE `Application` CHANGE `uploadPath` `grIdUploadPath` INT(11) NULL DEFAULT NULL;

And additionally you have to add even a second table called Note. You can do that by pasting the following query into
the SQL prompt: ::

    CREATE TABLE  `Note`
    (
        `id` INTEGER NOT NULL AUTO_INCREMENT ,
        `aId` INTEGER( 11 ) ,
        `pId` INTEGER( 11 ) ,
        `grId` INTEGER( 11 ) ,
        `xId` INTEGER( 11 ) ,
        `value` TEXT ,
        `pathFileName` VARCHAR( 255 ) ,
        `modified` DATETIME ,
        `created` DATETIME ,
        PRIMARY KEY `id`(`id`)
    ) ENGINE = INNODB DEFAULT CHARSET = utf8



Now you have to add it to the visualisation of the database:

.. figure:: Images/DiaAddedGgroupUpload.png

Now we can create the upload form elements. For that purpose go edit the Application form and add a new FormElement of
type upload. First you should create a new pill. Call the pill Uploads and assign all upload elements to that new pill.

@@@ bug upload @@@

.. figure:: Images/FormEditorUploadCV1.png


Reviews
=======


Now we have made a tool where people can apply, we have a page where the admin can add job advertisements and addtionally
we have a page where the admin can define new admins and reviewers. Now it is time to create a page, where the reviewers
can take a look at the applications and evaluate them. So in this part we have the following goals:

1) We want to modify the JobOffers form. We want to add a new formElement where we can add reviewers to every single
job we upload. (multiple reviewers for each application possible)

2) We want to create a new form where the reviewers can chose whether the applicant is suited for the job or not. He should
be able to give a grade and a little remark (in text form). Moreover it should be possible to access the a PDF  file
of the application in the form itself.

3) This form should be accessed by a page where you have a list of all applications which are assign to you. This page
should only be accessable by reviewers. So additionally we have to create a new FE User Group named reviewer.


But before we can do all of that, we have to add some structure to the database. This time we will make big changes in
the database structre.
We don't have to add any new Tables, but we have to add new columns and additionally we have to make a few connections between
the Tables.
So our goal for now is it, to adjust the structre of the database such that:
-We can assign one (or more) Reviewer to an application
-Give the Reviewer the opportunity to add a note to the application
-Give the Reviewer the opportunity to add a grade to the application
-Give the admin of the page the opportunity to change dynamically how many grades there exists

We want to store all the information in the Table Note. In order to do that we have to extend the Table note.
Since we want to give the reviewer the opportunity to add a comment, we also have to add a column named text where the
comment will be saved in.
By pasting the following query into the SQL Prompt you the columns will be added: ::

    ALTER TABLE `Note` ADD `text` text NOT NULL AFTER `value`;


Moreover we want to add one more Ggroup link to the Node Table. We want to assign a Ggroup Record to the Note
table to uniquely tell the Note Record that the all the Records which are linked to that Ggroup Record are Reviews.
In order to do that you can paste the following query into the SQL Prompt: ::

    INSERT INTO `Ggroup` (`id`, `grId`, `name`, `value`, `reference`, `ord`, `modified`, `created`) VALUES (NULL, NULL, NULL, NULL, 'ort_review', NULL, NULL, NULL);


If it is not clear so far don't worry. I will show a picture of the datastructure and give some intuition why it makes sense:


.. figure:: Images/DiaReviewChanges.png


The problem is that we made a few connections between the table Note and the Table Ggroup and the connection between
table Note and the Table Application so far. But only in theory. We didn't actually programmed it that way. We just
visualized to ourself how the date will be saved. So now we want to program what we just visualized.

The first thing we want to happen is the following: As soon as a person applies for a job, we want that automatically
(with a afterSave record) that a new record in the Table Note is created such that all the necessary connections (with
the Ggroup Tables are created).

For that purpose we edit the form Application and add an afterSave formElement to it.


NOTIZ DER UNTERE TEIL IST FUER SPAETER. NOCH NICHT ZU BEACHTEN.


So far we created the database structure. Now we want to modify the JobOffers form such that when we add a new job offer
we automatically add the reviewers. So that when somebody applies for a job X, the reviewers which are assigned to the
job X will automatically be assigned to that specific application.
So let's do that. So go into the formEditor and edit the form "JobOffers". You have to add a new formElement.