function export() { require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'PHPExel.php'; $cids = ARequest::getCids(); $objPHPExcel->getProperties()->setCreator("Bookpro")->setLastModifiedBy("Bookpro")->setTitle($tour->code)->setSubject("Tour Document"); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', 'Code')->setCellValue('B1', 'Title')->setCellValue('C1', 'Alias')->setCellValue('D1', 'Departure Dates')->setCellValue('E1', 'Description')->setCellValue('F1', 'Packages')->setCellValue('G1', 'Misc Tax')->setCellValue('G1', 'Visa'); for ($i = 1; $i <= count($cids); $i++) { $this->_model->setId($cids[$i - 1]); $tour = $this->_model->getObject(); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A' . $i + 1, $tour->code)->setCellValue('B' . $i + 1, $tour->title)->setCellValue('C' . $i + 1, $tour->alias)->setCellValue('D' . $i + 1, $departure)->setCellValue('E' . $i + 1, $tour->desc)->setCellValue('F' . $i + 1, $package)->setCellValue('G' . $i + 1, $tour->tax_tip_fee)->setCellValue('G' . $i + 1, $tour->visa_fee); } $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL; die; }
/** * Prepare to display page. * * @param string $tpl name of used template */ function display($tpl = null) { $mainframe =& JFactory::getApplication(); /* @var $mainframe JApplication */ $document =& JFactory::getDocument(); /* @var $document JDocument */ $document->setTitle(JText::_('List of roomrates')); $model = new BookProModelRoomRateLogs(); $this->lists = array(); $this->lists['limit'] = ARequest::getUserStateFromRequest('limit', $mainframe->getCfg('list_limit'), 'int'); $this->lists['limitstart'] = ARequest::getUserStateFromRequest('limitstart', 0, 'int'); $this->lists['order'] = ARequest::getUserStateFromRequest('filter_order', 'id', 'cmd'); $this->lists['order_Dir'] = ARequest::getUserStateFromRequest('filter_order_Dir', 'DESC', 'word'); //$this->lists['hotel_id'] = ARequest::getUserStateFromRequest('hotel_id', '', 'int'); $model->init($this->lists); $this->pagination =& $model->getPagination(); $this->items =& $model->getData(); if (count($this->items) > 0) { for ($i = 0; $i < count($this->items); $i++) { $item =& $this->items[$i]; $modelRoom = new BookProModelTour(); $modelRoom->setId($item->tour_id); $room = $modelRoom->getObject(); if ($room) { $item->tour_id = $room->room_type; } $startdate = ''; if ($item->startdate != '0000-00-00 00:00:00') { $startdate = JFactory::getDate($item->startdate)->format('d F Y'); } $item->startdate = $startdate; $enddate = ''; if ($item->enddate != '0000-00-00 00:00:00') { $enddate = JFactory::getDate($item->enddate)->format('d F Y'); } $item->enddate = $enddate; } } $this->params =& JComponentHelper::getParams(OPTION); $this->selectable = JRequest::getCmd('task') == 'element'; parent::display($tpl); }
function saveorderinfo() { JRequest::checkToken() or jexit('Invalid Token'); $mainframe =& JFactory::getApplication(); $post = JRequest::get('post'); $post['id'] = ARequest::getCid(); if (!class_exists('BookProModelOrderInfo')) { AImporter::model('orderinfo'); } $modelInfo = new BookProModelOrderInfo(); $id = $modelInfo->store($post); if (!class_exists('BookProModelPackagePrice')) { AImporter::model('packageprice'); } $modelpackprice = new BookProModelPackagePrice(); $modelpackprice->setId(JRequest::getInt('price_id')); $price = $modelpackprice->getObject(); $order_id = JRequest::getVar('order_id'); $order = array('id' => $order_id, 'total' => $total); $this->_model->store($order); if ($id !== false) { $mainframe->enqueueMessage(JText::_('Successfully saved'), 'message'); } else { $mainframe->enqueueMessage(JText::_('Save failed'), 'error'); } $this->setRedirect(JURI::base() . 'index.php?option=com_bookpro&controller=order&task=detail&cid[]=' . $order_id); }