Example #1
0
 function edit($tpl = null)
 {
     $document =& JFactory::getDocument();
     include JEV_ADMINLIBS . "/editStrings.php";
     $document->addScriptDeclaration($editStrings);
     // WHY THE HELL DO THEY BREAK PUBLIC FUNCTIONS !!!
     if (JVersion::isCompatible("1.6.0")) {
         JEVHelper::stylesheet('eventsadmin16.css', 'administrator/components/' . JEV_COM_COMPONENT . '/assets/css/');
     } else {
         JEVHelper::stylesheet('eventsadmin.css', 'administrator/components/' . JEV_COM_COMPONENT . '/assets/css/');
     }
     JEVHelper::script('editical.js', 'administrator/components/' . JEV_COM_COMPONENT . '/assets/js/');
     JEVHelper::script('view_detail.js', 'components/' . JEV_COM_COMPONENT . '/assets/js/');
     $document->setTitle(JText::_('EDIT_ICAL_REPEAT'));
     // Set toolbar items for the page
     JToolBarHelper::title(JText::_('EDIT_ICAL_REPEAT'), 'jevents');
     //JToolBarHelper::save('icalrepeat.save');
     //$this->addSaveToolBarButton();
     $submitbutton = JVersion::isCompatible("1.6.0") ? "Joomla.submitbutton" : "submitbutton";
     $toolbar =& JToolBar::getInstance('toolbar');
     $html = '<a class="toolbar" onclick="javascript: ' . $submitbutton . '(\'icalrepeat.save\');return false;" href="#"><span class="icon-32-save" title="Save"> </span>' . JText::_('SAVE') . '</a>';
     $toolbar->appendButton('Custom', $html, "customsave");
     $html = '<a class="toolbar" onclick="javascript: ' . $submitbutton . '(\'icalrepeat.apply\');return false;" href="#"><span class="icon-32-apply" title="Save"> </span>' . JText::_('JEV_APPLY') . '</a>';
     $toolbar->appendButton('Custom', $html, "customapply");
     $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     if ($params->get("editpopup", 0)) {
         $document->addStyleDeclaration("div#toolbar-box{margin:10px 10px 0px 10px;} div#jevents {margin:0px 10px 10px 10px;} ");
         JToolBarHelper::custom("icalevent.close", 'cancel', 'cancel', 'Cancel', false);
         JRequest::setVar('tmpl', 'component');
         //force the component template
     } else {
         $this->addCancelToolBarButton();
     }
     //JToolBarHelper::help( 'screen.icalrepeat.edit', true);
     $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     JHTML::_('behavior.tooltip');
     $this->_adminStart();
     parent::displaytemplate($tpl);
     $this->_adminEnd();
 }
 function rss($tpl = null)
 {
     $modid = intval(JRequest::getVar('modid', 0));
     if ($modid < 0) {
         $modid = 0;
     }
     $cfg =& JEVConfig::getInstance();
     $db =& JFactory::getDBO();
     // setup for all required function and classes
     $file = JPATH_SITE . '/components/com_jevents/mod.defines.php';
     include_once $file;
     // load language constants
     JEVHelper::loadLanguage('modlatest');
     // Check document type
     $doc =& JFactory::getDocument();
     if ($doc->getType() != 'feed') {
         JError::raiseError('E999', 'Fatal error, document type: "' . $doc->getType() . '" not supported.');
     }
     if ($modid > 0) {
         $user = JFactory::getUser();
         $query = "SELECT id, params" . "\n FROM #__modules AS m" . "\n WHERE m.published = 1" . "\n AND m.id = " . $modid . "\n AND m.access  " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user, 'string') . ')' : ' <=  ' . JEVHelper::getAid($user)) . "\n AND m.client_id != 1";
         $db =& JFactory::getDBO();
         $db->setQuery($query);
         $modules = $db->loadObjectList();
         if (count($modules) <= 0) {
             // fake module parameter
             $params = new JParameter('');
         } else {
             $params = new JParameter($modules[0]->params);
         }
     } else {
         $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     }
     // parameter intialization
     $info['link'] = str_replace('&', '&amp;', JURI::root(true));
     $info['imagelink'] = str_replace('&', '&amp;', JURI::root());
     $info['base'] = str_replace('&', '&amp;', JURI::root());
     $info['cache'] = $cfg->get('com_rss_cache', 1);
     $info['cache_time'] = $cfg->get('com_rss_cache_time', 3600);
     $info['count'] = $cfg->get('com_rss_count', 5);
     $info['title'] = $cfg->get('com_rss_title', 'Powered by JEvents!');
     $info['description'] = $cfg->get('com_rss_description', 'JEvents Syndication for Joomla');
     // get rss title from module param if requested and defined
     $t_title = $params->get('modlatest_rss_title', null);
     if ($params->get('modlatest_useLocalParam', 0) == 1 && !empty($t_title)) {
         $info['title'] = $t_title;
     }
     // get rss description from module param if requested and defined
     $t_description = $params->get('modlatest_rss_description', null);
     if ($params->get('modlatest_useLocalParam', 0) == 1 && !empty($t_description)) {
         $info['description'] = $t_description;
     }
     $info['image_url'] = htmlspecialchars($cfg->get('com_rss_logo', JURI::root() . 'administrator/components/' . JEV_COM_COMPONENT . '/assets/images/logo.gif'));
     if ($info['image_url'] == "") {
         $info['image_url'] = htmlspecialchars(JURI::root() . 'administrator/components/' . JEV_COM_COMPONENT . '/assets/images/logo.gif');
     }
     $info['image_alt'] = $info['title'];
     $info['limit_text'] = $cfg->get('com_rss_limit_text', 1);
     $info['text_length'] = $cfg->get('com_rss_text_length', 20);
     // include the appropraite VIEW - this should be based on config and/or URL?
     $cfg =& JEVConfig::getInstance();
     $theme = JEV_CommonFunctions::getJEventsViewName();
     $viewclass = ucfirst($theme) . "ModLatestView";
     jimport('joomla.application.module.helper');
     require_once JModuleHelper::getLayoutPath('mod_jevents_latest', $theme . DS . "latest");
     $jeventCalObject = new $viewclass($params, $modid);
     $jeventCalObject->getLatestEventsData($info["count"]);
     $this->set("eventsByRelDay", $jeventCalObject->eventsByRelDay);
     $this->set("info", $info);
     $this->set("modparams", $params);
     $this->set("jeventCalObject", $jeventCalObject);
     parent::displaytemplate($tpl);
 }