$form->setDefaults(array('embed_type' => 'popup')); } $form->addRule('scorm_size', _INVALIDFIELDDATA, 'checkParameter', 'id'); $smarty->assign("T_SCORM", true); } //Set elements rules $form->addRule('name', _THEFIELD . ' "' . _UNITNAME . '" ' . _ISMANDATORY, 'required', null, 'client'); //The name is mandatory //$form -> addRule('ctg_type', _THEFIELD.' '._CONTENTTYPE.' '._ISMANDATORY, 'required', null, 'client'); //The content type is mandatry if (!isset($_GET['edit'])) { // changed in case parent unit is inactive $form->addRule('parent_content_ID', _THEFIELD . ' ' . _UNITPARENT . ' ' . _ISMANDATORY, 'required', null, 'client'); $form->addRule('parent_content_ID', _INVALIDID, 'numeric'); } //Add the content's questions, in order to setup "complete with question" field if (sizeof($currentLesson->getQuestions()) > 0) { $pathStrings = $currentContent->toPathStrings(); foreach ($currentLesson->getQuestions() as $key => $value) { if ($value['type'] != 'raw_text' || $value['id'] == $currentUnit['options']['complete_question']) { $plainText = trim(strip_tags($value['text'])); if (mb_strlen($plainText) > Question::maxQuestionText) { $plainText = mb_substr($plainText, 0, Question::maxQuestionText) . '...'; } $pathStrings[$value['content_ID']] ? $lessonQuestions[$value['id']] = $pathStrings[$value['content_ID']] . ' » ' . $plainText : ($lessonQuestions[$value['id']] = $plainText); } } if (!empty($lessonQuestions) || $currentUnit['options']['complete_unit_setting'] == EfrontUnit::COMPLETION_OPTIONS_COMPLETEWITHQUESTION) { $form->addElement('select', 'complete_question', _COMPLETEWITHQUESTION, $lessonQuestions, 'id = "complete_question"'); $completeUnitSelect[EfrontUnit::COMPLETION_OPTIONS_COMPLETEWITHQUESTION] = _COMPLETEWITHQUESTION; } }