当前位置: 首页>>代码示例>>PHP>>正文


PHP Node::prepareInternalLinkMediaForEditor方法代码示例

本文整理汇总了PHP中Node::prepareInternalLinkMediaForEditor方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::prepareInternalLinkMediaForEditor方法的具体用法?PHP Node::prepareInternalLinkMediaForEditor怎么用?PHP Node::prepareInternalLinkMediaForEditor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Node的用法示例。


在下文中一共展示了Node::prepareInternalLinkMediaForEditor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: content

 protected function content()
 {
     //nome
     if (!empty($this->data['nome'])) {
         $defaultValue = $this->data['nome'];
     } else {
         $defaultValue = '';
     }
     $this->addTextInput('nome', translateFN('Nome (visualizzato nella breadcrumb)') . ':')->setRequired()->setValidator(FormValidator::NOT_EMPTY_STRING_VALIDATOR)->withData($defaultValue);
     //titolo
     $this->addTextInput('titolo', translateFN('Titolo') . ':')->setRequired()->setValidator(FormValidator::NOT_EMPTY_STRING_VALIDATOR)->withData($this->data['titolo']);
     //descrizione
     $this->addTextarea('testo', translateFN('Descrizione') . ':')->withData(Node::prepareInternalLinkMediaForEditor($this->data['testo']));
     //consegna (message showed on test / survey ending)
     if (!empty($this->data['nome'])) {
         $defaultValue = Node::prepareInternalLinkMediaForEditor($this->data['consegna']);
     } else {
         $defaultValue = translateFN('Dati inviati correttamente.');
     }
     $this->addTextarea('consegna', translateFN('Messaggio finale') . ':')->withData($defaultValue);
     //return
     $options = array(ADA_NO_TEST_RETURN => translateFN('Non mostrare link'), ADA_NEXT_NODE_TEST_RETURN => translateFN('Mostra link al nodo successivo del corso'), ADA_INDEX_TEST_RETURN => translateFN('Mostra link all\'indice del corso'), ADA_COURSE_INDEX_TEST_RETURN => translateFN('Mostra link all\'elenco dei corsi'));
     if (isset($this->data['return'])) {
         $defaultValue = $this->data['return'];
     } else {
         $defaultValue = ADA_NO_TEST_RETURN;
     }
     $this->addSelect('return', translateFN('Link di ritorno') . ':', $options, $defaultValue);
     //ripetibile
     $radios = array(ADA_YES_TEST_REPETEABLE => translateFN('Si'), ADA_NO_TEST_REPETEABLE => translateFN('No'));
     if (isset($this->data['ripetibile'])) {
         $defaultValue = $this->data['ripetibile'];
     } else {
         $defaultValue = ADA_YES_TEST_REPETEABLE;
     }
     $this->addRadios('ripetibile', translateFN('Ripetibile dall\'utente') . ':', $radios, $defaultValue);
     //suddivisione in sessioni
     $radios = array(ADA_SEQUENCE_TEST_MODE => translateFN('Si'), ADA_ONEPAGE_TEST_MODE => translateFN('No'));
     if (isset($this->data['suddivisione'])) {
         $defaultValue = $this->data['suddivisione'];
     } else {
         $defaultValue = ADA_ONEPAGE_TEST_MODE;
     }
     $this->addRadios('suddivisione', translateFN('Suddividi per sessioni') . ':', $radios, $defaultValue);
     //feedback
     $options = array(ADA_CORRECT_TEST_INTERACTION => translateFN('Correzioni risposte e risposta corretta'), ADA_RATING_TEST_INTERACTION => translateFN('Correzioni risposte, punteggio ottenuto e risposta corretta'), ADA_FEEDBACK_TEST_INTERACTION => translateFN('Correzioni risposte'), ADA_BLIND_TEST_INTERACTION => translateFN('Nessun feedback'));
     if (isset($this->data['feedback'])) {
         $defaultValue = $this->data['feedback'];
     } else {
         $defaultValue = ADA_RATING_TEST_INTERACTION;
     }
     $this->addSelect('feedback', translateFN('Feedback all\'utente') . ':', $options, $defaultValue);
     //livello minimo
     if (isset($this->data['min_level'])) {
         $defaultValue = $this->data['min_level'];
     } else {
         $defaultValue = 0;
     }
     $this->addTextInput('min_level', translateFN('Livello minimo per accedere al test (0 = nessun limite)') . ':')->setRequired()->setValidator(FormValidator::NON_NEGATIVE_NUMBER_VALIDATOR)->withData($defaultValue);
 }
开发者ID:eguicciardi,项目名称:ada,代码行数:60,代码来源:rootFormTest.inc.php

示例2: constructComponents

 /**
  * Function called by render method to initialize components
  * (following business logic and with data) that will be rendered
  *
  * @see render
  */
 public function constructComponents()
 {
     if ($this->open_answer) {
         $span = CDOMElement::create('span');
         $checkbox_value = CDOMElement::create('hidden', 'name:other_answer[]');
         $checkbox_value->setAttribute('class', 'other_answer');
         $checkbox = CDOMElement::create('checkbox');
         $checkbox->setAttribute('class', 'other_answer_checkbox');
         $checkbox->setAttribute('onchange', 'change_other_answer(this);');
         if ($this->_controlData['other_answer']) {
             $checkbox_value->setAttribute('value', 1);
             $checkbox->setAttribute('checked', '');
         } else {
             $checkbox_value->setAttribute('value', 0);
         }
         $span->addChild($checkbox_value);
         $span->addChild($checkbox);
         $this->item['other_answer'] = $span;
     } else {
         $this->item['other_answer'] = null;
     }
     $this->_controlData['answer'] = Node::prepareInternalLinkMediaForEditor($this->_controlData['answer']);
     $input = CDOMElement::create('text', 'name:answer[]');
     $input->setAttribute('class', 'answer');
     $input->setAttribute('value', htmlspecialchars($this->_controlData['answer']));
     if ($this->clonable) {
         $input->setAttribute('disabled', '');
     }
     $img = CDOMElement::create('img', 'class:addImage,onclick:insertImage(this);,title:' . translateFN('Inserisci Immagine'));
     $img->setAttribute('src', 'img/img.png');
     $this->item['answer'] = CDOMElement::create('span');
     $this->item['answer']->addChild($input);
     $this->item['answer']->addChild($img);
     $this->item['value'] = CDOMElement::create('text', 'name:value[]');
     $this->item['value']->setAttribute('class', 'value');
     $this->item['value']->setAttribute('value', intval($this->_controlData['value']));
     if ($this->show_case_sensitive) {
         $span = CDOMElement::create('span');
         $checkbox_value = CDOMElement::create('hidden', 'name:case_sensitive[]');
         $checkbox_value->setAttribute('class', 'case_sensitive');
         $checkbox = CDOMElement::create('checkbox');
         $checkbox->setAttribute('class', 'case_sensitive_checkbox');
         $checkbox->setAttribute('onchange', 'change_case_sensitive(this);');
         if ($this->_controlData['case_sensitive']) {
             $checkbox_value->setAttribute('value', 1);
             $checkbox->setAttribute('checked', '');
         } else {
             $checkbox_value->setAttribute('value', 0);
         }
         $span->addChild($checkbox_value);
         $span->addChild($checkbox);
         $this->item['case_sensitive'] = $span;
     } else {
         $this->item['case_sensitive'] = null;
     }
     $this->item['record'] = CDOMElement::create('hidden', 'name:record[]');
     $this->item['record']->setAttribute('class', 'record');
     $this->item['record']->setAttribute('value', $this->_controlData['record']);
 }
开发者ID:eguicciardi,项目名称:ada,代码行数:65,代码来源:answerControlTest.inc.php

示例3: common_elements

    protected function common_elements()
    {
        $dh = $GLOBALS['dh'];
        $this->setName('questionForm');
        $this->addHidden('step')->withData(2);
        $injectTemplate = 'injectTemplate';
        $commento = 'commento';
        $didascalia = 'didascalia';
        $js = '
			isCloze = ' . $this->isCloze . ';
			var injectTemplate_field = "' . $injectTemplate . '";
			var commento_field = "' . $commento . '";
			var field = "' . $didascalia . '";
			var regexp = /^(?:[\\d]+|[\\w]+).*$/;
			var module_http = "' . MODULES_TEST_HTTP . '";
			document.write(\'<script type="text/javascript" src="' . MODULES_TEST_HTTP . '/js/questionFormStep2.js"><\\/script>\');';
        $this->setCustomJavascript($js);
        //forgetExerciseType
        if ($this->savedExerciseType) {
            require_once MODULES_TEST_PATH . '/include/forms/controls/forgetExerciseTypeControlTest.inc.php';
            $this->addControl(new ForgetExerciseTypeControlTest());
        }
        //parent node
        $this->parentSelect();
        //nome
        if (!empty($this->data['nome'])) {
            $defaultValue = $this->data['nome'];
        } else {
            if (!is_null($this->id_nodo_parent)) {
                $defaultValue = translateFN('domanda') . ' ';
                $res = $dh->test_getNodesByRadix($this->id_test);
                if ($dh->isError($res) || empty($res)) {
                    $defaultValue .= 1;
                } else {
                    foreach ($res as $k => $v) {
                        if ($v['tipo'][0] != ADA_GROUP_QUESTION) {
                            unset($res[$k]);
                        }
                    }
                    $defaultValue .= count($res) + 1;
                }
            } else {
                $defaultValue = '';
            }
        }
        $this->addTextInput('nome', translateFN('Nome (per uso interno)') . ':')->setRequired()->setValidator(FormValidator::NOT_EMPTY_STRING_VALIDATOR)->withData($defaultValue);
        //titolo
        $this->addTextInput('titolo', translateFN('Titolo') . ':')->withData($this->data['titolo']);
        //consegna
        $this->addTextarea('consegna', translateFN('Consegna') . ':')->withData(Node::prepareInternalLinkMediaForEditor($this->data['consegna']));
        //importazione template
        $this->addTemplateEditor($injectTemplate, translateFN('Importare un template (opzionale):'));
        //descrizione
        $this->addTextarea('testo', translateFN('Descrizione') . ':')->withData(Node::prepareInternalLinkMediaForEditor($this->data['testo']));
        //commento a fine domanda
        $options = array(ADA_NO_TEST_COMMENT => translateFN('No'), ADA_YES_TEST_COMMENT => translateFN('Si'));
        if (isset($this->data[$commento])) {
            $defaultValue = $this->data[$commento];
        } else {
            $defaultValue = ADA_NO_TEST_COMMENT;
        }
        $this->addRadios($commento, translateFN('Permetti commento a fine domanda') . ':', $options, $defaultValue);
        //didascalia commento fine domanda
        $didascalia = $this->addTextInput($didascalia, translateFN('Testo commento fine domanda') . ':')->setValidator(null)->withData($this->data[$didascalia]);
        if (isset($this->data[$commento]) && $this->data[$commento] == ADA_YES_TEST_COMMENT) {
            $didascalia->setRequired();
        }
    }
开发者ID:eguicciardi,项目名称:ada,代码行数:68,代码来源:questionFormTest.inc.php

示例4: renderEndTest


//.........这里部分代码省略.........
                                 $q->setGivenAnswer($answer);
                                 $q->setDisplay(true);
                                 //while assigning calculate scores
                                 $score += $answer['punteggio'];
                                 $max_score += $q->getMaxScore();
                                 unset($questions[$k]);
                                 unset($givenAnswers[$a]);
                                 break;
                             }
                         }
                     }
                 }
             }
             unset($givenAnswers);
             //rendering test
             $html = $this->renderingHtml($ref, $this->feedback, $this->rating, $this->rating_answer);
             if (is_null($ref)) {
                 $ref = $html;
             }
             if (!empty($this->_children)) {
                 foreach ($this->_children as $v) {
                     $ref->addChild($v->render(false, $this->feedback, $this->rating, $this->rating_answer));
                 }
             }
             //show total Score
             if ($this->rating) {
                 $div = CDOMElement::create('div', 'id:test_score');
                 $div->setAttribute('id', 'score_test');
                 if ($_SESSION['sess_id_user_type'] != AMA_TYPE_STUDENT) {
                     $testo = translateFN('Lo studente ha totalizzato %s punti su %s');
                 } else {
                     $testo = translateFN('Hai totalizzato %s punti su %s');
                 }
                 $div->addChild(new CText(sprintf($testo, $score, $max_score)));
                 $html->addChild($div);
             }
             // prints control to set test repeatable
             if (!$this->repeatable && $_SESSION['sess_id_user_type'] == AMA_TYPE_TUTOR) {
                 $div = CDOMElement::create('div', 'id:test_controls');
                 $label = CDOMElement::create('label');
                 $label->addChild(new CText(translateFN('Permettere all\'utente di ripetere il test?')));
                 $div->addChild($label);
                 $radioSi = CDOMElement::create('radio', 'id:repeateTestYes,name:repeateTest');
                 $radioSi->setAttribute('onchange', 'toggleRepeatable(' . $id_history_test . ',true);');
                 if ($givenTest['ripetibile']) {
                     $radioSi->setAttribute('checked', '');
                 }
                 $div->addChild($radioSi);
                 $div->addChild(new CText(translateFN('Si')));
                 $radioNo = CDOMElement::create('radio', 'id:repeateTestNo,name:repeateTest');
                 $radioNo->setAttribute('onchange', 'toggleRepeatable(' . $id_history_test . ',false);');
                 if (!$givenTest['ripetibile']) {
                     $radioNo->setAttribute('checked', '');
                 }
                 $div->addChild($radioNo);
                 $div->addChild(new CText(translateFN('No')));
                 $html->addChild($div);
             }
         }
     } else {
         $html = CDOMElement::create('div');
         $html->addChild(new CText(Node::prepareInternalLinkMediaForEditor($this->consegna)));
     }
     //return link
     $return_link = null;
     switch ($this->returnLink) {
         default:
         case ADA_NO_TEST_RETURN:
             $label = null;
             $return_link = null;
             break;
         case ADA_NEXT_NODE_TEST_RETURN:
             $label = translateFN('Procedi');
             $node_obj = new Node($this->id_nodo_riferimento);
             if (!empty($node_obj->next_id)) {
                 $return_link = HTTP_ROOT_DIR . '/browsing/view.php?id_node=' . $node_obj->next_id;
             }
             break;
         case ADA_INDEX_TEST_RETURN:
             $label = translateFN('Torna all\'indice del corso');
             $return_link = HTTP_ROOT_DIR . '/browsing/main_index.php';
             break;
         case ADA_COURSE_INDEX_TEST_RETURN:
             $label = translateFN('Torna all\'elenco dei corsi');
             $return_link = HTTP_ROOT_DIR . '/browsing/user.php';
             break;
     }
     if (!is_null($return_link)) {
         $a = CDOMElement::create('a', 'href:' . $return_link);
         $a->addChild(new CText($label));
         $div = CDOMElement::create('div', 'id:return_link');
         $div->addChild($a);
         $html->addChild($div);
     }
     if ($return_html) {
         return $html->getHtml();
     } else {
         return $html;
     }
 }
开发者ID:eguicciardi,项目名称:ada,代码行数:101,代码来源:root.class.inc.php

示例5: content

    protected function content()
    {
        $dh = $GLOBALS['dh'];
        $this->setName('topicForm');
        $random = 'random';
        $random_number = 'random_number';
        $js = 'var random_field = "' . $random . '";
			var field = "' . $random_number . '";
			var regexp = /^[0-9]+$/;
			document.write(\'<script type="text/javascript" src="' . MODULES_TEST_HTTP . '/js/topicForm.js"><\\/script>\');';
        $this->setCustomJavascript($js);
        //parent
        $nodes = $dh->test_getNodesByParent($this->id_test, $this->id_test);
        $options = array($this->id_test => $nodes[$this->id_test]['titolo'] . ' (' . $nodes[$this->id_test]['nome'] . ')');
        foreach ($nodes as $id_nodo => $v) {
            if ($id_nodo != $this->id_test) {
                $options[$id_nodo] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' . $v['titolo'] . ' (' . $v['nome'] . ')';
            }
        }
        if (isset($this->data['id_nodo_parent'])) {
            $defaultValue = $this->data['id_nodo_parent'];
        } else {
            if (is_null($this->id_nodo_parent)) {
                $defaultValue = $this->id_test;
            } else {
                $defaultValue = $this->id_nodo_parent;
            }
        }
        $this->addSelect('id_nodo_parent', translateFN('Aggancia a') . ':', $options, $defaultValue);
        //nome
        if (!empty($this->data['nome'])) {
            $defaultValue = $this->data['nome'];
        } else {
            if (is_null($this->id_nodo_parent)) {
                $defaultValue = translateFN('sessione') . ' ';
            } else {
                $defaultValue = translateFN('argomento') . ' ';
            }
            $res = $dh->test_getNodesByRadix($this->id_test);
            if ($dh->isError($res) || empty($res)) {
                $defaultValue .= 1;
            } else {
                foreach ($res as $k => $v) {
                    if ($v['tipo'][0] != ADA_GROUP_TOPIC) {
                        unset($res[$k]);
                    }
                }
                $defaultValue .= count($res) + 1;
            }
        }
        $this->addTextInput('nome', translateFN('Nome (per uso interno)') . ':')->setRequired()->setValidator(FormValidator::NOT_EMPTY_STRING_VALIDATOR)->withData($defaultValue);
        //titolo
        $this->addTextInput('titolo', translateFN('Titolo') . ':')->withData($this->data['titolo']);
        //descrizione
        $this->addTextarea('testo', translateFN('Descrizione') . ':')->withData(Node::prepareInternalLinkMediaForEditor($this->data['testo']));
        //durata
        if (!is_null($this->id_nodo_parent)) {
            $this->addHidden('durata')->withData(0);
        } else {
            if (isset($this->data['durata'])) {
                $defaultValue = $this->data['durata'];
            } else {
                $defaultValue = 0;
            }
            $this->addTextInput('durata', translateFN('Tempo limite (in minuti, 0 = senza limite)') . ': ')->setRequired()->setValidator(FormValidator::NON_NEGATIVE_NUMBER_VALIDATOR)->withData($defaultValue);
        }
        //random questions
        $radios = array(ADA_PICK_QUESTIONS_NORMAL => translateFN('No'), ADA_PICK_QUESTIONS_RANDOM => translateFN('Si'));
        if (isset($this->data[$random])) {
            $defaultValue = $this->data[$random];
        } else {
            $defaultValue = ADA_PICK_QUESTIONS_NORMAL;
        }
        if (is_null($this->id_nodo_parent)) {
            $randomTranslation = translateFN('Scelta casuale degli argomenti');
        } else {
            $randomTranslation = translateFN('Scelta casuale delle domande');
        }
        $this->addRadios($random, $randomTranslation . ':', $radios, $defaultValue);
        //how many random questions
        if (is_null($this->id_nodo_parent)) {
            $label = translateFN('Numero di argomenti da mostrare');
        } else {
            $label = translateFN('Numero di domande da mostrare');
        }
        $num = $this->addTextInput($random_number, $label . ':')->setValidator(FormValidator::POSITIVE_NUMBER_VALIDATOR)->withData($this->data[$random_number]);
        if (isset($this->data[$random]) && $this->data[$random] == ADA_PICK_QUESTIONS_RANDOM) {
            $num->setRequired();
        }
    }
开发者ID:eguicciardi,项目名称:ada,代码行数:90,代码来源:topicFormTest.inc.php


注:本文中的Node::prepareInternalLinkMediaForEditor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。