本文整理匯總了PHP中ilTemplate::addJavascript方法的典型用法代碼示例。如果您正苦於以下問題:PHP ilTemplate::addJavascript方法的具體用法?PHP ilTemplate::addJavascript怎麽用?PHP ilTemplate::addJavascript使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ilTemplate
的用法示例。
在下文中一共展示了ilTemplate::addJavascript方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: showFormCmd
private function showFormCmd(ilPropertyFormGUI $form = null)
{
$this->tpl->addJavascript("./Services/JavaScript/js/Basic.js");
if ($form === null) {
$form = $this->buildForm();
}
$formHTML = $this->ctrl->getHTML($form);
$msgHTML = $this->getSettingsTemplateMessageHTML();
$this->tpl->setContent($formHTML . $msgHTML);
}
示例2: buildAdjustQuestionForm
/**
* @param $question_id
* @param $question_pool_id
*
* @return ilPropertyFormGUI
*/
protected function buildAdjustQuestionForm($question_id, $question_pool_id)
{
require_once './Services/Form/classes/class.ilPropertyFormGUI.php';
require_once './Modules/TestQuestionPool/classes/class.assQuestion.php';
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setMultipart(FALSE);
$form->setTableWidth("100%");
$form->setId("adjustment");
/** @var $question assQuestionGUI|ilGuiQuestionScoringAdjustable|ilGuiAnswerScoringAdjustable */
$question = assQuestion::instantiateQuestionGUI($question_id);
$form->setTitle($question->object->getTitle() . '<br /><small>(' . $question->outQuestionType() . ')</small>');
$hidden_question_id = new ilHiddenInputGUI('q_id');
$hidden_question_id->setValue($question_id);
$form->addItem($hidden_question_id);
$hidden_qpl_id = new ilHiddenInputGUI('qpl_id');
$hidden_qpl_id->setValue($question_pool_id);
$form->addItem($hidden_qpl_id);
$this->populateScoringAdjustments($question, $form);
$manscoring_section = new ilFormSectionHeaderGUI();
$manscoring_section->setTitle($this->lng->txt('manscoring'));
$form->addItem($manscoring_section);
$manscoring_preservation = new ilCheckboxInputGUI($this->lng->txt('preserve_manscoring'), 'preserve_manscoring');
$manscoring_preservation->setChecked(true);
$manscoring_preservation->setInfo($this->lng->txt('preserve_manscoring_info'));
$form->addItem($manscoring_preservation);
$form->addCommandButton("savescoringfortest", $this->lng->txt("save"));
$participants = $this->object->getParticipants();
$active_ids = array_keys($participants);
$results = array();
foreach ($active_ids as $active_id) {
$passes[] = $this->object->_getPass($active_id);
foreach ($passes as $key => $pass) {
for ($i = 0; $i <= $pass; $i++) {
$results[] = $question->object->getSolutionValues($active_id, $i);
}
}
}
$relevant_answers = array();
foreach ($results as $result) {
foreach ($result as $answer) {
if ($answer['question_fi'] == $question->object->getId()) {
$relevant_answers[] = $answer;
}
}
}
$answers_view = $question->getAggregatedAnswersView($relevant_answers);
include_once 'Services/jQuery/classes/class.iljQueryUtil.php';
iljQueryUtil::initjQuery();
include_once 'Services/YUI/classes/class.ilYuiUtil.php';
ilYuiUtil::initPanel();
ilYuiUtil::initOverlay();
$this->tpl->addJavascript('./Services/UIComponent/Overlay/js/ilOverlay.js');
$this->tpl->addJavaScript("./Services/JavaScript/js/Basic.js");
$container = new ilTemplate('tpl.il_as_tst_adjust_answer_aggregation_container.html', true, true, 'Modules/Test');
$container->setVariable('FORM_ELEMENT_NAME', 'aggr_usr_answ');
$container->setVariable('CLOSE_HTML', json_encode(ilGlyphGUI::get(ilGlyphGUI::CLOSE, $this->lng->txt('close'))));
$container->setVariable('TXT_SHOW_ANSWER_OVERVIEW', $this->lng->txt('show_answer_overview'));
$container->setVariable('TXT_CLOSE', $this->lng->txt('close'));
$container->setVariable('ANSWER_OVERVIEW', $answers_view);
$custom_input = new ilCustomInputGUI('', 'aggr_usr_answ');
$custom_input->setHtml($container->get());
$form->addItem($custom_input);
return $form;
}
示例3: insert
//.........這裏部分代碼省略.........
$tpl->setCurrentBlock('singleline');
$tpl->setVariable("SIZE", $this->getSize());
$tpl->setVariable("SINGLELINE_ID", $this->getPostVar() . "[answer][{$i}]");
$tpl->setVariable("SINGLELINE_ROW_NUMBER", $i);
$tpl->setVariable("SINGLELINE_POST_VAR", $this->getPostVar());
$tpl->setVariable("MAXLENGTH", $this->getMaxLength());
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED_SINGLELINE", " disabled=\"disabled\"");
}
$tpl->parseCurrentBlock();
} else {
if (!$this->getSingleline()) {
if (is_object($value)) {
$tpl->setCurrentBlock("prop_points_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPoints()));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("prop_points_unchecked_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPointsUnchecked()));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock('multiline');
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getAnswertext()));
$tpl->setVariable("MULTILINE_ID", $this->getPostVar() . "[answer][{$i}]");
$tpl->setVariable("MULTILINE_ROW_NUMBER", $i);
$tpl->setVariable("MULTILINE_POST_VAR", $this->getPostVar());
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED_MULTILINE", " disabled=\"disabled\"");
}
$tpl->parseCurrentBlock();
}
}
if ($this->getAllowMove()) {
$tpl->setCurrentBlock("move");
$tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("ID", $this->getPostVar() . "[{$i}]");
$tpl->setVariable("UP_BUTTON", ilUtil::getImagePath('a_up.png'));
$tpl->setVariable("DOWN_BUTTON", ilUtil::getImagePath('a_down.png'));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("row");
$class = $i % 2 == 0 ? "even" : "odd";
if ($i == 0) {
$class .= " first";
}
if ($i == count($this->values) - 1) {
$class .= " last";
}
$tpl->setVariable("ROW_CLASS", $class);
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("ROW_NUMBER", $i);
$tpl->setVariable("ID", $this->getPostVar() . "[answer][{$i}]");
$tpl->setVariable("POINTS_ID", $this->getPostVar() . "[points][{$i}]");
$tpl->setVariable("POINTS_UNCHECKED_ID", $this->getPostVar() . "[points_unchecked][{$i}]");
$tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]");
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED_POINTS", " disabled=\"disabled\"");
}
$tpl->setVariable("ADD_BUTTON", ilUtil::getImagePath('edit_add.png'));
$tpl->setVariable("REMOVE_BUTTON", ilUtil::getImagePath('edit_remove.png'));
$tpl->parseCurrentBlock();
$i++;
}
if ($this->getSingleline()) {
if (!$this->hideImages) {
if (is_array($this->getSuffixes())) {
$suff_str = $delim = "";
foreach ($this->getSuffixes() as $suffix) {
$suff_str .= $delim . "." . $suffix;
$delim = ", ";
}
$tpl->setCurrentBlock('allowed_image_suffixes');
$tpl->setVariable("TXT_ALLOWED_SUFFIXES", $lng->txt("file_allowed_suffixes") . " " . $suff_str);
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("image_heading");
$tpl->setVariable("ANSWER_IMAGE", $lng->txt('answer_image'));
$tpl->setVariable("TXT_MAX_SIZE", ilUtil::getFileSizeInfo());
$tpl->parseCurrentBlock();
}
}
$tpl->setVariable("ELEMENT_ID", $this->getPostVar());
$tpl->setVariable("TEXT_YES", $lng->txt('yes'));
$tpl->setVariable("TEXT_NO", $lng->txt('no'));
$tpl->setVariable("DELETE_IMAGE_HEADER", $lng->txt('delete_image_header'));
$tpl->setVariable("DELETE_IMAGE_QUESTION", $lng->txt('delete_image_question'));
$tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text'));
$tpl->setVariable("POINTS_TEXT", $lng->txt('points'));
$tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions'));
$tpl->setVariable("POINTS_CHECKED_TEXT", $lng->txt('checkbox_checked'));
$tpl->setVariable("POINTS_UNCHECKED_TEXT", $lng->txt('checkbox_unchecked'));
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
global $tpl;
include_once "./Services/YUI/classes/class.ilYuiUtil.php";
ilYuiUtil::initDomEvent();
$tpl->addJavascript("./Modules/TestQuestionPool/templates/default/multiplechoicewizard.js");
}
示例4: insert
/**
* Insert property html
*
* @return int Size
*/
function insert(&$a_tpl)
{
global $lng;
$tpl = new ilTemplate("tpl.prop_imagewizardinput.html", true, true, "Modules/TestQuestionPool");
$i = 0;
foreach ($this->values as $value) {
if (strlen($value)) {
$imagename = $this->qstObject->getImagePathWeb() . $value;
if ($this->qstObject->getThumbSize()) {
if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . $value)) {
$imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . $value;
}
}
$tpl->setCurrentBlock('image');
$tpl->setVariable('SRC_IMAGE', $imagename);
$tpl->setVariable('IMAGE_NAME', $value);
$tpl->setVariable('ALT_IMAGE', ilUtil::prepareFormOutput($value));
$tpl->setVariable("TXT_DELETE_EXISTING", $lng->txt("delete_existing_file"));
$tpl->setVariable("IMAGE_ROW_NUMBER", $i);
$tpl->setVariable("IMAGE_POST_VAR", $this->getPostVar());
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock('addimage');
$tpl->setVariable("IMAGE_ID", $this->getPostVar() . "[image][{$i}]");
$tpl->setVariable("IMAGE_SUBMIT", $lng->txt("upload"));
$tpl->setVariable("IMAGE_ROW_NUMBER", $i);
$tpl->setVariable("IMAGE_POST_VAR", $this->getPostVar());
$tpl->parseCurrentBlock();
if ($this->getAllowMove()) {
$tpl->setCurrentBlock("move");
$tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("ID", $this->getPostVar() . "[{$i}]");
$tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP));
$tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("row");
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("ROW_NUMBER", $i);
$tpl->setVariable("ID", $this->getPostVar() . "[answer][{$i}]");
$tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
$tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
$tpl->parseCurrentBlock();
$i++;
}
if (is_array($this->getSuffixes())) {
$suff_str = $delim = "";
foreach ($this->getSuffixes() as $suffix) {
$suff_str .= $delim . "." . $suffix;
$delim = ", ";
}
$tpl->setCurrentBlock('allowed_image_suffixes');
$tpl->setVariable("TXT_ALLOWED_SUFFIXES", $lng->txt("file_allowed_suffixes") . " " . $suff_str);
$tpl->parseCurrentBlock();
}
/*
$tpl->setCurrentBlock("image_heading");
$tpl->setVariable("ANSWER_IMAGE", $lng->txt('answer_image'));
$tpl->parseCurrentBlock();
*/
$tpl->setVariable("TXT_MAX_SIZE", ilUtil::getFileSizeInfo());
$tpl->setVariable("ELEMENT_ID", $this->getPostVar());
$tpl->setVariable("TEXT_YES", $lng->txt('yes'));
$tpl->setVariable("TEXT_NO", $lng->txt('no'));
$tpl->setVariable("DELETE_IMAGE_HEADER", $lng->txt('delete_image_header'));
$tpl->setVariable("DELETE_IMAGE_QUESTION", $lng->txt('delete_image_question'));
$tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text'));
$tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions'));
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
global $tpl;
$tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
$tpl->addJavascript("./Modules/TestQuestionPool/templates/default/imagewizard.js");
}
示例5: insert
/**
* Insert property html
*
* @return int Size
*/
function insert(&$a_tpl)
{
global $lng;
$tpl = new ilTemplate("tpl.prop_kvpwizardinput.html", true, true, "Modules/TestQuestionPool");
$i = 0;
foreach ($this->values as $value) {
if (is_array($value)) {
$tpl->setCurrentBlock("prop_key_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value[0]));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("prop_value_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value[1]));
$tpl->parseCurrentBlock();
}
if ($this->getAllowMove()) {
$tpl->setCurrentBlock("move");
$tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("ID", $this->getPostVar() . "[{$i}]");
$tpl->setVariable("UP_BUTTON", ilUtil::getImagePath('a_up.png'));
$tpl->setVariable("DOWN_BUTTON", ilUtil::getImagePath('a_down.png'));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("row");
$class = $i % 2 == 0 ? "even" : "odd";
if ($i == 0) {
$class .= " first";
}
if ($i == count($this->values) - 1) {
$class .= " last";
}
$tpl->setVariable("ROW_CLASS", $class);
$tpl->setVariable("ROW_NUMBER", $i);
$tpl->setVariable("KEY_SIZE", $this->getKeySize());
$tpl->setVariable("KEY_ID", $this->getPostVar() . "[key][{$i}]");
$tpl->setVariable("KEY_MAXLENGTH", $this->getKeyMaxlength());
$tpl->setVariable("VALUE_SIZE", $this->getValueSize());
$tpl->setVariable("VALUE_ID", $this->getPostVar() . "[value][{$i}]");
$tpl->setVariable("VALUE_MAXLENGTH", $this->getValueMaxlength());
$tpl->setVariable("ID", $this->getPostVar() . "[{$i}]");
$tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("ADD_BUTTON", ilUtil::getImagePath('edit_add.png'));
$tpl->setVariable("REMOVE_BUTTON", ilUtil::getImagePath('edit_remove.png'));
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->parseCurrentBlock();
$i++;
}
$tpl->setVariable("ELEMENT_ID", $this->getPostVar());
$tpl->setVariable("KEY_TEXT", $this->getKeyName());
$tpl->setVariable("VALUE_TEXT", $this->getValueName());
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
global $tpl;
include_once "./Services/YUI/classes/class.ilYuiUtil.php";
ilYuiUtil::initDomEvent();
$tpl->addJavascript("./Modules/TestQuestionPool/templates/default/kvpwizard.js");
}
示例6: insert
//.........這裏部分代碼省略.........
$tpl->setCurrentBlock("prop_text_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getAnswertext()));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock('singleline');
$tpl->setVariable("SIZE", $this->getSize());
$tpl->setVariable("SINGLELINE_ID", $this->getPostVar() . "[answer][{$value->getPosition()}]");
$tpl->setVariable("SINGLELINE_ROW_NUMBER", $value->getPosition());
$tpl->setVariable("SINGLELINE_POST_VAR", $this->getPostVar());
$tpl->setVariable("MAXLENGTH", $this->getMaxLength());
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED_SINGLELINE", " disabled=\"disabled\"");
}
$tpl->parseCurrentBlock();
} else {
if (!$this->getSingleline()) {
$tpl->setCurrentBlock('multiline');
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getAnswertext()));
$tpl->setVariable("MULTILINE_ID", $this->getPostVar() . "[answer][{$value->getPosition()}]");
$tpl->setVariable("MULTILINE_ROW_NUMBER", $value->getPosition());
$tpl->setVariable("MULTILINE_POST_VAR", $this->getPostVar());
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED_MULTILINE", " disabled=\"disabled\"");
}
$tpl->parseCurrentBlock();
}
}
if ($this->getAllowMove()) {
$tpl->setCurrentBlock("move");
$tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$value->getPosition()}]");
$tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$value->getPosition()}]");
$tpl->setVariable("UP_ID", "up_{$this->getPostVar()}[{$value->getPosition()}]");
$tpl->setVariable("DOWN_ID", "down_{$this->getPostVar()}[{$value->getPosition()}]");
$tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP));
$tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("row");
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("ROW_NUMBER", $value->getPosition());
$tpl->setVariable("ID", $this->getPostVar() . "[answer][{$value->getPosition()}]");
$tpl->setVariable("CORRECTNESS_TRUE_ID", $this->getPostVar() . "[correctness][{$value->getPosition()}][true]");
$tpl->setVariable("CORRECTNESS_FALSE_ID", $this->getPostVar() . "[correctness][{$value->getPosition()}][false]");
$tpl->setVariable("CORRECTNESS_TRUE_VALUE", 1);
$tpl->setVariable("CORRECTNESS_FALSE_VALUE", 0);
if ($value->getCorrectness() !== null) {
if ($value->getCorrectness()) {
$tpl->setVariable('CORRECTNESS_TRUE_SELECTED', ' checked="checked"');
} else {
$tpl->setVariable('CORRECTNESS_FALSE_SELECTED', ' checked="checked"');
}
}
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED_CORRECTNESS", " disabled=\"disabled\"");
}
$tpl->parseCurrentBlock();
}
if ($this->getSingleline()) {
if (!$this->hideImages) {
if (is_array($this->getSuffixes())) {
$suff_str = $delim = "";
foreach ($this->getSuffixes() as $suffix) {
$suff_str .= $delim . "." . $suffix;
$delim = ", ";
}
$tpl->setCurrentBlock('allowed_image_suffixes');
$tpl->setVariable("TXT_ALLOWED_SUFFIXES", $this->lng->txt("file_allowed_suffixes") . " " . $suff_str);
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("image_heading");
$tpl->setVariable("ANSWER_IMAGE", $this->lng->txt('answer_image'));
$tpl->setVariable("TXT_MAX_SIZE", ilUtil::getFileSizeInfo());
$tpl->parseCurrentBlock();
}
}
foreach ($this->qstObject->getValidOptionLabels() as $optionLabel) {
if ($this->qstObject->isCustomOptionLabel($optionLabel)) {
continue;
}
$tpl->setCurrentBlock('option_label_translations');
$tpl->setVariable('OPTION_LABEL', $optionLabel);
$tpl->setVariable('TRANSLATION_TRUE', $this->qstObject->getTrueOptionLabelTranslation($this->lng, $optionLabel));
$tpl->setVariable('TRANSLATION_FALSE', $this->qstObject->getFalseOptionLabelTranslation($this->lng, $optionLabel));
$tpl->parseCurrentBlock();
}
$tpl->setVariable("ELEMENT_ID", $this->getPostVar());
$tpl->setVariable("DELETE_IMAGE_HEADER", $this->lng->txt('delete_image_header'));
$tpl->setVariable("DELETE_IMAGE_QUESTION", $this->lng->txt('delete_image_question'));
$tpl->setVariable("ANSWER_TEXT", $this->lng->txt('answer_text'));
$tpl->setVariable("OPTIONS_TEXT", $this->lng->txt('options'));
// winzards input column label values will be updated on document ready js
//$tpl->setVariable("TRUE_TEXT", $this->qstObject->getTrueOptionLabelTranslation($this->lng, $this->qstObject->getOptionLabel()));
//$tpl->setVariable("FALSE_TEXT", $this->qstObject->getFalseOptionLabelTranslation($this->lng, $this->qstObject->getOptionLabel()));
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
include_once "./Services/YUI/classes/class.ilYuiUtil.php";
$this->tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
$this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/kprimchoicewizard.js");
$this->tpl->addJavascript('Modules/TestQuestionPool/js/ilAssKprimChoice.js');
}
示例7: insert
/**
* Insert property html
*
* @return int Size
*/
function insert(&$a_tpl)
{
global $lng;
$tpl = new ilTemplate("tpl.prop_matrixrowwizardinput.html", true, true, "Modules/SurveyQuestionPool");
$i = 0;
if (is_object($this->values)) {
for ($i = 0; $i < $this->values->getCategoryCount(); $i++) {
$cat = $this->values->getCategory($i);
$tpl->setCurrentBlock("prop_text_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($cat->title));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("prop_label_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($cat->label));
$tpl->parseCurrentBlock();
if ($this->getUseOtherAnswer()) {
$tpl->setCurrentBlock("other_answer_checkbox");
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("OTHER_ID", $this->getPostVar() . "[other][{$i}]");
$tpl->setVariable("ROW_NUMBER", $i);
if ($cat->other) {
$tpl->setVariable("CHECKED_OTHER", ' checked="checked"');
}
$tpl->parseCurrentBlock();
}
if ($this->getAllowMove()) {
$tpl->setCurrentBlock("move");
$tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("ID", $this->getPostVar() . "[{$i}]");
include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php";
$tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP));
$tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("row");
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("ROW_NUMBER", $i);
$tpl->setVariable("ID", $this->getPostVar() . "[answer][{$i}]");
$tpl->setVariable("ID_LABEL", $this->getPostVar() . "[label][{$i}]");
$tpl->setVariable("SIZE", $this->getSize());
$tpl->setVariable("SIZE_LABEL", 15);
$tpl->setVariable("MAXLENGTH", $this->getMaxLength());
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED", " disabled=\"disabled\"");
$tpl->setVariable("DISABLED_LABEL", " disabled=\"disabled\"");
}
$tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]");
include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php";
$tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
$tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
$tpl->parseCurrentBlock();
}
}
if ($this->getShowWizard()) {
$tpl->setCurrentBlock("wizard");
$tpl->setVariable("CMD_WIZARD", 'cmd[wizard' . $this->getFieldId() . ']');
$tpl->setVariable("WIZARD_BUTTON", ilUtil::getImagePath('wizard.svg'));
$tpl->setVariable("WIZARD_TEXT", $lng->txt('add_phrase'));
$tpl->parseCurrentBlock();
}
if ($this->getShowSavePhrase()) {
$tpl->setCurrentBlock('savephrase');
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("VALUE_SAVE_PHRASE", $lng->txt('save_phrase'));
$tpl->parseCurrentBlock();
}
if ($this->getUseOtherAnswer()) {
$tpl->setCurrentBlock('other_answer_title');
$tpl->setVariable("OTHER_TEXT", $lng->txt('use_other_answer'));
$tpl->parseCurrentBlock();
}
$tpl->setVariable("ELEMENT_ID", $this->getPostVar());
$tpl->setVariable("ANSWER_TEXT", $this->getCategoryText());
$tpl->setVariable("LABEL_TEXT", $this->getLabelText());
$tpl->setVariable("ACTIONS_TEXT", $lng->txt('actions'));
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
global $tpl;
$tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
$tpl->addJavascript("./Modules/SurveyQuestionPool/templates/default/matrixrowwizard.js");
}
示例8: insert
/**
* Insert property html
*
* @return int Size
*/
function insert(&$a_tpl)
{
$tpl = new ilTemplate("tpl.prop_textwizardinput.html", true, true, "Services/Form");
$i = 0;
foreach ($this->values as $value) {
if (strlen($value)) {
$tpl->setCurrentBlock("prop_text_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value));
$tpl->parseCurrentBlock();
}
if ($this->getAllowMove()) {
$tpl->setCurrentBlock("move");
$tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("ID", $this->getFieldId() . "[{$i}]");
include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php";
$tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP));
$tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("row");
$tpl->setVariable("POST_VAR", $this->getPostVar() . "[{$i}]");
$tpl->setVariable("ID", $this->getFieldId() . "[{$i}]");
$tpl->setVariable("SIZE", $this->getSize());
$tpl->setVariable("MAXLENGTH", $this->getMaxLength());
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED", " disabled=\"disabled\"");
} else {
$tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]");
include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php";
$tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
$tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
}
$tpl->parseCurrentBlock();
$i++;
}
$tpl->setVariable("ELEMENT_ID", $this->getFieldId());
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
if (!$this->getDisabled()) {
global $tpl;
$tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
$tpl->addJavascript("./Services/Form/templates/default/textwizard.js");
}
}
示例9: insert
/**
* Insert property html
*
* @return int Size
*/
function insert(&$a_tpl)
{
global $lng;
$tpl = new ilTemplate("tpl.prop_essaykeywordswizardinput.html", true, true, "Modules/TestQuestionPool");
$i = 0;
foreach ($this->values as $value) {
if ($this->getSingleline()) {
if (is_object($value)) {
$tpl->setCurrentBlock("prop_text_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getAnswertext()));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("prop_points_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPointsChecked()));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock('singleline');
$tpl->setVariable("SIZE", $this->getSize());
$tpl->setVariable("SINGLELINE_ID", $this->getPostVar() . "[answer][{$i}]");
$tpl->setVariable("SINGLELINE_ROW_NUMBER", $i);
$tpl->setVariable("SINGLELINE_POST_VAR", $this->getPostVar());
$tpl->setVariable("MAXLENGTH", $this->getMaxLength());
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED_SINGLELINE", " disabled=\"disabled\"");
}
$tpl->parseCurrentBlock();
} else {
if (!$this->getSingleline()) {
if (is_object($value)) {
$tpl->setCurrentBlock("prop_points_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPoints()));
$tpl->parseCurrentBlock();
}
}
}
$tpl->setCurrentBlock("row");
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("ROW_NUMBER", $i);
$tpl->setVariable("ID", $this->getPostVar() . "[answer][{$i}]");
$tpl->setVariable("POINTS_ID", $this->getPostVar() . "[points][{$i}]");
$tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]");
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED_POINTS", " disabled=\"disabled\"");
}
$tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
$tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
$tpl->parseCurrentBlock();
$i++;
}
$tpl->setVariable("ELEMENT_ID", $this->getPostVar());
$tpl->setVariable("TEXT_YES", $lng->txt('yes'));
$tpl->setVariable("TEXT_NO", $lng->txt('no'));
$tpl->setVariable("DELETE_IMAGE_HEADER", $lng->txt('delete_image_header'));
$tpl->setVariable("DELETE_IMAGE_QUESTION", $lng->txt('delete_image_question'));
$tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text'));
$tpl->setVariable("POINTS_TEXT", $lng->txt('points'));
$tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions'));
$tpl->setVariable("POINTS_CHECKED_TEXT", $lng->txt('checkbox_checked'));
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
global $tpl;
$tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
$tpl->addJavascript("./Modules/TestQuestionPool/templates/default/essaykeywordwizard.js");
}
示例10: insert
/**
* Insert property html
*
* @return int Size
*/
function insert(&$a_tpl)
{
global $lng;
$tpl = new ilTemplate("tpl.prop_essaykeywordswizardinput.html", true, true, "Modules/TestQuestionPool");
$i = 0;
foreach ($this->values as $value) {
if ($this->getSingleline()) {
if (is_object($value)) {
$tpl->setCurrentBlock("prop_text_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getAnswertext()));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("prop_points_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPointsChecked()));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock('singleline');
$tpl->setVariable("SIZE", $this->getSize());
$tpl->setVariable("SINGLELINE_ID", $this->getPostVar() . "[answer][{$i}]");
$tpl->setVariable("SINGLELINE_ROW_NUMBER", $i);
$tpl->setVariable("SINGLELINE_POST_VAR", $this->getPostVar());
$tpl->setVariable("MAXLENGTH", $this->getMaxLength());
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED_SINGLELINE", " disabled=\"disabled\"");
}
$tpl->parseCurrentBlock();
} else {
if (!$this->getSingleline()) {
if (is_object($value)) {
$tpl->setCurrentBlock("prop_points_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPoints()));
$tpl->parseCurrentBlock();
}
}
}
$tpl->setCurrentBlock("row");
$class = $i % 2 == 0 ? "even" : "odd";
if ($i == 0) {
$class .= " first";
}
if ($i == count($this->values) - 1) {
$class .= " last";
}
$tpl->setVariable("ROW_CLASS", $class);
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("ROW_NUMBER", $i);
$tpl->setVariable("ID", $this->getPostVar() . "[answer][{$i}]");
$tpl->setVariable("POINTS_ID", $this->getPostVar() . "[points][{$i}]");
$tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]");
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED_POINTS", " disabled=\"disabled\"");
}
$tpl->setVariable("ADD_BUTTON", ilUtil::getImagePath('edit_add.png'));
$tpl->setVariable("REMOVE_BUTTON", ilUtil::getImagePath('edit_remove.png'));
$tpl->parseCurrentBlock();
$i++;
}
$tpl->setVariable("ELEMENT_ID", $this->getPostVar());
$tpl->setVariable("TEXT_YES", $lng->txt('yes'));
$tpl->setVariable("TEXT_NO", $lng->txt('no'));
$tpl->setVariable("DELETE_IMAGE_HEADER", $lng->txt('delete_image_header'));
$tpl->setVariable("DELETE_IMAGE_QUESTION", $lng->txt('delete_image_question'));
$tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text'));
$tpl->setVariable("POINTS_TEXT", $lng->txt('points'));
$tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions'));
$tpl->setVariable("POINTS_CHECKED_TEXT", $lng->txt('checkbox_checked'));
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
global $tpl;
include_once "./Services/YUI/classes/class.ilYuiUtil.php";
ilYuiUtil::initDomEvent();
$tpl->addJavascript("./Modules/TestQuestionPool/templates/default/multiplechoicewizard.js");
}
示例11: insert
/**
* Insert property html
*
* @return int Size
*/
function insert(&$a_tpl)
{
global $lng;
$tpl = new ilTemplate($this->getTemplate(), true, true, "Modules/TestQuestionPool");
$i = 0;
foreach ($this->values as $value) {
if ($this->getSingleline()) {
if (is_object($value)) {
$tpl->setCurrentBlock("prop_text_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getAnswertext()));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("prop_points_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPoints()));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock('singleline');
$tpl->setVariable("SIZE", $this->getSize());
$tpl->setVariable("SINGLELINE_ID", $this->getPostVar() . "[answer][{$i}]");
$tpl->setVariable("SINGLELINE_ROW_NUMBER", $i);
$tpl->setVariable("SINGLELINE_POST_VAR", $this->getPostVar());
$tpl->setVariable("MAXLENGTH", $this->getMaxLength());
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED_SINGLELINE", " disabled=\"disabled\"");
}
$tpl->parseCurrentBlock();
} else {
if (!$this->getSingleline()) {
if (is_object($value)) {
$tpl->setCurrentBlock("prop_points_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPoints()));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock('multiline');
$tpl->setVariable("PROPERTY_VALUE", $this->qstObject->prepareTextareaOutput($value->getAnswertext()));
$tpl->setVariable("MULTILINE_ID", $this->getPostVar() . "[answer][{$i}]");
$tpl->setVariable("MULTILINE_ROW_NUMBER", $i);
$tpl->setVariable("MULTILINE_POST_VAR", $this->getPostVar());
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED_MULTILINE", " disabled=\"disabled\"");
}
$tpl->parseCurrentBlock();
}
}
if ($this->getAllowMove()) {
$tpl->setCurrentBlock("move");
$tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("ID", $this->getPostVar() . "[{$i}]");
$tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP));
$tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("row");
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("ROW_NUMBER", $i);
$tpl->setVariable("ID", $this->getPostVar() . "[answer][{$i}]");
$tpl->setVariable("POINTS_ID", $this->getPostVar() . "[points][{$i}]");
$tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]");
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED_POINTS", " disabled=\"disabled\"");
}
$tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
$tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
$tpl->parseCurrentBlock();
$i++;
}
$tpl->setVariable("ELEMENT_ID", $this->getPostVar());
$tpl->setVariable("ANSWER_TEXT", $this->getTextInputLabel($lng));
$tpl->setVariable("POINTS_TEXT", $this->getPointsInputLabel($lng));
$tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions'));
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
global $tpl;
$tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
$tpl->addJavascript("./Modules/TestQuestionPool/templates/default/answerwizard.js");
}
示例12: insert
//.........這裏部分代碼省略.........
$tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("ID", $this->getPostVar() . "[{$i}]");
$tpl->setVariable("UP_BUTTON", ilUtil::getImagePath('a_up.png'));
$tpl->setVariable("DOWN_BUTTON", ilUtil::getImagePath('a_down.png'));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("row");
$class = $i % 2 == 0 ? "even" : "odd";
if ($i == 0) {
$class .= " first";
}
if ($i == $this->values->getCategoryCount() - 1) {
$class .= " last";
}
$tpl->setVariable("ROW_CLASS", $class);
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("ROW_NUMBER", $i);
$tpl->setVariable("ID", $this->getPostVar() . "[answer][{$i}]");
$tpl->setVariable("SIZE", $this->getSize());
$tpl->setVariable("MAXLENGTH", $this->getMaxLength());
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED", " disabled=\"disabled\"");
}
$tpl->setVariable("SCALE_ID", $this->getPostVar() . "[scale][{$i}]");
if ($this->getDisabledScale()) {
$tpl->setVariable("DISABLED_SCALE", " disabled=\"disabled\"");
}
$tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("ADD_BUTTON", ilUtil::getImagePath('edit_add.png'));
$tpl->setVariable("REMOVE_BUTTON", ilUtil::getImagePath('edit_remove.png'));
$tpl->parseCurrentBlock();
} else {
$neutral_category = $cat;
}
}
}
if ($this->getShowWizard()) {
$tpl->setCurrentBlock("wizard");
$tpl->setVariable("CMD_WIZARD", 'cmd[addPhrase]');
$tpl->setVariable("WIZARD_BUTTON", ilUtil::getImagePath('wizard.png'));
$tpl->setVariable("WIZARD_TEXT", $lng->txt('add_phrase'));
$tpl->parseCurrentBlock();
}
if ($this->getShowSavePhrase()) {
$tpl->setCurrentBlock('savephrase');
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("VALUE_SAVE_PHRASE", $lng->txt('save_phrase'));
$tpl->parseCurrentBlock();
}
if ($this->getShowNeutralCategory()) {
if (is_object($neutral_category) && strlen($neutral_category->title)) {
$tpl->setCurrentBlock("prop_text_neutral_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($neutral_category->title));
$tpl->parseCurrentBlock();
}
if (strlen($this->getNeutralCategoryTitle())) {
$tpl->setCurrentBlock("neutral_category_title");
$tpl->setVariable("CATEGORY_TITLE", ilUtil::prepareFormOutput($this->getNeutralCategoryTitle()));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("prop_scale_neutral_propval");
$scale = $neutral_category->scale > 0 ? $neutral_category->scale : $this->values->getNewScale();
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($scale));
$tpl->parseCurrentBlock();
if ($this->getUseOtherAnswer()) {
$tpl->touchBlock('other_answer_neutral');
}
$tpl->setCurrentBlock('neutral_row');
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("ID", $this->getPostVar() . "_neutral");
$tpl->setVariable("SIZE", $this->getSize());
$tpl->setVariable("MAXLENGTH", $this->getMaxLength());
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED", " disabled=\"disabled\"");
}
$tpl->setVariable("SCALE_ID", $this->getPostVar() . "_neutral_scale");
if ($this->getDisabledScale()) {
$tpl->setVariable("DISABLED_SCALE", " disabled=\"disabled\"");
}
$tpl->parseCurrentBlock();
}
if ($this->getUseOtherAnswer()) {
$tpl->setCurrentBlock('other_answer_title');
$tpl->setVariable("OTHER_TEXT", $lng->txt('use_other_answer'));
$tpl->parseCurrentBlock();
}
$tpl->setVariable("ELEMENT_ID", $this->getPostVar());
$tpl->setVariable("ANSWER_TEXT", $this->getCategoryText());
$tpl->setVariable("SCALE_TEXT", $lng->txt('scale'));
$tpl->setVariable("ACTIONS_TEXT", $lng->txt('actions'));
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
global $tpl;
include_once "./Services/YUI/classes/class.ilYuiUtil.php";
ilYuiUtil::initDomEvent();
$tpl->addJavascript("./Modules/SurveyQuestionPool/templates/default/categorywizard.js");
}
示例13: insert
//.........這裏部分代碼省略.........
*
* @return int Size
*/
function insert(&$a_tpl)
{
global $lng;
$tpl = new ilTemplate("tpl.prop_matchingpairinput.html", true, true, "Modules/TestQuestionPool");
$i = 0;
foreach ($this->pairs as $pair) {
$counter = 1;
$tpl->setCurrentBlock("option_term");
$tpl->setVariable("TEXT_OPTION", ilUtil::prepareFormOutput($lng->txt('please_select')));
$tpl->setVariable("VALUE_OPTION", 0);
$tpl->parseCurrentBlock();
foreach ($this->terms as $term) {
$tpl->setCurrentBlock("option_term");
$tpl->setVariable("VALUE_OPTION", ilUtil::prepareFormOutput($term->identifier));
$tpl->setVariable("TEXT_OPTION", $lng->txt('term') . " " . $counter);
if ($pair->term->identifier == $term->identifier) {
$tpl->setVariable('SELECTED_OPTION', ' selected="selected"');
}
$tpl->parseCurrentBlock();
$counter++;
}
$counter = 1;
$tpl->setCurrentBlock("option_definition");
$tpl->setVariable("TEXT_OPTION", ilUtil::prepareFormOutput($lng->txt('please_select')));
$tpl->setVariable("VALUE_OPTION", 0);
$tpl->parseCurrentBlock();
foreach ($this->definitions as $definition) {
$tpl->setCurrentBlock("option_definition");
$tpl->setVariable("VALUE_OPTION", ilUtil::prepareFormOutput($definition->identifier));
$tpl->setVariable("TEXT_OPTION", $lng->txt('definition') . " " . $counter);
if ($pair->definition->identifier == $definition->identifier) {
$tpl->setVariable('SELECTED_OPTION', ' selected="selected"');
}
$tpl->parseCurrentBlock();
$counter++;
}
if (strlen($pair->points)) {
$tpl->setCurrentBlock('points_value');
$tpl->setVariable('POINTS_VALUE', $pair->points);
$tpl->parseCurrentBlock();
}
if ($this->getAllowMove()) {
$tpl->setCurrentBlock("move");
$tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("ID", $this->getPostVar() . "[{$i}]");
$tpl->setVariable("UP_BUTTON", ilUtil::getImagePath('a_up.png'));
$tpl->setVariable("DOWN_BUTTON", ilUtil::getImagePath('a_down.png'));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("row");
$class = $i % 2 == 0 ? "even" : "odd";
if ($i == 0) {
$class .= " first";
}
if ($i == count($this->values) - 1) {
$class .= " last";
}
$tpl->setVariable("ROW_CLASS", $class);
$tpl->setVariable("ROW_NUMBER", $i);
$tpl->setVariable("ID", $this->getPostVar() . "[{$i}]");
$tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("ADD_BUTTON", ilUtil::getImagePath('edit_add.png'));
$tpl->setVariable("REMOVE_BUTTON", ilUtil::getImagePath('edit_remove.png'));
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->parseCurrentBlock();
$i++;
}
$tpl->setCurrentBlock('term_ids');
$ids = array();
foreach ($this->terms as $term) {
array_push($ids, $term->identifier);
}
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("TERM_IDS", join($ids, ","));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock('definition_ids');
$ids = array();
foreach ($this->definitions as $definition) {
array_push($ids, $definition->identifier);
}
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("DEFINITION_IDS", join($ids, ","));
$tpl->parseCurrentBlock();
$tpl->setVariable("ELEMENT_ID", $this->getPostVar());
$tpl->setVariable("TEXT_POINTS", $lng->txt('points'));
$tpl->setVariable("TEXT_DEFINITION", $lng->txt('definition'));
$tpl->setVariable("TEXT_TERM", $lng->txt('term'));
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
global $tpl;
include_once "./Services/YUI/classes/class.ilYuiUtil.php";
ilYuiUtil::initDomEvent();
$tpl->addJavascript("./Modules/TestQuestionPool/templates/default/matchingpairwizard.js");
}
示例14: initEditingJS
/**
* Init wiki editing js
*
* @param ilTemplate $a_tpl template
*/
static function initEditingJS(ilTemplate $a_tpl)
{
global $lng;
$a_tpl->addJavascript("./Modules/Wiki/js/WikiEdit.js");
$a_tpl->addOnLoadCode("il.Wiki.Edit.txt.page_exists = '" . $lng->txt("wiki_page_exists") . "';");
$a_tpl->addOnLoadCode("il.Wiki.Edit.txt.new_page = '" . $lng->txt("wiki_new_page") . "';");
}
示例15: insert
/**
* Insert property html
*
* @return int Size
*/
public function insert($a_tpl)
{
$tpl = new ilTemplate("tpl.prop_selectbuilder.html", true, true, "Services/Form");
$i = 0;
foreach ($this->values as $value) {
if (!is_string($value)) {
continue;
}
if (strlen((string) $value)) {
$tpl->setCurrentBlock("prop_text_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput((string) $value));
$tpl->parseCurrentBlock();
}
if ($this->getAllowMove()) {
$tpl->setCurrentBlock("move");
$tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("ID", $this->getFieldId() . "[{$i}]");
$tpl->setVariable("UP_BUTTON", ilUtil::getImagePath('a_up.png'));
$tpl->setVariable("DOWN_BUTTON", ilUtil::getImagePath('a_down.png'));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("row");
$class = $i % 2 == 0 ? "even" : "odd";
if ($i == 0) {
$class .= " first";
}
if ($i == count($this->values) - 1) {
$class .= " last";
}
$tpl->setVariable("ROW_CLASS", $class);
$tpl->setVariable("POST_VAR", $this->getPostVar() . "[{$i}]");
$tpl->setVariable('POST_VAR_OPEN', $this->getPostVar() . '[open]' . '[' . $i . ']');
if ($this->isOpenAnswerIndex($i)) {
$tpl->setVariable('PROP_OPEN_CHECKED', 'checked="checked"');
}
if ($this->getDisabled()) {
$tpl->setVariable('PROP_OPEN_DISABLED', 'disabled="disabled"');
}
$tpl->setVariable("ID", $this->getFieldId() . "[{$i}]");
$tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]");
$tpl->setVariable("SIZE", $this->getSize());
$tpl->setVariable("MAXLENGTH", $this->getMaxLength());
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED", " disabled=\"disabled\"");
}
$tpl->setVariable("ADD_BUTTON", ilUtil::getImagePath('edit_add.png'));
$tpl->setVariable("REMOVE_BUTTON", ilUtil::getImagePath('edit_remove.png'));
$tpl->parseCurrentBlock();
$i++;
}
$tpl->setVariable("ELEMENT_ID", $this->getFieldId());
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
global $tpl;
include_once "./Services/YUI/classes/class.ilYuiUtil.php";
ilYuiUtil::initDomEvent();
$tpl->addJavascript("./Services/Form/templates/default/textwizard.js");
}