本文整理汇总了PHP中JComponentHelper类的典型用法代码示例。如果您正苦于以下问题:PHP JComponentHelper类的具体用法?PHP JComponentHelper怎么用?PHP JComponentHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JComponentHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
public function getInput()
{
jimport('joomla.filesystem.file');
$mainframe = JFactory::getApplication();
if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/libraries/MCAPI.class.php')) {
$mainframe->enqueueMessage(JText::_('JM_PLEASE_INSTALL_JOOMLAMAILER'), 'error');
$mainframe->redirect('index.php');
}
$listId = $this->form->getValue('listid', 'params');
require_once JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/libraries/MCAPI.class.php';
$params = JComponentHelper::getParams('com_joomailermailchimpintegration');
$MCapi = $params->get('params.MCapi');
$api = new joomlamailerMCAPI($MCapi);
$interests = $api->listInterestGroupings($listId);
$options = array();
if ($interests) {
foreach ($interests as $interest) {
if ($interest['form_field'] != 'hidden') {
$groups = array();
foreach ($interest['groups'] as $ig) {
$groups[] = $ig['name'];
}
$groups = implode('####', $groups);
$options[] = array('id' => $interest['id'] . ';' . $interest['form_field'] . ';' . $interest['name'] . ';' . $groups, 'name' => $interest['name']);
}
}
}
if (count($options)) {
return JHtml::_('select.genericlist', $options, 'jform[params][interests][]', 'multiple="multiple"', 'id', 'name', $this->value, $this->id);
} else {
return JText::_('JM_NO_INTEREST_GROUPS');
}
}
示例2: display
/**
* Generates a list of JSON items.
*
* @return void
*/
public function display($tpl = null)
{
$model = $this->getModel();
$this->item = $this->get('Item');
$this->component = $model->getState($model->getName() . '.component');
$this->section = $model->getState($model->getName() . '.section');
$this->asset_id = $model->getState($model->getName() . '.asset_id');
$this->project_id = $model->getState($model->getName() . '.project_id');
$this->inherit = $model->getState($model->getName() . '.inherit');
if (!$this->asset_id && $this->inherit) {
$this->asset_id = $this->getComponentProjectAssetId($this->component, $this->project_id);
}
$this->rules = $this->getAssetRules();
$this->public_groups = array('1', JComponentHelper::getParams('com_users')->get('guest_usergroup', 1));
$user = JFactory::getUser();
if (!$user->authorise('core.admin', $this->component) && !$user->authorise('core.manage', $this->component)) {
JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
return false;
}
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
parent::display($tpl);
}
示例3: onAfterRoute
public function onAfterRoute()
{
$app = JFactory::getApplication();
if($app->isAdmin()){
return;
}
$menus = $app->getMenu('site');
$menu = $menus->getActive();
if(!$menu || $menu->home != 1) return;
$doc = JFactory::getDocument();
if($doc->getType() != 'html') return;
$params = JComponentHelper::getParams('com_xmlrpc');
if($params->get('show_rsd', 1)){
class_exists('XMLRPCHelperRoute') or require(JPATH_SITE.'/components/com_xmlrpc/helpers/route.php');
$link = JRoute::_(XMLRPCHelperRoute::getRsdRoute());
$doc->addHeadLink($link, 'EditURI', 'rel', array('type' => 'application/rsd+xml', 'title'=>'RSD'));
}
if($params->get('show_manifest', 1)){
class_exists('XMLRPCHelperRoute') or require(JPATH_SITE.'/components/com_xmlrpc/helpers/route.php');
$link = JRoute::_(XMLRPCHelperRoute::getManifestRoute());
$doc->addHeadLink($link, 'wlwmanifest', 'rel', array('type'=>'application/wlwmanifest+xml'));
}
}
示例4: __construct
/**
* constructor (registers additional tasks to methods)
* @return void
*/
function __construct()
{
parent::__construct();
// Set reference to parameters
$this->params = JComponentHelper::getParams('com_chessvn');
//$dummy = $this->params->get('parm_text');
}
示例5: display
function display($tpl = null)
{
global $mainframe;
// Check if registration is allowed
$usersConfig =& JComponentHelper::getParams('com_users');
if (!$usersConfig->get('allowUserRegistration')) {
JError::raiseError(403, JText::_('Access Forbidden'));
return;
}
$pathway =& $mainframe->getPathway();
$document =& JFactory::getDocument();
$params =& $mainframe->getParams();
// Page Title
$menus =& JSite::getMenu();
$menu = $menus->getActive();
// because the application sets a default page title, we need to get it
// right from the menu item itself
if (is_object($menu)) {
$menu_params = new JParameter($menu->params);
if (!$menu_params->get('page_title')) {
$params->set('page_title', JText::_('Registration'));
}
} else {
$params->set('page_title', JText::_('Registration'));
}
$document->setTitle($params->get('page_title'));
$pathway->addItem(JText::_('New'));
// Load the form validation behavior
JHTML::_('behavior.formvalidation');
$user =& JFactory::getUser();
$this->assignRef('user', $user);
$this->assignRef('params', $params);
parent::display($tpl);
}
示例6: __construct
function __construct() {
$app = JFactory::getApplication();
parent::__construct();
$config = JFactory::getConfig();
$paramsC = JComponentHelper::getParams('com_phocadownload') ;
$defaultPagination = $paramsC->get( 'default_pagination', '20' );
$file_ordering = $paramsC->get( 'file_ordering', 1 );
$context = $this->_context.'.';
// Get the pagination request variables
$this->setState('limit', $app->getUserStateFromRequest($context.'limit', 'limit', $defaultPagination, 'int'));
$this->setState('limitstart', $app->input->get('limitstart', 0, 'int'));
// In case limit has been changed, adjust limitstart accordingly
$this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0));
$this->setState('filter.language',$app->getLanguageFilter());
$this->setState('fileordering', $app->getUserStateFromRequest($context .'fileordering', 'fileordering', $file_ordering, 'int'));
// Get the filter request variables
$this->setState('filter_order', JRequest::getCmd('filter_order', 'ordering'));
$this->setState('filter_order_dir', JRequest::getCmd('filter_order_Dir', 'ASC'));
}
示例7: populateState
protected function populateState($ordering = null, $direction = null)
{
// Load the component parameters.
$params = JComponentHelper::getParams($this->option);
$this->setState('params', $params);
// Load filter search.
$value = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $value);
// Load filter state.
$value = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string');
$this->setState('filter.state', $value);
// Load filter approved state.
$value = $this->getUserStateFromRequest($this->context . '.filter.approved', 'filter_approved', '', 'string');
$this->setState('filter.approved', $value);
// Load filter featured state.
$value = $this->getUserStateFromRequest($this->context . '.filter.featured', 'filter_featured', '', 'string');
$this->setState('filter.featured', $value);
// Load filter category.
$value = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id', 0, 'int');
$this->setState('filter.category_id', $value);
// Load filter type.
$value = $this->getUserStateFromRequest($this->context . '.filter.type_id', 'filter_type_id', 0, 'int');
$this->setState('filter.type_id', $value);
// List state information.
parent::populateState('a.created', 'asc');
}
示例8: upload
/**
* @brief Accion que se encarga de manipular el proceso de guardar
* un archivo en el servidor
* @param array $allowedExtensions Arreglo de extensiones validas para el archivo
* @param int $sizeLimit Tamaño maximo permitido del fichero que se sube
*/
function upload($allowedExtensions, $sizeLimit = 10485760)
{
jimport('Amadeus.Util.Uploader');
$media =& JComponentHelper::getParams('com_media');
$postSize = $this->toBytes(ini_get('post_max_size'));
$uploadSize = $this->toBytes(ini_get('upload_max_filesize'));
$mediaSize = (int) $media->get('upload_maxsize');
// Se selecciona el minimo tamaño válido para un fichero, de acuerdo
// a los valores configurados en el php, el joomla y el componente.
$sizeLimit = min($postSize, $uploadSize, $mediaSize, $sizeLimit);
// Se alamacena la imagen en la ruta especificada
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
$result = $uploader->handleUpload(JPATH_SITE . '/tmp/', true);
if (!isset($result['error'])) {
jimport('Amadeus.Util.Validation');
$file = $uploader->getName();
$result = AmadeusUtilValidation::isValidFile($file, $only_image);
if (isset($result['error'])) {
jimport('joomla.filesystem.file');
if (!JFile::delete($file)) {
$result = array('error' => JText::_('DELETEERROR'));
}
} else {
$this->_file = $file;
}
}
return $result;
}
示例9: display
/**
* Display
*
* @param string $tmpl Template
*
* @return void
*/
public function display($tmpl = 'default')
{
$srcs = FabrikHelperHTML::framework();
$app = JFactory::getApplication();
$input = $app->input;
FabrikHelperHTML::script($srcs);
$model = $this->getModel();
$usersConfig = JComponentHelper::getParams('com_fabrik');
$model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0))));
$visualization = $model->getVisualization();
$pluginParams = $model->getPluginParams();
$pluginManager = JModelLegacy::getInstance('Pluginmanager', 'FabrikModel');
$plugin = $pluginManager->getPlugIn($visualization->plugin, 'visualization');
$plugin->_row = $visualization;
if ($visualization->published == 0) {
return JError::raiseWarning(500, FText::_('COM_FABRIK_SORRY_THIS_VISUALIZATION_IS_UNPUBLISHED'));
}
// Plugin is basically a model
$pluginTask = $input->get('plugintask', 'render', 'request');
// @FIXME cant set params directly like this, but I think plugin model setParams() is not right
$plugin->_params = $pluginParams;
$tmpl = $plugin->getParams()->get('calendar_layout', $tmpl);
$plugin->{$pluginTask}($this);
$this->plugin = $plugin;
$viewName = $this->getName();
$this->addTemplatePath($this->_basePath . '/plugins/' . $this->_name . '/' . $plugin->_name . '/tmpl/' . $tmpl);
$root = $app->isAdmin() ? JPATH_ADMINISTRATOR : JPATH_SITE;
$this->addTemplatePath($root . '/templates/' . $app->getTemplate() . '/html/com_fabrik/visualization/' . $plugin->_name . '/' . $tmpl);
$ab_css_file = JPATH_SITE . '/plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/template.css';
if (JFile::exists($ab_css_file)) {
JHTML::stylesheet('template.css', 'plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/', true);
}
echo parent::display();
}
示例10: addEvForm
function addEvForm()
{
$listid = JRequest::getInt('listid');
$viewName = 'calendar';
$usersConfig = JComponentHelper::getParams('com_fabrik');
$model =& $this->getModel($viewName);
$id = JRequest::getInt('visualizationid', $usersConfig->get('visualizationid', 0));
$model->setId($id);
$model->setupEvents();
if (array_key_exists($listid, $model->_events)) {
$datefield = $model->_events[$listid][0]['startdate'];
} else {
$config = JFactory::getConfig();
$prefix = $config->getValue('config.dbprefix');
$datefield = $prefix . 'fabrik_calendar_events___start_date';
}
$rowid = JRequest::getInt('rowid');
$listModel = JModel::getInstance('list', 'FabrikFEModel');
$listModel->setId($listid);
$table = $listModel->getTable();
JRequest::setVar('view', 'form');
JRequest::setVar('formid', $table->form_id);
JRequest::setVar('tmpl', 'component');
JRequest::setVar('ajax', '1');
$link = 'index.php?option=com_fabrik&view=form&formid=' . $table->form_id . '&rowid=' . $rowid . '&tmpl=component&ajax=1';
$link .= '&jos_fabrik_calendar_events___visualization_id=' . JRequest::getInt('jos_fabrik_calendar_events___visualization_id');
$start_date = JRequest::getVar('start_date', '');
if (!empty($start_date)) {
$link .= "&{$datefield}=" . $start_date;
}
// $$$ rob have to add this to stop the calendar filtering itself after adding an new event?
$link .= '&clearfilters=1';
$this->setRedirect($link);
}
示例11: addToolbar
protected function addToolbar()
{
$user = JFactory::getUser();
$par = JComponentHelper::getParams('com_djclassifieds');
JToolBarHelper::title(JText::_('COM_DJCLASSIFIEDS_ITEMS'), 'generic.png');
if ($user->authorise('core.create', 'com_djclassifieds')) {
JToolBarHelper::addNew('item.add', 'JTOOLBAR_NEW');
}
if ($user->authorise('core.edit', 'com_djclassifieds')) {
JToolBarHelper::editList('item.edit', 'JTOOLBAR_EDIT');
}
JToolBarHelper::divider();
if ($user->authorise('core.admin', 'com_djclassifieds')) {
if ($par->get('store_org_img', '1') == 1) {
JToolBarHelper::custom('items.recreateThumbnails', 'move', 'move', JText::_('COM_DJCLASSIFIEDS_RECREATE_THUMBNAILS'), true, true);
}
JToolBarHelper::custom('items.resmushitThumbnails', 'loop', 'loop', JText::_('COM_DJCLASSIFIEDS_OPTIMIZE_THUMBNAILS'), true, true);
JToolBarHelper::custom('items.generateCoordinates', 'refresh', 'refresh', JText::_('COM_DJCLASSIFIEDS_GENERATE_COORDINATES'), false, true);
JToolBarHelper::divider();
}
if ($user->authorise('core.edit.state', 'com_djclassifieds')) {
JToolBarHelper::custom('items.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
JToolBarHelper::custom('items.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
JToolBarHelper::custom('items.archive', 'archive.png', 'archive_f2.png', 'JTOOLBAR_ARCHIVE', true);
}
if ($user->authorise('core.delete', 'com_djclassifieds')) {
JToolBarHelper::deleteList('', 'items.delete', 'JTOOLBAR_DELETE');
}
JToolBarHelper::divider();
if ($user->authorise('core.admin', 'com_djclassifieds')) {
JToolBarHelper::preferences('com_djclassifieds', 450, 800);
JToolBarHelper::divider();
}
}
示例12: display
public function display($tpl = null)
{
$this->option = JFactory::getApplication()->input->get('option');
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
// Get parameters of com_crowdfunding.
/** @var $cParams Joomla\Registry\Registry */
$cParams = JComponentHelper::getParams('com_crowdfunding');
$this->cfParams = $cParams;
$currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->cfParams->get('project_currency'));
$this->amount = new Crowdfunding\Amount($this->cfParams);
$this->amount->setCurrency($currency);
// Get rewards number
$projectsIds = array();
foreach ($this->items as $item) {
$projectsIds[] = $item->id;
}
$projects = new Crowdfunding\Projects(JFactory::getDbo());
$this->transactions = $projects->getTransactionsNumber($projectsIds);
// Prepare sorting data
$this->prepareSorting();
// Prepare actions
$this->addToolbar();
$this->addSidebar();
$this->setDocument();
parent::display($tpl);
}
示例13: save
function save()
{
// Check for request forgeries
JRequest::checkToken() or die('COM_JOOMLEAGUE_GLOBAL_INVALID_TOKEN');
$cid = JRequest::getInt("cid", 0);
$post = JRequest::get('post');
if ($cid > 0) {
$club =& JTable::getInstance("Club", "Table");
$club->load($cid);
$club->bind($post);
$params =& JComponentHelper::getParams('com_joomleague');
if ($club->store() && $params->get('cfg_edit_club_info_update_notify') == "1") {
$db = JFactory::getDBO();
$user = JFactory::getUser();
$query = "SELECT email\n FROM #__users \n WHERE usertype = 'Super Administrator' \n OR usertype = 'Administrator'";
$db->setQuery($query);
$to = $db->loadResultArray();
$subject = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_SUBJECT"), $club->name));
$message = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_MESSAGE"), $user->name, $club->name));
$message .= $this->_getShowClubInfoLink();
JUtility::sendMail('', '', $to, $subject, $message);
}
}
$this->setRedirect($this->_getShowClubInfoLink());
}
示例14: postflight
public function postflight($action, $adapter)
{
$table = JTable::getInstance('extension');
$component = "com_jevents";
if (!$table->load(array("element" => "com_jevents", "type" => "component"))) {
JFactory::getApplication()->enqueueMessage('Not a valid component', 'error');
return false;
}
$params = JComponentHelper::getParams("com_jevents");
$checkClashes = $params->get("checkclashes", 0);
if ($params->get("noclashes", 0)) {
$params->set("checkconflicts", "2");
} else {
if ($params->get("checkclashes", 0)) {
$params->set("checkconflicts", "1");
}
}
$paramsArray = $params->toArray();
unset($paramsArray['checkclashes']);
unset($paramsArray['noclashes']);
$post['params'] = $paramsArray;
$post['option'] = $component;
$table->bind($post);
// pre-save checks
if (!$table->check()) {
JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
return false;
}
// save the changes
if (!$table->store()) {
JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
return false;
}
return true;
}
示例15: getFeeds
function getFeeds()
{
$app = JFactory::getApplication();
$params = JComponentHelper::getParams('com_jce');
$limit = $params->get('feed_limit', 2);
$feeds = array();
$options = array('rssUrl' => 'http://www.joomlacontenteditor.net/news/feed/rss/latest-news?format=feed', 'cache_time' => $params->get('feed_cachetime', 86400));
// use this directly instead of JFactory::getXMLParserto avoid the feed data error
jimport('simplepie.simplepie');
if (!is_writable(JPATH_BASE . '/cache')) {
$options['cache_time'] = 0;
}
$rss = new SimplePie($options['rssUrl'], JPATH_BASE . '/cache', isset($options['cache_time']) ? $options['cache_time'] : 0);
$rss->force_feed(true);
$rss->handle_content_type();
if ($rss->init()) {
$count = $rss->get_item_quantity();
if ($count) {
$count = $count > $limit ? $limit : $count;
for ($i = 0; $i < $count; $i++) {
$feed = new StdClass();
$item = $rss->get_item($i);
$feed->link = $item->get_link();
$feed->title = $item->get_title();
$feed->description = $item->get_description();
$feeds[] = $feed;
}
}
}
return $feeds;
}