/**
 * Create HTML form to enter a new record with the minimum necessary fields.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 */
function get_new_record_form()
{
    if (!ACLController::checkAccess('Tasks', 'edit', true)) {
        return '';
    }
    require_once 'include/time.php';
    global $app_strings, $mod_strings, $app_list_strings;
    global $current_user;
    global $theme;
    // Unimplemented until jscalendar language files are fixed
    // global $current_language;
    // global $default_language;
    // global $cal_codes;
    $user_id = $current_user->id;
    $default_status = $mod_strings['LBL_DEFAULT_STATUS'];
    $default_priority = $mod_strings['LBL_DEFAULT_PRIORITY'];
    $default_parent_type = $app_list_strings['record_type_default_key'];
    // Unimplemented until jscalendar language files are fixed
    // $cal_lang = (empty($cal_codes[$current_language])) ? $cal_codes[$default_language] : $cal_codes[$current_language];
    $cal_lang = "en";
    $cal_dateformat = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
    $ntc_time_format = '(' . getDisplayTimeFormat() . ')';
    $ampm = AMPMMenu('', '');
    $the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
    $the_form .= <<<EOQ
\t\t<form name="TaskSave" onSubmit="return check_form('TaskSave')" method="POST" action="index.php">
\t\t\t<input type="hidden" name="module" value="Tasks">
\t\t\t<input type="hidden" name="record" value="">
\t\t\t<input type="hidden" name="status" value="{$default_status}">
\t\t\t<input type="hidden" name="assigned_user_id" value='{$user_id}'>
\t\t\t<input type="hidden" name="priority" value="{$default_priority}">
\t\t\t<input type="hidden" name="parent_type" value="{$default_parent_type}">
\t\t\t<input type="hidden" name="action" value="Save">
\t\t\t<input type="hidden" name="date_due_flag">
\t\t<p>{$mod_strings['LBL_NEW_FORM_SUBJECT']} <span class="required">{$app_strings['LBL_REQUIRED_SYMBOL']}</span><br>
\t\t<input name='name' type="text" value=""><br>
\t\t{$mod_strings['LBL_NEW_FORM_DUE_DATE']}&nbsp;<span class="dateFormat">{$app_strings['NTC_DATE_FORMAT']}</span><br>
\t\t<input name='date_due' maxlength="10" onblur="parseDate(this, '{$cal_dateformat}');" id='jscal_field' type="text" value=""> <img src="themes/{$theme}/images/jscalendar.gif" alt="{$app_strings['LBL_ENTER_DATE']}"  id="jscal_trigger" align="absmiddle"><br>
\t\t{$mod_strings['LBL_NEW_FORM_DUE_TIME']}&nbsp;<span class="dateFormat">{$ntc_time_format}</span><br>
\t\t<input name='time_due' maxlength='5' type="text">&nbsp;{$ampm}</p>
\t\t<p><input title="{$app_strings['LBL_SAVE_BUTTON_TITLE']}" accessKey="{$app_strings['LBL_SAVE_BUTTON_KEY']}" class="button" type="submit" name="button" value="{$app_strings['LBL_SAVE_BUTTON_LABEL']}" ></p>
\t\t</form>
\t\t<script type="text/javascript">
\t\tCalendar.setup ({
\t\t\tinputField : "jscal_field", ifFormat : "{$cal_dateformat}", showsTime : false, button : "jscal_trigger", singleClick : true, step : 1
\t\t});
\t\t</script>
EOQ;
    require_once 'include/javascript/javascript.php';
    require_once 'modules/Tasks/Task.php';
    $javascript = new javascript();
    $javascript->setFormName('TaskSave');
    $javascript->setSugarBean(new Task());
    $javascript->addRequiredFields('');
    $javascript->addField('date_due', false, '');
    $javascript->addField('time_due', false, '');
    $the_form .= $javascript->getScript();
    $the_form .= get_left_form_footer();
    return $the_form;
}
/**
 * Create HTML form to enter a new record with the minimum necessary fields.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 */
function get_new_record_form_old()
{
    require_once 'include/time.php';
    global $mod_strings;
    global $app_strings;
    global $app_list_strings;
    global $current_user;
    global $theme;
    // Unimplemented until jscalendar language files are fixed
    // global $current_language;
    // global $default_language;
    // global $cal_codes;
    $lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
    $lbl_subject = $mod_strings['LBL_SUBJECT'];
    $lbl_date = $mod_strings['LBL_DATE'];
    $lbl_time = $mod_strings['LBL_TIME'];
    $ntc_date_format = $app_strings['NTC_DATE_FORMAT'];
    $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
    $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
    $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
    $default_parent_type = $app_list_strings['record_type_default_key'];
    $default_date_start = date('Y-m-d');
    $default_time_start = to_display_time(date('H:i'));
    $ntc_time_format = '(' . getDisplayTimeFormat() . ')';
    $ampm = AMPMMenu('', date('H:i'));
    $user_id = $current_user->id;
    // Unimplemented until jscalendar language files are fixed
    // $cal_lang = (empty($cal_codes[$current_language])) ? $cal_codes[$default_language] : $cal_codes[$current_language];
    $cal_lang = "en";
    $cal_dateformat = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
    $the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
    $the_form .= <<<EOQ

\t\t<form name="EmailSave" onSubmit="return check_form('EmailSave')" method="POST" action="index.php">
\t\t\t<input type="hidden" name="module" value="Emails">
\t\t\t<input type="hidden" name="record" value="">
\t\t\t<input type="hidden" name="action" value="Save">
\t\t\t<input type="hidden" name="parent_type" value="{$default_parent_type}">
\t\t\t<input type="hidden" name="assigned_user_id" value='{$user_id}'>
<p>\t\t{$lbl_subject} <span class="required">{$lbl_required_symbol}</span><br>
\t\t<input name='name' type="text"><br>
\t\t{$lbl_date} <span class="required">{$lbl_required_symbol}</span>&nbsp;<span class="dateFormat">{$ntc_date_format}</span><br>
\t\t<input name='date_start' onblur="parseDate(this, {$cal_dateformat});" id='jscal_field' type="text" maxlength="10" value="{$default_date_start}"> <img src="themes/{$theme}/images/jscalendar.gif" alt="{$app_strings['LBL_ENTER_DATE']}"  id="jscal_trigger" align="absmiddle"><br>
\t\t{$lbl_time} <span class="required">{$lbl_required_symbol}</span>&nbsp;<span class="dateFormat">{$ntc_time_format}</span><br>
\t\t<input name='time_start' maxlength='5' type="text" value="{$default_time_start}">{$ampm}</p>
<p>\t\t<input title="{$lbl_save_button_title}" accessKey="{$lbl_save_button_key}" class="button" type="submit" name="button" value="  {$lbl_save_button_label}  " ></p>
\t\t</form>
\t\t<script type="text/javascript">
\t\tCalendar.setup ({
\t\t\tinputField : "jscal_field", ifFormat : "{$cal_dateformat}", showsTime : false, button : "jscal_trigger", singleClick : true, step : 1
\t\t});
\t\t</script>

EOQ;
    $the_form .= get_left_form_footer();
    require_once 'include/javascript/javascript.php';
    require_once 'modules/Emails/Email.php';
    $javascript = new javascript();
    $javascript->setFormName('EmailSave');
    $javascript->setSugarBean(new Email());
    $javascript->addRequiredFields('');
    $the_form .= $javascript->getScript();
    return $the_form;
}