コード例 #1
0
ファイル: view.html.php プロジェクト: rdeutz/babioon-event
 /**
  * default class construtor
  *
  * @param   array  $config  Configuration array
  */
 public function __construct($config = array())
 {
     parent::__construct($config);
     if (BabioonEventHelper::isVersion3()) {
         // Joomla! 3.x
         $renderer = new FOFRenderJoomla3();
     } else {
         // Joomla! 2.5
         $renderer = new FOFRenderJoomla();
     }
     $this->setRenderer($renderer);
 }
コード例 #2
0
ファイル: babioonevent.php プロジェクト: rdeutz/babioon-event
// Access check.
$user = JFactory::getUser();
$comp = 'com_babioonevent';
// START: Akeeba Live Update
$view = JFactory::getApplication()->input->get('view', 'cpanels');
// Load files if needed
if ($view == 'liveupdate' || $view == 'cpanels') {
    if (file_exists(JPATH_COMPONENT . '/liveupdate/liveupdate.php')) {
        require_once JPATH_COMPONENT . '/liveupdate/liveupdate.php';
    } else {
        return JError::raiseWarning(404, JText::_(strtoupper($comp) . '_COULD_NOT_LOAD_LIVEUPDATE_FILES'));
    }
}
if ($view == 'liveupdate') {
    if (JFactory::getUser()->authorise('core.admin', $comp)) {
        LiveUpdate::handleRequest();
        return;
    } else {
        return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
    }
}
// END: Akeeba Live Update
$doc = JFactory::getDocument();
if (BabioonEventHelper::isVersion3()) {
    // Add css
    $doc->addStyleSheet(JURI::base(true) . '/../media/babioon/css/3x.css');
} else {
    $doc->addStyleSheet(JURI::base(true) . '/../media/babioon/css/2x.css');
}
FOFDispatcher::getTmpInstance('com_babioonevent')->dispatch();
/** EOF **/
コード例 #3
0
ファイル: events.php プロジェクト: rdeutz/babioon-event
 /**
  * create the export files and returns the filenames
  *
  * @return array filenames
  */
 public function getExportFile()
 {
     $params = JComponentHelper::getParams('com_babioonevent');
     $exportfiles = $params->get('exportfiles', 1);
     if ($exportfiles == 0) {
         // Do nothing but return the correct valuetype
         return array('', '');
     }
     $filename = false;
     $filename2 = false;
     $this->getExportData();
     $cr = count($this->data);
     if ($cr != 0) {
         // Rel dir to siteroot
         $exportdir = $params->get('exportdir');
         $glue = $params->get('exportglue', ';');
         $quote = $params->get('exportquote', 0);
         $codepage = $params->get('export_codepage', 1);
         switch ($codepage) {
             default:
             case "1":
                 $codepage = 'CP1252';
                 break;
             case "2":
                 $codepage = 'ISO-8859-1';
                 break;
             case "3":
                 $codepage = 'UTF-8';
                 break;
         }
         $adir = JPATH_ROOT . '/' . $exportdir;
         if ($exportfiles == 1 || $exportfiles == 3) {
             $filename = BabioonEventHelper::getFilename($adir, 'export', 'csv');
         }
         if ($filename !== false) {
             $result_fields = array_keys($this->data[0]);
             $head_fields = array_slice($result_fields, 3);
             $headline = '';
             foreach ($head_fields as $e) {
                 $nr[] = JText::_('COM_BABIOONEVENT_EXPORTHEAD_' . strtoupper($e));
             }
             if ($quote == 1) {
                 $headline = '"' . implode('"' . $glue . '"', $nr) . '"' . "\n";
             } else {
                 $headline = implode($glue, $nr) . "\n";
             }
             // Format fields
             for ($i = 0; $i < $cr; $i++) {
                 $r = $this->data[$i];
                 if ($r['showemail'] == 0 && in_array('email', $head_fields)) {
                     $r['email'] = '';
                 }
                 if (in_array('start', $head_fields)) {
                     if ($r['stimeset'] == 1) {
                         $r['start'] = date($params->get('sformat', 'd.m.Y H:i'), strtotime($r['start']));
                     } else {
                         $r['start'] = date($params->get('sformat', 'd.m.Y'), strtotime($r['start']));
                     }
                 }
                 if (in_array('end', $head_fields)) {
                     if ($r['etimeset'] == 1) {
                         $r['end'] = date($params->get('sformat', 'd.m.Y H:i'), strtotime($r['end']));
                     } else {
                         if ($r['end'] == '0000-00-00') {
                             $r['end'] = '';
                         } else {
                             $r['end'] = date($params->get('sformat', 'd.m.Y'), strtotime($r['end']));
                         }
                     }
                 }
                 if (in_array('isfreeofcharge', $head_fields)) {
                     $r['isfreeofcharge'] = $r['isfreeofcharge'] ? JText::_('JYES') : JText::_('JNO');
                 }
                 if (in_array('address', $head_fields)) {
                     $r['address'] = BabioonEventHelper::html2txt($r['address']);
                 }
                 if (in_array('teaser', $head_fields)) {
                     $r['teaser'] = BabioonEventHelper::html2txt($r['teaser']);
                 }
                 if (in_array('text', $head_fields)) {
                     $r['text'] = BabioonEventHelper::html2txt($r['text']);
                 }
                 unset($r['stimeset']);
                 unset($r['etimeset']);
                 unset($r['showemail']);
                 foreach (array_keys($r) as $e) {
                     if ($quote == 1) {
                         $r[$e] = '"' . str_replace('"', "'", $r[$e]) . '"';
                     } else {
                         // Replace all GLUE in text
                         $r[$e] = str_replace($glue, ' ', $r[$e]);
                     }
                 }
                 $this->data[$i] = $r;
             }
             $handle = fopen(JPATH_ROOT . '/' . $exportdir . '/' . $filename, 'w+');
             fwrite($handle, $headline);
             for ($i = 0; $i < $cr; $i++) {
                 $r = $this->data[$i];
                 $line = implode($glue, $r);
                 $line .= "\n";
                 if ($codepage != 'UTF-8') {
                     $line = iconv("UTF-8", $codepage, $line);
                 }
                 fputs($handle, $line);
             }
             fclose($handle);
             $filename = $exportdir . '/' . $filename;
             if (DIRECTORY_SEPARATOR != '/') {
                 $filename = str_replace('\\', '/', $filename);
             }
             $result[] = $filename;
         } else {
             $result[] = '';
         }
         $txt = $exportfiles == 2 || $exportfiles == 3;
         if ($txt) {
             $filename2 = BabioonEventHelper::getFilename($adir, 'export', 'txt');
         }
         if ($filename2 !== false) {
             $txt = array();
             // Format fields
             for ($i = 0; $i < $cr; $i++) {
                 $r = $this->data[$i];
                 $text = '';
                 if (in_array('start', $head_fields)) {
                     $text .= trim($r['start'], '"');
                 }
                 if (in_array('end', $head_fields) && trim($r['end'], '"') != '') {
                     $text .= ' - ' . trim($r['end'], '"');
                 }
                 $text .= "\n";
                 $text .= trim($r['name'], '"');
                 $text .= "\n";
                 if (in_array('address', $head_fields)) {
                     $text .= trim(BabioonEventHelper::html2txt($r['address']), '"');
                     $text .= "\n";
                 }
                 if (in_array('organiser', $head_fields)) {
                     $text .= trim(BabioonEventHelper::html2txt($r['organiser']), '"');
                     $text .= "\n";
                 }
                 $txt[] = $text;
             }
             $handle = fopen(JPATH_ROOT . '/' . $exportdir . '/' . $filename2, 'w+');
             for ($i = 0; $i < $cr; $i++) {
                 $line = $txt[$i] . "\n";
                 if ($codepage != 'UTF-8') {
                     $line = iconv("UTF-8", $codepage, $line);
                 }
                 fputs($handle, $line);
             }
             fclose($handle);
             $filename2 = $exportdir . '/' . $filename2;
             if (DIRECTORY_SEPARATOR != '/') {
                 $filename2 = str_replace('\\', '/', $filename2);
             }
             $result[] = $filename2;
         } else {
             $result[] = '';
         }
         return $result;
     }
     return array('', '');
 }