Ejemplo n.º 1
0
function saveCalendar()
{
    global $error;
    global $obj_smarty;
    $arr_submit = array(array('calendar_id', 'int', false, -1), array('name', 'string', true, ''), array('dditems', 'string', true, ''), array('calendar_color', 'string', true, ''), array('can_add', 'bool', false, 0), array('can_edit', 'bool', false, 0), array('can_delete', 'bool', false, 0), array('can_change_color', 'bool', false, 0), array('checkbox_use_color_for_all_events', 'bool', false, 0), array('initial_show', 'bool', false, 0), array('share_type', 'string', true, 'private_group'), array('active', 'bool', false, 0));
    $frm_submitted = validate_var($arr_submit);
    if (!$error) {
        $bln_success = Calendar::saveCalendar($frm_submitted);
        if (is_string($bln_success)) {
            echo json_encode(array('success' => false, 'error' => $bln_success));
            exit;
        }
    } else {
        $obj_smarty->assign('error', $error);
    }
    header('location: ' . FULLCAL_URL . '/user/calendars/public');
    exit;
}
Ejemplo n.º 2
0
function saveCalendar()
{
    global $error;
    global $obj_smarty;
    $arr_submit = array(array('calendar_id', 'int', false, -1), array('name', 'string', true, ''), array('dditems', 'string', false, ''), array('calendar_color', 'string', true, ''), array('can_add', 'bool', false, 0), array('can_edit', 'bool', false, 0), array('can_delete', 'bool', false, 0), array('can_change_color', 'bool', false, 0), array('checkbox_use_color_for_all_events', 'bool', false, 0), array('initial_show', 'bool', false, 0), array('share_type', 'string', false, 'private'), array('active', 'string', true, ''), array('cal_startdate', 'string', false, ''), array('cal_enddate', 'string', false, ''), array('alterable_startdate', 'string', false, ''), array('alterable_enddate', 'string', false, ''));
    $frm_submitted = validate_var($arr_submit);
    if (!$error) {
        $bln_success = Calendar::saveCalendar($frm_submitted);
        if (is_string($bln_success)) {
            echo json_encode(array('success' => false, 'save_calendar_error' => $bln_success));
            exit;
        }
    } else {
        $obj_smarty->assign('save_calendar_error', $error);
    }
    if (!is_null($error) && $error !== false) {
        // give feedback about the error
        $arr_calendar = Calendar::getCalendar($frm_submitted['calendar_id'], true);
        $obj_smarty->assign('active', 'calendar');
        $obj_smarty->assign('calendar', $arr_calendar);
        $obj_smarty->display(FULLCAL_DIR . '/view/user_panel.tpl');
        exit;
    } else {
        header('location: ' . FULLCAL_URL . '/user/calendars');
        exit;
    }
}
Ejemplo n.º 3
0
function saveCalendar()
{
    global $error;
    global $obj_smarty;
    $arr_submit = array(array('calendar_id', 'int', false, -1), array('name', 'string', true, ''), array('dditems', 'string', false, ''), array('calendar_color', 'string', true, ''), array('can_add', 'bool', false, 0), array('can_edit', 'bool', false, 0), array('can_delete', 'bool', false, 0), array('can_change_color', 'bool', false, 0), array('can_dd_drag', 'string', false, ''), array('checkbox_use_color_for_all_events', 'bool', false, 0), array('initial_show', 'bool', false, 0), array('users_can_email_event', 'bool', false, 0), array('all_event_mods_to_admin', 'bool', false, 0), array('active', 'string', true, ''), array('cal_startdate', 'string', false, ''), array('cal_enddate', 'string', false, ''), array('alterable_startdate', 'string', false, ''), array('alterable_enddate', 'string', false, ''), array('share_type', 'string', true, 'private_group'), array('calendar_admin_email', 'email', false, ''));
    $frm_submitted = validate_var($arr_submit);
    //if(User::isAdminUser($frm_submitted['user_id'])) {
    if (!$error || is_null($error)) {
        $bln_success = Calendar::saveCalendar($frm_submitted);
        if (is_string($bln_success)) {
            echo json_encode(array('success' => false, 'save_calendar_error' => $bln_success));
            exit;
        }
    } else {
        $obj_smarty->assign('save_calendar_error', $error);
    }
    //} else {
    //	$obj_smarty->assign('error', 'NO rights to change this user');
    //}
    if (!is_null($error) && $error !== false) {
        // give feedback about the error
        $arr_calendar = Calendar::getCalendar($frm_submitted['calendar_id'], true);
        //$arr_birthdate = explode('-', $arr_calendar['birth_date']);
        $obj_smarty->assign('active', 'calendar');
        $obj_smarty->assign('calendar', $arr_calendar);
        $obj_smarty->display(FULLCAL_DIR . '/view/admin_panel.tpl');
        exit;
    } else {
        header('location: ' . FULLCAL_URL . '/admin/calendars');
        exit;
    }
}