首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Elgg中保存对象

如何在Elgg中保存对象
EN

Stack Overflow用户
提问于 2015-03-26 20:13:26
回答 1查看 101关注 0票数 1

我正试图在elgg中保存一个物体,但什么也没发生。单击按钮,页面开始重新加载,好像是为了保存对象,但是什么也没有发生。该页仅重新加载。什么都不会持续。

任何帮助都将不胜感激。

Rev/start.php

代码语言:javascript
复制
$lib = elgg_get_plugins_path() . 'Rev/lib';
elgg_register_library('Rev', "$lib/Rev.php");
elgg_load_library('Rev');

$base = elgg_get_plugins_path() . 'Rev/actions';
elgg_register_action("Rev/room_reservation", "$base/room_reservation.php");

Rev/actions/room_reservation.php

代码语言:javascript
复制
<?php
/**
* Save
*/
// get the form values
$category = get_input('category');
$full_names = get_input('full_names');
$check_in_date = get_input('check_in_date');
$check_out_date = get_input('check_out_date');

$result = help_save_topic($category, $full_names, $check_in_date, $check_out_date);
if (!$result) {
    register_error(elgg_echo('Error Saving'));
} else {
    system_message(elgg_echo('Successfully Saved'));
    $user = elgg_get_logged_in_user_entity();
    forward($user->getURL());
}

Rev/lib/Rev.php

代码语言:javascript
复制
function reservation_save($category, $full_names, $check_in_date, $check_out_date) {
    $reservation = new ElggObject();
    $reservation->subtype = 'reservation';
    $reservation->category = $category;
    $reservation->full_names = $full_names;
    $reservation->check_in_date = $check_in_date;
    $reservation->check_out_date = $check_out_date;
    $reservation->save();
    if (!$guid) {
        return false;
    }
    return true;
}

Rev/views/default/forms/olive_green/room_reservation.php

代码语言:javascript
复制
<div class="olive_color" >The Occupant's Full Names</div>
<div>
    <?php echo elgg_view('input/text', array(
        'name' => 'full_names',
        'class' => 'login_input',
        ));
        ?>
    </div>
    <div class="room_category">
        <?php
        $categories = rooms_get_categories();
        echo elgg_view('input/dropdown', array(
            'name' => 'category',
            'options_values' => $categories,
            ));
            ?>
        </div>
        <div class="check_in_out">
            <input name="check_in_date" class="check_in_out_input" type="text" placeholder="Enter check in date ..." />
            <input name="check_out_date" class="check_in_out_input" type="text" placeholder="Enter check out date ..." />
        </div>
        <div> <?php echo elgg_view('input/submit', array('value' => 'Check availability', 'id' => 'login_submit')); ?> </div>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-04-24 12:58:00

help_save_topic($category,$full_names,$check_in_date,$check_out_date);

您声明您的函数名是错误的。

reservation_save($category、$full_names、$check_in_date、$check_out_date)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29287955

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档