private static function input_html($id, $namespace, $date, $format, $title)
    {
        $html = <<<HTML
\t\t\t<div id="{$id}-container" class="calendar_container">

HTML;
        $date_str = $date;
        //date(str_replace('M', 'm', $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']), $date);
        switch ($format) {
            case 'select':
                $posies = array_flip(self::get_date_pos());
                foreach ($posies as $pos) {
                    switch ($pos) {
                        case 'd':
                            $html .= phpgwapi_sbox::getDays($name, $selected = null);
                    }
                }
            case 'input':
            default:
                $html .= <<<HTML
\t\t\t\t\t<input type="text" id="{$id}" name="{$id}" value="{$date_str}" onchange="updateCalFromSelect('{$namespace}', '{$id}');">

HTML;
        }
        $img = $GLOBALS['phpgw']->common->image('phpgwapi', 'cal');
        $alt = lang('date selector trigger');
        $html .= <<<HTML
\t\t\t\t<img src="{$img}" alt="{$alt}" title="{$title}">
\t\t\t</div>

HTML;
        return $html;
    }
 function edit()
 {
     $todo_id = isset($_REQUEST['todo_id']) ? (int) $_REQUEST['todo_id'] : 0;
     $cat_id = isset($_POST['cat_id']) ? (int) $_POST['cat_id'] : 0;
     $new_cat = isset($_POST['new_cat']) ? (int) $_POST['new_cat'] : 0;
     $values = isset($_POST['values']) ? (array) $_POST['values'] : array();
     $submit = isset($_POST['submit']) ? !!$_POST['submit'] : false;
     $new_parent = isset($_POST['new_parent']) ? $_POST['new_parent'] : 0;
     $parent = isset($_POST['parent']) ? (int) $_POST['parent'] : 0;
     $assigned = isset($_POST['assigned']) ? $_POST['assigned'] : 0;
     $assigned_group = isset($_POST['assigned_group']) ? $_POST['assigned_group'] : 0;
     if ($new_parent) {
         $parent = $new_parent;
     }
     if ($new_cat) {
         $cat_id = $new_cat;
     }
     if ($submit) {
         $values['cat'] = $cat_id;
         $values['parent'] = $parent;
         $values['id'] = $todo_id;
         if (is_array($assigned)) {
             $values['assigned'] = implode(',', $assigned);
             if (count($assigned) > 1) {
                 $values['assigned'] = ',' . $values['assigned'] . ',';
             }
         }
         if (is_array($assigned_group)) {
             $values['assigned_group'] = implode(',', $assigned_group);
             if (count($assigned_group) > 1) {
                 $values['assigned_group'] = ',' . $values['assigned_group'] . ',';
             }
         }
         $error = $this->botodo->check_values($values);
         if (is_array($error)) {
             $this->t->set_var('error', $GLOBALS['phpgw']->common->error_list($error));
         } else {
             $this->botodo->save($values, 'edit');
             $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 'todo.uitodo.show_list', 'cat_id' => $cat_id));
             $GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
             exit;
         }
     }
     $GLOBALS['phpgw']->common->phpgw_header(true);
     $this->t->set_file(array('todo_edit' => 'form.tpl'));
     $this->t->set_block('todo_edit', 'add', 'addhandle');
     $this->t->set_block('todo_edit', 'edit', 'edithandle');
     $this->set_app_langs();
     $this->t->set_var('actionurl', $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'todo.uitodo.edit', 'todo_id' => $todo_id)));
     $values = $this->botodo->read($todo_id);
     if ($values['parent'] != 0) {
         $this->t->set_var('lang_todo_action', lang('Edit sub project'));
     } else {
         $this->t->set_var('lang_todo_action', lang('Edit main project'));
     }
     $this->t->set_var('cat_list', $this->cats->formatted_list('select', 'all', $values['cat'], 'True'));
     $this->t->set_var('todo_list', $this->formatted_todo($values['parent']));
     $this->t->set_var('descr', $GLOBALS['phpgw']->strip_html($values['descr']));
     $this->t->set_var('title', $GLOBALS['phpgw']->strip_html($values['title']));
     $this->t->set_var('pri_list', phpgwapi_sbox::getPriority('values[pri]', $values['pri']));
     $this->t->set_var('stat_list', phpgwapi_sbox::getPercentage('values[status]', $values['status']));
     $this->t->set_var('user_list', $this->formatted_user($this->botodo->format_assigned($values['assigned']), 'accounts'));
     $this->t->set_var('group_list', $this->formatted_user($this->botodo->format_assigned($values['assigned_group']), 'groups'));
     if ($values['sdate'] == 0) {
         $values['sday'] = 0;
         $values['smonth'] = 0;
         $values['syear'] = 0;
     } else {
         $values['sday'] = date('d', $values['sdate']);
         $values['smonth'] = date('m', $values['sdate']);
         $values['syear'] = date('Y', $values['sdate']);
     }
     $this->t->set_var('start_select_date', $GLOBALS['phpgw']->common->dateformatorder(phpgwapi_sbox::getYears('values[syear]', $values['syear']), phpgwapi_sbox::getMonthText('values[smonth]', $values['smonth']), phpgwapi_sbox::getDays('values[sday]', $values['sday'])));
     if ($values['edate'] == 0) {
         $values['eday'] = 0;
         $values['emonth'] = 0;
         $values['eyear'] = 0;
     } else {
         $values['eday'] = date('d', $values['edate']);
         $values['emonth'] = date('m', $values['edate']);
         $values['eyear'] = date('Y', $values['edate']);
     }
     $this->t->set_var('end_select_date', $GLOBALS['phpgw']->common->dateformatorder(phpgwapi_sbox::getYears('values[eyear]', $values['eyear']), phpgwapi_sbox::getMonthText('values[emonth]', $values['emonth']), phpgwapi_sbox::getDays('values[eday]', $values['eday'])));
     $this->t->set_var('selfortoday', '&nbsp;');
     $this->t->set_var('lang_selfortoday', '&nbsp;');
     $this->t->set_var('lang_daysfromstartdate', '&nbsp;');
     $this->t->set_var('daysfromstartdate', '&nbsp;');
     $this->t->set_var('access_list', '<input type="checkbox" name="values[access]" value="True"' . ($values['access'] == 'private' ? ' checked' : '') . '>');
     if ($this->botodo->check_perms($this->grants[$values['owner']], PHPGW_ACL_DELETE) || $values['owner'] == $GLOBALS['phpgw_info']['user']['account_id']) {
         $this->t->set_var('delete', '<form method="POST" action="' . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'todo.uitodo.delete', 'todo_id' => $values['id'])) . '"><input type="submit" value="' . lang('Delete') . '"></form>');
     } else {
         $this->t->set_var('delete', '&nbsp;');
     }
     $this->t->set_var('lang_submit', lang('Submit'));
     $this->t->set_var('edithandle', '');
     $this->t->set_var('addhandle', '');
     $this->t->pfp('out', 'todo_edit');
     $this->t->pfp('edithandle', 'edit');
 }