08-15-2008, 04:06 AM
[eluser]steel_slasher[/eluser]
i am trying to make a dynamic form to enable modules but i dont want codex to use a database because there wont be a column for each module.
i have the main code for my script below which gathers all the files in a modules folder and then makes a form with all the modules available and wether the user wants them activated.
(you are free to scan for errors)
the real problem here is that codex creates a sql query on the overview page when i told it not to display any information at all, i have made a table in the db just to satisfy the config variables
i know codex wasnt made to be used like this but by looking through the config files it seemed possible
i am trying to make a dynamic form to enable modules but i dont want codex to use a database because there wont be a column for each module.
i have the main code for my script below which gathers all the files in a modules folder and then makes a form with all the modules available and wether the user wants them activated.
(you are free to scan for errors)
Code:
$this->load->helper('directory');
$module = directory_map('system/application/modules/',true);
$helper = directory_map('system/application/helpers/',true);
$library = directory_map('system/application/libraries/',true);
$form = array();
$files = array();
$index=array();
$config=array();
foreach($module as $fname)
{
$file[]=explode('.', $fname);
}
foreach($file as $name)
{
$index[]= "Enable $name[0] module";
}
$config = array(
'db_table' => 'modules', //The name of the table associated with this controller
'controller_name' => 'Modules', //The name of the controller, so that it can be used when generating the URLs
'primary_key' => 'id', //The name of the controller, so that it can be used when generating the URLs
'display_fields'=>array(''),
);
$config['form_setup']['Module name']= array('class'=>'TextBox');
foreach($index as $name)
{
echo "$name"; //For development reasons i want to check what is going into the arrays
$config['form_setup'][$name] = array('class'=>'checkbox', 'value'=> FALSE); //this line seems to cause the problems
}
$this->setConfig($config);
the real problem here is that codex creates a sql query on the overview page when i told it not to display any information at all, i have made a table in the db just to satisfy the config variables
i know codex wasnt made to be used like this but by looking through the config files it seemed possible