function show_conf($row, $id, $form_id, $option)
    {
        global $mainframe;
        require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'plugin.php';
        $helper = new ChronoContactHelperPlugin();
        // identify and initialise the parameters used in this plugin
        $params_array = array('debugging' => '0', 'name' => '', 'username' => '', 'email' => '', 'pass' => '', 'vpass' => '', 'emailuser' => 'Yes', 'emailadmins' => 'Yes', 'joomlastatus' => '1', 'showmessages' => '1', 'createpassword' => '0', 'onsubmit' => 'before_email', 'new_usertype' => 'Registered', 'autologin' => '0');
        $params = $helper->loadParams($row, $params_array);
        $messages[] = '$params: ' . print_r($params, true);
        if ($params->get('debugging')) {
            $helper->showPluginDebugMessages($messages);
        }
        ?>
<form action="index2.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<?php 
        echo $pane->startPane("joomlaregistration");
        echo $pane->startPanel('Field names', "general6");
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('User information field names', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $tooltip = "Enter the name of the the 'User's name' field";
        $input = $helper->createInputTD("'Name' field name", "params[name]", $params->get('name'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter the name of the the 'User's username' field";
        $input = $helper->createInputTD("'Username' field name", "params[username]", $params->get('username'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter the name of the the 'User's email' field";
        $input = $helper->createInputTD("'Email' field name", "params[email]", $params->get('email'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter the name of the the 'User's password' field";
        $input = $helper->createInputTD("'Password' field name", "params[pass]", $params->get('pass'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Enter the name of the the 'Confirm password' field";
        $input = $helper->createInputTD("'Confirm password' field name", "params[vpass]", $params->get('vpass'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        echo "</table>";
        echo $pane->endPanel();
        echo $pane->startPanel('Configuration', "general6");
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Registration configuration', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        $option_array = array('Yes' => 'Yes (Default Joomla Email)', 'No' => 'No');
        $query = "\n        \tSELECT *\n        \t\tFROM `#__chrono_contact_emails`\n        \t\tWHERE `formid` = '{$form_id}'\n        \t\tORDER BY emailid ;\n        \t";
        $db->setQuery($query);
        $emails = $db->loadObjectList();
        $emailcount = 1;
        foreach ($emails as $email) {
            $option_array['custom' . $emailcount] = "Yes (Custom Form Email {$emailcount})";
            $emailcount++;
        }
        foreach ($option_array as $k => $v) {
            $option_array[$k] = JHTML::_('select.option', $k, JText::_($v));
        }
        $tooltip = "Select an e-mail template to send to the User";
        $input = $helper->createSelectTD("E-mail the User?", "params[emailuser]", $option_array, $params->get('emailuser'), $attribs['select'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Select an e-mail template to send to the Admins";
        $input = $helper->createSelectTD("E-mail the Admins?", "params[emailadmins]", $option_array, $params->get('emailadmins'), $attribs['select'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Show Joomla status messages<br />\n        \te.g: Your account has been created . . .";
        $input = $helper->createYesNoTD("Show Joomla messages", "params[joomlastatus]", '', $params->get('joomlastatus'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Show messages using the Joomla message display.<br />\n        \tThese may not show if your template doesn't support system message display.";
        $input = $helper->createYesNoTD("Use Joomla message display", "params[showmessages]", '', $params->get('showmessages'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Automatically create a password for the user.<br />\n        \tNote: Any password fields on the form will be ignored.";
        $input = $helper->createYesNoTD("Create password", "params[createpassword]", '', $params->get('createpassword'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "you may want the plugin to advance with the registration even if Joomla global allow user registration is off";
        $input = $helper->createYesNoTD("Override Joomla's Allow User Registration", "params[overrideJallowUserRegistration]", '', $params->get('overrideJallowUserRegistration', '0'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Auto login after registration, will work only if user is activated";
        $input = $helper->createYesNoTD("Auto login", "params[autologin]", '', $params->get('autologin'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $option_array = array('before_email' => 'Before Email', 'after_email' => 'After Email');
        foreach ($option_array as $k => $v) {
            $option_array[$k] = JHTML::_('select.option', $k, JText::_($v));
        }
        $tooltip = "Run the plugin before or after the email.<br />\n        \tRunning it before the email may be necessary to include some data into the email";
        $input = $helper->createSelectTD("Flow control", "params[onsubmit]", $option_array, $params->get('onsubmit'), $attribs['select'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Show debug information on Submit?";
        $input = $helper->createYesNoTD("Debugging", "params[debugging]", '', $params->get('debugging'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $option_array = array('Registered' => 'Registered', 'Author' => 'Author', 'Editor' => 'Editor', 'Publisher' => 'Publisher', 'Manager' => 'Manager', 'Administrator' => 'Administrator', 'Super Administrator' => 'Super Administrator');
        foreach ($option_array as $k => $v) {
            $option_array[$k] = JHTML::_('select.option', $k, JText::_($v));
        }
        $tooltip = "Select to which users group the new user will be added";
        $input = $helper->createSelectTD("Target group", "params[new_usertype]", $option_array, $params->get('new_usertype', 'Registered'), $attribs['select'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("Extra code", 'extracode');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Extra code', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        $tooltip = "Execute some code just before the Registration transaction is executed";
        $input = $helper->createTextareaTD('Extra before Registration code', 'extra4', $row->extra4, $attribs['textarea'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Execute some code just after the Registration transaction is executed";
        $input = $helper->createTextareaTD('Extra after Registration code', 'extra5', $row->extra5, $attribs['textarea'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("Help", 'Legend3');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('How to configure the Jooma Registration plugin', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        ?>
    <tr>
        <td colspan='4' style='border:1px solid silver; padding:6px;'>
        <div>The plugin allows you to use a ChronoForms Form to register users with your Joomla site.
        The form will be redisplayed if there is a registration error (the password confirmation does not match,
        the username or email are already in use, email is invalid, etc.). The password field values are not re-shown for security.</div>
        <ul><li>On the 'Field Names' tab enter the field names from your form that correspond
        to the standard Joomla Registration fields. If here are fields that you are not using leave them blank.</li>
        <li>On the Configuration tab you can choose the emails to send to the User or the Admins.
        If you have Custom Email Setups for this form they will also show in the lists.</li>
        <li>The Flow Control setting should normally be left as 'Before Email'
        (but note that emails must be enabled on your form General Tab or the plugin will not run).</li>
        <li>Debugging will show some extra messages that may be helpful in setting up the plugin.
        This should be set to 'No' on a production site.</li>
        <li>The Create Password option will use the standard Joomla function to create a random string password.
            This can simplify the registration process and remove a security risk if users tend to use weak passwords.
            If you select this option you do not need password fields in your form and any that you do have will be ignored.</li>
        <li>The Use Joomla Message Display options will show standard Joomla system messages if there is a registration error.
        If you do not use this option you will need to add code to add messages yourself.
        NB, not all templates show system messgaes correctly.</li>
        <li>If you wish to set up values for fields you can do this in the Extra Code boxes.
        For example you could create a user name from first and last name fields, or autogenerate a password.
        Use a hidden field with no value in the Form HTML, put the field name in the Field Names tab here,
        and set the field value in the Extra Code Before box.</li>
        <li>The Extra Code tab allows you to add extra PHP to run before and / or after the Registration.
        Normally you will leave these boxes empty; use them if you need to alter the submitted data in some way.</li>
        <li>The three variables below will contain the Registration results if you wish to do more processing.</li>
        </ul>
        </td>
    </tr>
<?php 
        $tooltip = "This object will have all the inserted user data";
        $input = $helper->createTextTD("User object", '$MyPlugins->cf_joomla_registration[\'user\']', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Any error messages returned by Joomla if the Registration fails!";
        $input = $helper->createTextTD("Registration messages", '$MyPlugins->cf_joomla_registration[\'errors\']', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Returns true or false based on the success of the Registration";
        $input = $helper->createTextTD("Registration result (true/false)", '$MyPlugins->cf_joomla_registration[\'complete\']', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->endPane();
        $hidden_array = array('id' => $id, 'form_id' => $form_id, 'name' => $this->plugin_name, 'event' => $this->event, 'option' => $option, 'task' => 'save_conf');
        echo $helper->createHiddenArray($hidden_array);
        ?>
</form>
<?php 
    }
Exemplo n.º 2
0
    function show_conf($row, $id, $form_id, $option)
    {
        global $mainframe;
        require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_chronocontact' . DS . 'helpers' . DS . 'plugin.php';
        $helper = new ChronoContactHelperPlugin();
        $query = "\n        \tSELECT *\n        \t\tFROM `#__chrono_contact`\n        \t\tWHERE id = " . $db->Quote($form_id);
        $db->setQuery($query);
        $form = $db->loadObject();
        $htmlstring = $form->html;
        preg_match_all('/name=("|\').*?("|\')/i', $htmlstring, $matches);
        $names = array();
        foreach ($matches[0] as $name) {
            $name = preg_replace('/name=("|\')/i', '', $name);
            $name = preg_replace('/("|\')/', '', $name);
            $name = preg_replace('/name=("|\')/', '', $name);
            if (strpos($name, '[]')) {
                $name = str_replace('[]', '', $name);
            }
            $names[] = trim($name);
        }
        $names = array_unique($names);
        // identify and initialise the parameters used in this plugin
        $params_array = array('debugging' => '0', 'target_url' => 'http://', 'onsubmit' => 'before_email');
        $params = $helper->loadParams($row, $params_array);
        $messages[] = '$params: ' . print_r($params, true);
        if ($params->get('debugging')) {
            $helper->showPluginDebugMessages($messages);
        }
        ?>
<form action="index2.php" method="post" name="adminForm" id="adminForm" class="adminForm" >
<?php 
        echo $pane->startPane("cf_redirect");
        echo $pane->startPanel('General', "general");
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Field names from your form', '', true, $attribs['header']);
        echo $helper->wrapTR($input);
        foreach ($names as $name) {
            $tooltip = "Enter the other site field name that matches '{$name}'";
            $input = $helper->createInputTD("'{$name}' field", "extra2[{$name}]", $extra2->get($name), '', $attribs['input'], $tooltip);
            echo $helper->wrapTR($input, array('class' => 'cf_config'));
        }
        $input = $helper->createHeaderTD('Extra field values to send', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        $tooltip = "Extra Fields, enter data in this format : ship_to_name=field_name<br />Take care to add each entry to a new line";
        $input = $helper->createTextareaTD('Extra fields Data', 'extra1', $row->extra1, $attribs['textarea'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("URL parameters", 'url_params');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Plugin parameters', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        $tooltip = "The target URL to redirect to";
        $input = $helper->createInputTD("Target URL", "params[target_url]", $params->get('target_url'), '', $attribs['input'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $option_array = array('before_email' => 'Before Email', 'after_email' => 'After Email');
        foreach ($option_array as $k => $v) {
            $option_array[$k] = JHTML::_('select.option', $k, JText::_($v));
        }
        $tooltip = "Run the plugin before or after the email.<br />\n        \tRunning it before the email may be necessary to include some data into the email";
        $input = $helper->createSelectTD("Flow control", "params[onsubmit]", $option_array, $params->get('onsubmit'), $attribs['select'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        $tooltip = "Show debug information on Submit?";
        $input = $helper->createYesNoTD("Debugging", "params[debugging]", '', $params->get('debugging'), '', $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel("Extra code", 'extracode');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('Extra code', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        $tooltip = "Execute some code just before the Redirect transaction is executed";
        $input = $helper->createTextareaTD('Extra before CURL code', 'extra4', $row->extra4, $attribs['textarea'], $tooltip);
        echo $helper->wrapTR($input, array('class' => 'cf_config'));
        /*$tooltip = "Execute some code just after the CURL transaction is executed";
          $input = $helper->createTextareaTD('Extra after CURL code', 'extra5',
              $row->extra5, $attribs['textarea'], $tooltip );
          echo $helper->wrapTR($input, array('class' => 'cf_config'));*/
        ?>
</table>
<?php 
        echo $pane->endPanel();
        echo $pane->startPanel('Help', 'help');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $input = $helper->createHeaderTD('How to configure the Redirect plugin', '', true, array('colspan' => '4', 'class' => 'cf_header'));
        echo $helper->wrapTR($input);
        ?>
    <tr>
        <td colspan='4' style='border:1px solid silver; padding:6px;'>
        <div>The plugin allows you to use the Redirect URL to send data and the user from a ChronoForms Form to
        another site or to another application on your site. Use this when you need to redirect the user
        for example to PayPal to authorise a payment, if you just want to transfer data from the form and keep teh user on
        your site, then the CURL plugin is better.</div>
        <ul><li>First, open the URL params tab and put the url that you want to submit the information to
        in the Target URL box e.g. http://www.paypal.com/cgi-bin/webscr </li>
        <li>Next click the General Tab and you will see a list of the fields in your form.
        Put the corresponding names for the site you are sending to in the boxes along-side
        (often these will be the same as the field names in your form.)</li>
        <li>In the Extra Fields Data box you can enter values for fields that will be the same
        for each submission. These will often be client or transaction identifiers for the other site.
        (Note: Putting this information here means that it is never exposed in your form.)</li>
        <li>Lastly on the Redirect params tab, you can set the Redirect Plugin to run before or after Emails are sent.
        Use this if you need to fine-tune the process flow. Note that the Redirection will be done after any emails are
        sent and the data saved.</li>
        <li>The Extra Code tab allows you to add extra PHP to run before the Redirection Plugin
        (running code after redirection is not possible).
        Normally you will leave these boxes empty; use them if you need to alter the submitted data in some way.</li>
        </ul>
        </td>
    </tr>
    </table>
<?php 
        echo $pane->endPane();
        echo $pane->endPane();
        $hidden_array = array('id' => $id, 'form_id' => $form_id, 'name' => $this->plugin_name, 'event' => $this->event, 'option' => $option, 'task' => 'save_conf');
        $hidden_array['params[onsubmit]'] = 'before_email';
        echo $helper->createHiddenArray($hidden_array);
        ?>

</form>
<?php 
        if ($style) {
            $doc->addStyleDeclaration($style);
        }
        if ($script) {
            $doc->addScriptDeclaration($script);
        }
    }
Exemplo n.º 3
0
    function show_conf($row, $id, $form_id, $option)
    {
        global $mainframe;
        require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'plugin.php';
        $helper = new ChronoContactHelperPlugin();
        // identify and initialise the parameters used in this plugin
        $params_array = array('debugging' => '0', 'languages' => '', 'default_language' => '');
        $params = $helper->loadParams($row, $params_array);
        $messages[] = '$params: ' . print_r($params, true);
        if ($params->get('debugging')) {
            $helper->showPluginDebugMessages($messages);
        }
        $tags = explode(',', $params->get('languages'));
        ?>
<form action="index2.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<?php 
        echo $pane->startPane("multilanguage");
        /* echo $pane->startPanel( 'Multi Language settings', "settings" );
        ?>
        <table border='0' cellpadding='3' cellspacing='0' class='cf_table' >
        <?php
                $input = $helper->createHeaderTD('Configure the plugin', '',
                    true, array('colspan' => '4', 'class' => 'cf_header'));
                echo $helper->wrapTR($input);
        
                $tooltip = "Your list of supported languages, in 2-2 letters form e.g. en-GB,fr-FR,es-ES";
                $input = $helper->createInputTD("Languages supported",
                    "params[languages]", $params->get('languages'), '', $attribs['input'], $tooltip);
                echo $helper->wrapTR($input, array('class' => 'cf_config'));
        
                $tooltip = "Default language which will run when the current site language is not supported e.g. en-GB";
                $input = $helper->createInputTD("Default language",
                    "params[default_language]", $params->get('default_language'), '', $attribs['input'], $tooltip);
                echo $helper->wrapTR($input, array('class' => 'cf_config'));
        ?>
        	</table>
        <?php
        		echo $pane->endPanel(); */
        echo $pane->startPanel("Languages 1-5", 'Languages2');
        ?>
<table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
<?php 
        $tooltip = "Add your language translations here!";
        for ($i = 1; $i <= 2; $i++) {
            $extra = 'extra' . $i;
            $tag_name = '';
            if (!empty($tags[$i - 1])) {
                $tag_name = $tags[$i - 1];
            }
            $input = $helper->createTextareaTD('Language Strings: ' . $tag_name, $extra, $row->{$extra}, $attribs['textarea'], $tooltip);
            echo $helper->wrapTR($input, array('class' => 'cf_config'));
        }
        ?>
</table>
<?php 
        echo $pane->endPanel();
        /* echo $pane->startPanel( "Languages 6-10", 'Languages3' );
        ?>
        <table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
        <?php
                for ( $i = 6; $i <= 10; $i++ ) {
                    $extra = 'extra'.$i;
                    $input = $helper->createTextareaTD('Language Strings', 'params['.$extra.']',
                        $params->get($extra),
                        $attribs['textarea'], $tooltip );
                    echo $helper->wrapTR($input, array('class' => 'cf_config'));
                }
        ?>
        </table>
        <?php
        		echo $pane->endPanel(); */
        /* echo $pane->startPanel( "Help", 'Legend3' );
        ?>
        <table border="0" cellpadding="3" cellspacing="0" class='cf_table' >
        <?php
                $input = $helper->createHeaderTD('How to use the Multi Language plugin', '',
                    true, array('colspan' => '4', 'class' => 'cf_header'));
                echo $helper->wrapTR($input);
        ?>
            <tr>
                <td colspan='4' style='border:1px solid silver; padding:6px;'>
                <div>The plugin allows you to create multi-language forms in ChronoForms.</div>
                <div>The plugin works by checking the current language from the Joomla settings
                and then replacing 'key phrases' in the form html with the equivalent you have
                defined for that language.</div>
                <ul><li>In the Settings tab enter a list of the languages that you want to support
                using the 'country code'-'region code' format: en-GB, fr-FR </li>
                <li>Enter one of these language codes as the default value to be used if there isn't
                a definition for a language in use.</li>
                <li>On the second and third tabs are a series of text areas in which you can enter your
                language translations. Note that after the plugin is saved language tags will show up
                by the corresponding box names.</li>
                <li>In each box enter each of the 'key phrases' and the language equivalents
                e.g. in en-GB: 'Required field=This field is required';
                in fr-FR: 'Requred field=Ce champ est obligatoire'; and in nl-NL: Requred field=Dit veld is verplicht'.</li>
                <li>Notice that each entry takes the form Key phrase=Translated expression.
                Don't leave spaces around the '=' and don't add quotes around either part of the entry.</li>
                <li>Start each new 'key phrase' on a new line.</li>
                <li>In your form html make sure that the 'key phrase' is entered in exactly the same way as
                in the plugin e.g. &lt;input . . . title='Required field' . . . /&gt;</li>
                </ul>
                <div>Note that you can use Key phrases for any text in your for html.</div>
                <ul><li>For label text.</li>
                <li>For title entries to show validation error messages.</li>
                <li>For image names to show language specific images e.g 'Submit_image=submit_img_fr.jpg'</li>
                <li>For short body text - remember that the entry has to go onto a single line in the text area.</li></ul>
                <div>This version of the multi-language plugin will also translate ChronoForms errors
                so it can be used, for example, with the AntiSpam error message.</div>
                </td>
            </tr>
        </table>
        <?php
                echo $pane->endPanel(); */
        echo $pane->endPane();
        $hidden_array = array('id' => $id, 'form_id' => $form_id, 'name' => $this->plugin_name, 'event' => $this->event, 'option' => $option, 'task' => 'save_conf');
        //$hidden_array['params[onsubmit]'] = 'before_email';
        echo $helper->createHiddenArray($hidden_array);
        ?>
</form>
<?php 
    }