예제 #1
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/global.php';
require_once DOC_ROOT . '/includes/classes/class.user.php';
require_once DOC_ROOT . '/includes/classes/class.city.php';
require_once DOC_ROOT . '/includes/classes/class.announcement_feedback.php';
$id = get_param('id');
$announcement = new Announcement($id);
$data = array('id' => $id, 'type' => ANNOUNCEMENT_TYPE, 'title' => $announcement->title(), 'description' => $announcement->text(), 'text' => $announcement->text(), 'category' => array('id' => $announcement->category['id'], 'name' => $announcement->category['name']), 'question' => $announcement->question(), 'location' => $announcement->location(), 'image' => $announcement->get_image_src(), 'status' => $announcement->status->status(), 'calendared' => $announcement->calendared(), 'vote' => $announcement->vote(), 'support' => $announcement->get_support(), 'oppose' => $announcement->get_oppose(), 'days_remaining' => $announcement->days_remaining(), 'sponsors' => $announcement->sponsors, 'comment_data' => $announcement->comment_data, 'user_feedback' => $announcement->feedback_submitted($user_id));
return_jsonp_data($data);
예제 #2
0
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/global.php';
require_once DOC_ROOT . '/includes/classes/class.html.php';
require_once DOC_ROOT . '/includes/classes/class.announcement.php';
require_once DOC_ROOT . '/includes/classes/class.office.php';
$region_id = 65517;
$region_type = REGION_CITY;
$id = get_param('id');
$announcement = new Announcement($id);
if (!empty($_POST)) {
    $announcement->region_id($region_id);
    $announcement->region_type($region_type);
    $announcement->title(get_param('title'));
    $announcement->description(get_param('description'));
    $announcement->text(get_param('text'));
    $announcement->question(get_param('question'));
    $announcement->location(get_param('location'));
    $date_beginning = set_date_parts(get_param('begin_month'), get_param('begin_day'), get_param('begin_year'));
    $date_ending = set_date_parts(get_param('end_month'), get_param('end_day'), get_param('end_year'));
    $calendared = set_date_parts(get_param('calendared_month'), get_param('calendared_day'), get_param('calendared_year'));
    $vote = set_date_parts(get_param('vote_month'), get_param('vote_day'), get_param('vote_year'));
    $announcement->date_beginning($date_beginning);
    $announcement->date_ending($date_ending);
    $announcement->calendared($calendared);
    $announcement->vote($vote);
    if ($id) {
        $announcement->update();
    } else {
        $id = $announcement->insert();
    }
    // sponsor IDs next
    $sponsor_ids = get_param('sponsor_ids');