source: branches/1.2/workflow/inc/smarty/wf_plugins/function.wf_calendar_init.php @ 1349

Revision 1349, 1.5 KB checked in by niltonneto, 15 years ago (diff)

Ticket #561 - Inclusão do módulo Workflow faltante nessa versão.

  • Property svn:executable set to *
Line 
1<?php
2/**
3 * Insere código que regerencia arquivos js e css do jscalendar.
4 *
5 * @package Smarty
6 * @subpackage wf_plugins
7 * @author  boots
8 * @author  Sidnei Augusto Drovetto Junior
9 * @version  1.1.2
10 * @link http://www.dynarch.com/projects/calendar/ {dhtml calendar}
11 *          (dynarch.com)
12 * @param array $params Array de parametros
13 * @param object &$smarty Instância do objeto smarty em uso
14 * @return string $_out codigo a ser inserido
15 * @access public
16 */
17function smarty_function_wf_calendar_init($params, &$smarty)
18{
19        $path = "";
20        if (isset($params['path']))
21                $path = $params['path'] . "/";
22        else
23                $path = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/workflow/js/jscalendar/';
24        $defaults = array(
25                'css' => $path . 'calendar-blue.css',
26                'src' => $path . 'calendar.js',
27                'lang' => $path . 'calendar-br.js',
28                'setup_src' => $path . 'calendar-setup.js',
29                'input_format' => $path . 'calendar-input.js');
30       
31        foreach ($defaults as $field=>$default)
32        {
33                $_field = "_$field";
34                if (array_key_exists($field, $params))
35                {
36                        $$_field = (empty($params[$field])) ? $default : $params[$field];
37                }
38                else
39                {
40                        $$_field = $default;
41                }
42        }
43
44$_out = <<<EOF
45        <link rel="stylesheet" type="text/css" media="all" href="{$_css}">
46        <script type="text/javascript" src="{$_src}"></script>
47        <script type="text/javascript" src="{$_lang}"></script>
48        <script type="text/javascript" src="{$_setup_src}"></script>
49        <script type="text/javascript" src="{$_input_format}"></script>
50EOF;
51
52        return $_out;
53}
54?>
Note: See TracBrowser for help on using the repository browser.