public static function output($target, $event, $form) { $form_id = 'chronoform-' . $form->form['Form']['title']; $return = "\$('" . $target . "').find('option').remove();"; if (!empty($event['ajax'])) { $return .= "\r\n\t\t\t\$('" . $target . "').html('<img src=\"" . \GCore\Helpers\Assets::image('loading-small.gif') . "\" />');\r\n\t\t\t\$.ajax({\r\n\t\t\t\t'type' : 'GET',\r\n\t\t\t\t'url' : '" . r_('index.php?ext=chronoforms&chronoform=' . $form->form['Form']['title'] . '&event=' . $event['ajax'] . '&tvout=ajax') . "',\r\n\t\t\t\t'data' : \$('#" . $form_id . "').serialize(),\r\n\t\t\t\t'success' : function(res){\r\n\t\t\t\t\t\$('" . $target . "').html(res);\r\n\t\t\t\t},\r\n\t\t\t});"; } return $return; }
public static function output($target, $event, $form) { $form_id = 'chronoform-' . $form->form['Form']['title']; $return = "\$('" . $target . "').find('option').remove();"; if (!empty($event['ajax'])) { $return .= "\r\n\t\t\t\$.ajax({\r\n\t\t\t\t'type' : 'GET',\r\n\t\t\t\t'url' : '" . r_('index.php?ext=chronoforms&chronoform=' . $form->form['Form']['title'] . '&event=' . $event['ajax'] . '&tvout=ajax') . "',\r\n\t\t\t\t'data' : \$('#" . $form_id . "').serialize(),\r\n\t\t\t\t'success' : function(res){\r\n\t\t\t\t\t\$.each(\$.parseJSON(res), function(id, val){\r\n\t\t\t\t\t\t\$('" . $target . "').append('<option value=\"'+id+'\">'+val+'</option>');\r\n\t\t\t\t\t});\r\n\t\t\t\t},\r\n\t\t\t});"; } return $return; }
public static function output($target, $event, $form) { $form_id = 'chronoform-' . $form->form['Form']['title']; $return = ""; if (!empty($event['ajax'])) { $return .= "\r\n\t\t\t\$.ajax({\r\n\t\t\t\t'type' : 'GET',\r\n\t\t\t\t'url' : '" . r_('index.php?ext=chronoforms&chronoform=' . $form->form['Form']['title'] . '&event=' . $event['ajax'] . '&tvout=ajax') . "',\r\n\t\t\t\t'data' : \$('#" . $form_id . "').serialize(),\r\n\t\t\t\t'success' : function(res){\r\n\t\t\t\t\t\$('" . $target . "').val(res);\r\n\t\t\t\t},\r\n\t\t\t});"; } return $return; }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); if ((bool) $config->get('refresh_button', 0) === true) { $form->form['Form']['content'] = str_replace('{captcha_img}', '<img src="' . r_(\GCore\C::get('GCORE_ROOT_URL') . 'index.php?ext=chronoforms&act=render&action=load_captcha&chronoform=' . $form->form['Form']['title'] . '&action_id=' . $action_id . '&tvout=ajax&rand=' . mt_rand()) . '" alt="captcha" id="gcaptcha_' . $action_id . '" /><img src="' . \GCore\C::get('GCORE_FRONT_URL') . 'admin/extensions/chronoforms/actions/load_captcha/refresh.png" border="0" style="padding:0px 0px 15px 10px;" alt="refresh" onclick="document.getElementById(\'gcaptcha_' . $action_id . '\').src = \'' . r_(\GCore\C::get('GCORE_ROOT_URL') . 'index.php?ext=chronoforms&act=render&tvout=ajax&action=load_captcha&action_id=' . $action_id . '&chronoform=') . $form->form['Form']['title'] . '\' + \'&\' + Math.random();" />', $form->form['Form']['content']); } else { $form->form['Form']['content'] = str_replace('{captcha_img}', '<img src="' . r_(\GCore\C::get('GCORE_ROOT_URL') . 'index.php?ext=chronoforms&act=render&action=load_captcha&chronoform=' . $form->form['Form']['title'] . '&action_id=' . $action_id . '&tvout=ajax&rand=' . mt_rand()) . '" alt="captcha" />', $form->form['Form']['content']); } }
function execute(&$form, $action_id) { $config = !empty($form->actions_config[$action_id]) ? $form->actions_config[$action_id] : array(); $config = new \GCore\Libs\Parameter($config); $doc = \GCore\Libs\Document::getInstance(); $ajax_url = $config->get('results_event', '') ? r_(\GCore\C::get('GCORE_ROOT_URL') . 'index.php?ext=chronoforms&chronoform=' . $form->form['Form']['title'] . '&event=' . $config->get('results_event', '') . '&tvout=ajax') : $config->get('results_url', ''); $doc->_('jquery'); //$doc->_('autocompleter'); //$doc->__('autocompleter', $config->get('field_selector', '.auto_complete'), array('path' => $ajax_url, 'length' => $config->get('length', 2), 'multiple' => $config->get('multiple', 0))); $doc->_('select2'); $doc->addJsCode(' jQuery(document).ready(function($){ $("' . $config->get('field_selector', '') . '").select2( { minimumInputLength: ' . $config->get('length', 2) . ', containerCss:{"min-width":"200px"}, width: "element", multiple: ' . ($config->get('multiple', 0) ? 'true' : 'false') . ', //tags: true, tokenSeparators: [","," "], ajax:{ url: "' . $ajax_url . '", dataType: "json", data: function (term, page){ return { ' . $config->get('field_name', 'tag') . ': term, }; }, results: function (data, page){ return {results: data}; } }, formatNoMatches: "' . $config->get('no_matches_msg', 'Error!!') . '", formatSearching: "' . $config->get('searching_msg', 'Loading....') . '", formatAjaxError: "' . $config->get('ajax_error_msg', 'Loading failed....') . '", ' . ($config->get('multiple', 0) ? ' initSelection: function(element, callback){ var data = []; $(element.val().split(",")).each(function (){ data.push({id: this, text: this}); }); callback(data); } ' : ' initSelection: function(element, callback){ var data = {"id": $(element).val(), "text": $(element).val()}; callback(data); } ') . ' } ); });'); }
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')); }
function execute(&$form, $action_id) { $config = !empty($form->actions_config[$action_id]) ? $form->actions_config[$action_id] : array(); $config = new \GCore\Libs\Parameter($config); $doc = \GCore\Libs\Document::getInstance(); $ajax_url = $config->get('results_event', '') ? r_(\GCore\C::get('GCORE_ROOT_URL') . 'index.php?ext=chronoforms&chronoform=' . $form->form['Form']['title'] . '&event=' . $config->get('results_event', '') . '&tvout=ajax') : $config->get('results_url', ''); if ((bool) $form->params->get('jquery', 1) === true) { $doc->_('jquery'); } $doc->_('autocompleter'); $doc->__('autocompleter', $config->get('field_selector', '.auto_complete'), array('path' => $ajax_url, 'length' => $config->get('length', 2), 'multiple' => $config->get('multiple', 0))); }
public function link($text, $field, $params = array()) { $drc = $field == $this->active_field ? $this->direction : 'asc'; $drc_new = strtolower($this->direction) == 'asc' ? 'desc' : 'asc'; $drc = strtolower($drc); if ($field == $this->active_field) { $href = r_(\GCore\Libs\Url::buildQuery($this->url, array('act' => $this->action, 'orderfld' => $field, 'orderdrc' => $drc_new))); $data = self::build_link_params($text, $params, $drc, true); } else { $href = r_(\GCore\Libs\Url::buildQuery($this->url, array('act' => $this->action, 'orderfld' => $field, 'orderdrc' => $drc))); $data = self::build_link_params($text, $params, $drc, false); } extract($data); $full = \GCore\Helpers\Html::url($text, $href, $params); return $full; }
public function on_list($fld, $ttl, &$data_columns) { if ($fld == '_EDIT_') { $data_columns[$fld]['a'] = r_('index.php?ext=chronoconnectivity&cont=lists&ccname=' . $this->connection['Connection']['title'] . '&act=edit'); if ($this->model->pkey) { $data_columns[$fld]['a'] .= '&gcb={' . $this->model->alias . '.' . $this->model->pkey . '}'; } $data_columns[$fld]['html'] = '<a href="' . $data_columns[$fld]['a'] . '">' . $ttl . '</a>'; } if ($fld == '_DELETE_') { $data_columns[$fld]['a'] = r_('index.php?ext=chronoconnectivity&cont=lists&ccname=' . $this->connection['Connection']['title'] . '&act=delete'); if ($this->model->pkey) { $data_columns[$fld]['a'] .= '&gcb={' . $this->model->alias . '.' . $this->model->pkey . '}'; } $data_columns[$fld]['html'] = '<a href="' . $data_columns[$fld]['a'] . '">' . $ttl . '</a>'; } }
<h3><?php echo l_('Validate your ChronoForms install'); ?> </h3> </div> <div class="col-md-6 pull-right text-right"> <?php echo $this->Toolbar->renderBar(); ?> </div> </div> <div class="row"> <div class="panel panel-default"> <div class="panel-body"> <form action="<?php echo r_('index.php?ext=chronoforms&act=validateinstall'); ?> " method="post" name="admin_form" id="admin_form"> <?php echo $this->Html->formStart(); ?> <?php echo $this->Html->formSecStart(); ?> <?php echo $this->Html->formLine('domain', array('type' => 'custom', 'label' => 'Domain', 'code' => $domain, 'sublabel' => 'The domain name, this domain MUST match the domain name used to generate the key on ChronoEngine.com')); ?> <?php echo $this->Html->formLine('domain_name', array('type' => 'hidden', 'value' => $domain)); ?> <?php
<h3><?php echo l_('CF_SETTINGS'); ?> </h3> </div> <div class="col-md-6 pull-right text-right"> <?php echo $this->Toolbar->renderBar(); ?> </div> </div> <div class="row"> <div class="panel panel-default"> <div class="panel-body"> <form action="<?php echo r_('index.php?ext=chronoforms&act=save_settings'); ?> " method="post" name="admin_form" id="admin_form"> <ul class="nav nav-tabs"> <li class="active"><a href="#emails" data-g-toggle="tab"><?php echo l_('CF_EMAILS'); ?> </a></li> <li><a href="#wizard" data-g-toggle="tab"><?php echo l_('CF_WIZARD'); ?> </a></li> </ul> <div class="tab-content"> <div id="emails" class="tab-pane active"> <?php
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(); }
/* $pattern = '/<form([^>]*?)([^>]*?)>/is'; preg_match_all($pattern, $output, $matches); if(!empty($matches[0][0])){ $form_tag = $matches[0][0]; $form_tag = preg_replace('/ action=("|\')(.*?)("|\')/i', ' action="'.r_('index.php?ext=chronoconnectivity&cont=lists&ccname='.$connection['Connection']['title']).'"', $form_tag); $form_tag = preg_replace('/ name=("|\')(.*?)("|\')/i', ' name="admin_form"', $form_tag); $form_tag = preg_replace('/ id=("|\')(.*?)("|\')/i', ' id="admin_form"', $form_tag); } $output = str_replace($matches[0][0], $form_tag, $output); */ echo $output; } else { $code = $connection['Connection']['extras'][$area]['actions'][$act_name]['code']; ob_start(); eval('?>' . $code); $code = ob_get_clean(); $code = $this->Lister->prepare($connection, $code); $code = $this->Lister->translate($connection, $code); $code = \GCore\Libs\Str::replacer($code, $this->data); ?> <form action="<?php echo r_('index.php?ext=chronoconnectivity&cont=lists&ccname=' . $connection['Connection']['title']); ?> " method="post" name="admin_form" id="admin_form"> <?php echo $code; ?> </form> <?php }
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(); }
public static function _config_cells($columns_info = array()) { foreach ($columns_info as $c => $info) { if (!empty($info['function'])) { $function = !empty($info['function']) ? $info['function'] : ''; if (is_array($info['function'])) { foreach ($info['function'] as $k => $fn) { self::$columns_info[$c]['function'][$k] = $fn; } } else { self::$columns_info[$c]['function'] = $function; } } if (!empty($info['html'])) { $html = !empty($info['html']) ? $info['html'] : ''; if (is_array($info['html'])) { foreach ($info['html'] as $k => $htm) { self::$columns_info[$c]['html'][$k] = $htm; } } else { self::$columns_info[$c]['html'] = $html; } } if (!empty($info['image'])) { $image_params = !empty($info['image_params']) ? $info['image_params'] : array(); $src = !empty($info['image']) ? $info['image'] : ''; if (is_array($info['image'])) { foreach ($info['image'] as $k => $img) { self::$columns_info[$c]['image'][$k] = \GCore\Helpers\Html::image($img, $image_params); } } else { self::$columns_info[$c]['image'] = \GCore\Helpers\Html::image($src, $image_params); } } if (!empty($info['link'])) { $path = !empty($info['link']) ? $info['link'] : ''; if (is_array($info['link'])) { foreach ($info['link'] as $k => $link) { self::$columns_info[$c]['link'][$k] = r_($link); } } else { self::$columns_info[$c]['link'] = r_($path); } } if (!empty($info['field'])) { $field = !empty($info['field']) ? $info['field'] : ''; if (is_array($info['field'])) { foreach ($info['field'] as $k => $fld) { self::$columns_info[$c]['field'][$k] = $fld; } } else { self::$columns_info[$c]['field'] = $field; } } self::$columns_info[$c]['style'] = !empty($info['style']) ? $info['style'] : ''; self::$columns_info[$c]['class'] = !empty($info['class']) ? (array) $info['class'] : ''; } }
function delete() { $this->delete_model = $this->pmodel; parent::_delete(); $this->redirect(r_('index.php?ext=chronoconnectivity&cont=lists&act=index&ccname=' . $this->connection['Connection']['title'])); }
<div class="row" style="margin-top:20px;"> <div class="col-md-6"> <h3><?php echo !empty($this->data['Connection']['title']) ? $this->data['Connection']['title'] : 'New connection...'; ?> </h3> </div> <div class="col-md-6 pull-right text-right"> <?php echo $this->Toolbar->renderBar(); ?> </div> </div> <div class="row"> <form action="<?php echo r_('index.php?ext=chronoconnectivity&act=save'); ?> " method="post" name="admin_form" id="admin_form"> <?php echo $this->Html->input('Connection[id]', array('type' => 'hidden')); ?> <?php //l_('ADMIN_LIST'); //l_('FRONT_LIST'); ?> <div id="details-panel"> <div class="panel panel-default"> <div class="panel-heading"> <ul class="nav nav-pills"> <li class="active"><a href="#general" data-g-toggle="tab"><?php echo l_('GENERAL');
public function on_list($fld, $ttl, &$data_columns) { $config = new \GCore\Libs\Parameter($this->connection['Connection']['extras']['plugins']['download']); if ($config->get('path_field') and $config->get('download_action')) { $path = $config->get('path_field'); $action = $config->get('download_action'); if ($fld == '_DOWNLOAD_.link') { $link = r_('index.php?ext=chronoconnectivity&cont=lists&act=' . $action . '&ccname=' . $this->connection['Connection']['title'] . '&gcb={' . $this->model->alias . '.' . $this->model->pkey . '}'); $text = $ttl; if ($config->get('display_icon', 1)) { $text = '<i class="fa fa-download fa-fw"></i> ' . $text; } $data_columns[$fld]['html'] = '<a class="' . $config->get('download_link_class', 'btn btn-success btn-xs') . '" href="' . $link . '">' . $text . '</a>'; } $file_info = array(); $file_info['filesize'] = ''; $file_info['filetime'] = ''; $file_info['filename'] = ''; $get_file_info = function ($cell, $row, $column) use($path, $file_info, $config) { $file_path = \GCore\Libs\Arr::getVal($row, explode('.', $path)); if ($config->get('download_path')) { $file_path = rtrim($config->get('download_path'), DS) . DS . $file_path; } //$file_info = array(); if (file_exists($file_path)) { if (is_dir($file_path)) { //this is a folder $files = @\GCore\Libs\Folder::getFiles($file_path, false); foreach ($files as $file) { $found[$file] = filemtime($file); } if (empty($found)) { return false; } arsort($found); $files = array_keys($found); sort($files); $file = array_pop($files); $file_info['filesize'] = \GCore\Libs\File::humanSize(filesize($file)); $file_info['filetime'] = date($config->get('filetime_format', 'd-m-Y H:i'), filemtime($file)); $file_info['filename'] = basename($file); } else { //this is a file $file = $file_path; $file_info['filesize'] = \GCore\Libs\File::humanSize(filesize($file)); $file_info['filetime'] = date($config->get('filetime_format', 'd-m-Y H:i'), filemtime($file)); $file_info['filename'] = basename($file); } } foreach ($file_info as $k => $info) { if ($column == '_DOWNLOAD_.' . $k) { return $file_info[$k]; } } return ''; //$file_info; }; foreach ($file_info as $k => $info) { if ($fld == '_DOWNLOAD_.' . $k) { $data_columns[$fld]['function'] = $get_file_info; } } if ($fld == '_HkkITS_.hot') { $data_columns[$fld]['function'] = create_function('$value,$row', ' if(\\GCore\\Libs\\Arr::getVal($row, explode(".", "' . $download . '"), 0) >= (int)' . $config->get('hot_limit', '1000') . '){ return 1; }else{ return 0; } '); $data_columns[$fld]['html'] = array(0 => '', 1 => '<span class="label label-danger">' . $config->get('hot_text', 'Hot') . '</span>'); } } }
<div class="col-md-6 pull-right text-right"> <?php echo $this->Toolbar->renderBar(); ?> </div> </div> <div class="row"> <div class="col-md-12 pull-left text-left help-block"> <?php echo !empty($this->data['Form']['params']['description']) ? $this->data['Form']['params']['description'] : ''; ?> </div> </div> <div class="row"> <form action="<?php echo r_('index.php?ext=chronoforms&act=save'); ?> " method="post" enctype="multipart/form-data" name="admin_form" id="admin_form"> <?php echo $this->Html->input('Form[id]', array('type' => 'hidden', 'value' => 0)); ?> <?php echo $this->Html->input('serialized_form_data', array('type' => 'textarea', 'id' => 'serialized_form_data', 'style' => 'display:none;')); ?> <div id="serialized_form_chunks_area" style="display:none;"> </div> <div id="details-panel"> <div class="panel panel-default"> <div class="panel-heading"> <ul class="nav nav-pills"> <li class="active"><a href="#general" data-g-toggle="tab"><?php
" method="post" name="admin_form" id="admin_form"> <?php echo $this->DataTable->headerPanel($this->DataTable->_l('<h4>' . l_('CF_LIST_DATA_TITLE') . '</h4>') . $this->DataTable->_r($this->Toolbar->renderBar())); $this->DataTable->create(); $columns = array('created' => l_('CF_CREATED'), 'id' => l_('CF_ID')); if (!empty($form['Form']['extras']['db_fields_list'][$this->data['table']])) { $columns = \GCore\Libs\Str::list_to_array($form['Form']['extras']['db_fields_list'][$this->data['table']]); } $listing_header = array(); foreach ($columns as $column => $title) { $listing_header['ListData.' . $column] = $this->Sorter->link($title, 'ListData.' . $column); } $this->DataTable->header(array_merge(array('CHECK' => $this->Toolbar->selectAll()), $listing_header)); $listing_row = array(); $count = 0; foreach ($columns as $column => $title) { $listing_row['ListData.' . $column] = array('style' => array('width' => '15%')); if (empty($count)) { $listing_row['ListData.' . $column]['link'] = r_('index.php?ext=chronoforms&act=show_data&table=' . $this->data['table'] . '&id={ListData.id}' . '&form_id=' . $this->data['form_id']); } $count++; } $this->DataTable->cells($rows, array_merge(array('CHECK' => array('style' => array('width' => '5%'), 'html' => $this->Toolbar->selector('{ListData.id}'))), $listing_row)); echo $this->DataTable->build(); echo $this->DataTable->footerPanel($this->DataTable->_l($this->Paginator->getInfo()) . $this->DataTable->_r($this->Paginator->getNav())); echo $this->DataTable->footerPanel($this->DataTable->_r($this->Paginator->getList())); ?> </form> </div> </div> </div>
function create_event($field, $event_data, $form) { $return = ''; $form_id = 'chronoform-' . $form->form['Form']['title']; if (empty($event_data['operator'])) { $event_data['operator'] = '='; } if ($event_data['state'] == 'check') { $return .= 'if($("input:checkbox[name=\'' . $field['name'] . '\']").prop("checked"))'; } else { if ($event_data['state'] == 'uncheck') { $return .= 'if(!$("input:checkbox[name=\'' . $field['name'] . '\']").prop("checked"))'; } else { if (in_array($field['type'], array('checkbox_group'))) { $operator = $event_data['operator'] == '=' ? '=' : $event_data['operator']; $return .= 'if($("[name=\'' . $field['name'] . '\'][value' . $operator . '\'' . $event_data['state'] . '\']").prop("checked"))'; } else { if (in_array($field['type'], array('radio'))) { $operator = $event_data['operator'] == '=' ? '==' : $event_data['operator']; $return .= 'if($("[name=\'' . $field['name'] . '\']:checked").val() ' . $operator . ' "' . $event_data['state'] . '")'; } else { $operator = $event_data['operator'] == '=' ? '==' : $event_data['operator']; $return .= 'if($("[name=\'' . $field['name'] . '\']").val() ' . $operator . ' "' . $event_data['state'] . '")'; } } } } $return .= '{' . "\n"; $target_field = '$("#' . $event_data['target'] . '")'; $target = '$("#fin-' . $event_data['target'] . ', #' . $event_data['target'] . '")'; if ($event_data['action'] == 'enable') { $return .= $target_field . '.prop("disabled", false);'; } if ($event_data['action'] == 'disable') { $return .= $target_field . '.prop("disabled", true);'; } if ($event_data['action'] == 'show') { $return .= $target . '.css("display", "");'; } if ($event_data['action'] == 'show_parent') { $return .= 'if(' . $target . '.closest(".gcore-subinput-container").length > 0){ ' . $target . '.closest(".gcore-subinput-container").css("display", ""); }else if(' . $target . '.closest(".gcore-form-row").length > 0){ ' . $target . '.closest(".gcore-form-row").css("display", ""); }'; } if ($event_data['action'] == 'hide') { $return .= $target . '.css("display", "none");'; } if ($event_data['action'] == 'hide_parent') { $return .= 'if(' . $target . '.closest(".gcore-subinput-container").length > 0){ ' . $target . '.closest(".gcore-subinput-container").css("display", "none"); }else if(' . $target . '.closest(".gcore-form-row").length > 0){ ' . $target . '.closest(".gcore-form-row").css("display", "none"); }'; } if ($event_data['action'] == 'set_options') { $return .= $target_field . '.find("option").remove();'; $options = array(); if (!empty($event_data['options'])) { $lines = explode("\n", $event_data['options']); foreach ($lines as $line) { $opts = explode("=", $line); $options[$opts[0]] = $opts[1]; $return .= $target_field . '.append(\'<option value="' . $opts[0] . '">' . trim($opts[1]) . '</option>\');' . "\n"; } } } if ($event_data['action'] == 'set_dynamic_options') { $return .= $target_field . '.find("option").remove();'; $options = array(); if (!empty($event_data['options'])) { $ajax_event = $event_data['options']; $return .= ' $.ajax({ "type" : "GET", "url" : "' . r_('index.php?ext=chronoforms&chronoform=' . $form->form['Form']['title'] . '&event=' . $ajax_event . '&tvout=ajax') . '", //"data" : {"' . $field['name'] . '":$("#' . $field['id'] . '").val()}, "data" : $("#' . $form_id . '").serialize(), "success" : function(res){ $.each($.parseJSON(res), function(id, val){ ' . $target_field . '.append(\'<option value="\'+id+\'">\'+val+\'</option>\'); }); }, });'; } } if ($event_data['action'] == 'set_dynamic_html') { if (!empty($event_data['options'])) { $ajax_event = $event_data['options']; $return .= ' ' . $target_field . '.html("<img src=\'' . \GCore\Helpers\Assets::image('loading-small.gif') . '\' />"); $.ajax({ "type" : "GET", "url" : "' . r_('index.php?ext=chronoforms&chronoform=' . $form->form['Form']['title'] . '&event=' . $ajax_event . '&tvout=ajax') . '", "data" : $("#' . $form_id . '").serialize(), "success" : function(res){ ' . $target_field . '.html(res); }, });'; } } if ($event_data['action'] == 'function') { $return .= $event_data['target'] . ';'; } $return .= "\n" . '}'; return $return; }
<h3><?php echo l_('Validate your ChronoConnectivity5 install'); ?> </h3> </div> <div class="col-md-6 pull-right text-right"> <?php echo $this->Toolbar->renderBar(); ?> </div> </div> <div class="row"> <div class="panel panel-default"> <div class="panel-body"> <form action="<?php echo r_('index.php?ext=chronoconnectivity&act=validateinstall'); ?> " method="post" name="admin_form" id="admin_form"> <?php echo $this->Html->formStart(); ?> <?php echo $this->Html->formSecStart(); ?> <?php echo $this->Html->formLine('domain', array('type' => 'custom', 'label' => 'Domain', 'code' => $domain, 'sublabel' => 'The domain name, this domain MUST match the domain name used to generate the key on ChronoEngine.com')); ?> <?php echo $this->Html->formLine('domain_name', array('type' => 'hidden', 'value' => $domain)); ?> <?php
<h3><?php echo l_('CF_INSTALL_LOCALE_TITLE'); ?> </h3> </div> <div class="col-md-6 pull-right text-right"> <?php echo $this->Toolbar->renderBar(); ?> </div> </div> <div class="row"> <div class="panel panel-default"> <div class="panel-body"> <form action="<?php echo r_('index.php?ext=chronoforms&act=install_locale'); ?> " method="post" name="admin_form" id="admin_form" enctype="multipart/form-data"> <?php echo $this->Html->formStart(); ?> <?php echo $this->Html->formSecStart(); ?> <?php echo $this->Html->formLine('upload', array('type' => 'file', 'label' => l_('CF_SELECT_LOCALE_FILE'), 'sublabel' => l_('CF_SELECT_LOCALE_FILE_DESC'))); ?> <?php echo $this->Html->formSecEnd(); ?> <?php
} } } } if ($field_name_errors) { $forms[$k]['Form']['diagnostics'] .= '<div class="alert alert-danger">' . l_('CF_FIELD_NAME_ERRORS') . '</div>'; } if ($field_name_warnings) { if (\GCore\C::get('GSITE_PLATFORM') == 'wordpress') { $forms[$k]['Form']['diagnostics'] .= '<div class="alert alert-warning">' . sprintf(l_('CF_FIELD_NAME_WARNINGS'), implode(", ", $invalid_names_wp), "Wordpress") . '</div>'; } else { $forms[$k]['Form']['diagnostics'] .= '<div class="alert alert-warning">' . sprintf(l_('CF_FIELD_NAME_WARNINGS'), implode(", ", $invalid_names_j), "Joomla") . '</div>'; } } } $title_width_desc = function ($cell, $row) { $out = '<a href="' . r_('index.php?ext=chronoforms&act=edit&id={Form.id}') . '">{Form.title}</a>'; if (!empty($row['Form']['params']['description'])) { $out .= '<br><small>{Form.params.description}</small>'; } return $out; }; $this->DataTable->cells($forms, array('CHECK' => array('style' => array('width' => '5%'), 'html' => $this->Toolbar->selector('{Form.id}')), 'Form.title' => array('function' => $title_width_desc, 'style' => array('text-align' => 'left', 'width' => '20%')), 'Form.view' => array('style' => array('width' => '10%'), 'html' => '<a href="' . r_(\GCore\C::get('GCORE_ROOT_URL') . 'index.php?ext=chronoforms&chronoform={Form.title}') . '" target="_blank">' . l_('CF_VIEW_FORM') . '</a>'), 'Form.diagnostics' => array('style' => array('width' => '25%')), 'Form.tables' => array('style' => array('width' => '10%')), 'Form.app' => array('style' => array('width' => '10%')), 'Form.published' => array('link' => array(r_('index.php?ext=chronoforms&act=toggle&gcb={Form.id}&val=1&fld=published'), r_('index.php?ext=chronoforms&act=toggle&gcb={Form.id}&val=0&fld=published')), 'image' => array($this->Assets->image('disabled.png'), $this->Assets->image('enabled.png')), 'style' => array('width' => '5%')), 'Form.id' => array('style' => array('width' => '5%')))); echo $this->DataTable->build(); echo $this->DataTable->footerPanel($this->DataTable->_l($this->Paginator->getInfo()) . $this->DataTable->_r($this->Paginator->getNav())); echo $this->DataTable->footerPanel($this->DataTable->_r($this->Paginator->getList())); ?> </form> </div> </div> </div>
function validateinstall() { $domain = str_replace(array('http://', 'https://'), '', \GCore\Libs\Url::domain()); $this->set('domain', $domain); if (!empty($this->data['license_key'])) { $session = \GCore\Libs\Base::getSession(); $fields = ''; $update_fld = 'validated'; if ($this->data['pid'] == 18) { $update_fld = 'validated_paypal'; } if ($this->data['pid'] == 7) { $update_fld = 'validated_authorize'; } if ($this->data['pid'] == 31) { $update_fld = 'validated_2checkout'; } //$postfields = array(); unset($this->data['option']); unset($this->data['act']); foreach ($this->data as $key => $value) { $fields .= "{$key}=" . urlencode($value) . "&"; } $target_url = 'http://www.chronoengine.com/index.php?option=com_chronocontact&task=extra&chronoformname=validateLicense'; $output = '-'; if (ini_get('allow_url_fopen')) { $output = file_get_contents($target_url . '&' . rtrim($fields, "& ")); } else { if (function_exists('curl_version')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $target_url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim($fields, "& ")); $output = curl_exec($ch); curl_close($ch); } } if ($output == '-') { $session->setFlash('error', 'Validation error, Could not connect to the remote server, your host does not have neither the CURL nor the allow_url_fopen.'); $this->redirect(r_('index.php?ext=chronoforms')); } $validstatus = $output; if ($validstatus == 'valid') { parent::_settings('chronoforms'); $this->data['Chronoforms'][$update_fld] = 1; $result = parent::_save_settings('chronoforms'); if ($result) { $session->setFlash('success', 'Validated successfully.'); $this->redirect(r_('index.php?ext=chronoforms')); } else { $session->setFlash('error', 'Validation error.'); } } else { if ($validstatus == 'invalid') { parent::_settings('chronoforms'); $this->data['Chronoforms'][$update_fld] = 0; $result = parent::_save_settings('chronoforms'); $session->setFlash('error', 'Validation error, you have provided incorrect data.'); $this->redirect(r_('index.php?ext=chronoforms')); } else { if (!empty($this->data['instantcode'])) { $step1 = base64_decode(trim($this->data['instantcode'])); $step2 = str_replace(substr(md5(str_replace('www.', '', strtolower($matches[2]))), 0, 7), '', $step1); $step3 = str_replace(substr(md5(str_replace('www.', '', strtolower($matches[2]))), -strlen(md5(str_replace('www.', '', strtolower($matches[2])))) + 7), '', $step2); $step4 = str_replace(substr($this->data['license_key'], 0, 10), '', $step3); $step5 = str_replace(substr($this->data['license_key'], -strlen($this->data['license_key']) + 10), '', $step4); //echo (int)$step5;return; //if((((int)$step5 + (24 * 60 * 60)) > strtotime(date('d-m-Y H:i:s')))||(((int)$step5 - (24 * 60 * 60)) < strtotime(date('d-m-Y H:i:s')))){ if ((int) $step5 < strtotime("now") + 24 * 60 * 60 and (int) $step5 > strtotime("now") - 24 * 60 * 60) { parent::_settings('chronoforms'); $this->data['Chronoforms'][$update_fld] = 1; $result = parent::_save_settings('chronoforms'); if ($result) { $session->setFlash('success', 'Validated successfully.'); $this->redirect(r_('index.php?ext=chronoforms')); } else { $session->setFlash('error', 'Validation error.'); } } else { $session->setFlash('error', 'Validation error, Invalid instant code provided.'); $this->redirect(r_('index.php?ext=chronoforms')); } } else { if (!empty($this->data['serial_number'])) { $blocks = explode("-", trim($this->data['serial_number'])); $hash = md5($this->data['pid'] . $this->data['license_key'] . str_replace('www.', '', $domain) . $blocks[3]); if (substr($hash, 0, 7) == $blocks[4]) { parent::_settings('chronoforms'); $this->data['Chronoforms'][$update_fld] = 1; $result = parent::_save_settings('chronoforms'); if ($result) { $session->setFlash('success', 'Validated successfully.'); $this->redirect(r_('index.php?ext=chronoforms')); } else { $session->setFlash('error', 'Validation error.'); } } else { $session->setFlash('error', 'Serial number invalid!'); } } $session->setFlash('error', 'Validation error, please try again using the Instant Code, or please contact us on www.chronoengine.com'); $this->redirect(r_('index.php?ext=chronoforms')); } } } } }
?> <div class="chrono-page-container"> <div class="container" style="width:100%;"> <?php //$this->Toolbar->setTitle(l_('CONNECTIONS_MANAGER')); $this->Toolbar->addButton('add', r_('index.php?ext=chronoconnectivity&act=edit'), l_('_NEW_'), $this->Assets->image('add', 'toolbar/')); $this->Toolbar->addButton('remove', r_('index.php?ext=chronoconnectivity&act=delete'), l_('DELETE'), $this->Assets->image('remove', 'toolbar/'), 'submit_selectors'); $this->Toolbar->addButton('copy', r_('index.php?ext=chronoconnectivity&act=copy'), l_('CONN_COPY'), \GCore\C::get('GCORE_ADMIN_URL') . 'extensions/chronoconnectivity/assets/images/copy.png', 'submit_selectors'); $this->Toolbar->addButton('create_table', r_('index.php?ext=chronoconnectivity&act=create_table'), l_('CONN_CREATE_TABLE'), \GCore\C::get('GCORE_ADMIN_URL') . 'extensions/chronoconnectivity/assets/images/database_table.png', 'link'); $this->Toolbar->addButton('delete_cache', r_('index.php?ext=chronoconnectivity&act=delete_cache'), l_('CONN_DELETE_CACHE'), \GCore\C::get('GCORE_ADMIN_URL') . 'extensions/chronoconnectivity/assets/images/delete_cache.png', 'link'); $this->Toolbar->addButton('backup', r_('index.php?ext=chronoconnectivity&act=backup'), l_('CONN_BACKUP'), \GCore\C::get('GCORE_ADMIN_URL') . 'extensions/chronoconnectivity/assets/images/backup.png', 'submit_selectors'); $this->Toolbar->addButton('restore', r_('index.php?ext=chronoconnectivity&act=restore'), l_('CONN_RESTORE'), \GCore\C::get('GCORE_ADMIN_URL') . 'extensions/chronoconnectivity/assets/images/restore.png'); ?> <div class="row"> <form action="<?php echo r_('index.php?ext=chronoconnectivity'); ?> " method="post" name="admin_form" id="admin_form"> <?php echo $this->DataTable->headerPanel($this->DataTable->_l('<h4>' . l_('CONNECTIONS_MANAGER') . '</h4>') . $this->DataTable->_r($this->Toolbar->renderBar())); $this->DataTable->create(); $this->DataTable->header(array('CHECK' => $this->Toolbar->selectAll(), 'Connection.title' => $this->Sorter->link(l_('TITLE'), 'Connection.title'), 'Connection.aview' => l_('ADMIN_VIEW'), 'Connection.fview' => l_('FRONT_VIEW'), 'Connection.published' => l_('PUBLISHED'), 'Connection.id' => $this->Sorter->link('ID', 'Connection.id'))); $this->DataTable->cells($connections, array('CHECK' => array('style' => array('width' => '5%'), 'html' => $this->Toolbar->selector('{Connection.id}')), 'Connection.title' => array('link' => r_('index.php?ext=chronoconnectivity&act=edit&id={Connection.id}'), 'style' => array('text-align' => 'left')), 'Connection.aview' => array('html' => '<a href="' . r_('index.php?ext=chronoconnectivity&cont=lists&act=index&ccname={Connection.title}') . '" target="_blank">View Connection</a>', 'style' => array('width' => '15%')), 'Connection.fview' => array('html' => '<a href="' . \GCore\C::get('GCORE_ROOT_URL') . r_('index.php?ext=chronoconnectivity&cont=lists&act=index&ccname={Connection.title}') . '" target="_blank">View Connection</a>', 'style' => array('width' => '15%')), 'Connection.published' => array('link' => array(r_('index.php?ext=chronoconnectivity&act=toggle&gcb={Connection.id}&val=1&fld=published'), r_('index.php?ext=chronoconnectivity&act=toggle&gcb={Connection.id}&val=0&fld=published')), 'image' => array($this->Assets->image('disabled.png'), $this->Assets->image('enabled.png')), 'style' => array('width' => '10%')), 'Connection.id' => array('style' => array('width' => '5%')))); echo $this->DataTable->build(); echo $this->DataTable->footerPanel($this->DataTable->_l($this->Paginator->getInfo()) . $this->DataTable->_r($this->Paginator->getNav())); echo $this->DataTable->footerPanel($this->DataTable->_r($this->Paginator->getList())); ?> </form> </div> </div> </div>
<h3><?php echo l_('CONN_CREATE_TABLE'); ?> </h3> </div> <div class="col-md-6 pull-right text-right"> <?php echo $this->Toolbar->renderBar(); ?> </div> </div> <div class="row"> <div class="panel panel-default"> <div class="panel-body"> <form action="<?php echo r_('index.php?ext=chronoconnectivity&act=create_table'); ?> " method="post" name="admin_form" id="admin_form"> <?php echo $this->Html->formSecStart(); ?> <?php echo $this->Html->formLine('table_name', array('type' => 'text', 'label' => 'Table Name', 'value' => $table_name, 'class' => 'XXL', 'sublabel' => 'The name of the table to be created, it should not contain any spaces.')); ?> <?php echo $this->Html->formSecEnd(); ?> <table class="table table-hover table-bordered"> <thead> <tr> <th><?php
<h3><?php echo l_('CF_INSTALL_ACTION_TITLE'); ?> </h3> </div> <div class="col-md-6 pull-right text-right"> <?php echo $this->Toolbar->renderBar(); ?> </div> </div> <div class="row"> <div class="panel panel-default"> <div class="panel-body"> <form action="<?php echo r_('index.php?ext=chronoforms&act=install_action'); ?> " method="post" name="admin_form" id="admin_form" enctype="multipart/form-data"> <?php echo $this->Html->formStart(); ?> <?php echo $this->Html->formSecStart(); ?> <?php echo $this->Html->formLine('upload', array('type' => 'file', 'label' => l_('CF_SELECT_ACTION_FILE'), 'sublabel' => l_('CF_SELECT_ACTION_FILE_DESC'))); ?> <?php echo $this->Html->formSecEnd(); ?> <?php
<h3><?php echo l_('CF_SHOW_DATA_TITLE'); ?> </h3> </div> <div class="col-md-6 pull-right text-right"> <?php echo $this->Toolbar->renderBar(); ?> </div> </div> <div class="row"> <div class="panel panel-default"> <div class="panel-body"> <form action="<?php echo r_('index.php?ext=chronoforms&act=list_data&table=' . $this->data['table']); ?> " method="post" name="admin_form" id="admin_form"> <table class="table"> <?php /*foreach($fields as $field){ echo "<tr>"; echo "<td>".$field."</td>"; echo "<td>".$row['ListData'][$field]."</td>"; echo "</tr>"; }*/ echo \GCore\Helpers\Html::formStart(); echo \GCore\Helpers\Html::formSecStart(); foreach ($fields as $field) { echo \GCore\Helpers\Html::formLine($field, array('type' => 'custom', 'label' => $field, 'code' => $row['ListData'][$field])); }
public function setup($connection, $area = 'front', $rows = array()) { $pmodel = '\\GCore\\Models\\' . $connection['Connection']['extras']['models']['name'][1]; $pmodel_inst = $pmodel::getInstance(); //$this->view->Plugin->setup($connection, $pmodel_inst); $columns = array(); $_f = function ($e) { $cs = explode(':', $e, 2); return trim($cs[0]); }; $_t = function ($e) { $cs = explode(':', $e, 2); if (isset($cs[1])) { if (strpos($cs[1], 'array(') !== false and strpos($cs[1], 'array(') == 0) { eval('?>' . '<?php $tmp = ' . $cs[1] . '; ?>'); return $tmp; } return $cs[1]; } else { return $cs[0]; } return isset($cs[1]) ? $cs[1] : $cs[0]; }; $columns_string = trim($connection['Connection']['extras'][$area]['columns']['list']); if (!empty($columns_string)) { ob_start(); eval('?>' . $columns_string); $columns_string = ob_get_clean(); $columns = explode("\n", $columns_string); $fields = array_map($_f, $columns); $titles = array_map($_t, $columns); $headers = array_combine($fields, $titles); $sortables_string = trim($connection['Connection']['extras'][$area]['columns']['sortable']); if (!empty($sortables_string)) { $columns = explode("\n", $sortables_string); $fields = array_map($_f, $columns); $titles = array_map($_t, $columns); foreach ($fields as $k => $field) { if (isset($headers[$field])) { $headers[$field] = $this->view->Sorter->link($headers[$field], trim($titles[$k])); } } } $data_columns = array(); //chek for selectors foreach ($headers as $fld => $ttl) { if ($fld == '_SELECTOR_') { $headers[$fld] = $this->view->Toolbar->selectAll(); $data_columns[$fld]['html'] = $this->view->Toolbar->selector('{' . $pmodel_inst->alias . '.' . $pmodel_inst->pkey . '}'); } $this->view->Plugin->on_list($fld, $ttl, $data_columns); /*if($fld == '_EDIT_'){ //$headers[$fld] = $this->view->Toolbar->selectAll(); $data_columns[$fld]['a'] = r_('index.php?ext=chronoconnectivity&cont=lists&ccname='.$connection['Connection']['title'].'&act=edit'); if($pmodel_inst->pkey){ $data_columns[$fld]['a'] .= '&gcb={'.$pmodel_inst->alias.'.'.$pmodel_inst->pkey.'}'; } $data_columns[$fld]['html'] = '<a href="'.$data_columns[$fld]['a'].'">'.$ttl.'</a>'; } if($fld == '_DELETE_'){ //$headers[$fld] = $this->view->Toolbar->selectAll(); $data_columns[$fld]['a'] = r_('index.php?ext=chronoconnectivity&cont=lists&ccname='.$connection['Connection']['title'].'&act=delete'); if($pmodel_inst->pkey){ $data_columns[$fld]['a'] .= '&gcb={'.$pmodel_inst->alias.'.'.$pmodel_inst->pkey.'}'; } $data_columns[$fld]['html'] = '<a href="'.$data_columns[$fld]['a'].'">'.$ttl.'</a>'; }*/ } $view_linkable_string = isset($connection['Connection']['extras'][$area]['columns']['view_linkable']) ? trim($connection['Connection']['extras'][$area]['columns']['view_linkable']) : ''; if (!empty($view_linkable_string)) { $columns = explode("\n", $view_linkable_string); $fields = array_map($_f, $columns); $linkable = array_map($_t, $columns); foreach ($fields as $k => $field) { $data_columns[$field]['link'] = r_('index.php?ext=chronoconnectivity&cont=lists&ccname=' . $connection['Connection']['title'] . '&act=view'); if ($pmodel_inst->pkey) { $data_columns[$field]['link'] .= '&gcb={' . $pmodel_inst->alias . '.' . $pmodel_inst->pkey . '}'; } } } $edit_linkable_string = trim($connection['Connection']['extras'][$area]['columns']['linkable']); if (!empty($edit_linkable_string)) { $columns = explode("\n", $edit_linkable_string); $fields = array_map($_f, $columns); $linkable = array_map($_t, $columns); foreach ($fields as $k => $field) { $data_columns[$field]['link'] = r_('index.php?ext=chronoconnectivity&cont=lists&ccname=' . $connection['Connection']['title'] . '&act=edit'); if ($pmodel_inst->pkey) { $data_columns[$field]['link'] .= '&gcb={' . $pmodel_inst->alias . '.' . $pmodel_inst->pkey . '}'; } } } $binary_string = trim($connection['Connection']['extras'][$area]['columns']['binary']); if (!empty($binary_string)) { $columns = explode("\n", $binary_string); $fields = array_map($_f, $columns); $binary = array_map($_t, $columns); foreach ($fields as $k => $field) { $model = $pmodel_inst->alias; $fld = $field; if (strpos($field, '.') !== false) { $pcs = explode('.', $field); $model = $pcs[0]; $fld = $pcs[1]; } $data_columns[$field]['link'] = array(r_('index.php?ext=chronoconnectivity&cont=lists&act=toggle&ccname=' . $connection['Connection']['title'] . '&gcb={' . $pmodel_inst->alias . '.' . $pmodel_inst->pkey . '}&val=1&fld=' . $fld . '&model=' . $model), r_('index.php?ext=chronoconnectivity&cont=lists&act=toggle&ccname=' . $connection['Connection']['title'] . '&gcb={' . $pmodel_inst->alias . '.' . $pmodel_inst->pkey . '}&val=0&fld=' . $fld . '&model=' . $model)); $data_columns[$field]['image'] = array($this->view->Assets->image('disabled.png'), $this->view->Assets->image('enabled.png')); } } $links_string = trim($connection['Connection']['extras'][$area]['columns']['links']); if (!empty($links_string)) { $columns = explode("\n", $links_string); $fields = array_map($_f, $columns); $links = array_map($_t, $columns); foreach ($fields as $k => $field) { $data_columns[$field]['link'] = $links[$k]; } } $htmls_string = trim($connection['Connection']['extras'][$area]['columns']['htmls']); if (!empty($htmls_string)) { $columns = explode("\n", $htmls_string); $fields = array_map($_f, $columns); $htmls = array_map($_t, $columns); foreach ($fields as $k => $field) { $data_columns[$field]['html'] = $htmls[$k]; } } $styles_string = trim($connection['Connection']['extras'][$area]['columns']['styles']); if (!empty($styles_string)) { $columns = explode("\n", $styles_string); $fields = array_map($_f, $columns); $styles = array_map($_t, $columns); foreach ($fields as $k => $field) { $data_columns[$field]['style'] = $styles[$k]; } } $images_string = trim($connection['Connection']['extras'][$area]['columns']['images']); if (!empty($images_string)) { $columns = explode("\n", $images_string); $fields = array_map($_f, $columns); $images = array_map($_t, $columns); foreach ($fields as $k => $field) { $data_columns[$field]['image'] = $images[$k]; } } $functions_string = trim($connection['Connection']['extras'][$area]['columns']['functions']); if (!empty($functions_string)) { $columns = explode("\n", $functions_string); $fields = array_map($_f, $columns); $functions = array_map($_t, $columns); foreach ($fields as $k => $field) { $data_columns[$field]['function'] = create_function('$cell, $row', $functions[$k]); } } $fields_string = trim($connection['Connection']['extras'][$area]['columns']['fields']); if (!empty($fields_string)) { $columns = explode("\n", $fields_string); $fields = array_map($_f, $columns); $fields_info = array_map($_t, $columns); foreach ($fields as $k => $field) { $data_columns[$field]['field'] = $fields_info[$k]; } } \GCore\Helpers\DataPresenter::create(); \GCore\Helpers\DataPresenter::header($headers); \GCore\Helpers\DataPresenter::cells($rows, $data_columns); \GCore\Helpers\DataPresenter::set_cells_data(); } }