Column actions.

@param  object $row
@return string
487292
protected function col_actions($row) {
        global $OUTPUT;

        $action = new \confirm_action(get_string('areyousure'));
        $url = new moodle_url($this->baseurl);
        $url->params(array('removecohort' => $row->id, 'sesskey' => sesskey()));
        $actionlink = $OUTPUT->action_link($url, '', $action, null, new \pix_icon('t/delete',
            get_string('stopsyncingcohort', 'tool_lp')));

        return $actionlink;

    }
1086509
private function fillCells($row)
    {
        $newRow = [];
        foreach ($row as $column => $cell) {
            $newRow[] = $cell;
            if ($cell instanceof TableCell && $cell->getColspan() > 1) {
                foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
                    // insert empty value at column position
                    $newRow[] = '';
                }
            }
        }

        return $newRow ?: $row;
    }
1171286
protected function transform($row)
    {
        // loop through the object keys and normalize
        $entry = [];

        if (is_object($row) && get_class($row) == 'Cassandra\\Map') {
            /** @var \Cassandra\Map $row */
            $keys = $row->keys();
            $data = [];
            foreach ($keys as $key) {
                $data[(string) $key] = $row->offsetGet($key);
            }
            $row = $data;
        }

        $handlerMap = [
            'Cassandra\\Timestamp' => function ($value) {
                return $this->handleTimestamp($value);
            },
            'Cassandra\\UserTypeValue' => function ($value) {
                return $this->transform($value);
            },
            'Cassandra\\Map' => function ($value) {
                return $this->transform($value);
            },
            'Cassandra\\Set' => function ($value) {
                return $this->transform($value);
            },
        ];

        foreach ($row as $key => $value) {

            // if it's not an object just assign it
            if (!is_object($value)) {
                $entry[$key] = $value;

                continue;
            }

            // it's an object so let's get the class
            $class = get_class($value);

            // it this a Cassandra object?
            if (array_key_exists($class, $handlerMap)) {
                $entry[$key] = $handlerMap[$class];

                continue;
            }

            // it's an object but not a known cassandra object so let
            // the hydrator deal with it.

            $entry[$key] = $value;
        }

        return $entry;
    }
1141535
public function content($row = null)
    {
        if (null === $row) {
            // Generate content for table head column

            $result = $this->label();
            if ($this->sortable()) {
                // Column is sortable - get anchor HTML
                $result .= $this->_getSortAnchor();
            }
            return $result;
        }

        if (!$this->hasRenderer()) {
            return (string)$row->{$this->index()};
        }

        return (string)$this->renderer($row);
    }
235355
public function col_actions($row) : string {
        global $OUTPUT;

        $actions = [];

        $url = new \moodle_url('/admin/tasklogs.php', ['logid' => $row->id]);

        // Quick view.
        $actions[] = $OUTPUT->action_icon(
            $url,
            new \pix_icon('e/search', get_string('view')),
            new \popup_action('click', $url)
        );

        // Download.
        $actions[] = $OUTPUT->action_icon(
            new \moodle_url($url, ['download' => true]),
            new \pix_icon('t/download', get_string('download'))
        );

        return implode('&nbsp;', $actions);
    }
283184
public function col_courseid($row) {
        $courses = $this->feedbackstructure->get_completed_courses();
        $name = '';
        if (isset($courses[$row->courseid])) {
            $name = $courses[$row->courseid];
            if (!$this->is_downloading()) {
                $name = html_writer::link(course_get_url($row->courseid), $name);
            }
        }
        return $name;
    }
805034
private function output_csv_row( $row ){
		$this->px->fs()->mkdir(dirname($this->path_tmp_csv));
		file_put_contents(
			$this->path_tmp_csv,
			$this->px->fs()->mk_csv(
				array($row),
				array('charset'=>'UTF-8')
			),
			FILE_APPEND|LOCK_EX
		);
		return $res;
	}
1023757
private function parseS3CmdListRow($row)
    {
        $columns = explode(' ', preg_replace('/\s+/', ' ', $row));

        if (4 !== count($columns)) {
            throw new \RuntimeException(sprintf('Error processing result: %s', $row));
        }

        return new Backup($columns[3], $columns[2], new \DateTime(sprintf('%s %s', $columns[0], $columns[1])));
    }
26230
public function getHighestColumn($row = null)
    {
        if ($row == null) {
            return $this->_cachedHighestColumn;
        }
        return $this->getHighestDataColumn($row);
    }
992449
protected function _renderRow($row = null)
    {
        static $csv = '';

        if ($this->_resetStaticVariables) {
            $csv = '';
            $this->_resetStaticVariables = false;

            return null;
        }

        $csv .= (string)$this->_generateRow($row);

        return $csv;
    }
142489
public function col_db($row) : string {
        $output = '';

        $output .= \html_writer::div(get_string('task_stats:dbreads', 'admin', $row->dbreads));
        $output .= \html_writer::div(get_string('task_stats:dbwrites', 'admin', $row->dbwrites));

        return $output;
    }
431375
public function created_at($row)
    {
        if (is_object($row))
        {
            $row->created_at = date('Y-m-d H:i:s');
        }
        else
        {
            $row['created_at'] = date('Y-m-d H:i:s');
        }

        return $row;
    }
920556
protected function onInput($row)
    {
        $index = "";
        foreach ($this->groupColumns as $gColumn) {
            $index .= $row[$gColumn];
        }
        $index = strtolower($index) . md5($index);
        if (isset($this->gData[$index])) {
            $res = $this->gData[$index];
            $this->cData[$index]++;

            foreach ($this->sumColumns as $sumColumn) {
                $res[$sumColumn] += $row[$sumColumn];
            }
            foreach ($this->countColumns as $countColumn) {
                $res[$countColumn] = $this->cData[$index];
            }
            foreach ($this->minColumns as $minColumn) {
                if ($res[$minColumn] > $row[$minColumn]) {
                    $res[$minColumn] = $row[$minColumn];
                }
            }

            foreach ($this->maxColumns as $maxColumn) {
                if ($res[$maxColumn] < $row[$maxColumn]) {
                    $res[$maxColumn] = $row[$maxColumn];
                }
            }

            foreach ($this->avgColumns as $avgColumn) {
                $res[$avgColumn] = ($res[$avgColumn] * ($this->cData[$index] - 1) + $row[$avgColumn]) / $this->cData[$index];
            }

            $this->gData[$index] = $res;
        } else {
            $this->cData[$index] = 1;
            foreach ($this->countColumns as $countColumn) {
                $row[$countColumn] = 1;
            }
            $this->gData[$index] = $row;
        }
    }
971873
private function convertColumns(array $row)
    {
        $result = [];

        foreach ($row as $fieldName => $value) {
            if (is_null($value)) {
                $result[$fieldName] = null;
                continue;
            }
            switch($this->columnTypes[$fieldName]) {
                case self::BOOL:
                    $value = is_null($value) ? null : $value == 't';
                    break;
                case self::INTEGER:
                case self::SMALLINT:
                case self::BIGINT:
                    $value = (int) $value;
                    break;
                case self::NUMERIC:
                    $value = (float) $value;
                    break;
                case self::JSON:
                    $value = json_decode($value, true);
                    break;
                case self::HSTORE:
                    $value = self::fromHStore($value);
                    break;
                case self::DATE:
                case self::TIMESTAMP:
                case self::TIMESTAMPTZ:
                    $value = self::fromTimestamp($value);
                    break;
                case self::SMALLINT_ARRAY:
                case self::INTEGER_ARRAY:
                    $value = self::fromArray($value);
                    if (!is_null($value)) {
                        $value = array_map(function($a) {
                            return $a === 'NULL' ? null : intval($a);
                        }, $value);
                    }
                    break;
                case self::BIGINT_ARRAY:
                case self::NUMERIC_ARRAY:
                    $value = self::fromArray($value);
                    if (!is_null($value)) {
                        $value = array_map(function($a) {
                            return $a === 'NULL' ? null : doubleval($a);
                        }, $value);
                    }
                    break;
                case self::TEXT_ARRAY:
                case self::VARCHAR_ARRAY:
                case self::CHAR_ARRAY:
                    $value = self::fromArray($value);
                    break;
                case self::HSTORE_ARRAY:
                    $array = self::fromArray($value);
                    $value = [];
                    foreach ($array as $val) {
                        $value[] = self::fromHStore($val);
                    }
                    break;
                case self::JSON_ARRAY:
                    $array = self::fromArray($value);
                    $value = [];
                    foreach ($array as $val) {
                        $value[] = json_decode($val, true);
                    }
                    break;
                case self::INTERVAL:
                    $value = self::fromInterval($value);
                    break;
            }

            $result[$fieldName] = $value;
        }
        return $result;
    }
455975
public function getCellValue(int $col, int $row): string
    {
        if (!isset($this->structure[$row][$col])) {
            return '';
        }

        return $this->structure[$row][$col]['value'];
    }
17192
protected function onInput($row)
    {
        $func = Util::get($this->params, '{value}', null);
        if (is_callable($func)) {
            $return = $func(
                $row,
                $this->metaData,
                $this->index, 
                $this->mapState
            );

            if (is_array($return) && (array_key_exists('{rows}', $return)
                ||array_key_exists('{state}', $return))
            ) {
                $newRows = Util::get($return, '{rows}', []);
                $this->mapState = Util::get($return, '{state}', $this->mapState);
            } else {
                $newRows = $return;
            }
            $newRows = $this->to2DArray($newRows);
            if (!$this->metaSent) {
                $colMetas = $this->newMeta['columns'];
                $newRow = Util::get($newRows, 0, []);
                foreach (array_keys($newRow) as $newCol) {
                    if (!isset($colMetas[$newCol])) {
                        $type = $this->guessType($newRow[$newCol]);
                        $colMetas[$newCol] = ['type' => $type];
                    }
                }
                $this->newMeta['columns'] = $colMetas;
                $this->sendMeta($this->newMeta);
                $this->metaSent = true;
            }
            foreach ($newRows as $row) {
                $this->next($row);
            }
        } else {
            if (!$this->metaSent) {
                $this->sendMeta($this->newMeta);
                $this->metaSent = true;
            }
            $this->next($row);
        }
        $this->index++;
    }
903591
public function col_note($row) {
        if ($this->is_downloading()) {
            return $row->note;
        } else {
            return format_text($row->note, FORMAT_MOODLE);
        }
    }