public function display($tpl = null) { $this->option = JFactory::getApplication()->input->get('option'); $this->state = $this->get('State'); $this->form = $this->get('Form'); $this->importType = $this->state->get('import.context'); switch ($this->importType) { case 'locations': $this->legend = JText::_('COM_SOCIALCOMMUNITY_IMPORT_LOCATIONS_DATA'); $this->uploadTask = 'import.locations'; break; case 'countries': $this->legend = JText::_('COM_SOCIALCOMMUNITY_IMPORT_COUNTRIES_DATA'); $this->uploadTask = 'import.countries'; break; case 'states': $this->legend = JText::_('COM_SOCIALCOMMUNITY_IMPORT_STATES_DATA'); $this->uploadTask = 'import.states'; break; default: // Currencies $this->legend = JText::_('COM_SOCIALCOMMUNITY_IMPORT_CURRENCY_DATA'); $this->uploadTask = 'import.currencies'; break; } // Add submenu SocialCommunityHelper::addSubmenu($this->importType); // Prepare actions $this->addToolbar(); $this->setDocument(); parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { $this->state = $this->get('State'); $this->form = $this->get('Form'); $this->importType = $this->state->get("import.context"); switch ($this->importType) { case "locations": $this->legend = JText::_("COM_SOCIALCOMMUNITY_IMPORT_LOCATIONS_DATA"); $this->uploadTask = "import.locations"; break; case "countries": $this->legend = JText::_("COM_SOCIALCOMMUNITY_IMPORT_COUNTRIES_DATA"); $this->uploadTask = "import.countries"; break; case "states": $this->legend = JText::_("COM_SOCIALCOMMUNITY_IMPORT_STATES_DATA"); $this->uploadTask = "import.states"; break; default: // Currencies $this->legend = JText::_("COM_SOCIALCOMMUNITY_IMPORT_CURRENCY_DATA"); $this->uploadTask = "import.currencies"; break; } // Add submenu SocialCommunityHelper::addSubmenu($this->importType); // Prepare actions $this->addToolbar(); $this->setDocument(); parent::display($tpl); }
/** * Add a menu on the sidebar of page */ protected function addSidebar() { // Add submenu SocialCommunityHelper::addSubmenu($this->getName()); JHtmlSidebar::setAction('index.php?option=' . $this->option . '&view=' . $this->getName()); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('archived' => false, 'trash' => false)), 'value', 'text', $this->state->get('filter.state'), true)); $this->sidebar = JHtmlSidebar::render(); }
/** * Add a menu on the sidebar of page */ protected function addSidebar() { // Add submenu SocialCommunityHelper::addSubmenu($this->getName()); JHtmlSidebar::setAction('index.php?option=' . $this->option . '&view=' . $this->getName()); $states = array(JHtml::_('select.option', '0', JText::_('COM_SOCIALCOMMUNITY_DOES_NOT_EXISTS')), JHtml::_('select.option', '1', JText::_('COM_SOCIALCOMMUNITY_EXISTS'))); JHtmlSidebar::addFilter(JText::_('COM_SOCIALCOMMUNITY_SELECT_PROFILE_STATE'), 'filter_profile', JHtml::_('select.options', $states, 'value', 'text', $this->state->get('filter.profile'), true)); $this->sidebar = JHtmlSidebar::render(); }
public function display($tpl = null) { $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); // Add submenu SocialCommunityHelper::addSubmenu($this->getName()); // Prepare sorting data $this->prepareSorting(); // Prepare actions $this->addToolbar(); $this->addSidebar(); $this->setDocument(); parent::display($tpl); }
public function display($tpl = null) { $this->version = new SocialCommunity\Version(); // Load Prism library version if (!class_exists("Prism\\Version")) { $this->itprismVersion = JText::_("COM_SOCIALCOMMUNITY_PRISM_LIBRARY_DOWNLOAD"); } else { $itprismVersion = new Prism\Version(); $this->prismVersion = $itprismVersion->getShortVersion(); } // Add submenu SocialCommunityHelper::addSubmenu($this->getName()); $this->addToolbar(); $this->addSidebar(); $this->setDocument(); parent::display($tpl); }
public function display($tpl = null) { $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); // Load the component parameters. $params = JComponentHelper::getParams($this->option); $this->imagesFolder = $params->get("images_directory", "images/profiles"); // Add submenu SocialCommunityHelper::addSubmenu($this->getName()); // Prepare sorting data $this->prepareSorting(); // Prepare actions $this->addToolbar(); $this->addSidebar(); $this->setDocument(); parent::display($tpl); }
/** * Add a menu on the sidebar of page */ protected function addSidebar() { // Add submenu SocialCommunityHelper::addSubmenu($this->getName()); $this->sidebar = JHtmlSidebar::render(); }
/** * Method to run after an install/update/uninstall method. * * @param string $type * @param string $parent * * @return void */ public function postflight($type, $parent) { if (!defined('SOCIALCOMMUNITY_PATH_COMPONENT_ADMINISTRATOR')) { define('SOCIALCOMMUNITY_PATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_socialcommunity'); } // Register Install Helper JLoader::register('SocialCommunityInstallHelper', SOCIALCOMMUNITY_PATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'install.php'); jimport('Prism.init'); jimport('Socialcommunity.init'); $params = JComponentHelper::getParams('com_socialcommunity'); /** @var $params Joomla\Registry\Registry */ $mediaFolder = JFolder::makeSafe($params->get('local_media_folder', 'media/socialcommunity')); $mediaFolderPath = JPath::clean(JPATH_SITE . DIRECTORY_SEPARATOR . $mediaFolder); $temporaryMediaFolder = $mediaFolder . '/temporary'; $temporaryMediaFolderPath = JPath::clean(JPATH_SITE . DIRECTORY_SEPARATOR . $temporaryMediaFolder); // Create images folder if (!JFolder::exists($mediaFolderPath)) { SocialCommunityInstallHelper::createFolder($mediaFolderPath); } // Create temporary images folder if (!JFolder::exists($temporaryMediaFolderPath)) { SocialCommunityInstallHelper::createFolder($temporaryMediaFolderPath); } // Start table with the information SocialCommunityInstallHelper::startTable(); // Requirements SocialCommunityInstallHelper::addRowHeading(JText::_('COM_SOCIALCOMMUNITY_MINIMUM_REQUIREMENTS')); // Display result about verification for existing folder $title = JText::_('COM_SOCIALCOMMUNITY_IMAGE_FOLDER'); $info = $mediaFolder; if (!JFolder::exists($mediaFolderPath)) { $result = array('type' => 'important', 'text' => JText::_('JNO')); } else { $result = array('type' => 'success', 'text' => JText::_('JYES')); } SocialCommunityInstallHelper::addRow($title, $result, $info); // Display result about verification for writable folder $title = JText::_('COM_SOCIALCOMMUNITY_WRITABLE_FOLDER'); $info = $mediaFolder; if (!is_writable($mediaFolderPath)) { $result = array('type' => 'important', 'text' => JText::_('JNO')); } else { $result = array('type' => 'success', 'text' => JText::_('JYES')); } SocialCommunityInstallHelper::addRow($title, $result, $info); // Display result about verification for existing folder $title = JText::_('COM_SOCIALCOMMUNITY_TEMPORARY_IMAGE_FOLDER'); $info = $temporaryMediaFolder; if (!JFolder::exists($temporaryMediaFolderPath)) { $result = array('type' => 'important', 'text' => JText::_('JNO')); } else { $result = array('type' => 'success', 'text' => JText::_('JYES')); } SocialCommunityInstallHelper::addRow($title, $result, $info); // Display result about verification for writable folder $title = JText::_('COM_SOCIALCOMMUNITY_TEMPORARY_WRITABLE_FOLDER'); $info = $temporaryMediaFolder; if (!is_writable($temporaryMediaFolderPath)) { $result = array('type' => 'important', 'text' => JText::_('JNO')); } else { $result = array('type' => 'success', 'text' => JText::_('JYES')); } SocialCommunityInstallHelper::addRow($title, $result, $info); // Display result about verification for GD library $title = JText::_('COM_SOCIALCOMMUNITY_GD_LIBRARY'); $info = ''; if (!extension_loaded('gd') and function_exists('gd_info')) { $result = array('type' => 'important', 'text' => JText::_('COM_SOCIALCOMMUNITY_WARNING')); } else { $result = array('type' => 'success', 'text' => JText::_('JON')); } SocialCommunityInstallHelper::addRow($title, $result, $info); // Display result about verification for cURL library $title = JText::_('COM_SOCIALCOMMUNITY_CURL_LIBRARY'); $info = ''; if (!extension_loaded('curl')) { $info = JText::_('COM_SOCIALCOMMUNITY_CURL_INFO'); $result = array('type' => 'important', 'text' => JText::_('COM_SOCIALCOMMUNITY_WARNING')); } else { $result = array('type' => 'success', 'text' => JText::_('JON')); } SocialCommunityInstallHelper::addRow($title, $result, $info); // Display result about verification Magic Quotes $title = JText::_('COM_SOCIALCOMMUNITY_MAGIC_QUOTES'); $info = ''; if (get_magic_quotes_gpc()) { $info = JText::_('COM_SOCIALCOMMUNITY_MAGIC_QUOTES_INFO'); $result = array('type' => 'important', 'text' => JText::_('JON')); } else { $result = array('type' => 'success', 'text' => JText::_('JOFF')); } SocialCommunityInstallHelper::addRow($title, $result, $info); // Display result about verification FileInfo $title = JText::_('COM_SOCIALCOMMUNITY_FILEINFO'); $info = ''; if (!function_exists('finfo_open')) { $info = JText::_('COM_SOCIALCOMMUNITY_FILEINFO_INFO'); $result = array('type' => 'important', 'text' => JText::_('JOFF')); } else { $result = array('type' => 'success', 'text' => JText::_('JON')); } SocialCommunityInstallHelper::addRow($title, $result, $info); // Display result about verification PHP Version. $title = JText::_('COM_SOCIALCOMMUNITY_PHP_VERSION'); $info = ''; if (version_compare(PHP_VERSION, '5.4.0', '<')) { $result = array('type' => 'important', 'text' => JText::_('COM_SOCIALCOMMUNITY_WARNING')); } else { $result = array('type' => 'success', 'text' => JText::_('JYES')); } SocialCommunityInstallHelper::addRow($title, $result, $info); // Display result about MySQL Version. $title = JText::_('COM_SOCIALCOMMUNITY_MYSQL_VERSION'); $info = ''; $dbVersion = JFactory::getDbo()->getVersion(); if (version_compare($dbVersion, '5.5.3', '<')) { $result = array('type' => 'important', 'text' => JText::_('COM_SOCIALCOMMUNITY_WARNING')); } else { $result = array('type' => 'success', 'text' => JText::_('JYES')); } SocialCommunityInstallHelper::addRow($title, $result, $info); // Display result about verification of installed Prism Library $title = JText::_('COM_SOCIALCOMMUNITY_PRISM_LIBRARY'); $info = ''; if (!class_exists('Prism\\Version')) { $info = JText::_('COM_SOCIALCOMMUNITY_PRISM_LIBRARY_DOWNLOAD'); $result = array('type' => 'important', 'text' => JText::_('JNO')); } else { $result = array('type' => 'success', 'text' => JText::_('JYES')); } SocialCommunityInstallHelper::addRow($title, $result, $info); // Installed extensions SocialCommunityInstallHelper::addRowHeading(JText::_('COM_SOCIALCOMMUNITY_INSTALLED_EXTENSIONS')); // SocialCommunity Library $result = array('type' => 'success', 'text' => JText::_('COM_SOCIALCOMMUNITY_INSTALLED')); SocialCommunityInstallHelper::addRow(JText::_('COM_SOCIALCOMMUNITY_SOCIALCOMMUNITY_LIBRARY'), $result, JText::_('COM_SOCIALCOMMUNITY_LIBRARY')); // User - Social Community New User $result = array('type' => 'success', 'text' => JText::_('COM_SOCIALCOMMUNITY_INSTALLED')); SocialCommunityInstallHelper::addRow(JText::_('COM_SOCIALCOMMUNITY_USER_SOCIALCOMMUNITY_USER'), $result, JText::_('COM_SOCIALCOMMUNITY_PLUGIN')); // End table with the information SocialCommunityInstallHelper::endTable(); echo JText::sprintf('COM_SOCIALCOMMUNITY_MESSAGE_REVIEW_SAVE_SETTINGS', JRoute::_('index.php?option=com_socialcommunity')); if (!class_exists('Prism\\Version')) { echo JText::_('COM_SOCIALCOMMUNITY_MESSAGE_INSTALL_PRISM_LIBRARY'); } else { if (class_exists('Socialcommunity\\Version')) { $prismVersion = new Prism\Version(); $componentVersion = new Socialcommunity\Version(); if (version_compare($prismVersion->getShortVersion(), $componentVersion->requiredPrismVersion, '<')) { echo JText::_('COM_SOCIALCOMMUNITY_MESSAGE_INSTALL_PRISM_LIBRARY'); } } } // Create profiles if orphans exist. SocialCommunityHelper::createProfiles(); }
/** * Save data into the DB * * @param array $data The data about item * * @return int Item ID */ public function save($data) { $id = Joomla\Utilities\ArrayHelper::getValue($data, 'id', 0, 'int'); $name = Joomla\Utilities\ArrayHelper::getValue($data, 'name', '', 'string'); $alias = Joomla\Utilities\ArrayHelper::getValue($data, 'alias', '', 'string'); $bio = Joomla\Utilities\ArrayHelper::getValue($data, 'bio', '', 'string'); if (!$bio) { $bio = null; } // Prepare gender. $allowedGender = array('male', 'female'); $gender = JString::trim(Joomla\Utilities\ArrayHelper::getValue($data, 'gender')); if (!in_array($gender, $allowedGender, true)) { $gender = 'male'; } // Prepare birthday $birthday = SocialCommunityHelper::prepareBirthday($data); // Load a record from the database $row = $this->getTable(); $row->load($id); $row->set('name', $name); $row->set('alias', $alias); $row->set('bio', $bio); $row->set('birthday', $birthday); $row->set('gender', $gender); $this->prepareTable($row); $this->prepareImages($row, $data); $this->prepareContact($row, $data); $row->store(true); // Update the name in Joomla! users table SocialCommunityHelper::updateName($row->get('user_id'), $name); $this->saveSocialProfiles($row->get('user_id'), $data); return $row->get('id'); }