Пример #1
0
/**
 * Campsite interview_form block plugin
 *
 * Type:     block
 * Name:     interview_form
 * Purpose:  Provides a form for an interview
 *
 * @param string
 *     $p_params
 * @param string
 *     $p_smarty
 * @param string
 *     $p_content
 *
 * @return
 *
 */
function smarty_block_interview_form($p_params, $p_content, &$p_smarty, &$p_repeat)
{
    require_once $p_smarty->_get_plugin_filepath('shared','escape_special_chars');
    
    // gets the context variable
    $campsite = $p_smarty->get_template_vars('gimme');
    $html = '';
    
    if (0) {
        $Interview = new Interview($campsite->interview->identifier);
        return $Interview->getForm('/en/first/interview/', '', true);
    }
    
    if (isset($p_params['template'])) {
        $template = new Template($p_params['template']);
        $tpl_id = $template->getTemplateId();
    }
    if (!isset($p_params['submit_button'])) {
        $p_params['submit_button'] = 'Submit';
    }
    if (!isset($p_params['html_code']) || empty($p_params['html_code'])) {
        $p_params['html_code'] = '';
    }

    if (isset($p_content)) {
        $html = "<form name=\"interview\" action=\"{$campsite->url->uri_path}\" method=\"post\" enctype=\"multipart/form-data\">\n";
        $html .= "<input type=\"hidden\" name=\"_qf__interview\">\n";
        $html .= "<input type=\"hidden\" name=\"f_interview\" value=\"edit\">\n";
        
        if ($tpl_id) {
            $html .= "<input type=\"hidden\" name=\"".TEMPLATE_ID."\" value=\"$tpl_id\" />\n";
        }
        if ($campsite->interview->identifier) {
            $html .= "<input type=\"hidden\" name=\"f_interview_id\" value=\"{$campsite->interview->identifier}\" />\n";
        }
        $html .= $p_content;
        $html .= "<input type=\"submit\" name=\"f_interview_submit\" value=\""
              .smarty_function_escape_special_chars($p_params['submit_button'])
              ."\" ".$p_params['html_code']." />\n</form>\n";
    }

    return $html;
} // fn smarty_block_poll_form
/**
 * Campsite interview_form block plugin
 *
 * Type:     block
 * Name:     poll_form
 * Purpose:  Provides a form for an interview
 *
 * @param string
 *     $p_params
 * @param string
 *     $p_smarty
 * @param string
 *     $p_content
 *
 * @return
 *
 */
function smarty_block_interview_form($p_params, $p_content, &$p_smarty, &$p_repeat)
{
    require_once $p_smarty->_get_plugin_filepath('shared','escape_special_chars');

    // gets the context variable
    $camp = $p_smarty->get_template_vars('gimme');
    $html = '';

    if (isset($p_content)) {
        require_once $p_smarty->_get_plugin_filepath('function', 'urlparameters');
        require_once $p_smarty->_get_plugin_filepath('function', 'uripath');
        
        parse_str(smarty_function_urlparameters($p_params, &$p_smarty), $urlparameters);
        $uripath = smarty_function_uripath($p_params, &$p_smarty);
        
        $Interview = new Interview($camp->interview->identifier);
        $html = $Interview->getForm($uripath, $urlparameters, true);
    }

    return $html;
} // fn smarty_block_poll_form
Пример #3
0
    }    
};

if (!$error && $Interview->store()) {
    ?>
    <script language="javascript">
        window.opener.location.reload();
        window.close();
    </script>
    <?php
    exit();
}

?>
<?php camp_html_display_msgs(); ?>
<table style="margin-top: 10px; margin-left: 15px; margin-right: 15px;" cellpadding="0" cellspacing="0" width="95%" class="table_input">
    <TR>
    	<TD style="padding: 3px";>
    		<B><?php $Interview->exists() ? putGS('Edit Interview') : putGS('Add new Interview'); ?></B>
    		<hr style="color: #8baed1";>
    	</TD>
    </TR>
    <tr>
        <td>
            <?php p($Interview->getForm('edit.php', array(), true)); ?>
        </td>
    </tr>
</table>
</body>
</html>