55 "survey_id" => Number,
57 "introduction" => Text,
60 "instructions" => HTML,
62 "sender_email" => String,
64 "cc_recipients" => Text,
65 "additional_recipients" => Text,
66 "allow_anonymous_responses" => Boolean,
67 "show_preview_before_submitting" => Boolean,
69 "confirmation_message" => HTML,
83 "cc_recipients" =>
"CC Recipients",
87 "not sent" =>
"Not Sent",
100 $pk = $l_user->getPrimaryKey();
102 $authors = Query::create(
$class,
"WHERE $pk =:user_id")
103 ->bind(
":user_id", $this->
user_id)
105 return (count($authors) > 0) ? $authors[0] :
null;
110 return $this->
User();
132 $query =
"WHERE response_id IN (SELECT response_id FROM survey_response WHERE status = 'submitted' AND survey_id=:survey_id AND include_in_results=true)";
135 $query .= preg_replace(
"/WHERE/i",
" AND",
$constraint);
145 trace(
"Email survey answers constraint ". $query, 3);
147 ->bind(
":survey_id", $this->survey_id)
157 $title .= ($this->start_date > 0) ?
" – " . $this->format(
"{start_date:F d, Y}") :
"";
164 if(!$this->survey_id)
172 return ($this->
status ==
"not sent") ?
false :
true;
177 return ($this->
status ==
"open") ?
true :
false;
184 $this->
status =
"not sent";
185 $this->
user_id = $user->user_id;
191 if($this->
status ==
"open" AND $this->end_date > 0)
194 if($this->end_date <
$today)
200 return ($this->
status ==
"closed") ?
true :
false;
206 return (checkRole(
"admin,data") || $this->site_user_id ==
$user->site_user_id) ?
true :
false;
214 if($status ==
"open")
216 $this->
filter =
new InclusionFilter(
"start_date",
"end_date",
"status");
218 if($this->start_date > 0)
220 if($this->end_date > 0)
224 $this->start_date =
$today;
227 elseif($status ==
"closed")
229 $this->
filter =
new InclusionFilter(
"end_date",
"status");
244 $count = Query::create(
SurveyResponse,
"WHERE survey_id=:survey_id AND include_in_results=true")
245 ->bind(
":survey_id", $this->survey_id)
246 ->executeValue(
"COUNT(1)");
260 $count = Query::create(
SurveyResponse,
"WHERE status = 'submitted' AND survey_id=:survey_id AND include_in_results=true")
261 ->bind(
":survey_id", $this->survey_id)
262 ->executeValue(
"COUNT(1)");
274 $nonResponders = Query::create(
SurveyResponse,
"WHERE survey_id=:survey_id AND status != 'submitted' AND include_in_results=true")
275 ->bind(
":survey_id", $this->survey_id)
278 return $nonResponders;
283 if(!$this->survey_id)
286 return ($this->
status !=
"open") ?
true :
false;
291 $this->table =
"survey";
292 $this->primary_key =
"survey_id";
295 $this->pretty_class_name =
"Survey";
297 $this->DataItem(func_get_args());
Defines the relations and functions required of a Questionnaire class that uses Questionnaire form an...
static using()
Import the datamodels, views and manifest for the specified component(s).
Responses($constraint="")
Questions($constraint="ORDER BY sort_order")
getResponseCount()
Called by SurveyResultsManager.
getRecipientCount()
Called by SurveyResultsManager.
setDefaults()
Set the initial default values in the item e.g., user_id = user->user_id status = xx.
SurveyQuestionXrefs($constraint="ORDER BY sort_order")
getNonResponders()
Called by SurveyResultsManager.
Provides the interface to the user model for the application.
$table column("Redirect From", "<a href='redirect_form?redirect_id={redirect_id}'>{redirect_from}</a>", true, "width: 30%") -> column("Redirect To", "<a href='{redirect_to}' target='_blank'>{redirect_to}</a>", true, "width: 30%") ->column("Last Modified", "{last_modified}", true, "width: 20%; text-align: center") ->column("Override", "{ override true