Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1108095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:01:47+00:00 2026-05-17T02:01:47+00:00

I have such an array for rendering TableGear : array( database => array( ‘username’

  • 0

I have such an array for rendering TableGear:

array(
            "database" => array(
                'username' => $this->config->resources->db->params->username,
                'password' => $this->config->resources->db->params->password,
                'name' => $this->config->resources->db->params->dbname,
                'table'    => "projetos",
                'fields' => array(
                    'pro_cliente',
                    'pro_area',
                    'pro_evento',
                    'estado',
                    'cidade',
                    'pro_mes',
                    'pro_montagem_inicio',
                    'pro_montagem_fim',
                    'pro_evento_inicio',
                    'pro_evento_fim',
                    'pro_desmontagem_inicio',
                    'pro_desmontagem_fim',
                    'pro_atendimento',
                    'pro_projeto',
                    'pro_situacao'
                )
                //"noAutoQuery" => true
            ),
            "selects" => array(
                'pro_situacao' => array('Aberto', 'Em Andamento', 'Fechado', 'Cancelado'),
                'estado' => $this->estados->getEstados()
            ),
            "formatting" => array(
                'pro_valor' => 'currency[prefix=R$ ,pad]',
                'pro_montagem_inicio' => 'date[d/m]',
                'pro_montagem_fim' => 'date[d/m]',
                'pro_evento_inicio' => 'date[d/m]',
                'pro_evento_fim' => 'date[d/m]',
                'pro_desmontagem_inicio' => 'date[d/m]',
                'pro_desmontagem_fim' => 'date[d/m]'
            ),
            'headers' => array(
                'pro_id' => 'ID',
                'pro_cliente' => 'Cliente',
                'pro_area' => 'Area',
                'pro_evento' => 'Evento',
                'estado' => 'UF',
                'cidade' => 'Cidade',
                'pro_mes' => 'Mes',
                'pro_montagem_inicio' => 'Inicio Montagem',
                'pro_montagem_fim' => 'Fim Montagem',
                'pro_evento_inicio' => 'Inicio Evento',
                'pro_evento_fim' => 'Fim Evento',
                'pro_desmontagem_inicio' => 'Inicio Desmontagem',
                'pro_desmontagem_fim' => 'Fim Desmontagem',
                'pro_atendimento' => 'Atendimento',
                'pro_projeto' => 'Projeto',
                'pro_situacao' => 'Situacao',
                'pro_valor' => 'Valor',
                'DELETE' => 'Deletar'
            ),
            'columns' => array(
                'pro_montagem_inicio' => 'date-picker',
                'pro_montagem_fim' => 'date-picker',
                'pro_evento_inicio' => 'date-picker',
                'pro_evento_fim' => 'date-picker',
                'pro_desmontagem_inicio' => 'date-picker',
                'pro_desmontagem_fim' => 'date-picker'
            ),
            'allowDelete' => false,
            'editable' => 'none'
        ); // End of Tablegear

As you can see. I use dynamic data $this->config->resources->db->params->username and $this->estados->getEstados() (data from my database) which I can only get inside the controller in an array-form data.

I found these options too large and unnecessary to be in the controller. I’d like to use Zend_Config with a INI or XML file. But how can I retrieve these data I use (i.e. $this->estados->getEstados())?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:01:48+00:00Added an answer on May 17, 2026 at 2:01 am

    I managed to create the Tablegear model to handle this problem

    <?php
    
    class Application_Model_Tablegear
    {
    protected $_name = null;
    protected $_username = null;
    protected $_password = null;
    protected $_estados = null;
    protected $_allowDelete = false;
    protected $_editable = 'all';
    
    public function allowDelete() {
        $this->_allowDelete = true;
        return $this;
    }
    
    public function setEditable($fields) {
        $this->_editable = $fields;
        return $this;
    }
    
    public function setEstados($estados) {
        $this->_estados = $estados;
        return $this;
    }
    
    public function setDatabase($params) {
        $this->_username = $params->username;
        $this->_password = $params->password;
        $this->_name = $params->dbname;
        return $this;
    }
    
    public function getOptions() {
        return array(
                "database" => array(
                    'username' => $this->_username,
                    'password' => $this->_password,
                    'name' => $this->_name,
                    'table'    => "projetos",
                    'fields' => array(
                        'pro_cliente',
                        'pro_area',
                        'pro_evento',
                        'estado',
                        'cidade',
                        'pro_mes',
                        'pro_montagem_inicio',
                        'pro_montagem_fim',
                        'pro_evento_inicio',
                        'pro_evento_fim',
                        'pro_desmontagem_inicio',
                        'pro_desmontagem_fim',
                        'pro_atendimento',
                        'pro_projeto',
                        'pro_situacao'
                    )
                    //"noAutoQuery" => true
                ),
                    "selects" => array(
                        'pro_situacao' => array('Aberto', 'Em Andamento', 'Fechado', 'Cancelado'),
                        'estado' => $this->_estados
                    ),
                    "formatting" => array(
                        'pro_valor' => 'currency[prefix=R$ ,pad]',
                        'pro_montagem_inicio' => 'date[d/m]',
                        'pro_montagem_fim' => 'date[d/m]',
                        'pro_evento_inicio' => 'date[d/m]',
                        'pro_evento_fim' => 'date[d/m]',
                        'pro_desmontagem_inicio' => 'date[d/m]',
                        'pro_desmontagem_fim' => 'date[d/m]'
                    ),
                    'headers' => array(
                        'pro_id' => 'ID',
                        'pro_cliente' => 'Cliente',
                        'pro_area' => 'Area',
                        'pro_evento' => 'Evento',
                        'estado' => 'UF',
                        'cidade' => 'Cidade',
                        'pro_mes' => 'Mes',
                        'pro_montagem_inicio' => 'Inicio Montagem',
                        'pro_montagem_fim' => 'Fim Montagem',
                        'pro_evento_inicio' => 'Inicio Evento',
                        'pro_evento_fim' => 'Fim Evento',
                        'pro_desmontagem_inicio' => 'Inicio Desmontagem',
                        'pro_desmontagem_fim' => 'Fim Desmontagem',
                        'pro_atendimento' => 'Atendimento',
                        'pro_projeto' => 'Projeto',
                        'pro_situacao' => 'Situacao',
                        'pro_valor' => 'Valor',
                        'DELETE' => 'Deletar'
                    ),
                    'columns' => array(
                        'pro_montagem_inicio' => 'date-picker',
                        'pro_montagem_fim' => 'date-picker',
                        'pro_evento_inicio' => 'date-picker',
                        'pro_evento_fim' => 'date-picker',
                        'pro_desmontagem_inicio' => 'date-picker',
                        'pro_desmontagem_fim' => 'date-picker'
                    ),
                    'allowDelete' => $this->_allowDelete,
                    'editable' => $this->_editable
                );
        }
    }
    

    Then I set the methods in my controller

    $this->tgOptions = new Application_Model_Tablegear();
    $this->tgOptions->setDatabase($this->config->resources->db->params)
                ->setEstados($this->estados->getEstados());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have an array such as: $arr[] = array(id => 11, name =>
For example I have such array: name[0] = Griffin; name[1] = David; name[2] =
I have an 'dictionary' array such as this: $arr['a']=5; $arr['b']=9; $arr['as']=56; $arr['gbsdfg']=89; And I
I have this problem that when I use array as such Array ( [11]
Say I have an array such as this in Javascript: var cars = {
I have extracted a MAC address into a char* array such that each section
I want to have a large 2 dimensional array such like int myArray[10000][2]; I
I have a simple question: how exactly are array variables such as $_SESSION and
I have an array of points in unknown dimensional space, such as: data=numpy.array( [[
Possible Duplicate: String with array structure to Array I have an array as such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.