Example #1
0
 public function __construct($announcement_id = 0, $get_list = false)
 {
     parent::__construct('announcement', $announcement_id);
     if ($get_list === false && $announcement_id) {
         $this->sponsor_ids = $this->get_sponsor_ids();
         $sponsors = array();
         if (!empty($this->sponsor_ids)) {
             foreach ($this->sponsor_ids as $id) {
                 $sponsors[] = new Sponsor($id);
             }
         }
         $this->sponsors = Announcement::get_sponsor_data($sponsors);
         list($category_id, $category_name) = Category::announcement_get_category($this->id());
         $this->category = array('id' => $category_id, 'name' => $category_name);
         $this->status = new Status($this->status_id());
         $this->office = new Office($this->sponsor_id());
         $this->date_beginning_parts = get_date_parts($this->date_beginning());
         $this->date_ending_parts = get_date_parts($this->date_ending());
         $this->calendared_parts = get_date_parts($this->calendared());
         $this->vote_parts = get_date_parts($this->vote());
         $this->_get_public_opinion();
         $this->comment_data = $this->get_comment_data();
     }
 }