/**
  * Liefert bereits selektierte Elemente.
  * @param 	tx_mklib_treelib_TreeView 	$oTreeView
  * @return 	array
  */
 private function getItemArray(&$oTreeView)
 {
     $itemArrayProcessed = array();
     foreach ($oTreeView->getItemArray() as $tk => $tv) {
         $tvP = explode('|', $tv, 2);
         $tvP[1] = rawurlencode($this->oTceForm->sL(rawurldecode($tvP[1])));
         $itemArrayProcessed[$tk] = implode('|', $tvP);
     }
     return $itemArrayProcessed;
 }
Exemple #2
0
 /**
  * Render a checkbox for the default settings of records in
  * this table
  *
  * @param array $params
  * @param t3lib_TCEforms $fobj
  * @return string
  */
 public function renderDefaultSettingsField($params, $fobj)
 {
     global $TCA;
     $table = $params['fieldConf']['config']['table'];
     t3lib_div::loadTCA($table);
     $content = '';
     $namePre = str_replace('[default_settings_', '[default_settings][', $params['itemFormElName']);
     /* @var $context Tx_Contexts_Context_Abstract */
     $uid = (int) $params['row']['uid'];
     $context = $uid ? Tx_Contexts_Context_Container::get()->initAll()->find($uid) : null;
     foreach ($params['fieldConf']['config']['settings'] as $setting => $config) {
         $id = $params['itemFormElID'] . '-' . $setting;
         $name = $namePre . '[' . $setting . ']';
         $content .= '<input type="hidden" name="' . $name . '" value="0"/>';
         $content .= '<input class="checkbox" type="checkbox" name="' . $name . '" ';
         if (!$context || !$context->hasSetting($table, $setting, 0) || $context->getSetting($table, $setting, 0)->getEnabled()) {
             $content .= 'checked="checked" ';
         }
         $content .= 'value="1" id="' . $id . '" /> ';
         $content .= '<label for="' . $id . '">';
         $content .= $fobj->sL($config['label']);
         $content .= '</label><br/>';
     }
     return $content;
 }
 /**
  * Get possible records.
  * Copied from TCEform and modified.
  *
  * @param	string		The table name of the record
  * @param	string		The field name which this element is supposed to edit
  * @param	array		The record data array where the value(s) for the field can be found
  * @param	array		An array with additional configuration options.
  * @param	string		$checkForConfField: For which field in the foreign_table the possible records should be fetched
  * @return	mixed		Array of possible record items; false if type is "group/db", then everything could be "possible"
  */
 function getPossibleRecords($table, $field, $row, $conf, $checkForConfField = 'foreign_selector')
 {
     // ctrl configuration from TCA:
     $tcaTableCtrl = $GLOBALS['TCA'][$table]['ctrl'];
     // Field configuration from TCA:
     $foreign_table = $conf['foreign_table'];
     $foreign_check = $conf[$checkForConfField];
     $foreignConfig = $this->getPossibleRecordsSelectorConfig($conf, $foreign_check);
     $PA = $foreignConfig['PA'];
     $config = $PA['fieldConf']['config'];
     if ($foreignConfig['type'] == 'select') {
         // Getting the selector box items from the system
         $selItems = $this->fObj->addSelectOptionsToItemArray($this->fObj->initItemArray($PA['fieldConf']), $PA['fieldConf'], $this->fObj->setTSconfig($table, $row), $field);
         // Possibly filter some items:
         $keepItemsFunc = create_function('$value', 'return $value[1];');
         $selItems = t3lib_div::keepItemsInArray($selItems, $PA['fieldTSConfig']['keepItems'], $keepItemsFunc);
         // Possibly add some items:
         $selItems = $this->fObj->addItems($selItems, $PA['fieldTSConfig']['addItems.']);
         if (isset($config['itemsProcFunc']) && $config['itemsProcFunc']) {
             $selItems = $this->fObj->procItems($selItems, $PA['fieldTSConfig']['itemsProcFunc.'], $config, $table, $row, $field);
         }
         // Possibly remove some items:
         $removeItems = t3lib_div::trimExplode(',', $PA['fieldTSConfig']['removeItems'], 1);
         foreach ($selItems as $tk => $p) {
             // Checking languages and authMode:
             $languageDeny = $tcaTableCtrl['languageField'] && !strcmp($tcaTableCtrl['languageField'], $field) && !$GLOBALS['BE_USER']->checkLanguageAccess($p[1]);
             $authModeDeny = $config['form_type'] == 'select' && $config['authMode'] && !$GLOBALS['BE_USER']->checkAuthMode($table, $field, $p[1], $config['authMode']);
             if (in_array($p[1], $removeItems) || $languageDeny || $authModeDeny) {
                 unset($selItems[$tk]);
             } elseif (isset($PA['fieldTSConfig']['altLabels.'][$p[1]])) {
                 $selItems[$tk][0] = $this->fObj->sL($PA['fieldTSConfig']['altLabels.'][$p[1]]);
             }
             // Removing doktypes with no access:
             if ($table . '.' . $field == 'pages.doktype') {
                 if (!($GLOBALS['BE_USER']->isAdmin() || t3lib_div::inList($GLOBALS['BE_USER']->groupData['pagetypes_select'], $p[1]))) {
                     unset($selItems[$tk]);
                 }
             }
         }
     } else {
         $selItems = false;
     }
     return $selItems;
 }