how to make a simple star notation in symfony 3
Good evening, I try to allow patients to note the doctors they consulted, so that after the search for doctors, the most noticeable appear first. But here I do not know how to do it too much. And in the first place I added a voting attribute to my entity.
Entity
class Medecin
/**
* @var int
*
* @ORMColumn(name="id", type="integer")
* @ORMId
* @ORMGeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORMColumn(name="sexe", type="string", length=40)
*/
public $sexe;
/**
* @var int
*
* @ORMColumn(name="note", type="integer")
*/
private $note = 0;
and here is my twig file where I display the doctor's data with the stars as well:
Twig
<span class="rating">
% for i in 1..5 %
<i class="icon_star medecin.note >= (i * 20) ? 'voted' : ''"></i>
% endfor %
| <small> <strong> medecin.note </strong></small>
</span>
CSS
.rating i
color: #ddd;
font-size: 13px;
font-size: 0.8125rem;
.rating i.voted
color: #FFC107;
.rating small
margin-bottom: 0;
display: inline-block;
font-size: 12px;
font-size: 0.75rem;
.rating small a
color: #999;
text-decoration: underline;
My problem is that when I fly over the stars no action happens. And then how to record the vote, when the patient clicks on the number of votes, and that his vote is recorded to the affiliated doctor ?
Thanks
javascript symfony rating-system
add a comment |
Good evening, I try to allow patients to note the doctors they consulted, so that after the search for doctors, the most noticeable appear first. But here I do not know how to do it too much. And in the first place I added a voting attribute to my entity.
Entity
class Medecin
/**
* @var int
*
* @ORMColumn(name="id", type="integer")
* @ORMId
* @ORMGeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORMColumn(name="sexe", type="string", length=40)
*/
public $sexe;
/**
* @var int
*
* @ORMColumn(name="note", type="integer")
*/
private $note = 0;
and here is my twig file where I display the doctor's data with the stars as well:
Twig
<span class="rating">
% for i in 1..5 %
<i class="icon_star medecin.note >= (i * 20) ? 'voted' : ''"></i>
% endfor %
| <small> <strong> medecin.note </strong></small>
</span>
CSS
.rating i
color: #ddd;
font-size: 13px;
font-size: 0.8125rem;
.rating i.voted
color: #FFC107;
.rating small
margin-bottom: 0;
display: inline-block;
font-size: 12px;
font-size: 0.75rem;
.rating small a
color: #999;
text-decoration: underline;
My problem is that when I fly over the stars no action happens. And then how to record the vote, when the patient clicks on the number of votes, and that his vote is recorded to the affiliated doctor ?
Thanks
javascript symfony rating-system
1) a doctor can receive many ratings from many users, so you need to somehow save all those ratings in a seprate db table linked to doctro_id. 2) Then display average rating for each doctor 3) ratings should have aditional input fields in case a user (that has not yet rated the current doctor) whishes to rate her
– Nikos M.
Nov 15 '18 at 19:25
please consider accepting & up-voting my answer if helped you
– Trix
Nov 30 '18 at 19:42
add a comment |
Good evening, I try to allow patients to note the doctors they consulted, so that after the search for doctors, the most noticeable appear first. But here I do not know how to do it too much. And in the first place I added a voting attribute to my entity.
Entity
class Medecin
/**
* @var int
*
* @ORMColumn(name="id", type="integer")
* @ORMId
* @ORMGeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORMColumn(name="sexe", type="string", length=40)
*/
public $sexe;
/**
* @var int
*
* @ORMColumn(name="note", type="integer")
*/
private $note = 0;
and here is my twig file where I display the doctor's data with the stars as well:
Twig
<span class="rating">
% for i in 1..5 %
<i class="icon_star medecin.note >= (i * 20) ? 'voted' : ''"></i>
% endfor %
| <small> <strong> medecin.note </strong></small>
</span>
CSS
.rating i
color: #ddd;
font-size: 13px;
font-size: 0.8125rem;
.rating i.voted
color: #FFC107;
.rating small
margin-bottom: 0;
display: inline-block;
font-size: 12px;
font-size: 0.75rem;
.rating small a
color: #999;
text-decoration: underline;
My problem is that when I fly over the stars no action happens. And then how to record the vote, when the patient clicks on the number of votes, and that his vote is recorded to the affiliated doctor ?
Thanks
javascript symfony rating-system
Good evening, I try to allow patients to note the doctors they consulted, so that after the search for doctors, the most noticeable appear first. But here I do not know how to do it too much. And in the first place I added a voting attribute to my entity.
Entity
class Medecin
/**
* @var int
*
* @ORMColumn(name="id", type="integer")
* @ORMId
* @ORMGeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORMColumn(name="sexe", type="string", length=40)
*/
public $sexe;
/**
* @var int
*
* @ORMColumn(name="note", type="integer")
*/
private $note = 0;
and here is my twig file where I display the doctor's data with the stars as well:
Twig
<span class="rating">
% for i in 1..5 %
<i class="icon_star medecin.note >= (i * 20) ? 'voted' : ''"></i>
% endfor %
| <small> <strong> medecin.note </strong></small>
</span>
CSS
.rating i
color: #ddd;
font-size: 13px;
font-size: 0.8125rem;
.rating i.voted
color: #FFC107;
.rating small
margin-bottom: 0;
display: inline-block;
font-size: 12px;
font-size: 0.75rem;
.rating small a
color: #999;
text-decoration: underline;
My problem is that when I fly over the stars no action happens. And then how to record the vote, when the patient clicks on the number of votes, and that his vote is recorded to the affiliated doctor ?
Thanks
.rating i
color: #ddd;
font-size: 13px;
font-size: 0.8125rem;
.rating i.voted
color: #FFC107;
.rating small
margin-bottom: 0;
display: inline-block;
font-size: 12px;
font-size: 0.75rem;
.rating small a
color: #999;
text-decoration: underline;
.rating i
color: #ddd;
font-size: 13px;
font-size: 0.8125rem;
.rating i.voted
color: #FFC107;
.rating small
margin-bottom: 0;
display: inline-block;
font-size: 12px;
font-size: 0.75rem;
.rating small a
color: #999;
text-decoration: underline;
javascript symfony rating-system
javascript symfony rating-system
asked Nov 15 '18 at 19:06
Mohamed SackoMohamed Sacko
599
599
1) a doctor can receive many ratings from many users, so you need to somehow save all those ratings in a seprate db table linked to doctro_id. 2) Then display average rating for each doctor 3) ratings should have aditional input fields in case a user (that has not yet rated the current doctor) whishes to rate her
– Nikos M.
Nov 15 '18 at 19:25
please consider accepting & up-voting my answer if helped you
– Trix
Nov 30 '18 at 19:42
add a comment |
1) a doctor can receive many ratings from many users, so you need to somehow save all those ratings in a seprate db table linked to doctro_id. 2) Then display average rating for each doctor 3) ratings should have aditional input fields in case a user (that has not yet rated the current doctor) whishes to rate her
– Nikos M.
Nov 15 '18 at 19:25
please consider accepting & up-voting my answer if helped you
– Trix
Nov 30 '18 at 19:42
1) a doctor can receive many ratings from many users, so you need to somehow save all those ratings in a seprate db table linked to doctro_id. 2) Then display average rating for each doctor 3) ratings should have aditional input fields in case a user (that has not yet rated the current doctor) whishes to rate her
– Nikos M.
Nov 15 '18 at 19:25
1) a doctor can receive many ratings from many users, so you need to somehow save all those ratings in a seprate db table linked to doctro_id. 2) Then display average rating for each doctor 3) ratings should have aditional input fields in case a user (that has not yet rated the current doctor) whishes to rate her
– Nikos M.
Nov 15 '18 at 19:25
please consider accepting & up-voting my answer if helped you
– Trix
Nov 30 '18 at 19:42
please consider accepting & up-voting my answer if helped you
– Trix
Nov 30 '18 at 19:42
add a comment |
1 Answer
1
active
oldest
votes
Please code in English, not french nor Dutch, or Chinese. Choose English for your code base.
You need to have a Rating entity:
Doctor
class Doctor
// ...
/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“doctor”)
*/
protected $ratings;
// ...
Rating
class Rating
// ...
/**
* @ORMColumn(type=“integer”, name=“value”)
*/
protected $value;
/**
* @ORMManyToOne(targetEntity=“Doctor”, inversedBy=“ratings”)
*/
protected $doctor;
/**
* @ORMManyToOne(targetEntity=“Patient”, inversedBy=“ratings”)
*/
protected $patient;
// ...
Patient
class Patient
// ...
/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“patient”, cascade=“persist”, “remove”)
*/
protected $ratings;
// ...
Hi, @Trix sorry for my late. I applied your recommendations, And now how to save the vote, when the patient clicks on the number of votes. And I would like to know, it's not anyone who has to click on the stars to vote, it has to be a patient ? Thanks
– Mohamed Sacko
Nov 16 '18 at 12:49
please ask separate questions for separate things to help questions and answers more useful to other users. I can not understand your English well, but if you have problem with Patient, replace it with User. you may share your Domain Model if you have detailed questions about that
– Trix
Nov 16 '18 at 12:59
Sorry @Trix for my English. But you said I'll need the Rating entity. I did it and now what's next. Knowing that the goal is to allow a patient to note a doctor. Please help me.Thanks
– Mohamed Sacko
Nov 16 '18 at 15:11
you should put your RatingType form in doctor profile and process it in your DoctorController
– Trix
Nov 16 '18 at 15:15
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53326346%2fhow-to-make-a-simple-star-notation-in-symfony-3%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Please code in English, not french nor Dutch, or Chinese. Choose English for your code base.
You need to have a Rating entity:
Doctor
class Doctor
// ...
/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“doctor”)
*/
protected $ratings;
// ...
Rating
class Rating
// ...
/**
* @ORMColumn(type=“integer”, name=“value”)
*/
protected $value;
/**
* @ORMManyToOne(targetEntity=“Doctor”, inversedBy=“ratings”)
*/
protected $doctor;
/**
* @ORMManyToOne(targetEntity=“Patient”, inversedBy=“ratings”)
*/
protected $patient;
// ...
Patient
class Patient
// ...
/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“patient”, cascade=“persist”, “remove”)
*/
protected $ratings;
// ...
Hi, @Trix sorry for my late. I applied your recommendations, And now how to save the vote, when the patient clicks on the number of votes. And I would like to know, it's not anyone who has to click on the stars to vote, it has to be a patient ? Thanks
– Mohamed Sacko
Nov 16 '18 at 12:49
please ask separate questions for separate things to help questions and answers more useful to other users. I can not understand your English well, but if you have problem with Patient, replace it with User. you may share your Domain Model if you have detailed questions about that
– Trix
Nov 16 '18 at 12:59
Sorry @Trix for my English. But you said I'll need the Rating entity. I did it and now what's next. Knowing that the goal is to allow a patient to note a doctor. Please help me.Thanks
– Mohamed Sacko
Nov 16 '18 at 15:11
you should put your RatingType form in doctor profile and process it in your DoctorController
– Trix
Nov 16 '18 at 15:15
add a comment |
Please code in English, not french nor Dutch, or Chinese. Choose English for your code base.
You need to have a Rating entity:
Doctor
class Doctor
// ...
/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“doctor”)
*/
protected $ratings;
// ...
Rating
class Rating
// ...
/**
* @ORMColumn(type=“integer”, name=“value”)
*/
protected $value;
/**
* @ORMManyToOne(targetEntity=“Doctor”, inversedBy=“ratings”)
*/
protected $doctor;
/**
* @ORMManyToOne(targetEntity=“Patient”, inversedBy=“ratings”)
*/
protected $patient;
// ...
Patient
class Patient
// ...
/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“patient”, cascade=“persist”, “remove”)
*/
protected $ratings;
// ...
Hi, @Trix sorry for my late. I applied your recommendations, And now how to save the vote, when the patient clicks on the number of votes. And I would like to know, it's not anyone who has to click on the stars to vote, it has to be a patient ? Thanks
– Mohamed Sacko
Nov 16 '18 at 12:49
please ask separate questions for separate things to help questions and answers more useful to other users. I can not understand your English well, but if you have problem with Patient, replace it with User. you may share your Domain Model if you have detailed questions about that
– Trix
Nov 16 '18 at 12:59
Sorry @Trix for my English. But you said I'll need the Rating entity. I did it and now what's next. Knowing that the goal is to allow a patient to note a doctor. Please help me.Thanks
– Mohamed Sacko
Nov 16 '18 at 15:11
you should put your RatingType form in doctor profile and process it in your DoctorController
– Trix
Nov 16 '18 at 15:15
add a comment |
Please code in English, not french nor Dutch, or Chinese. Choose English for your code base.
You need to have a Rating entity:
Doctor
class Doctor
// ...
/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“doctor”)
*/
protected $ratings;
// ...
Rating
class Rating
// ...
/**
* @ORMColumn(type=“integer”, name=“value”)
*/
protected $value;
/**
* @ORMManyToOne(targetEntity=“Doctor”, inversedBy=“ratings”)
*/
protected $doctor;
/**
* @ORMManyToOne(targetEntity=“Patient”, inversedBy=“ratings”)
*/
protected $patient;
// ...
Patient
class Patient
// ...
/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“patient”, cascade=“persist”, “remove”)
*/
protected $ratings;
// ...
Please code in English, not french nor Dutch, or Chinese. Choose English for your code base.
You need to have a Rating entity:
Doctor
class Doctor
// ...
/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“doctor”)
*/
protected $ratings;
// ...
Rating
class Rating
// ...
/**
* @ORMColumn(type=“integer”, name=“value”)
*/
protected $value;
/**
* @ORMManyToOne(targetEntity=“Doctor”, inversedBy=“ratings”)
*/
protected $doctor;
/**
* @ORMManyToOne(targetEntity=“Patient”, inversedBy=“ratings”)
*/
protected $patient;
// ...
Patient
class Patient
// ...
/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“patient”, cascade=“persist”, “remove”)
*/
protected $ratings;
// ...
answered Nov 15 '18 at 21:22
TrixTrix
10.2k85175
10.2k85175
Hi, @Trix sorry for my late. I applied your recommendations, And now how to save the vote, when the patient clicks on the number of votes. And I would like to know, it's not anyone who has to click on the stars to vote, it has to be a patient ? Thanks
– Mohamed Sacko
Nov 16 '18 at 12:49
please ask separate questions for separate things to help questions and answers more useful to other users. I can not understand your English well, but if you have problem with Patient, replace it with User. you may share your Domain Model if you have detailed questions about that
– Trix
Nov 16 '18 at 12:59
Sorry @Trix for my English. But you said I'll need the Rating entity. I did it and now what's next. Knowing that the goal is to allow a patient to note a doctor. Please help me.Thanks
– Mohamed Sacko
Nov 16 '18 at 15:11
you should put your RatingType form in doctor profile and process it in your DoctorController
– Trix
Nov 16 '18 at 15:15
add a comment |
Hi, @Trix sorry for my late. I applied your recommendations, And now how to save the vote, when the patient clicks on the number of votes. And I would like to know, it's not anyone who has to click on the stars to vote, it has to be a patient ? Thanks
– Mohamed Sacko
Nov 16 '18 at 12:49
please ask separate questions for separate things to help questions and answers more useful to other users. I can not understand your English well, but if you have problem with Patient, replace it with User. you may share your Domain Model if you have detailed questions about that
– Trix
Nov 16 '18 at 12:59
Sorry @Trix for my English. But you said I'll need the Rating entity. I did it and now what's next. Knowing that the goal is to allow a patient to note a doctor. Please help me.Thanks
– Mohamed Sacko
Nov 16 '18 at 15:11
you should put your RatingType form in doctor profile and process it in your DoctorController
– Trix
Nov 16 '18 at 15:15
Hi, @Trix sorry for my late. I applied your recommendations, And now how to save the vote, when the patient clicks on the number of votes. And I would like to know, it's not anyone who has to click on the stars to vote, it has to be a patient ? Thanks
– Mohamed Sacko
Nov 16 '18 at 12:49
Hi, @Trix sorry for my late. I applied your recommendations, And now how to save the vote, when the patient clicks on the number of votes. And I would like to know, it's not anyone who has to click on the stars to vote, it has to be a patient ? Thanks
– Mohamed Sacko
Nov 16 '18 at 12:49
please ask separate questions for separate things to help questions and answers more useful to other users. I can not understand your English well, but if you have problem with Patient, replace it with User. you may share your Domain Model if you have detailed questions about that
– Trix
Nov 16 '18 at 12:59
please ask separate questions for separate things to help questions and answers more useful to other users. I can not understand your English well, but if you have problem with Patient, replace it with User. you may share your Domain Model if you have detailed questions about that
– Trix
Nov 16 '18 at 12:59
Sorry @Trix for my English. But you said I'll need the Rating entity. I did it and now what's next. Knowing that the goal is to allow a patient to note a doctor. Please help me.Thanks
– Mohamed Sacko
Nov 16 '18 at 15:11
Sorry @Trix for my English. But you said I'll need the Rating entity. I did it and now what's next. Knowing that the goal is to allow a patient to note a doctor. Please help me.Thanks
– Mohamed Sacko
Nov 16 '18 at 15:11
you should put your RatingType form in doctor profile and process it in your DoctorController
– Trix
Nov 16 '18 at 15:15
you should put your RatingType form in doctor profile and process it in your DoctorController
– Trix
Nov 16 '18 at 15:15
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53326346%2fhow-to-make-a-simple-star-notation-in-symfony-3%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1) a doctor can receive many ratings from many users, so you need to somehow save all those ratings in a seprate db table linked to doctro_id. 2) Then display average rating for each doctor 3) ratings should have aditional input fields in case a user (that has not yet rated the current doctor) whishes to rate her
– Nikos M.
Nov 15 '18 at 19:25
please consider accepting & up-voting my answer if helped you
– Trix
Nov 30 '18 at 19:42