Example #1
0
 function add()
 {
     $data = filter_forwarded_data($this);
     logout_invalid_user($this);
     # user has posted the new bid information
     if (!empty($_POST)) {
         # Upload the file before you proceed with the rest of the process
         $fileUrls = upload_many_files($_FILES, 'document__fileurl', 'document_', 'pdf,doc,docx');
         $_POST['documents'] = !empty($fileUrls) ? $fileUrls : array();
         $result = $this->_bid->add($_POST);
         if (!$result['boolean']) {
             echo "ERROR: The bid could not be added. " . $result['reason'];
         }
     } else {
         # if the tender notice id is provided
         if (!empty($data['t'])) {
             $this->load->model('_tender');
             $data['tender'] = $this->_tender->details($data['t']);
         }
         if (!empty($data['d'])) {
             $data['bid'] = $this->_bid->details(array('bid_id' => $data['d']));
         } else {
             if (!empty($data['t'])) {
                 $data['bid'] = $this->_bid->details(array('tender_id' => $data['t']));
             }
         }
         $this->load->view('bids/new_bid', $data);
     }
 }
Example #2
0
 function add()
 {
     $data = filter_forwarded_data($this);
     logout_invalid_user($this);
     # use has posted the contract form
     if (!empty($_POST)) {
         # Upload the file before you proceed with the rest of the process
         $fileUrls = upload_many_files($_FILES, 'document__fileurl', 'document_', 'pdf,doc,docx');
         if (!empty($fileUrls)) {
             $_POST['documents'] = $fileUrls;
             $result = $this->_contract->add($_POST);
         } else {
             $result = array('boolean' => FALSE, 'reason' => 'Files could not be uploaded.');
         }
         if (!$result['boolean']) {
             echo "ERROR: The contract could not be added. " . $result['reason'];
         }
     } else {
         $this->load->model('_bid');
         $data['award'] = $this->_bid->details(array('bid_id' => $data['t']));
         $this->load->view('contracts/new_contract', $data);
     }
 }