Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev Implemented first renderable questions.
- Loading branch information
Showing
10 changed files
with
479 additions
and
476 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: sam | ||
* Date: 8/21/15 | ||
* Time: 10:13 AM | ||
*/ | ||
|
||
namespace ls\models\questions; | ||
|
||
|
||
use ls\interfaces\iRenderable; | ||
|
||
class HugeTextQuestion extends LongTextQuestion implements iRenderable | ||
{ | ||
/** | ||
* This function renders the object. | ||
* It MUST NOT produce any output. | ||
* It should return a string or an object that can be converted to string. | ||
* @param Response $response | ||
* @param \SurveySession $session | ||
* @return string | ||
*/ | ||
public function render(\Response $response, \SurveySession $session) | ||
{ | ||
if (!isset($this->text_input_width)) { | ||
$this->text_input_width = 70; | ||
} | ||
|
||
if (!isset($this->display_rows)) { | ||
$this->display_rows = 70; | ||
} | ||
return parent::render($response, $session); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: sam | ||
* Date: 8/21/15 | ||
* Time: 10:15 AM | ||
*/ | ||
|
||
namespace ls\models\questions; | ||
|
||
|
||
use ls\interfaces\iRenderable; | ||
|
||
class LongTextQuestion extends TextQuestion implements iRenderable | ||
{ | ||
/** | ||
* This function renders the object. | ||
* It MUST NOT produce any output. | ||
* It should return a string or an object that can be converted to string. | ||
* @param Response $response | ||
* @param \SurveySession $session | ||
* @return string | ||
*/ | ||
public function render(\Response $response, \SurveySession $session) | ||
{ | ||
$classes = ['question', 'answer-item', 'text-item']; | ||
if ($this->maximum_chars > 0 ) | ||
{ | ||
// Only maxlength attribute, use textarea[maxlength] jquery selector for textarea | ||
$maxlength= "maxlength='{$this->maximum_chars}' "; | ||
$classes[] = "maxchars"; | ||
$classes[] = "maxchars-" . $this->maximum_chars; | ||
} | ||
|
||
$rows = isset($this->display_rows) ? $this->display_rows : 5; | ||
|
||
if (isset($this->text_input_width)) { | ||
$classes[] = "inputwidth-" . $this->text_input_width; | ||
$width = $this->text_input_width; | ||
} else { | ||
$width = 40; | ||
} | ||
|
||
$html = \TbHtml::tag('p', ['class' => implode(' ', $classes)], | ||
\TbHtml::label(gT('Your answer'), "answer{$this->sgqa}") | ||
. \TbHtml::textArea($this->sgqa, $response->{$this->sgqa}, [ | ||
'class' => 'textarea', | ||
'rows' => $rows, | ||
'cols' => $width, | ||
'maxlength' => isset($this->maximum_chars) ? $this->maximum_chars : 0, | ||
'id' => "answer{$this->sgqa}" | ||
|
||
]) | ||
); | ||
|
||
return $html; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters