当前位置: 首页>>代码示例>>PHP>>正文


PHP Events::insertEvent方法代码示例

本文整理汇总了PHP中Events::insertEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP Events::insertEvent方法的具体用法?PHP Events::insertEvent怎么用?PHP Events::insertEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Events的用法示例。


在下文中一共展示了Events::insertEvent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: submit

function submit()
{
    global $error;
    global $obj_smarty;
    global $obj_db;
    $arr_submit = array(array('user_id', 'int', true, ''), array('title', 'string', true, ''));
    $frm_submitted = validate_var($arr_submit);
    // save in the database
    Events::insertEvent($frm_submitted);
    // send message if success
    global $obj_smarty;
    // $obj_smarty->assign('results', $arr_return);
    //$obj_smarty->assign('q', $frm_submitted['sq']);
    $obj_smarty->display(FULLCAL_DIR . '/view/new.tpl');
}
开发者ID:ramant15,项目名称:ektimo,代码行数:15,代码来源:new.php

示例2: updateEvent

function updateEvent()
{
    global $error;
    $arr_submit = array(array('color', 'string', false, ''), array('date_end', 'int', true, ''), array('date_start', 'int', true, ''), array('str_date_end', 'string', false, ''), array('str_date_start', 'string', false, ''), array('title', 'string', false, ''), array('location', 'string', false, ''), array('description', 'string', false, ''), array('phone', 'phone', false, ''), array('myurl', 'string', false, ''), array('cal_type', 'textonly', false, ''), array('allDay', 'bool', false, ''), array('repair_pattern', 'bool', false, ''), array('event_id', 'int', true, ''), array('rep_event_id', 'int', false, ''), array('cal_id', 'int', false, ''), array('calendar_id', 'int', false, -1), array('interval', 'string', false, ''), array('weekdays', 'string', false, ''), array('monthday', 'textonly', false, ''), array('yearmonthday', 'int', false, ''), array('yearmonth', 'int', false, ''));
    $frm_submitted = validate_var($arr_submit);
    if (empty($error)) {
        $frm_submitted['title'] = stripslashes($frm_submitted['title']);
        $frm_submitted['location'] = stripslashes($frm_submitted['location']);
        $frm_submitted['description'] = stripslashes($frm_submitted['description']);
        if (!empty($frm_submitted['time_end'])) {
            $frm_submitted['date_end'] = strtotime(date('Y-m-d', $frm_submitted['date_end']) . ' ' . $frm_submitted['time_end']);
        } else {
            if (!IGNORE_TIMEZONE) {
                $frm_submitted['date_end'] -= TIME_OFFSET;
            }
        }
        if (!empty($frm_submitted['time_start'])) {
            $frm_submitted['date_start'] = strtotime(date('Y-m-d', $frm_submitted['date_start']) . ' ' . $frm_submitted['time_start']);
        } else {
            if (!IGNORE_TIMEZONE) {
                $frm_submitted['date_start'] -= TIME_OFFSET;
            }
        }
        // check if repeating event
        // existing repeating event
        if ($frm_submitted['date_start'] !== $frm_submitted['date_end'] && isset($frm_submitted['interval']) && ($frm_submitted['interval'] == 'W' || $frm_submitted['interval'] == '2W' || $frm_submitted['interval'] == 'M' || $frm_submitted['interval'] == 'Y')) {
            if ($frm_submitted['rep_event_id'] > 0) {
                $arr_days = Utils::getDaysInPattern($frm_submitted);
                $arr_event = Events::updateRepeatingEvent($arr_days, $frm_submitted);
                echo json_encode(array('success' => true));
                exit;
            } else {
                // normal event changed to repeating pattern
                $arr_days = Utils::getDaysInPattern($frm_submitted);
                $arr_event = Events::insertRepeatingEvent($arr_days, $frm_submitted);
                if ($frm_submitted['event_id'] > 0) {
                    // delete old normal event
                    $bln_deleted = Events::deleteEvent(array('event_id' => $frm_submitted['event_id'], 'rep_event_id' => 0));
                }
                echo json_encode(array('success' => true));
                exit;
            }
        } else {
            if ($frm_submitted['rep_event_id'] > 0) {
                // this event changed from repeating event to an normal day event
                $bln_deleted = Events::deleteEvent(array('event_id' => $frm_submitted['event_id'], 'rep_event_id' => $frm_submitted['rep_event_id'], 'delete_all' => true));
                //					// delete repeating_event
                //					Events::deleteRepeatingEvent($frm_submitted['rep_event_id']);
                //
                //					// delete events with this rep_event_id
                //
                //
                // insert new daily event
                $frm_submitted['repeating_event_id'] = 0;
                $frm_submitted['rep_event_id'] = 0;
                $arr_event = Events::insertEvent($frm_submitted);
                $arr_event['remove_old_event'] = true;
                echo json_encode(array('success' => true, 'event' => $arr_event));
                exit;
                //
                //					//Events::setEventToNotRepeating($frm_submitted['rep_event_id']);
            } else {
                $arr_event = Events::updateEvent($frm_submitted);
                echo json_encode(array('success' => true, 'event' => $arr_event));
                exit;
            }
        }
        //
        //		if($frm_submitted['interval'] == 'W') {
        //			// weekday
        //
        //			$arr_days = Utils::getDaysInPattern($frm_submitted);
        //			$arr_event = Events::updateRepeatingEvent($arr_days, $frm_submitted);
        //
        //			echo json_encode(array('success'=>true));exit;
        //		}
        //		else {
        //			$arr_days = Utils::getDaysInPattern($frm_submitted);
        //			$arr_event = Events::insertRepeatingEvent($arr_days, $frm_submitted);
        //			//$arr_event = Events::updateEvent($frm_submitted);
        //			echo json_encode(array('success'=>true, 'event'=>$arr_event	));exit;
        //		}
    } else {
        echo json_encode(array('success' => false, 'error' => $error));
        exit;
    }
    echo json_encode(array('success' => false));
    exit;
}
开发者ID:ramant15,项目名称:ektimo,代码行数:89,代码来源:cal_events.php

示例3: updateEvent

function updateEvent()
{
    global $error;
    $arr_submit = array(array('date_end', 'int', false, ''), array('date_start', 'int', false, ''), array('title', 'string', false, ''), array('video_url', 'string', false, ''), array('category', 'string', false, ''), array('genre', 'string', false, ''), array('instructor_link', 'string', false, ''), array('spots', 'string', false, ''), array('size', 'string', false, ''), array('img_url', 'string', false, ''), array('class_time', 'string', false, ''), array('rank', 'string', false, ''), array('instructor', 'string', false, ''), array('description', 'string', false, ''), array('interval', 'string', false, ''), array('weekdays', 'string', false, ''));
    $frm_submitted = validate_var($arr_submit);
    //print_r($frm_submitted);
    if (empty($error)) {
        if (!empty($frm_submitted['time_end'])) {
            $frm_submitted['date_end'] = strtotime(date('Y-m-d', $frm_submitted['date_end']) . ' ' . $frm_submitted['time_end']);
        } else {
            $frm_submitted['date_end'] -= TIME_OFFSET;
        }
        if (!empty($frm_submitted['time_start'])) {
            $frm_submitted['date_start'] = strtotime(date('Y-m-d', $frm_submitted['date_start']) . ' ' . $frm_submitted['time_start']);
        } else {
            $frm_submitted['date_start'] -= TIME_OFFSET;
        }
        // check if repeating event
        // existing repeating event
        if ($frm_submitted['date_start'] !== $frm_submitted['date_end'] && isset($frm_submitted['interval']) && ($frm_submitted['interval'] == 'W' || $frm_submitted['interval'] == '2W' || $frm_submitted['interval'] == 'M' || $frm_submitted['interval'] == 'Y')) {
            if ($frm_submitted['rep_event_id'] > 0) {
                $arr_days = Utils::getDaysInPattern($frm_submitted);
                return $arr_days;
                exit;
                $arr_event = Events::updateRepeatingEvent($arr_days, $frm_submitted);
                echo json_encode(array('success' => true));
                exit;
            } else {
                // normal event changed to repeating pattern
                $arr_days = Utils::getDaysInPattern($frm_submitted);
                $arr_event = Events::insertRepeatingEvent($arr_days, $frm_submitted);
                if ($frm_submitted['event_id'] > 0) {
                    // delete old normal event
                    $bln_deleted = Events::deleteEvent(array('event_id' => $frm_submitted['event_id'], 'rep_event_id' => 0));
                }
                echo json_encode(array('success' => true));
                exit;
            }
        } else {
            if ($frm_submitted['rep_event_id'] > 0) {
                // this event changed from repeating event to an normal day event
                $bln_deleted = Events::deleteEvent(array('event_id' => $frm_submitted['event_id'], 'rep_event_id' => $frm_submitted['rep_event_id'], 'delete_all' => true));
                //					// delete repeating_event
                //					Events::deleteRepeatingEvent($frm_submitted['rep_event_id']);
                //
                //					// delete events with this rep_event_id
                //
                //
                // insert new daily event
                $frm_submitted['repeating_event_id'] = 0;
                $frm_submitted['rep_event_id'] = 0;
                $arr_event = Events::insertEvent($frm_submitted);
                $arr_event['remove_old_event'] = true;
                echo json_encode(array('success' => true, 'event' => $arr_event));
                exit;
                //
                //					//Events::setEventToNotRepeating($frm_submitted['rep_event_id']);
            } else {
                $arr_event = Events::updateEvent($frm_submitted);
                echo json_encode(array('success' => true, 'event' => $arr_event));
                exit;
            }
        }
        //
        //		if($frm_submitted['interval'] == 'W') {
        //			// weekday
        //
        //			$arr_days = Utils::getDaysInPattern($frm_submitted);
        //			$arr_event = Events::updateRepeatingEvent($arr_days, $frm_submitted);
        //
        //			echo json_encode(array('success'=>true));exit;
        //		}
        //		else {
        //			$arr_days = Utils::getDaysInPattern($frm_submitted);
        //			$arr_event = Events::insertRepeatingEvent($arr_days, $frm_submitted);
        //			//$arr_event = Events::updateEvent($frm_submitted);
        //			echo json_encode(array('success'=>true, 'event'=>$arr_event	));exit;
        //		}
    } else {
        echo json_encode(array('success' => false, 'error' => $error));
        exit;
    }
    echo json_encode(array('success' => false));
    exit;
}
开发者ID:GroupXTech,项目名称:GroupX-Dev,代码行数:85,代码来源:cal_events.php


注:本文中的Events::insertEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。