本文整理汇总了PHP中ilSelectInputGUI::addCustomAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP ilSelectInputGUI::addCustomAttribute方法的具体用法?PHP ilSelectInputGUI::addCustomAttribute怎么用?PHP ilSelectInputGUI::addCustomAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilSelectInputGUI
的用法示例。
在下文中一共展示了ilSelectInputGUI::addCustomAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildPageViewToolbar
//.........这里部分代码省略.........
// if ($optionKeys[0] != $qid) {
// //$ilToolbar->addFormButton($lng->txt("test_prev_question"), "prevQuestion");
// $ilToolbar->addLink($lng->txt("test_prev_question"), $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'prevQuestion'));
// $addSeparator = true;
// }
// else {
// $ilToolbar->addSpacer(45);
// }
//
// if ($optionKeys[count($optionKeys)-1] != $qid) {
// //$ilToolbar->addFormButton($lng->txt("test_next_question"), "nextQuestion");
// $ilToolbar->addLink($lng->txt("test_next_question"), $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'nextQuestion'));
// $addSeparator = true;
// }
// else {
// $ilToolbar->addSpacer(45);
// }
//
// //if ($addSeparator) {
// $ilToolbar->addSeparator();
// //}
if (count($questions)) {
if (isset($show_separator) && $show_separator) {
$ilToolbar->addSeparator();
}
$btn = ilLinkButton::getInstance();
$btn->setCaption("test_prev_question");
$btn->setUrl($ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'prevQuestion'));
$ilToolbar->addButtonInstance($btn);
if (count($options) <= 1 || $optionKeys[0] == $qid) {
$btn->setDisabled(true);
}
$btn = ilLinkButton::getInstance();
$btn->setCaption("test_next_question");
$btn->setUrl($ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'nextQuestion'));
$ilToolbar->addButtonInstance($btn);
if (count($options) <= 1 || $optionKeys[count($optionKeys) - 1] == $qid) {
$btn->setDisabled(true);
}
}
if (count($questions) > 1) {
$ilToolbar->addSeparator();
include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
$si = new ilSelectInputGUI($lng->txt("test_jump_to"), "q_id");
$si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
$si->setOptions($options);
if ($qid) {
$si->setValue($qid);
}
$ilToolbar->addInputItem($si, true);
}
$total = $this->object->evalTotalPersons();
/*if (count($options)) {
include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
$si = new ilSelectInputGUI($lng->txt("test_jump_to"), "q_id");
$si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
$si->setOptions($options);
if ($qid) {
$si->setValue($qid);
}
$ilToolbar->addInputItem($si, true);
}*/
if (count($questions) && !$total) {
$ilCtrl->setParameter($this, 'q_id', $_REQUEST['q_id']);
$ilToolbar->addSeparator();
$ilToolbar->addButton($lng->txt("test_delete_page"), $ilCtrl->getLinkTarget($this, "removeQuestions"));
}
if (count($questions) > 1 && !$total) {
$ilToolbar->addSeparator();
$ilToolbar->addButton($lng->txt("test_move_page"), $ilCtrl->getLinkTarget($this, "movePageForm"));
}
global $ilAccess, $ilUser;
$online_access = false;
if ($this->object->getFixedParticipants()) {
include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
$online_access_result = ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $ilUser->getId());
if ($online_access_result === true) {
$online_access = true;
}
}
if ($this->object->isOnline() && $this->object->isComplete($this->testQuestionSetConfigFactory->getQuestionSetConfig())) {
if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id)) {
$testSession = $this->testSessionFactory->getSession();
$executable = $this->object->isExecutable($testSession, $ilUser->getId(), $allowPassIncrease = TRUE);
if ($executable["executable"]) {
$player_factory = new ilTestPlayerFactory($this->object);
$player_instance = $player_factory->getPlayerGUI();
if ($testSession->getActiveId() > 0) {
$ilToolbar->addSeparator();
$ilToolbar->addButton($lng->txt('tst_resume_test'), $ilCtrl->getLinkTarget($player_instance, 'resumePlayer'));
} else {
$ilToolbar->addSeparator();
$ilToolbar->addButton($lng->txt('tst_start_test'), $ilCtrl->getLinkTarget($player_instance, 'startTest'));
}
}
}
}
}
示例2: renderToolbar
/**
* Render toolbar form
*
* @param array $a_pages
*/
protected function renderToolbar($a_pages)
{
global $ilToolbar, $ilCtrl, $lng, $ilUser;
if (!$this->has_datasets) {
$ilToolbar->addButton($lng->txt("survey_add_new_question"), $ilCtrl->getLinkTarget($this, "addQuestionToolbarForm"));
if ($this->object->isPoolActive()) {
$ilToolbar->addSeparator();
$last_on_page = 0;
if ($a_pages) {
$last_on_page = $a_pages[$this->current_page - 1];
$last_on_page = array_pop($last_on_page);
$last_on_page = $last_on_page["question_id"];
}
$ilCtrl->setParameter($this->editor_gui, "pgov", $this->current_page);
$ilCtrl->setParameter($this->editor_gui, "pgov_pos", $last_on_page . "c");
$cmd = $ilUser->getPref('svy_insert_type') == 1 || strlen($ilUser->getPref('svy_insert_type')) == 0 ? 'browseForQuestions' : 'browseForQuestionblocks';
$ilToolbar->addButton($lng->txt("browse_for_questions"), $ilCtrl->getLinkTarget($this->editor_gui, $cmd));
$ilCtrl->setParameter($this->editor_gui, "pgov", "");
$ilCtrl->setParameter($this->editor_gui, "pgov_pos", "");
}
if ($a_pages) {
$ilToolbar->addSeparator();
}
}
// parse data for pages drop-down
if ($a_pages) {
// previous/next
$ilCtrl->setParameter($this, "pg", $this->current_page - 1);
$ilToolbar->addLink($lng->txt("survey_prev_question"), $ilCtrl->getLinkTarget($this, "renderPage"), !$this->has_previous_page);
$ilCtrl->setParameter($this, "pg", $this->current_page + 1);
$ilToolbar->addLink($lng->txt("survey_next_question"), $ilCtrl->getLinkTarget($this, "renderPage"), !$this->has_next_page);
$ilCtrl->setParameter($this, "pg", $this->current_page);
foreach ($a_pages as $idx => $questions) {
$page = $questions;
$page = array_shift($page);
if ($page["questionblock_id"]) {
$pages_drop[$idx + 1] = $page["questionblock_title"];
if (sizeof($questions) > 1) {
foreach ($questions as $question) {
$pages_drop[$idx + 1 . "__" . $question["question_id"]] = "- " . $question["title"];
}
}
} else {
$pages_drop[$idx + 1] = strip_tags($page["title"]);
}
}
}
// jump to page
if (sizeof($pages_drop) > 1) {
$ilToolbar->addSeparator();
$ilToolbar->setFormAction($ilCtrl->getFormAction($this));
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$si = new ilSelectInputGUI($lng->txt("survey_jump_to"), "jump");
$si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
$si->setOptions($pages_drop);
$si->setValue($this->current_page);
$ilToolbar->addInputItem($si, true);
// we need this to have to right cmd
$cmd = new ilHiddenInputGUI("cmd[renderPage]");
$cmd->setValue("1");
$ilToolbar->addInputItem($cmd);
if (!$this->has_datasets) {
$ilToolbar->addSeparator();
$ilCtrl->setParameter($this, "csum", md5(print_r($a_pages[$this->current_page - 1], true)));
$ilToolbar->addButton($lng->txt("survey_delete_page"), $ilCtrl->getLinkTarget($this, "deleteBlock"));
$ilCtrl->setParameter($this, "csum", "");
$ilToolbar->addSeparator();
$ilToolbar->addButton($lng->txt("survey_move_page"), $ilCtrl->getLinkTarget($this, "movePageForm"));
}
}
}
示例3: initForm
/**
* init form
*
* @access protected
* @param string mode ('edit' | 'create')
* @return
*/
protected function initForm($a_mode, $a_as_milestone = false, $a_edit_single_app = false)
{
global $ilUser, $tpl;
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
include_once './Services/Calendar/classes/class.ilCalendarRecurrenceGUI.php';
include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
$this->form = new ilPropertyFormGUI();
include_once './Services/YUI/classes/class.ilYuiUtil.php';
ilYuiUtil::initDomEvent();
$resp_info = false;
switch ($a_mode) {
case 'create':
$this->ctrl->saveParameter($this, array('seed', 'idate'));
$this->form->setFormAction($this->ctrl->getFormAction($this));
if ($a_as_milestone) {
$this->form->setTitle($this->lng->txt('cal_new_ms'));
$this->form->addCommandButton('saveMilestone', $this->lng->txt('cal_add_milestone'));
$this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
} else {
$this->form->setTitle($this->lng->txt('cal_new_app'));
$this->form->addCommandButton('save', $this->lng->txt('cal_add_appointment'));
$this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
}
break;
case 'edit':
if ($a_as_milestone) {
$this->form->setTitle($this->lng->txt('cal_edit_milestone'));
} else {
$this->form->setTitle($this->lng->txt('cal_edit_appointment'));
}
$this->ctrl->saveParameter($this, array('seed', 'app_id', 'idate'));
$this->form->setFormAction($this->ctrl->getFormAction($this));
$ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
$cat = $ass->getFirstAssignment();
include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
$cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat);
$type = ilObject::_lookupType($cat_info['obj_id']);
if ($a_as_milestone && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ && ($type == "grp" || $type == "crs")) {
$resp_info = true;
$this->form->addCommandButton('editResponsibleUsers', $this->lng->txt('cal_change_responsible_users'));
}
$this->form->addCommandButton('update', $this->lng->txt('save'));
// $this->form->addCommandButton('askDelete',$this->lng->txt('delete'));
$this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
break;
}
// title
$title = new ilTextInputGUI($this->lng->txt('title'), 'title');
$title->setValue($this->app->getTitle());
$title->setRequired(true);
$title->setMaxLength(128);
$title->setSize(32);
$this->form->addItem($title);
// calendar selection
$calendar = new ilSelectInputGUI($this->lng->txt('cal_category_selection'), 'calendar');
if ($_POST['category']) {
$calendar->setValue((int) $_POST['calendar']);
$selected_calendar = (int) $_POST['calendar'];
} else {
if ($_GET['category_id']) {
$calendar->setValue((int) $_GET['category_id']);
$selected_calendar = (int) $_GET['category_id'];
} elseif ($a_mode == 'edit') {
$ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
$cat = $ass->getFirstAssignment();
$calendar->setValue($cat);
$selected_calendar = $cat;
} elseif (isset($_GET['ref_id'])) {
include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
$obj_cal = ilObject::_lookupObjId($_GET['ref_id']);
$calendar->setValue(ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal));
$selected_calendar = ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal);
}
}
$calendar->setRequired(true);
$cats = ilCalendarCategories::_getInstance($ilUser->getId());
$calendar->setOptions($cats->prepareCategoriesOfUserForSelection());
include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
if (ilCalendarSettings::_getInstance()->isNotificationEnabled()) {
$notification_cals = $cats->getNotificationCalendars();
$notification_cals = count($notification_cals) ? implode(',', $notification_cals) : '';
$calendar->addCustomAttribute("onchange=\"ilToggleNotification(new Array(" . $notification_cals . "));\"");
}
$this->form->addItem($calendar);
if (!$a_as_milestone) {
include_once './Services/Form/classes/class.ilDateDurationInputGUI.php';
$tpl->addJavaScript('./Services/Form/js/date_duration.js');
$dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'), 'event');
$dur->setStartText($this->lng->txt('cal_start'));
$dur->setEndText($this->lng->txt('cal_end'));
$dur->enableToggleFullTime($this->lng->txt('cal_fullday_title'), $this->app->isFullday() ? true : false);
//.........这里部分代码省略.........