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


PHP ilTemplate::addInlineCss方法代码示例

本文整理汇总了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);
//.........这里部分代码省略.........
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.ilDataCollectionRecordEditGUI.php


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