/** * Creates a link to CB profile * * @param int $id - user id * * @return string - link to profile */ public static function getLink($id) { $itemId = ''; if (CompojoomComponentHelper::getItemid('com_comprofiler')) { $itemId = '&Itemid=' . CompojoomComponentHelper::getItemid('com_comprofiler'); } $link = JRoute::_('index.php?option=com_comprofiler&task=userProfile&user=' . $id . $itemId); return $link; }
/** * Update the value for jed * 1 = don't remind me again * 2 = remind me in a week * * @throws Exception * * @return void */ public function update() { $config = JComponentHelper::getParams($this->component); $jed = JFactory::getApplication()->input->getInt('jed', 1); // The user wants a reminder if ($jed === 2) { $jed = JFactory::getDate()->toSql(); } $config->set('jed', $jed); // Store the updated config CompojoomComponentHelper::updateConfiguration($this->component, $config); $this->setRedirect('index.php?option=' . $this->component); }
/** * Method to get the field options. * * @return array The field option objects. */ protected function getOptions() { jimport('joomla.filesystem.folder'); $options = array('0' => JText::_('LIB_COMPOJOOM_NONE')); $components = JFolder::files(JPATH_LIBRARIES . '/compojoom/avatars/avatars'); $isPro = (int) $this->element['isPro']; foreach ($components as $component) { $disabled = true; $component = str_replace('.php', '', $component); // Disable this option if the component is not installed, or if we are not in a PRO extension if (CompojoomComponentHelper::isInstalled('com_' . $component) && $isPro) { $disabled = false; } $options[] = Jhtml::_('select.option', $component, JText::_('LIB_COMPOJOOM_COM_' . strtoupper($component)), 'value', 'text', $disabled); } return $options; }
/** * Do we need to update the statistics on this site? * * @return bool */ public function needsUpdate() { $config = JComponentHelper::getParams($this->extension); // Has the user enabled stat reports? if ($config->get('update_stats', 1)) { // When was the last time we've send a report? $customData = CompojoomComponentHelper::getComponentCustomData($this->extension); $reportSent = $customData->get('update_report_sent', ''); // We haven't set anything, then we need to update if ($reportSent == '') { return true; } // We have a date? $now = JFactory::getDate(); $reportSentDate = JFactory::getDate($reportSent); $diff = $now->diff($reportSentDate); if ($diff->days > 7) { return true; } } return false; }