function render() { $condition['live'] = ANNOUNCE_LIVE; //live announcements having status = '1' $param = array(); $this->announcement = Announcement::load_announcements_array($param, $condition); $this->inner_HTML = $this->generate_inner_html($this->announcement); $announcement = parent::render(); return $announcement; }
} } if (empty($error_msg)) { try { $announcement->save(); } catch (PAException $e) { $error_msg = $e->message; } } } } else { if ($_REQUEST['aid']) { $aid = $_REQUEST['aid']; if ($aid) { $condition = array('content_id' => (int) $aid); $announce = Announcement::load_announcements_array($params = NULL, $condition); $form_data['title'] = $announce[0]['title']; $form_data['body'] = $announce[0]['body']; $form_data['announcement_time'] = $announce[0]['announcement_time']; $form_data['position'] = $announce[0]['position']; } } //if announcement is submitted and $error is false yet if ($_POST['PublishNow'] && !$error) { filter_all_post($_POST); //validate posted values $value_to_validate = array('title' => 'Title', 'body' => 'Body'); foreach ($value_to_validate as $key => $value) { $_POST[$key] = trim($_POST[$key]); if (empty($_POST[$key])) { $error_msg .= $value . ' can not be empty<br>';