> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getlecker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Helper_Content

> Utility trait for content management in a PHP application

The `Helper_Content` trait provides various utility functions for content management, including table preparation, authentication, custom button creation, Google Analytics integration, and CSV handling.

## Main Methods

### prepareTable()

Prepares the table for display, including authentication, custom button creation, and CRUD setup.

### authentication()

Checks if the user is an admin and redirects if not.

### createCustomButtons()

Creates custom buttons based on the type of table being displayed.

### solveTypes()

Determines the entity type ID based on whether it's an article or non-article entity.

### solvePagination()

Sets the pagination value based on GET parameters or a default value.

### createBC()

Creates and configures the BESC CRUD object for table operations.

### setTableName()

Sets the table name based on the calling function and performs checks on the name.

### getLangArray()

Returns an array of language options based on the application's language configuration.

## Google Analytics Methods

### initializeAnalytics()

Initializes the Google Analytics service object.

### GA\_Analytics\_Cities()

Retrieves analytics data for cities over the past year.

### GA\_Analytics\_User\_Data()

Retrieves user analytics data for the past day.

## CSV Handling Methods

### csvToDb(\$tableName)

Imports data from a CSV file into the specified database table.

### dbTableToBlankCSV(\$tableName)

Exports a blank CSV file with headers based on the specified table structure.

### exportTableToCSV(\$tableName)

Exports the entire contents of a database table to a CSV file.

### makeCSV($filePath, $header, \$rows)

Creates a CSV file with the given headers and rows.

### getMeTableColumns($tableName, $withId = false)

Retrieves the column names and types for a given table.

### createNewCSVFile(\$tableName)

Creates a new CSV file with a random number appended to the name.

### downloadCSVFile(\$filePath)

Handles the download of a CSV file.
