ItemProcFunc for columns items

@param array $params An array containing the items and parameters for the list of items
327432
public function columnsItemsProcFunc(array &$params)
    {
        $this->init($params['row']['pid']);
        $gridContainerId = is_array($params['row']['tx_gridelements_container'])
            ? (int)$params['row']['tx_gridelements_container'][0]
            : (int)$params['row']['tx_gridelements_container'];

        if ($gridContainerId > 0) {
            $gridElement = $this->layoutSetup->cacheCurrentParent($gridContainerId, true);
            $params['items'] = $this->layoutSetup->getLayoutColumnsSelectItems($gridElement['tx_gridelements_backend_layout']);

            $ContentType = is_array($params['row']['CType']) ? $params['row']['CType'][0] : $params['row']['CType'];
            if (!empty($ContentType) && is_array($params['items'])) {
                foreach ($params['items'] as $itemKey => $itemArray) {
                    if ($itemArray[3] !== '' && $itemArray[3] !== '*'
                        && !GeneralUtility::inList($itemArray[3], $ContentType)
                    ) {
                        unset($params['items'][$itemKey]);
                    }
                }
            }
        }
    }
691071
public function addLtiLinkItemExtended($params = array())
    {
        global $CFG;

        // populate the default parameters
        if (empty($params['title']))
            $params['title'] = false;
        if (empty($params['text']))
            $params['text'] = false;
        if (empty($params['icon']))
            $params['icon'] = false;
        if (empty($params['fa_icon']))
            $params['fa_icon'] = false;
        if (empty($params['custom']))
            $params['custom'] = false;
        if (empty($params['points']))
            $params['points'] = false;
        if (empty($params['activityId']))
            $params['activityId'] = false;
        if (empty($params['placementTarget']))
            $params['placementTarget'] = 'iframe';
        if (empty($params['placementWindowTarget']))
            $params['placementWindowTarget'] = '';
        if (empty($params['placementWidth']))
            $params['placementWidth'] = '';
        if (empty($params['placementHeight']))
            $params['placementHeight'] = '';

        $item = '{ "@type" : "LtiLinkItem",
                    "@id" : ":item2",
                    "title" : "A cool tool hosted in the Tsugi environment.",
                    "mediaType" : "application/vnd.ims.lti.v1.ltilink",
                    "text" : "For more information on how to build and host powerful LTI-based Tools quickly, see www.tsugi.org",
                    "url" : "http://www.tsugi.org/",
                    "placementAdvice" : {
                        "presentationDocumentTarget" : "iframe"
                    },
                    "icon" : {
                        "@id" : "https://static.tsugi.org/img/default-icon.png",
                        "fa_icon" : "fa-magic",
                        "width" : 64,
                        "height" : 64
                    },
                    "lineItem" : {
                        "@type" : "LineItem",
                        "label" : "Gradable External Tool",
                        "reportingMethod" : "res:totalScore",
                        "assignedActivity" : {
                            "@id" : "http://toolprovider.example.com/assessment/66400",
                            "activityId" : "a-9334df-33"
                        },
                        "scoreConstraints" : {
                            "@type" : "NumericLimits",
                            "normalMaximum" : 10
                        }
                    }
                }';

        $item = '{
            "type": "ltiResourceLink",
            "title": "A title",
            "url": "https://lti.example.com/launchMe",
            "presentation": {
                "documentTarget": "iframe",
                "width": 500,
                "height": 600
            },
            "icon": {
                "url": "https://lti.example.com/image.jpg",
                "fa_icon" : "fa-magic",
                "width": 100,
                "height": 100
            },
            "thumbnail": {
                "url": "https://lti.example.com/thumb.jpg",
                "width": 90,
                "height": 90
            },
            "lineItem": {
                "scoreMaximum": 87,
                "label": "Chapter 12 quiz",
                "resourceId": "xyzpdq1234",
                "tag": "originality"
            },
            "custom": {
                "quiz_id": "az-123",
                "duedate": "$Resource.submission.endDateTime"
            },
            "window": {
                "targetName": "examplePublisherContent"
            },
            "iframe": {
                "height": 890
            }
       }';

        $json = json_decode($item);
        $json->url = $params['url'];
        if ( $params['title'] ) $json->{'title'} = $params['title'];
        // TODO: WTF? Text is gone?
        // if ( $params['text'] ) $json->text = $params['text'];
        if ( $params['icon'] ) $json->icon->url = $params['icon'];
        if ( $params['fa_icon'] ) $json->icon->fa_icon = $params['fa_icon'];
        unset($json->custom);
        if ( $params['custom'] ) $json->custom = $params['custom'];
        if ( $params['points'] && $params['activityId'] ) {
            $json->lineItem->label = $params['title'];
            // Leave guid in as an extension until we are forced to get rid of it :)
            $json->lineItem->guid = $CFG->wwwroot . '/lti/activity/' . $params['activityId'];
            $json->lineItem->resourceId = $params['activityId'];
            $json->lineItem->scoreMaximum = $params['points'];
        } else {
            unset($json->lineItem);
        }

        if ($params['placementTarget'])
            $json->presentation->documentTarget = $params['placementTarget'];
        if ($params['placementWindowTarget'])
            $json->presentation->windowTarget = $params['placementWindowTarget'];
        if (! empty($params['placementWidth']))
            $json->presentation->width = $params['placementWidth'];
        if (! empty($params['placementHeight']))
            $json->presentation->height = $params['placementHeight'];

        $this->items[] = $json;
    }
417437
public function itemsFilterHash($params) {
		$itemsHash = parent::itemsFilterHash($params);
		//Filter users by email
		if (isset($params['email'])) {
			$itemsHash .= ':email=' . $params['email'];
		}
		return $itemsHash;
	}
15978
public function itemsFilterIds($params) {
		//
		$cacheenabled = (!empty($params['cacheenabled']));
		if ($cacheenabled) {
			$bcache = \Brilliant\BFactory::GetCache();
		}
		if ($bcache) {
			$hash = $this->itemsFilterHash($params);
			$ids = $bcache->get($hash);
			if (($ids !== false) && ($ids !== NULL)) {
				return $ids;
			}
		}
		//
		if (!$db = $this->getDBO()) {
			return false;
		}
		if (is_array($this->primaryKeyName)) {
			$flds = array();
			foreach ($this->primaryKeyName as $pk) {
				$flds[] = '`' . $this->tableName . '`.`' . $pk . '`';
			}
			$qr = 'select ' . implode(',', $flds) . ' from `' . $this->tableName . '`';
		} else {
			$qr = 'select `' . $this->tableName . '`.`' . $this->primaryKeyName . '` from `' . $this->tableName . '`';
		}
		$this->itemsFilterSql($params, $wh, $jn);
		if (!empty($jn)) {
			$qr .= ' ' . implode(' ', $jn);
		}
		if (!empty($wh)) {
			$qr .= ' WHERE (' . implode(' AND ', $wh) . ')';
		}
		if (isset($params['orderby'])) {
			$orderasc = isset($params['orderdir']) ? ' ' . $params['orderdir'] : '';
			if ($params['orderby'] == "RAND()") {
				$qr .= ' ORDER BY ' . $params['orderby'] . '' . $orderasc;
			} else {
				$qr .= ' ORDER BY `' . $params['orderby'] . '`' . $orderasc;
			}
		}
		//Limit & offset
		if (!empty($params['limit'])) {
			$limit = (int)$params['limit'];
			$offset = (int)$params['offset'];
			$qr .= ' LIMIT ' . $limit;
			if ($offset) {
				$qr .= ' OFFSET ' . $offset;
			}
		}
		//Execute query
		$q = $db->Query($qr);
		if (empty($q)) {
			return false;
		}
		$ids = array();
		while ($l = $db->fetch($q)) {
			if (is_array($this->primaryKeyName)) {
				$id = array();
				foreach ($this->primaryKeyName as $pk) {
					$id[$pk] = $l[$pk];
				}
			} else {
				$id = (int)$l[$this->primaryKeyName];
			}
			$ids[] = $id;
		}
		//
		if ($bcache) {
			$bcache->set($hash, $ids, $this->cacheTime);
		}
		//
		return $ids;
	}
89194
protected static function prepareParams($params, $column)
    {
        if (is_string($params)) {
            $params = str_replace('[column]', $column, $params);
            return $params;
        } elseif (is_array($params)) {
            $params = Json::decode(str_replace('[column]', $column, Json::encode($params)));
            return $params;
        } else {
            throw new Exception(Module::t('app', 'Params should be string or array'));
        }
    }
224160
public function proc($wizardItems)
    {
        foreach ($this->plugins as $plugin) {
            $wizardItems[$this->getWizardKey($plugin)] = [
                'icon' => $this->getExtRelPath() . $this->iconFile,
                'title' => $this->translate('title', $plugin),
                'description' => $this->translate('description', $plugin),
                'params' => '&defVals[tt_content][CType]=list&defVals[tt_content][list_type]=' . $this->getListType($plugin)
            ];
        }

        return $wizardItems;
    }
562926
public function select($params/*, ...*/)
    {
        $rel = $this->currentOrClone();
        
        $params = func_get_args();
        if (is_array($params[0])) {
            $params = array_shift($params);
        }
        $rel->select->columns($params);
        return $rel;
    }
42783
public function itemsProcFunc(&$params)
    {
        // if this tt_content element is inline element of mask
        if ($params["row"]["colPos"] == $this->colPos) {
            $fieldHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper');
            $this->storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('MASK\\Mask\\Domain\\Repository\\StorageRepository');

            if (isset($_REQUEST["ajax"]["context"])) {
                $ajaxContext = json_decode($_REQUEST["ajax"]["context"]);
                $fieldKey = str_replace("_parent", "", $ajaxContext->config->foreign_field);
            } else {
                $fields = $params["row"];
                foreach ($fields as $key => $field) {
                    // search for the parent field, to get the key of mask field this content element belongs to
                    if ($this->startsWith($key, "tx_mask_") && $this->endsWith($key, "_parent") && $field > 0) {

                        // if a parent field was found, that is filled with a uid, extract the mask field name from it
                        $fieldKey = str_replace("_parent", "", $key);

                        // if one parent field was found, don't continue search, there can only be one parent
                        break;
                    }
                }
            }

            // load the json configuration of this field
            $table = $fieldHelper->getFieldType($fieldKey);
            $fieldConfiguration = $this->storageRepository->loadField($table, $fieldKey);

            // if there is a restriction of cTypes specified
            if (is_array($fieldConfiguration["cTypes"])) {

                // prepare array of allowed cTypes, with cTypes as keys
                $cTypes = array_flip($fieldConfiguration["cTypes"]);

                // and check each item if it is allowed. if not, unset it
                foreach ($params["items"] as $itemKey => $item) {
                    if (!isset($cTypes[$item[1]])) {
                        unset($params["items"][$itemKey]);
                    }
                }
            }
        } else { // if it is not inline tt_content element
            // and if other itemsProcFunc from other extension was available (e.g. gridelements),
            // then call it now and let it render the items
            if (!empty($params["config"]["m_itemsProcFunc"])) {
                \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($params["config"]["m_itemsProcFunc"], $params,
                    $this);
            }
        }
    }
329360
public function saveItems( stdClass $params )
	{
		$this->_checkParams( $params, array( 'site', 'items' ) );
		$this->_setLocale( $params->site );

		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$item = $this->_createItem( (array) $entry );
			$this->_manager->saveItem( $item );
		}

		return array(
			'items' => $params->items,
			'success' => true,
		);
	}
315399
public function saveItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'items' ) );

		$ids = [];
		$manager = $this->getManager();
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$item = $manager->createItem();
			$item->fromArray( (array) $this->transformValues( $entry ) );
			$item = $manager->saveItem( $item );
			$ids[] = $item->getId();
		}

		return $this->getItems( $ids, $this->getPrefix() );
	}
1315639
private function validateAndSetBotParamsExtra(array $params)
    {
        foreach (self::$valid_extra_bot_params as $extra_key) {
            if (!array_key_exists($extra_key, $params)) {
                continue;
            }

            $this->bot_params[$extra_key] = $params[$extra_key];
        }
    }
793914
public final function setRecord ($params)
    {
        foreach ($params as $key => $param) {
            if (! in_array($key, $this->getColumn())) {
                unset($params->{$key});
            }
        }

        $this->record = $params;
    }
508603
protected function processParams(array $params)
    {
        //If a file needs to be uploaded
        if (isset($params['file']) && $params['file'] instanceof BoxFile) {
            //Set the file property
            $this->setFile($params['file']);
            //Remove the file item from the params array
            unset($params['file']);
        }

        //Whether the response needs to be validated
        //against being a valid JSON response
        if (isset($params['validateResponse'])) {
            //Set the validateResponse
            $this->validateResponse = $params['validateResponse'];
            //Remove the validateResponse from the params array
            unset($params['validateResponse']);
        }

        return $params;
    }
181260
public function insertItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'items' ) );

		$manager = $this->getManager();

		$refId = ( isset( $params->refid ) ? $params->refid : null );
		$parentId = ( ( isset( $params->parentid ) && $params->parentid !== 'root' ) ? $params->parentid : null );
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$item = $manager->createItem();
			$item->fromArray( (array) $this->transformValues( $entry ) );
			$manager->insertItem( $item, $parentId, $refId );

			$entry->{'locale.site.id'} = $item->getId();
		}

		return array(
			'items' => ( !is_array( $params->items ) ? reset( $items ) : $items ),
			'success' => true,
		);
	}
783835
public function layoutItemsProcFunc(array &$params)
    {
        $this->init($params['row']['pid']);
        $layoutSelectItems = $this->layoutSetup->getLayoutSelectItems(
            isset($params['row']['colPos'][0]) ? $params['row']['colPos'][0] : $params['row']['colPos'],
            $params['row']['tx_gridelements_columns'],
            $params['row']['tx_gridelements_container'],
            $this->layoutSetup->getRealPid()
        );
        $params['items'] = ArrayUtility::keepItemsInArray($layoutSelectItems, $params['items'], true);
    }
266642
public function bindParams($params)
    {
        $bindParams = [''];
        
        foreach ($params as $dbColumnName => $dbColumnValue) {
            $dbColumnValueAry = (!is_array($dbColumnValue)) ? [$dbColumnValue] : $dbColumnValue;
            
            $i = 1;
            foreach ($dbColumnValueAry as $dbColumnValueAryValue) {
                ${$dbColumnName . $i} = $dbColumnValueAryValue;
                
                if (is_numeric($dbColumnValueAryValue)) {
                    $bindParams[0] .= 'i';
                } else if (is_double($dbColumnValueAryValue)) {
                    $bindParams[0] .= 'd';
                } else if (is_string($dbColumnValueAryValue)) {
                    $bindParams[0] .= 's';
                } else if (is_null($dbColumnValueAryValue)) {
                    $bindParams[0] .= 's';
                } else {
                    $bindParams[0] .= 'b';
                }
                
                $bindParams[] = &${$dbColumnName . $i};
                $i++;
            }
        }
        
        call_user_func_array([$this->statement, 'bind_param'], $bindParams);
        
        return $this;
    }
955725
public function setParams(array $params = null)
    {
        $this->params = $params;
        if (null !== $params && empty($params)) {
            $this->params = null;
        }
    }