function index() { //apply updates $sql = file_get_contents(\GCore\C::ext_path('chronoforms', 'admin') . 'sql' . DS . 'install.chronoforms.sql'); $queries = \GCore\Libs\Database::getInstance()->split_sql($sql); foreach ($queries as $query) { \GCore\Libs\Database::getInstance()->exec(\GCore\Libs\Database::getInstance()->_prefixTable($query)); } $session = \GCore\Libs\Base::getSession(); $session->setFlash('success', l_('CF_DB_TABLES_INSTALLED')); $this->redirect(r_('index.php?ext=chronoforms')); }
public static function config() { $tables = \GCore\Libs\Database::getInstance()->getTablesList(); array_unshift($tables, ''); $tables = array_combine($tables, $tables); echo \GCore\Helpers\Html::formStart('action_config db_save_action_config', 'db_save_action_config_{N}'); echo \GCore\Helpers\Html::formSecStart(); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][enabled]', array('type' => 'dropdown', 'label' => l_('CF_ENABLED'), 'options' => array(0 => l_('NO'), 1 => l_('YES')))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][tablename]', array('type' => 'dropdown', 'label' => l_('CF_TABLENAME'), 'options' => $tables, 'sublabel' => l_('CF_TABLENAME_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][save_under_modelid]', array('type' => 'dropdown', 'label' => l_('CF_SAVE_UNDER_MODELID'), 'options' => array(0 => l_('NO'), 1 => l_('YES')), 'sublabel' => l_('CF_SAVE_UNDER_MODELID_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][multi_save]', array('type' => 'dropdown', 'label' => l_('CF_MULTI_SAVE'), 'options' => array(0 => l_('NO'), 1 => l_('YES')), 'sublabel' => l_('CF_MULTI_SAVE_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][model_id]', array('type' => 'text', 'label' => l_('CF_MODEL_ID'), 'sublabel' => l_('CF_MODEL_ID_DESC'))); echo \GCore\Helpers\Html::formSecEnd(); echo \GCore\Helpers\Html::formEnd(); }
public static function config() { $tables = \GCore\Libs\Database::getInstance()->getTablesList(); array_unshift($tables, ''); $tables = array_combine($tables, $tables); echo \GCore\Helpers\Html::formStart('action_config google_spreadsheet_save_action_config', 'google_spreadsheet_save_action_config_{N}'); echo \GCore\Helpers\Html::formSecStart(); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][enabled]', array('type' => 'dropdown', 'label' => l_('CF_ENABLED'), 'options' => array(0 => l_('NO'), 1 => l_('YES')))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][username]', array('type' => 'text', 'label' => l_('CF_GSPREADSHEET_SAVE_USERNAME'), 'class' => 'L', 'sublabel' => l_('CF_GSPREADSHEET_SAVE_USERNAME_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][password]', array('type' => 'text', 'label' => l_('CF_GSPREADSHEET_SAVE_PASSWORD'), 'class' => 'L', 'sublabel' => l_('CF_GSPREADSHEET_SAVE_PASSWORD_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][spreadsheet]', array('type' => 'text', 'label' => l_('CF_GSPREADSHEET_SAVE_SPREADSHEET'), 'class' => 'L', 'sublabel' => l_('CF_GSPREADSHEET_SAVE_SPREADSHEET_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][worksheet]', array('type' => 'text', 'label' => l_('CF_GSPREADSHEET_SAVE_WORKSHEET'), 'class' => 'L', 'sublabel' => l_('CF_GSPREADSHEET_SAVE_WORKSHEET_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][data_path]', array('type' => 'text', 'label' => l_('CF_GSPREADSHEET_SAVE_DATA_PATH'), 'class' => 'L', 'sublabel' => l_('CF_GSPREADSHEET_SAVE_DATA_PATH_DESC'))); echo \GCore\Helpers\Html::formSecEnd(); echo \GCore\Helpers\Html::formEnd(); }
public static function config() { $tables = \GCore\Libs\Database::getInstance()->getTablesList(); array_unshift($tables, ''); $tables = array_combine($tables, $tables); echo \GCore\Helpers\Html::formStart('action_config csv_export_action_config', 'csv_export_action_config_{N}'); echo \GCore\Helpers\Html::formSecStart(); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][enabled]', array('type' => 'dropdown', 'label' => l_('CF_ENABLED'), 'options' => array(0 => l_('NO'), 1 => l_('YES')))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][tablename]', array('type' => 'dropdown', 'label' => l_('CF_CSV_TABLENAME'), 'options' => $tables, 'sublabel' => l_('CF_CSV_TABLENAME_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][data_path]', array('type' => 'text', 'class' => 'M', 'label' => l_('CF_CSV_DATA_PATH'), 'sublabel' => l_('CF_CSV_DATA_PATH_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][columns]', array('type' => 'text', 'class' => 'XL', 'label' => l_('CF_CSV_COLUMNS'), 'sublabel' => l_('CF_CSV_COLUMNS_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][titles]', array('type' => 'text', 'class' => 'XL', 'label' => l_('CF_CSV_TITLES'), 'sublabel' => l_('CF_CSV_TITLES_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][order_by]', array('type' => 'text', 'class' => 'XL', 'label' => l_('CF_CSV_ORDER_BY'), 'sublabel' => l_('CF_CSV_ORDER_BY_DESC'))); echo \GCore\Helpers\Html::formSecEnd(); echo \GCore\Helpers\Html::formEnd(); }
public static function config() { $tables = \GCore\Libs\Database::getInstance()->getTablesList(); array_unshift($tables, ''); $tables = array_combine($tables, $tables); echo \GCore\Helpers\Html::formStart('action_config db_read_action_config', 'db_read_action_config_{N}'); echo \GCore\Helpers\Html::formSecStart(); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][enabled]', array('type' => 'dropdown', 'label' => l_('CF_ENABLED'), 'options' => array(0 => l_('NO'), 1 => l_('YES')))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][tablename]', array('type' => 'dropdown', 'label' => l_('CF_TABLENAME'), 'options' => $tables, 'sublabel' => l_('CF_DB_READ_TABLENAME_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][multi_read]', array('type' => 'dropdown', 'label' => l_('CF_DB_READ_MULTI'), 'options' => array(0 => l_('NO'), 1 => l_('YES')), 'sublabel' => l_('CF_DB_READ_MULTI_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][load_under_modelid]', array('type' => 'dropdown', 'label' => l_('CF_DB_READ_UNDER_MODELID'), 'options' => array(0 => l_('NO'), 1 => l_('YES')), 'sublabel' => l_('CF_DB_READ_UNDER_MODELID_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][model_id]', array('type' => 'text', 'label' => l_('CF_MODEL_ID'), 'sublabel' => l_('CF_DB_READ_MODEL_ID_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][fields]', array('type' => 'text', 'class' => 'L', 'label' => l_('CF_DB_READ_FIELDS'), 'sublabel' => l_('CF_DB_READ_FIELDS_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][order]', array('type' => 'text', 'class' => 'L', 'label' => l_('CF_DB_READ_ORDER'), 'sublabel' => l_('CF_DB_READ_ORDER_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][group]', array('type' => 'text', 'class' => 'L', 'label' => l_('CF_DB_READ_GROUP'), 'sublabel' => l_('CF_DB_READ_GROUP_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][conditions]', array('type' => 'textarea', 'rows' => 8, 'cols' => 70, 'label' => l_('CF_DB_READ_CONDITIONS'), 'sublabel' => l_('CF_DB_READ_CONDITIONS_DESC'))); echo \GCore\Helpers\Html::formSecEnd(); echo \GCore\Helpers\Html::formEnd(); }
public static function config($data = array()) { $tables = \GCore\Libs\Database::getInstance()->getTablesList(); array_unshift($tables, ''); $tables = array_combine($tables, $tables); $ndb_tables = array(); if (!empty($data['ndb_table_name'])) { /*$ndb_tables = \GCore\Libs\Database::getInstance(array( 'type' => $data['ndb_driver'], 'host' => $data['ndb_host'], 'name' => $data['ndb_database'], 'user' => $data['ndb_user'], 'pass' => $data['ndb_password'], 'prefix' => $data['ndb_prefix'] ))->getTablesList(); $ndb_tables = array_combine($ndb_tables, $ndb_tables);*/ $ndb_tables = array($data['ndb_table_name'] => $data['ndb_table_name']); } echo \GCore\Helpers\Html::formStart('action_config db_read_action_config', 'db_read_action_config_{N}'); ?> <script> function db_read_ndb_load_tables(elem, SID){ jQuery('#db_read_ndb_table_name_'+SID).empty(); jQuery('#db_read_ndb_table_name_'+SID).append('<option value="">Loading....</option>'); jQuery.ajax({ "type" : "POST", "url" : "<?php echo r_('index.php?ext=chronoforms&act=action_task&action_name=db_read&action_fn=load_tables&tvout=ajax'); ?> ", "data" : jQuery("#external-"+SID+" :input").serialize(), "success" : function(res){ try{ jQuery('#db_read_ndb_table_name_'+SID).empty(); jQuery.each(jQuery.parseJSON(res), function(id, val){ jQuery('#db_read_ndb_table_name_'+SID).append('<option value="'+id+'">'+val+'</option>'); }); }catch(error){ jQuery('#db_read_ndb_table_name_'+SID).empty(); jQuery('#db_read_ndb_table_name_'+SID).append('<option value="">Failed to connect!!</option>'); } }, "error" : function(){ jQuery('#db_read_ndb_table_name_'+SID).empty(); jQuery('#db_read_ndb_table_name_'+SID).append('<option value="">Failed to connect!!</option>'); }, }); } function addRelation(elem, SID){ var last = jQuery(elem).closest('.form-group').prev(); var count = parseInt(last.clone().wrap('<p>').parent().html().match(/\[relations\]\[[0-9]+\]/).pop().replace('[relations][', '').replace(']', '')) + 1; jQuery(elem).closest('.form-group').before(last.clone().wrap('<p>').parent().html().replace(/\[relations\]\[[0-9]+\]/g, '[relations]['+count+']')); } function removeRelation(elem, button_id){ var last = jQuery(elem).closest('.form-group').prev(); var count = last.clone().wrap('<p>').parent().html().match(/\[relations\]\[[0-9]+\]/).pop().replace('[relations][', '').replace(']', ''); if(count != '0'){ last.remove(); } } </script> <ul class="nav nav-tabs"> <li class="active"><a href="#basic-{N}" data-g-toggle="tab"><?php echo l_('CF_BASIC'); ?> </a></li> <li><a href="#relations-{N}" data-g-toggle="tab"><?php echo l_('CF_RELATIONS'); ?> </a></li> <li><a href="#external-{N}" data-g-toggle="tab"><?php echo l_('CF_EXTERNAL_DB'); ?> </a></li> </ul> <div class="tab-content"> <div id="basic-{N}" class="tab-pane active"> <?php echo \GCore\Helpers\Html::formSecStart(); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][action_label]', array('type' => 'text', 'label' => l_('CF_ACTION_LABEL'), 'class' => 'XL', 'sublabel' => l_('CF_ACTION_LABEL_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][enabled]', array('type' => 'dropdown', 'label' => l_('CF_ENABLED'), 'options' => array(0 => l_('NO'), 1 => l_('YES')))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][tablename]', array('type' => 'dropdown', 'label' => l_('CF_TABLENAME'), 'options' => $tables, 'sublabel' => l_('CF_DB_READ_TABLENAME_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][multi_read]', array('type' => 'dropdown', 'label' => l_('CF_DB_READ_MULTI'), 'options' => array(0 => l_('NO'), 1 => l_('YES')), 'sublabel' => l_('CF_DB_READ_MULTI_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][load_under_modelid]', array('type' => 'dropdown', 'label' => l_('CF_DB_READ_UNDER_MODELID'), 'options' => array(0 => l_('NO'), 1 => l_('YES')), 'sublabel' => l_('CF_DB_READ_UNDER_MODELID_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][model_id]', array('type' => 'text', 'label' => l_('CF_MODEL_ID'), 'sublabel' => l_('CF_DB_READ_MODEL_ID_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][fields]', array('type' => 'text', 'class' => 'L', 'label' => l_('CF_DB_READ_FIELDS'), 'sublabel' => l_('CF_DB_READ_FIELDS_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][order]', array('type' => 'text', 'class' => 'L', 'label' => l_('CF_DB_READ_ORDER'), 'sublabel' => l_('CF_DB_READ_ORDER_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][group]', array('type' => 'text', 'class' => 'L', 'label' => l_('CF_DB_READ_GROUP'), 'sublabel' => l_('CF_DB_READ_GROUP_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][conditions]', array('type' => 'textarea', 'rows' => 8, 'cols' => 70, 'label' => l_('CF_DB_READ_CONDITIONS'), 'sublabel' => l_('CF_DB_READ_CONDITIONS_DESC'))); echo \GCore\Helpers\Html::formSecEnd(); ?> </div> <div id="relations-{N}" class="tab-pane"> <?php echo \GCore\Helpers\Html::formSecStart(); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][enable_relations]', array('type' => 'dropdown', 'label' => l_('CF_DB_READ_ENABLE_RELATIONS'), 'options' => array(0 => l_('NO'), 1 => l_('YES')), 'sublabel' => l_('CF_DB_READ_ENABLE_RELATIONS_DESC'))); if (empty($data['relations'])) { $data['relations'] = array(array()); } foreach ($data['relations'] as $i => $relation) { echo '<div class="panel panel-default"><div class="panel-body">'; echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][relations][' . $i . '][model]', array('type' => 'text', 'label' => l_('CF_DB_READ_RELATIONS_MODEL'), 'class' => 'M', 'sublabel' => l_('CF_DB_READ_RELATIONS_MODEL_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][relations][' . $i . '][tablename]', array('type' => 'dropdown', 'label' => l_('CF_DB_READ_RELATIONS_TABLENAME'), 'options' => $tables, 'sublabel' => l_('CF_DB_READ_RELATIONS_TABLENAME_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][relations][' . $i . '][type]', array('type' => 'dropdown', 'label' => l_('CF_DB_READ_RELATIONS_TYPE'), 'options' => array('hasOne' => l_('hasOne'), 'hasMany' => l_('hasMany'), 'belongsTo' => l_('belongsTo')), 'sublabel' => l_('CF_DB_READ_RELATIONS_TYPE_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][relations][' . $i . '][fkey]', array('type' => 'text', 'label' => l_('CF_DB_READ_RELATIONS_FKEY'), 'class' => 'M', 'sublabel' => l_('CF_DB_READ_RELATIONS_FKEY_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][relations][' . $i . '][join_conditions]', array('type' => 'textarea', 'rows' => 3, 'cols' => 70, 'label' => l_('CF_DB_READ_RELATIONS_JOIN_CONDITIONS'), 'sublabel' => l_('CF_DB_READ_RELATIONS_JOIN_CONDITIONS_DESC'))); echo '</div></div>'; } echo \GCore\Helpers\Html::formLine('process_relations', array('type' => 'multi', 'layout' => 'wide', 'inputs' => array(array('type' => 'button', 'name' => 'add_relation', 'class' => 'btn btn-success', 'value' => l_('CF_DB_READ_ADD_RELATION'), 'id' => 'add_relation_{N}', 'onclick' => 'addRelation(this, \'{N}\');'), array('type' => 'button', 'name' => 'remove_relation', 'class' => 'btn btn-danger', 'value' => l_('CF_DB_READ_REMOVE_RELATION'), 'id' => 'remove_relation_{N}', 'onclick' => 'removeRelation(this, \'{N}\');')))); echo \GCore\Helpers\Html::formSecEnd(); ?> </div> <div id="external-{N}" class="tab-pane"> <?php echo \GCore\Helpers\Html::formSecStart(); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][ndb_enable]', array('type' => 'dropdown', 'label' => l_('CF_DB_SAVE_EXTERNAL_ENABLED'), 'options' => array(0 => l_('NO'), 1 => l_('YES')), 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_ENABLED_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][ndb_driver]', array('type' => 'text', 'label' => l_('CF_DB_SAVE_EXTERNAL_DB_DRIVER'), 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_DB_DRIVER_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][ndb_host]', array('type' => 'text', 'label' => l_('CF_DB_SAVE_EXTERNAL_DB_HOST'), 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_DB_HOST_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][ndb_database]', array('type' => 'text', 'label' => l_('CF_DB_SAVE_EXTERNAL_DB_NAME'), 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_DB_NAME_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][ndb_user]', array('type' => 'text', 'label' => l_('CF_DB_SAVE_EXTERNAL_DB_USER'), 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_DB_USER_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][ndb_password]', array('type' => 'text', 'label' => l_('CF_DB_SAVE_EXTERNAL_DB_PASSWORD'), 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_DB_PASSWORD_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][ndb_prefix]', array('type' => 'text', 'label' => l_('CF_DB_SAVE_EXTERNAL_DB_PREFIX'), 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_DB_PREFIX_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][ndb_load_tables]', array('type' => 'button', 'value' => l_('CF_DB_SAVE_EXTERNAL_DB_LOAD_TABLES'), 'onclick' => 'db_read_ndb_load_tables(this, \'{N}\')', 'sublabel' => '')); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][{N}][ndb_table_name]', array('type' => 'dropdown', 'label' => l_('CF_DB_SAVE_EXTERNAL_DB_TABLE'), 'id' => 'db_read_ndb_table_name_{N}', 'options' => $ndb_tables, 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_DB_TABLE_DESC'))); echo \GCore\Helpers\Html::formSecEnd(); ?> </div> </div> <?php echo \GCore\Helpers\Html::formEnd(); }
public static function config($data = array()) { $tables = \GCore\Libs\Database::getInstance()->getTablesList(); array_unshift($tables, ''); $tables = array_combine($tables, $tables); $ndb_tables = array(); if (!empty($data['ndb_table_name'])) { /*$ndb_tables = \GCore\Libs\Database::getInstance(array( 'type' => $data['ndb_driver'], 'host' => $data['ndb_host'], 'name' => $data['ndb_database'], 'user' => $data['ndb_user'], 'pass' => $data['ndb_password'], 'prefix' => $data['ndb_prefix'] ))->getTablesList(); $ndb_tables = array_combine($ndb_tables, $ndb_tables);*/ $ndb_tables = array($data['ndb_table_name'] => $data['ndb_table_name']); } echo \GCore\Helpers\Html::formStart('action_config db_save_action_config', 'db_save_action_config__XNX_'); ?> <script> function db_save_ndb_load_tables(elem, SID){ jQuery('#db_save_ndb_table_name_'+SID).empty(); jQuery('#db_save_ndb_table_name_'+SID).append('<option value="">Loading....</option>'); jQuery.ajax({ "type" : "POST", "url" : "<?php echo r_('index.php?ext=chronoforms&act=action_task&action_name=db_save&action_fn=load_tables&tvout=ajax'); ?> ", "data" : jQuery("#external-"+SID+" :input").serialize(), "success" : function(res){ try{ jQuery('#db_save_ndb_table_name_'+SID).empty(); jQuery.each(jQuery.parseJSON(res), function(id, val){ jQuery('#db_save_ndb_table_name_'+SID).append('<option value="'+id+'">'+val+'</option>'); }); }catch(error){ jQuery('#db_save_ndb_table_name_'+SID).empty(); jQuery('#db_save_ndb_table_name_'+SID).append('<option value="">Failed to connect!!</option>'); } }, "error" : function(){ jQuery('#db_save_ndb_table_name_'+SID).empty(); jQuery('#db_save_ndb_table_name_'+SID).append('<option value="">Failed to connect!!</option>'); }, }); } </script> <ul class="nav nav-tabs"> <li class="active"><a href="#basic-_XNX_" data-g-toggle="tab"><?php echo l_('CF_BASIC'); ?> </a></li> <li><a href="#external-_XNX_" data-g-toggle="tab"><?php echo l_('CF_EXTERNAL_DB'); ?> </a></li> </ul> <div class="tab-content"> <div id="basic-_XNX_" class="tab-pane active"> <?php echo \GCore\Helpers\Html::formSecStart(); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][action_label]', array('type' => 'text', 'label' => l_('CF_ACTION_LABEL'), 'class' => 'XL', 'sublabel' => l_('CF_ACTION_LABEL_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][enabled]', array('type' => 'dropdown', 'label' => l_('CF_ENABLED'), 'options' => array(0 => l_('NO'), 1 => l_('YES')))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][tablename]', array('type' => 'dropdown', 'label' => l_('CF_TABLENAME'), 'options' => $tables, 'sublabel' => l_('CF_TABLENAME_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][save_under_modelid]', array('type' => 'dropdown', 'label' => l_('CF_SAVE_UNDER_MODELID'), 'options' => array(0 => l_('NO'), 1 => l_('YES')), 'sublabel' => l_('CF_SAVE_UNDER_MODELID_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][multi_save]', array('type' => 'dropdown', 'label' => l_('CF_MULTI_SAVE'), 'options' => array(0 => l_('NO'), 1 => l_('YES')), 'sublabel' => l_('CF_MULTI_SAVE_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][model_id]', array('type' => 'text', 'label' => l_('CF_MODEL_ID'), 'sublabel' => l_('CF_MODEL_ID_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][force_save]', array('type' => 'dropdown', 'label' => l_('CF_FORCE_SAVE'), 'options' => array(0 => l_('NO'), 1 => l_('YES')), 'sublabel' => l_('CF_FORCE_SAVE_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][conditions]', array('type' => 'textarea', 'rows' => 5, 'cols' => 70, 'label' => l_('CF_DB_SAVE_CONDITIONS'), 'sublabel' => l_('CF_DB_SAVE_CONDITIONS_DESC'))); echo \GCore\Helpers\Html::formSecEnd(); ?> </div> <div id="external-_XNX_" class="tab-pane"> <?php echo \GCore\Helpers\Html::formSecStart(); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][ndb_enable]', array('type' => 'dropdown', 'label' => l_('CF_DB_SAVE_EXTERNAL_ENABLED'), 'options' => array(0 => l_('NO'), 1 => l_('YES')), 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_ENABLED_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][ndb_driver]', array('type' => 'text', 'label' => l_('CF_DB_SAVE_EXTERNAL_DB_DRIVER'), 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_DB_DRIVER_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][ndb_host]', array('type' => 'text', 'label' => l_('CF_DB_SAVE_EXTERNAL_DB_HOST'), 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_DB_HOST_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][ndb_database]', array('type' => 'text', 'label' => l_('CF_DB_SAVE_EXTERNAL_DB_NAME'), 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_DB_NAME_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][ndb_user]', array('type' => 'text', 'label' => l_('CF_DB_SAVE_EXTERNAL_DB_USER'), 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_DB_USER_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][ndb_password]', array('type' => 'text', 'label' => l_('CF_DB_SAVE_EXTERNAL_DB_PASSWORD'), 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_DB_PASSWORD_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][ndb_prefix]', array('type' => 'text', 'label' => l_('CF_DB_SAVE_EXTERNAL_DB_PREFIX'), 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_DB_PREFIX_DESC'))); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][ndb_load_tables]', array('type' => 'button', 'value' => l_('CF_DB_SAVE_EXTERNAL_DB_LOAD_TABLES'), 'onclick' => 'db_save_ndb_load_tables(this, \'_XNX_\')', 'sublabel' => '')); echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][ndb_table_name]', array('type' => 'dropdown', 'label' => l_('CF_DB_SAVE_EXTERNAL_DB_TABLE'), 'id' => 'db_save_ndb_table_name__XNX_', 'options' => $ndb_tables, 'sublabel' => l_('CF_DB_SAVE_EXTERNAL_DB_TABLE_DESC'))); echo \GCore\Helpers\Html::formSecEnd(); ?> </div> </div> <?php echo \GCore\Helpers\Html::formEnd(); }
function save() { //check the new database connection details if (!empty($this->data['Connection']['extras']['ndb']['enabled'])) { $dbo_config = array('type' => $this->data['Connection']['extras']['ndb']['driver'], 'host' => $this->data['Connection']['extras']['ndb']['host'], 'name' => $this->data['Connection']['extras']['ndb']['database'], 'user' => $this->data['Connection']['extras']['ndb']['user'], 'pass' => $this->data['Connection']['extras']['ndb']['password'], 'prefix' => $this->data['Connection']['extras']['ndb']['prefix']); $tables = \GCore\Libs\Database::getInstance($dbo_config)->getTablesList(); } $result = parent::_save(); if ($result) { if ($this->Request->get('save_act') == 'apply') { $this->redirect(r_('index.php?ext=chronoconnectivity&act=edit&id=' . $this->Connection->id)); } else { $this->redirect(r_('index.php?ext=chronoconnectivity')); } } else { $this->edit(); $this->view = 'edit'; $session = \GCore\Libs\Base::getSession(); $session->setFlash('error', \GCore\Libs\Arr::flatten($this->Connection->errors)); } }