-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev Enabled plugin output in survey completion page.
- Loading branch information
Showing
23 changed files
with
399 additions
and
202 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
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,61 @@ | ||
<?php | ||
|
||
/** | ||
* @todo Add proper security for this controller. | ||
*/ | ||
|
||
class QuestionsController extends LSYii_Controller | ||
{ | ||
/** | ||
* Creates a new question object. | ||
*/ | ||
public function actionCreate() | ||
{ | ||
$question = new Questions(); | ||
|
||
|
||
if ($_POST['position'] == 'last') | ||
{ | ||
$cmd = App()->db->createCommand(); | ||
$cmd->select(array('max(question_order) as max')); | ||
$cmd->from(Questions::model()->tableName()); | ||
$cmd->where('sid = :sid', array('sid' =>$_POST['sid'])); | ||
$maxPosition = intval($cmd->queryScalar()); | ||
$question->question_order = $maxPosition + 1; | ||
} | ||
elseif ($_POST['position'] == 'first') | ||
{ | ||
// We save the new question with order 0. | ||
// After saving we will increase all ordering numbers by 1. | ||
$question->question_order = 0; | ||
} | ||
else | ||
{ | ||
$question->question_order = intval($_POST['position']) + 1; | ||
} | ||
|
||
$question->title = $_POST['title']; | ||
$question->relevance = $_POST['relevance']; | ||
$question->questiontype_id = $_POST['type']; | ||
$question->sid = $_POST['sid']; | ||
$question->gid = $_POST['gid']; | ||
|
||
|
||
$attributes = $_POST; | ||
unset($attributes['sid'], $attributes['gid'], $attributes['relevance'], $attributes['type'], $attributes['title'], $attributes['position']); | ||
if (true || $question->save()) | ||
{ | ||
// @var $question iQuestion | ||
|
||
echo '<pre>'; | ||
$questionObject = tidToQuestion($_POST['type']); | ||
$questionObject->saveAttributes($question->qid, $attributes); | ||
//$question->save(); | ||
|
||
echo '</pre>'; | ||
die(); | ||
} | ||
} | ||
} | ||
|
||
?> |
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
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,41 @@ | ||
<?php | ||
/** | ||
* This file will scan all files in the project and output an array with event names. | ||
*/ | ||
$basePath = dirname(dirname(dirname(__FILE__))); | ||
|
||
$i = new RecursiveDirectoryIterator($basePath); | ||
$i2 = new RecursiveIteratorIterator($i); | ||
$events = array(); | ||
|
||
|
||
foreach ($i2 as $file) | ||
{ | ||
/* @var $file SplFileInfo */ | ||
|
||
|
||
if (substr($file->getFileName(), -3, 3) == 'php') | ||
{ | ||
scanFile($file->getPathname()); | ||
} | ||
} | ||
|
||
$events = array_unique($events); | ||
sort($events); | ||
print_r($events); | ||
|
||
function scanFile($fileName) | ||
{ | ||
global $events; | ||
$contents = file_get_contents($fileName); | ||
|
||
$regex = '/(\$[[:alnum:]]*)[[:space:]]*=[[:space:]]*new[[:space:]]*PluginEvent[[:space:]]*\([[:space:]]*[\'"]+(.*)[\'"]+/'; | ||
|
||
$count = preg_match_all($regex, $contents, $matches); | ||
if ($count > 0) | ||
{ | ||
$events = array_merge($events, $matches[2]); | ||
} | ||
} | ||
|
||
?> |
Oops, something went wrong.