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


PHP EM_Event::delete方法代码示例

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


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

示例1: updateEvent

function updateEvent($data)
{
    $em_event = em_get_event(getPostIdByMetaValue('_ss_id', $data['id']), 'post_id');
    $check = true;
    if (isset($data['command']) && $data['command'] == 'UPDATE') {
        if (!$em_event->event_id) {
            $em_event = new EM_Event();
        }
        $em_event->event_start_date = $data["starttag"];
        $em_event->event_start_time = $data["startzeit"];
        $em_event->event_end_date = $data["endtag"];
        $em_event->event_end_time = $data["endzeit"];
        $em_event->start = strtotime($em_event->event_start_date . " " . $em_event->event_start_time);
        $em_event->end = strtotime($em_event->event_end_date . " " . $em_event->event_end_time);
        $em_event->location_id = isset($data["venueid"]) ? $data["venueid"] : '';
        $em_event->post_title = $data["titel"];
        $em_event->event_name = $data["titel"];
        //$em_event->body = (($data["kurzbeschreibung"]) ? $data["kurzbeschreibung"] : '');
        $em_event->post_content = isset($data["kurzbeschreibung"]) ? $data["kurzbeschreibung"] : '';
        $em_event->post_excerpt = isset($data["auszug"]) ? $data["auszug"] : '';
        $em_event->post_tags = @$data["tags"];
        // meta
        $em_event->event_attributes = array('Status' => $data['status'], 'Line Up' => $data['lineup'], 'Stil' => isset($data["stil"]) ? $data["stil"] : '', 'Preis' => $data['preis'], 'Parent' => isset($data["parentid"]) ? $data["parentid"] : '', 'Team' => $data['team'], 'Recommended' => $data['recommended'], 'Promoted' => $data['promoted'], 'Gewinnspiel' => $data['gewinnspiel'], 'Kurzbeschreibung' => $data["kurzbeschreibung"]);
        $em_event->group_id = 0;
        $em_event->event_date_modified = date('Y-m-d H:i:s', time());
        $em_event->event_all_day = $data['ganztägig'] ? 1 : 0;
        $em_event->event_rsvp = 0;
        $check = $em_event->save();
        add_post_meta($em_event->post_id, '_ss_id', $data['id']);
        // add category
        $categories = array();
        $type = new EM_Category(strtolower($data["veranstaltungstyp"]));
        if (!$type->term_id) {
            $type = new EM_Category("sonstiges");
        }
        array_push($categories, $type->term_id);
        if ($data["recommended"]) {
            array_push($categories, get_cat_ID('tipp'));
        }
        if ($data["promoted"]) {
            array_push($categories, get_cat_ID('sponsored'));
        }
        if ($data["team"]) {
            array_push($categories, get_cat_ID('team'));
        }
        if ($data["veranstaltungstyp"]) {
            array_push($categories, get_cat_ID(strtolower($data["veranstaltungstyp"])));
        }
        if ($data["gewinnspiel"]) {
            array_push($categories, get_cat_ID('gewinnspiel'));
        }
        if ($data["preis"] != '' && $data["preis"] == 0) {
            array_push($categories, get_cat_ID('kostenlos'));
        }
        if (count($categories)) {
            wp_set_post_terms($em_event->post_id, $categories, 'event-categories', false);
        }
        // add tags
        $tags = array();
        if ($data["tags"]) {
            array_push($tags, $data["tags"]);
        }
        //if($data["ausverkauft"]) 	array_push($tags, "ausverkauft");
        if ($data["openair"]) {
            array_push($tags, "open air");
        }
        if ($data['lineup']) {
            $tags = array_merge($tags, explode(',', $data['lineup']));
        }
        if ($data['tags']) {
            $tags = array_merge($tags, explode(',', $data['tags']));
        }
        if (count($tags)) {
            wp_set_post_terms($em_event->post_id, $tags, 'event-tags', false);
        }
    } elseif (isset($data['command']) && $data['command'] == 'DELETE') {
        if ($em_event->event_id) {
            $check = $em_event->delete(true);
        }
    }
    return $check;
}
开发者ID:NicoKnoll,项目名称:BLNFMCalSync,代码行数:82,代码来源:blnfmcalsync.php


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