Generate an HTML row of data for the census header
Add prefix cell (store XREF and drag/drop)
Add suffix cell (delete button)

@param CensusInterface $census

@return string
779508
protected function censusTableHeader(CensusInterface $census): string
    {
        $html = '';
        foreach ($census->columns() as $column) {
            $html .= '<th class="wt-census-assistant-field" title="' . $column->title() . '">' . $column->abbreviation() . '</th>';
        }

        return '<tr class="wt-census-assistant-row"><th hidden></th>' . $html . '<th></th></tr>';
    }
404427
public function getHtmlHeader(): string
  {
    $ret = Html::generateTag('tr', ['class' => [OverviewTable::$class, 'header']]);
    foreach ($this->slatJoints as $factory)
    {
      $ret .= $factory->getHtmlColumnHeader();
    }
    $ret .= '<th class="error"></th>';
    $ret .= '</tr>';

    if ($this->filter)
    {
      $ret .= Html::generateTag('tr', ['class' => [OverviewTable::$class, 'filter']]);
      foreach ($this->slatJoints as $factory)
      {
        $ret .= $factory->getHtmlColumnFilter();
      }
      $ret .= '<th class="error"></th>';
      $ret .= '</tr>';
    }

    return $ret;
  }
893584
public function columns(): array
    {
        return [
            new CensusColumnSurnameGivenNameInitial($this, 'Name', 'Name'),
            new CensusColumnRelationToHead($this, 'Relation', 'Relationship of each person to the head of the family'),
            new CensusColumnSexMF($this, 'Sex', 'Sex'),
            new CensusColumnNull($this, 'Race', 'Color or race'),
            new CensusColumnAge($this, 'Age', 'Age at last birthday'),
            new CensusColumnConditionUs($this, 'Cond', 'Whether single, married, widowed, or divorced'),
            new CensusColumnYearsMarried($this, 'Marr', 'Number of years of present marriage'),
            new CensusColumnChildrenBornAlive($this, 'Chil', 'Mother of how many children'),
            new CensusColumnChildrenLiving($this, 'Chil', 'Number of these children living'),
            new CensusColumnBirthPlaceSimple($this, 'BP', 'Place of birth of this person'),
            new CensusColumnFatherBirthPlaceSimple($this, 'FBP', 'Place of birth of father of this person'),
            new CensusColumnMotherBirthPlaceSimple($this, 'MBP', 'Place of birth of mother of this person'),
            new CensusColumnNull($this, 'Imm', 'Year of immigration to the United States'),
            new CensusColumnNull($this, 'Nat', 'Whether naturalized or alien'),
            new CensusColumnNull($this, 'Lang', 'Whether able to speak English, of if not, give language spoken'),
            new CensusColumnOccupation($this, 'Occupation', 'Trade or profession of, or particular kind of work done by this person'),
            new CensusColumnNull($this, 'Ind', 'General nature of industry'),
            new CensusColumnNull($this, 'Emp', 'Whether an employer, employee, or work on own account'),
            new CensusColumnNull($this, 'Unemp', 'Whether out of work on April 15, 1910'),
            new CensusColumnNull($this, 'Unemp', 'Number of weeks out of work in 1909'),
            new CensusColumnNull($this, 'R', 'Whether able to read'),
            new CensusColumnNull($this, 'W', 'Whether able to write'),
            new CensusColumnNull($this, 'Sch', 'Attended school since September 1, 1909'),
            new CensusColumnNull($this, 'Home', 'Owned or rented'),
            new CensusColumnNull($this, 'Mort', 'Owned free or mortgaged'),
            new CensusColumnNull($this, 'Farm', 'Farm or house'),
            new CensusColumnNull($this, 'CW', 'Whether a survivor of the Union or Confederate Army or Navy'),
            new CensusColumnNull($this, 'Blind', 'Whether blind (both eyes)'),
            new CensusColumnNull($this, 'Deaf', 'Whether deaf and dumb'),
        ];
    }
1108121
public function generate(array $data): string
    {
        /** @var RecordFinder $recordFinder */
        $recordFinder = GeneralUtility::makeInstance(RecordFinder::class);
        $staticDataRecords = $recordFinder->findUidsOfStaticdata();
        // Select first two
        return implode(',', array_slice($staticDataRecords, 0, 2));
    }
290646
public function getHeadersAsString(ResponseInterface $response)
    {
        $headers = $response->getHeaders();
        $rawHeaders = [];
        foreach ($headers as $name => $values) {
            $rawHeaders[] = $name . ": " . implode(", ", $values);
        }

        return implode("\r\n", $rawHeaders);
    }
555521
private function createHeaders(RequestInterface $request)
    {
        $nonce = $this->nonceGenerator->generate();
        $timestamp = $this->timestampGenerator->generate();

        /** @var array $data */
        $data = $this->createDataElement($request, $nonce, $timestamp);

        $payload = $request->getMethod() .
            '&' . rawurlencode((string)$request->getUri()) .
            '&' . implode(rawurlencode('&'), $data);

        $signkey = rawurlencode($this->key) . '&' . rawurlencode($this->secret);
        $hash = rawurlencode(base64_encode(hash_hmac('sha256', $payload, $signkey)));

        /** @var array $oauth_header */
        $oauth_header = $this->createOAuthHeaders($nonce, $timestamp, $hash);

        $header = [];
        $header['Content-type'] = 'application/json';
        $header['Authorization'] = 'OAuth ' . implode(', ', $oauth_header);

        return $header;
    }
613617
public static function renderType(ButtonInterface $button) {
        return null !== $button->getType() ? $button->getPrefix() . $button->getType() : null;
    }
1276263
public function generateHeaderId(string $headerText): string
    {

        // $headerText is completely raw markdown input. We need to strip it
        // from all markup, because we are only interested in the actual 'text'
        // part of it.

        // Step 1: Remove html tags.
        $result = strip_tags($headerText);

        // Step 2: Remove all markdown links. To do this, we simply remove
        // everything between ( and ) if the ( occurs right after a ].
        $result = preg_replace('%
            (?<= \\]) # Look behind to find ]
            (
                \\(     # match (
                [^\\)]* # match everything except )
                \\)     # match )
            )

            %x', '', $result);

        // Step 3: Convert spaces to dashes, and remove unwanted special
        // characters.
        $map = [
            ' ' => '-',
            '(' => '',
            ')' => '',
            '[' => '',
            ']' => '',
        ];
        return rawurlencode(strtolower(
            strtr($result, $map)
        ));
    }
397002
public function generate(array $data): string
    {
        /** @var RecordFinder $recordFinder */
        $recordFinder = GeneralUtility::makeInstance(RecordFinder::class);
        return implode(',', $recordFinder->findUidsOfDemoBeUsers());
    }
170865
private function parseExam(ResponseInterface $response)
    {
        $body = $this->checkAndThrow($response);

        // form => 考试形式, district => 校区
        return Parser::table($body, '#DataGrid1', [
            'code', 'name', 'student_name', 'time', 'location', 'form', 'seat', 'district'
        ], 8);
    }
1287286
private function renderCell(CellInterface $cell, int $colWidth) : string
    {
        $content = self::CHAR_CELL_PADDING . $cell->getValue()
                . str_repeat(self::CHAR_CELL_PADDING, ($colWidth - $cell->getWidth() + 1));

        return $content;
    }
530350
public function getHeaderRowHTML()
    {
        $output = [];
        foreach ($this->columns as $name => $column) {

            // If multiple formatters are defined, use the first for the header cell
            if (is_array($column)) {
                $column = $column[0];
            }

            if (!is_int($name)) {
                $field = $this->model->getElement($name);

                $output[] = $column->getHeaderCellHTML($field);
            } else {
                $output[] = $column->getHeaderCellHTML();
            }
        }

        return implode('', $output);
    }
207455
public function getDataCellContent($row)
	{
		$data=$this->grid->dataProvider->data[$row];
		if($this->value!==null)
			$value=$this->evaluateExpression($this->value,array('data'=>$data,'row'=>$row));
		elseif($this->name!==null)
			$value=CHtml::value($data,$this->name);
		else
			$value=$this->grid->dataProvider->keys[$row];

		$checked = false;
		if($this->checked!==null)
			$checked=$this->evaluateExpression($this->checked,array('data'=>$data,'row'=>$row));

		$options=$this->checkBoxHtmlOptions;
		if($this->disabled!==null)
			$options['disabled']=$this->evaluateExpression($this->disabled,array('data'=>$data,'row'=>$row));

		$name=$options['name'];
		unset($options['name']);
		$options['value']=$value;
		$options['id']=$this->id.'_'.$row;
		return CHtml::checkBox($name,$checked,$options);
	}
1249928
public function getId($suffix = null)
    {
        $id = 'column';

        $id .= '-'.$this->columnName;

        if ($suffix) {
            $id .= '-'.$suffix;
        }

        return HtmlHelper::nameToId($id);
    }
1323265
private function createNoteText(CensusInterface $census, $ca_title, $ca_place, $ca_citation, $ca_individuals, $ca_notes): string
    {
        $text = $ca_title . "\n" . $ca_citation . "\n" . $ca_place . "\n\n";

        foreach ($census->columns() as $n => $column) {
            if ($n === 0) {
                $text .= "\n";
            } else {
                $text .= ' | ';
            }
            $text .= $column->abbreviation();
        }

        foreach ($census->columns() as $n => $column) {
            if ($n === 0) {
                $text .= "\n";
            } else {
                $text .= ' | ';
            }
            $text .= '-----';
        }

        foreach ($ca_individuals as $xref => $columns) {
            $text .= "\n" . implode(' | ', $columns);
        }

        return $text . "\n\n" . $ca_notes;
    }
1040605
public static function responseToString(ResponseInterface $response): string
    {
        $reasonPhrase = $response->getReasonPhrase();
        $headers = self::serializeHeaders($response->getHeaders());
        $body = (string) $response->getBody();
        $format = 'HTTP/%s %d%s%s%s';
        if (! empty($headers)) {
            $headers = self::EOL . $headers;
        }
        $headers .= self::EOL . self::EOL;

        return sprintf(
            $format,
            $response->getProtocolVersion(),
            $response->getStatusCode(),
            ($reasonPhrase ? ' ' . $reasonPhrase : ''),
            $headers,
            $body
        );
    }
747512
public function render( ElementInterface $element )
    {
        if ( ! $element instanceof TagListElement )
        {
            throw new Exception\InvalidArgumentException( sprintf(
                '%s requires that the element is of type Grid\Tag\Form\Element\TagList',
                __METHOD__
            ) );
        }

        $rendered       = '';
        $type           = $this->getInputType();
        $name           = static::getName( $element );
        $closingBracket = $this->getInlineClosingBracket();

        $hidden = sprintf(
            '<input %s%s',
            $this->createAttributesString( array(
                'type'  => 'hidden',
                'name'  => $element->getName(),
                'value' => '',
            ) ),
            $closingBracket
        );

        foreach ( $element->getValue() as $value )
        {
            $rendered .= sprintf(
                '<input %s%s',
                $this->createAttributesString( array(
                    'type'  => $type,
                    'name'  => $name,
                    'value' => $value,
                ) ),
                $closingBracket
            );
        }

        $attributes = $element->getAttributes();

        if ( empty( $attributes['class'] ) )
        {
            $attributes['class'] = '';
        }
        else
        {
            $attributes['class'] .= ' ';
        }

        $attributes['class'] .= 'tag_list';
        $attributes['data-name'] = $name;
        unset( $attributes['type'] );
        unset( $attributes['name'] );
        unset( $attributes['value'] );

        return sprintf(
            '%s<div %s>%s</div>',
            $hidden,
            $this->createAttributesString( $attributes ),
            $rendered
        );
    }