本文整理匯總了PHP中ilTemplate::addInlineCss方法的典型用法代碼示例。如果您正苦於以下問題:PHP ilTemplate::addInlineCss方法的具體用法?PHP ilTemplate::addInlineCss怎麽用?PHP ilTemplate::addInlineCss使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ilTemplate
的用法示例。
在下文中一共展示了ilTemplate::addInlineCss方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: initForm
/**
* init Form
*/
public function initForm()
{
$this->form = new ilPropertyFormGUI();
$prefix = $this->ctrl->isAsynch() ? 'dclajax' : 'dcl';
// Used by datacolleciton.js to select input elements
$this->form->setId($prefix . $this->table_id . $this->record_id);
$hidden_prop = new ilHiddenInputGUI("table_id");
$hidden_prop->setValue($this->table_id);
$this->form->addItem($hidden_prop);
if ($this->record_id) {
$hidden_prop = new ilHiddenInputGUI("record_id");
$hidden_prop->setValue($this->record_id);
$this->form->addItem($hidden_prop);
}
$this->ctrl->setParameter($this, "record_id", $this->record_id);
$this->form->setFormAction($this->ctrl->getFormAction($this));
$allFields = $this->table->getRecordFields();
$inline_css = '';
foreach ($allFields as $field) {
$item = ilDataCollectionDatatype::getInputField($field);
if ($item === NULL) {
continue;
// Fields calculating values at runtime, e.g. ilDataCollectionFormulaField do not have input
}
if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
$fieldref = $field->getFieldRef();
$reffield = ilDataCollectionCache::getFieldCache($fieldref);
$options = array();
if (!$field->isNRef()) {
$options[""] = $this->lng->txt('dcl_please_select');
}
$reftable = ilDataCollectionCache::getTableCache($reffield->getTableId());
foreach ($reftable->getRecords() as $record) {
// If the referenced field is MOB or FILE, we display the filename in the dropdown
switch ($reffield->getDatatypeId()) {
case ilDataCollectionDatatype::INPUTFORMAT_FILE:
$file_obj = new ilObjFile($record->getRecordFieldValue($fieldref), false);
$options[$record->getId()] = $file_obj->getFileName();
break;
case ilDataCollectionDatatype::INPUTFORMAT_MOB:
$media_obj = new ilObjMediaObject($record->getRecordFieldValue($fieldref), false);
$options[$record->getId()] = $media_obj->getTitle();
break;
case ilDataCollectionDatatype::INPUTFORMAT_DATETIME:
$options[$record->getId()] = $record->getRecordFieldSingleHTML($fieldref);
break;
default:
$options[$record->getId()] = $record->getRecordFieldValue($fieldref);
break;
}
}
asort($options);
$item->setOptions($options);
if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
// FSX use this to apply to MultiSelectInputGUI
// if (!$field->isNRef()) { // addCustomAttribute only defined for single selects
if ($reftable->hasPermissionToAddRecord($_GET['ref_id'])) {
$item->addCustomAttribute('data-ref="1"');
$item->addCustomAttribute('data-ref-table-id="' . $reftable->getId() . '"');
$item->addCustomAttribute('data-ref-field-id="' . $reffield->getId() . '"');
}
// }
}
if ($item instanceof ilMultiSelectInputGUI) {
$item->setWidth(400);
$item->setHeight(100);
$inline_css .= 'div#' . $item->getFieldId() . '{resize:both;} ';
}
}
if ($this->record_id) {
$record = ilDataCollectionCache::getRecordCache($this->record_id);
}
$item->setRequired($field->getRequired());
//WORKAROUND. If field is from type file: if it's required but already has a value it is no longer required as the old value is taken as default without the form knowing about it.
if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE || $field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB) {
if ($this->record_id and $record->getId()) {
$field_value = $record->getRecordFieldValue($field->getId());
if ($field_value) {
$item->setRequired(false);
}
}
// If this is an ajax request to return the form, input files are currently not supported
if ($this->ctrl->isAsynch()) {
$item->setDisabled(true);
}
}
if (!ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id) && $field->getLocked()) {
$item->setDisabled(true);
}
$this->form->addItem($item);
}
$this->tpl->addInlineCss($inline_css);
// Add possibility to change the owner in edit mode
if ($this->record_id) {
$ownerField = $this->table->getField('owner');
$inputfield = ilDataCollectionDatatype::getInputField($ownerField);
$this->form->addItem($inputfield);
//.........這裏部分代碼省略.........