本文整理汇总了PHP中ilPropertyFormGUI::setValuesByArray方法的典型用法代码示例。如果您正苦于以下问题:PHP ilPropertyFormGUI::setValuesByArray方法的具体用法?PHP ilPropertyFormGUI::setValuesByArray怎么用?PHP ilPropertyFormGUI::setValuesByArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilPropertyFormGUI
的用法示例。
在下文中一共展示了ilPropertyFormGUI::setValuesByArray方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValues
public function getValues()
{
$values = array();
foreach ($this->checkboxes as $key => $cb) {
if (!is_array($cb)) {
$values[$cb] = $this->_getValue($cb);
} else {
$values[$key] = $this->_getValue($key);
foreach ($cb as $field => $gui) {
$values[$key . '_' . $field] = $this->_getValue($key . '_' . $field);
}
}
}
$this->form->setValuesByArray($values);
}
示例2: showUnitCategoryModificationForm
/**
*
*/
protected function showUnitCategoryModificationForm()
{
if (!$this->isCRUDContext()) {
$this->{$this->getDefaultCommand()}();
return;
}
$category = $this->getCategoryById((int) $_GET['category_id']);
$this->initUnitCategoryForm($category);
$this->unit_cat_form->setValuesByArray(array('category_name' => $category->getCategory()));
$this->tpl->setContent($this->unit_cat_form->getHtml());
}
示例3: getValues
/**
* getFieldValues
*/
public function getValues()
{
//Std-Values
$values = array('table_id' => $this->field_obj->getTableId(), 'field_id' => $this->field_obj->getId(), 'title' => $this->field_obj->getTitle(), 'datatype' => $this->field_obj->getDatatypeId(), 'description' => $this->field_obj->getDescription(), 'required' => $this->field_obj->getRequired(), 'unique' => $this->field_obj->isUnique());
$propertyvalues = $this->field_obj->getPropertyvalues();
// Propertie-Values - Subitems
foreach (ilDataCollectionDatatype::getAllDatatypes() as $datatype) {
foreach (ilDataCollectionDatatype::getProperties($datatype['id']) as $property) {
$values['prop_' . $property['id']] = $propertyvalues[$property['id']];
}
}
$this->form->setValuesByArray($values);
return true;
}
示例4: setFormValues
/**
* Set values from object to form
*
* @return bool
*/
public function setFormValues()
{
//Get Record-Values
$record_obj = ilDataCollectionCache::getRecordCache($this->record_id);
//Get Table Field Definitions
$allFields = $this->table->getFields();
$values = array();
foreach ($allFields as $field) {
$value = $record_obj->getRecordFieldFormInput($field->getId());
$values['field_' . $field->getId()] = $value;
}
$values['record_id'] = $record_obj->getId();
$this->form->setValuesByArray($values);
return true;
}
示例5: showMembersObject
public function showMembersObject()
{
/**
* @var $tree ilTree
* @var $tpl ilTemplate
* @var $ilTabs ilTabsGUI
* @var $ilAccess ilAccessHandler
* @var $ilErr ilErr
*/
global $tree, $tpl, $ilTabs, $ilAccess, $ilErr;
if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
$ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
}
$tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_members_list.html', 'Modules/Forum');
$ilTabs->setTabActive('settings');
$this->settingsTabs();
// instantiate the property form
if (!$this->initNotificationSettingsForm()) {
// if the form was just created set the values fetched from database
$this->notificationSettingsForm->setValuesByArray(array('notification_type' => $this->objProperties->getNotificationType(), 'adm_force' => (bool) $this->objProperties->isAdminForceNoti(), 'usr_toggle' => (bool) $this->objProperties->isUserToggleNoti()));
}
// set form html into template
$tpl->setVariable('NOTIFICATIONS_SETTINGS_FORM', $this->notificationSettingsForm->getHTML());
include_once 'Modules/Forum/classes/class.ilForumNotification.php';
include_once 'Modules/Forum/classes/class.ilObjForum.php';
$frm_noti = new ilForumNotification($this->object->getRefId());
$oParticipants = $this->getParticipantsObject();
$moderator_ids = $frm_noti->_getModerators($this->object->getRefId());
$admin_ids = $oParticipants->getAdmins();
$member_ids = $oParticipants->getMembers();
$tutor_ids = $oParticipants->getTutors();
if ($this->objProperties->getNotificationType() == 'default') {
// update forum_notification table
include_once 'Modules/Forum/classes/class.ilForumNotification.php';
$forum_noti = new ilForumNotification($this->object->getRefId());
$forum_noti->setAdminForce($this->objProperties->isAdminForceNoti());
$forum_noti->setUserToggle($this->objProperties->isUserToggleNoti());
$forum_noti->setForumId($this->objProperties->getObjId());
} else {
if ($this->objProperties->getNotificationType() == 'per_user') {
$moderators = $this->getUserNotificationTableData($moderator_ids, $frm_noti);
$admins = $this->getUserNotificationTableData($admin_ids, $frm_noti);
$members = $this->getUserNotificationTableData($member_ids, $frm_noti);
$tutors = $this->getUserNotificationTableData($tutor_ids, $frm_noti);
$this->__showMembersTable($moderators, $admins, $members, $tutors);
}
}
}
示例6: settings
/**
* @param bool $init_from_database
*/
protected function settings($init_from_database = true)
{
/**
* @var $rbacsystem ilRbacSystem
* @var $ilErr ilErrorHandling
* @var $tpl ilTemplate
*/
global $rbacsystem, $ilErr, $tpl;
if (!$rbacsystem->checkAccess('read', $this->object->getRefId())) {
$ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
}
$this->initSettingsForm();
if ($init_from_database) {
$this->form->setValuesByArray(array('tos_status' => $this->object->getStatus()));
} else {
$this->form->setValuesByPost();
}
$tpl->setContent($this->form->getHtml());
}
示例7: populateForm
/**
* @param ilPropertyFormGUI $form
*/
protected function populateForm(ilPropertyFormGUI $form)
{
/**
* @var $ilSetting ilSetting
*/
global $ilSetting;
require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
$frma_set = new ilSetting('frma');
$form->setValuesByArray(array('forum_overview' => (bool) $frma_set->get('forum_overview', false), 'fora_statistics' => (bool) $ilSetting->get('enable_fora_statistics', false), 'anonymous_fora' => (bool) $ilSetting->get('enable_anonymous_fora', false), 'forum_notification' => (int) $ilSetting->get('forum_notification') === 1 ? true : false, 'activate_captcha_anonym' => ilCaptchaUtil::isActiveForForum()));
}
示例8: formTimingObject
private function formTimingObject()
{
global $ilAccess;
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTableWidth("100%");
$form->setId("tst_change_workingtime");
$form->setTitle($this->lng->txt("tst_change_workingtime"));
// test users
$participantslist = new ilSelectInputGUI($this->lng->txt('participants'), "participant");
$participants =& $this->object->getTestParticipants();
$times = $this->object->getStartingTimeOfParticipants();
$addons = $this->object->getTimeExtensionsOfParticipants();
$options = array('' => $this->lng->txt('please_select'), '0' => $this->lng->txt('all_participants'));
foreach ($participants as $participant) {
$started = "";
if ($this->object->getAnonymity()) {
$name = $this->lng->txt("anonymous");
} else {
$name = $participant['lastname'] . ', ' . $participant['firstname'];
}
if ($times[$participant['active_id']]) {
$started = ", " . $this->lng->txt('tst_started') . ': ' . ilDatePresentation::formatDate(new ilDateTime($times[$participant['active_id']], IL_CAL_DATETIME));
}
if ($addons[$participant['active_id']] > 0) {
$started .= ", " . $this->lng->txt('extratime') . ': ' . $addons[$participant['active_id']] . ' ' . $this->lng->txt('minutes');
}
$options[$participant['active_id']] = $participant['login'] . ' (' . $name . ')' . $started;
}
$participantslist->setRequired(true);
$participantslist->setOptions($options);
$form->addItem($participantslist);
// extra time
$extratime = new ilNumberInputGUI($this->lng->txt("extratime"), "extratime");
$extratime->setInfo($this->lng->txt('tst_extratime_info'));
$extratime->setRequired(true);
$extratime->setMinValue(0);
$extratime->setMinvalueShouldBeGreater(false);
$extratime->setSuffix($this->lng->txt('minutes'));
$extratime->setSize(5);
$form->addItem($extratime);
if (is_array($_POST) && strlen($_POST['cmd']['timing'])) {
$form->setValuesByArray($_POST);
}
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
$form->addCommandButton("timing", $this->lng->txt("save"));
}
$form->addCommandButton('timingOverview', $this->lng->txt("cancel"));
return $form;
}
示例9: showMembersObject
public function showMembersObject()
{
/**
* @var $tree ilTree
* @var $tpl ilTemplate
* @var $ilTabs ilTabsGUI
* @var $ilAccess ilAccessHandler
* @var $ilErr ilErr
*/
global $tree, $tpl, $ilTabs, $ilAccess, $ilErr;
if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
$ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
}
$tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_members_list.html', 'Modules/Forum');
$ilTabs->setTabActive('settings');
$this->settingsTabs();
// instantiate the property form
if (!$this->initNotificationSettingsForm()) {
// if the form was just created set the values fetched from database
$this->notificationSettingsForm->setValuesByArray(array('notification_type' => $this->objProperties->getNotificationType(), 'adm_force' => (bool) $this->objProperties->isAdminForceNoti(), 'usr_toggle' => (bool) $this->objProperties->isUserToggleNoti()));
}
// set form html into template
$tpl->setVariable('NOTIFICATIONS_SETTINGS_FORM', $this->notificationSettingsForm->getHTML());
include_once 'Modules/Forum/classes/class.ilForumNotification.php';
include_once 'Modules/Forum/classes/class.ilObjForum.php';
$frm_noti = new ilForumNotification($this->object->getRefId());
// check if there a parent-node is a grp or crs
$grp_ref_id = $tree->checkForParentType($this->object->getRefId(), 'grp');
$crs_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs');
if ($grp_ref_id == 0 && $crs_ref_id == 0) {
$ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
}
/**
* @var $oParticipants ilParticipants
*/
$oParticipants = null;
if ($grp_ref_id > 0) {
$parent_obj = ilObjectFactory::getInstanceByRefId($grp_ref_id);
include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
$oParticipants = ilGroupParticipants::_getInstanceByObjId($parent_obj->getId());
} else {
if ($crs_ref_id > 0) {
$parent_obj = ilObjectFactory::getInstanceByRefId($crs_ref_id);
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$oParticipants = ilCourseParticipants::_getInstanceByObjId($parent_obj->getId());
}
}
$moderator_ids = $frm_noti->_getModerators($this->object->getRefId());
$admin_ids = $oParticipants->getAdmins();
$member_ids = $oParticipants->getMembers();
$tutor_ids = $oParticipants->getTutors();
$moderators = array();
$admins = array();
$members = array();
$tutors = array();
$all_forum_users = array_merge($moderator_ids, $admin_ids, $member_ids, $tutor_ids);
$all_forum_users = array_unique($all_forum_users);
if ($this->objProperties->getNotificationType() == 'default') {
// update forum_notification table
include_once 'Modules/Forum/classes/class.ilForumNotification.php';
$forum_noti = new ilForumNotification($this->object->getRefId());
$forum_noti->setAdminForce($this->objProperties->isAdminForceNoti());
$forum_noti->setUserToggle($this->objProperties->isUserToggleNoti());
$forum_noti->setForumId($this->objProperties->getObjId());
if (isset($_POST['notification_type']) && $_POST['notification_type'] == 'default') {
// delete all notifications set by admin
$forum_noti->deleteNotificationAllUsers();
}
} else {
if ($this->objProperties->getNotificationType() == 'per_user') {
$counter = 0;
foreach ($moderator_ids as $user_id) {
$frm_noti->setUserId($user_id);
#$admin_force_noti = $frm_noti->isAdminForceNotification();
$user_toggle_noti = $frm_noti->isUserToggleNotification();
$icon_ok = $this->getIcon(!$user_toggle_noti);
$moderators[$counter]['user_id'] = ilUtil::formCheckbox(0, 'user_id[]', $user_id);
$moderators[$counter]['login'] = ilObjUser::_lookupLogin($user_id);
$name = ilObjUser::_lookupName($user_id);
$moderators[$counter]['firstname'] = $name['firstname'];
$moderators[$counter]['lastname'] = $name['lastname'];
$moderators[$counter]['user_toggle_noti'] = $icon_ok;
$counter++;
}
$counter = 0;
foreach ($admin_ids as $user_id) {
$frm_noti->setUserId($user_id);
#$admin_force_noti = $frm_noti->isAdminForceNotification();
$user_toggle_noti = $frm_noti->isUserToggleNotification();
$icon_ok = $this->getIcon(!$user_toggle_noti);
$admins[$counter]['user_id'] = ilUtil::formCheckbox(0, 'user_id[]', $user_id);
$admins[$counter]['login'] = ilObjUser::_lookupLogin($user_id);
$name = ilObjUser::_lookupName($user_id);
$admins[$counter]['firstname'] = $name['firstname'];
$admins[$counter]['lastname'] = $name['lastname'];
$admins[$counter]['user_toggle_noti'] = $icon_ok;
$counter++;
}
$counter = 0;
foreach ($member_ids as $user_id) {
//.........这里部分代码省略.........
示例10: populateSettings
/**
* Populate the Test Overview settings.
*
* This method is called internally by
* @see self::editSettings() to fill the form
* by the current settings' values.
*/
protected function populateSettings()
{
$values['title'] = $this->object->getTitle();
$values['desc'] = $this->object->getDescription();
$this->form->setValuesByArray($values);
}
示例11: populateEctsForm
/**
* @param ilPropertyFormGUI $form
*/
protected function populateEctsForm(ilPropertyFormGUI $form)
{
$data = array();
$data['ectcs_status'] = $this->object->getECTSOutput();
$data['use_ects_fx'] = preg_match('/\\d+/', $this->object->getECTSFX());
$data['ects_fx_threshold'] = $this->object->getECTSFX();
$ects_grades = $this->object->getECTSGrades();
for ($i = ord('a'); $i <= ord('e'); $i++) {
$mark = chr($i);
$data['ects_grade_' . $mark] = $ects_grades[chr($i - 32)];
}
$form->setValuesByArray($data);
}
示例12: getPropertiesValues
public function getPropertiesValues()
{
$values['title'] = $this->object->getTitle();
$values['desc'] = $this->object->getDescription();
$this->form->setValuesByArray($values);
}
示例13: populateWithCurrentSettings
/**
* @param ilPropertyFormGUI $form
*/
protected function populateWithCurrentSettings(ilPropertyFormGUI $form)
{
require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
$form->setValuesByArray(array('activate_captcha_anonym' => ilCaptchaUtil::isActiveForWiki()));
}