コード例 #1
0
 /**
  * Populate __sleep values, restore serialize values specified on __sleep() method
  *
  * @return self
  */
 public function populateWithItself(self $formulary)
 {
     $this->_name = $formulary->getName();
     $this->_isActive = $formulary->isActive();
     $this->_isDefault = $formulary->isDefault();
     return $this;
 }
コード例 #2
0
 public function processDownloadCsvAction()
 {
     $name = preg_replace('/[^a-zA-Z]+/', '', $this->_getParam('name', ''));
     $formularyItem = new FormularyItem($name);
     $rows = array();
     $header = array('Drug Name', 'NDC', 'Directions', 'Comments', 'Schedule', 'Label ID', 'External URL', 'Price', 'Qty', 'Qualifier', 'Keywords', 'DEA Schedule', 'Print', 'Description', 'Dose', 'Route', 'PRN', 'Refills', 'Days Supply', 'Substitution');
     $rows[] = implode(',', $header);
     foreach ($formularyItem->getAllRows() as $row) {
         $tmp = array();
         $drug = $row['fda_drugname'] . ' - ' . $row['dose'] . ' - ' . $row['strength'] . ' - ' . $row['rxnorm'] . ' - ' . $row['tradename'];
         $tmp[] = $drug;
         $tmp[] = $row['fullNDC'];
         $tmp[] = $row['directions'];
         $tmp[] = $row['comments'];
         $tmp[] = $row['schedule'];
         $tmp[] = $row['labelId'];
         $tmp[] = $row['externalUrl'];
         $tmp[] = $row['price'];
         $tmp[] = $row['qty'];
         $tmp[] = $row['quantityQualifier'];
         $tmp[] = $row['keywords'];
         $tmp[] = $row['deaSchedule'];
         $tmp[] = $row['print'];
         $tmp[] = $row['description'];
         $tmp[] = $row['dose'];
         $tmp[] = $row['route'];
         $tmp[] = $row['prn'];
         $tmp[] = $row['refills'];
         $tmp[] = $row['daysSupply'];
         $tmp[] = $row['substitution'];
         $rows[] = implode(',', $this->_sanitizeCSV($tmp));
     }
     $data = implode("\n", $rows);
     header('Content-type: application/octet-stream');
     header('Content-Disposition: attachment; filename="formularies.csv"');
     $this->view->data = $data;
 }