Пример #1
0
$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');
    if (!empty($sponsor_ids)) {
        $announcement->associate_sponsors($sponsor_ids);
    }
    // finally, tags
Пример #2
0
require_once DOC_ROOT . '/includes/classes/class.legislation.php';
$region_id = 65517;
$region_type = REGION_CITY;
$id = get_param('id');
$legislation = new Legislation($id);
if (!empty($_POST)) {
    $legislation->region_id($region_id);
    $legislation->region_type($region_type);
    $legislation->title(get_param('title'));
    $legislation->status(get_param('status'));
    $legislation->recommended_action(get_param('recommended_action'));
    $legislation->summary(get_param('summary'));
    $legislation->discussion(get_param('discussion'));
    $legislation->question(get_param('question'));
    $date_introduced = set_date_parts(get_param('intro_month'), get_param('intro_day'), get_param('intro_year'));
    $date_heard = set_date_parts(get_param('heard_month'), get_param('heard_day'), get_param('heard_year'));
    $legislation->date_introduced($date_introduced);
    $legislation->date_heard($date_heard);
    if ($id) {
        $legislation->update();
    } else {
        $id = $legislation->insert();
    }
    // sponsor IDs next
    $sponsor_ids = get_param('sponsor_ids');
    if (!empty($sponsor_ids)) {
        $legislation->associate_sponsors($sponsor_ids);
    }
    // tags next
    $tag_list = get_param('tag_list');
    $tags = explode('|', $tag_list);