本文整理汇总了PHP中FabrikWorker::getPluginManager方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikWorker::getPluginManager方法的具体用法?PHP FabrikWorker::getPluginManager怎么用?PHP FabrikWorker::getPluginManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FabrikWorker
的用法示例。
在下文中一共展示了FabrikWorker::getPluginManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOtherElement
private function getOtherElement($elementModel, $c)
{
$params = $this->getParams();
$otherfield = (array) $params->get('areuniquevalues-otherfield', array());
$otherfield = $otherfield[$c];
return FabrikWorker::getPluginManager()->getElementPlugin($otherfield);
}
示例2: getFabrikItem
/**
* Decorate the J2Store product information with its related Fabrik record
*
* @param $product
*
* @return object
*/
private function getFabrikItem(&$product)
{
list($component, $listId) = explode('.', $product->product_source);
$key = $listId . '.' . $product->product_source_id;
static $sets;
if (!is_array($sets)) {
$sets = array();
}
if (!isset($sets[$key])) {
JModelLegacy::addIncludePath(COM_FABRIK_FRONTEND . '/models', 'FabrikFEModel');
/** @var FabrikFEModelList $listModel */
$listModel = JModelLegacy::getInstance('List', 'FabrikFEModel');
$listModel->setId($listId);
$formModel = $listModel->getFormModel();
$formModel->setRowId($product->product_source_id);
$row = $formModel->getData();
$params = $formModel->getParams();
$index = array_search('j2store', (array) $params->get('plugins', array(), 'array'));
$w = new FabrikWorker();
$plugIn = FabrikWorker::getPluginManager()->loadPlugIn('j2store', 'form');
// Set params relative to plugin render order
$plugInParams = $plugIn->setParams($params, $index);
$context = new stdClass();
$context->title = $w->parseMessageForPlaceHolder($plugInParams->get('j2store_product_name'), $row);
$context->published = $w->parseMessageForPlaceHolder($plugInParams->get('j2store_enabled'), $row);
$objectRow = JArrayHelper::toObject($row);
$context->viewLink = $listModel->viewDetailsLink($objectRow);
$context->editLink = $listModel->editLink($objectRow);
$context->id = $objectRow->__pk_val;
$sets[$key] = $context;
}
//echo "<pre>";print_r($sets);echo "</pre>";
return $sets[$key];
}
示例3: pluginAjax
/**
* Ajax action called from element
* 11/07/2011 - I've updated things so that any plugin ajax call uses 'view=plugin' rather than controller=plugin
* this means that the controller used is now plugin.php and not plugin.raw.php
*
* @return null
*/
public function pluginAjax()
{
$app = JFactory::getApplication();
$input = $app->input;
$plugin = $input->get('plugin', '');
$method = $input->get('method', '');
$group = $input->get('g', 'element');
$pluginManager = FabrikWorker::getPluginManager();
try {
// First lets try the fabrik plugin manager - needed when loading namespaced plugins
$pluginManager->loadPlugIn($plugin, $group);
} catch (Exception $e) {
if (!JPluginHelper::importPlugin('fabrik_' . $group, $plugin)) {
$o = new stdClass();
$o->err = 'unable to import plugin fabrik_' . $group . ' ' . $plugin;
echo json_encode($o);
return;
}
}
if (substr($method, 0, 2) !== 'on') {
$method = 'on' . JString::ucfirst($method);
}
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger($method);
}
示例4: _process
/**
* Clone the record
*
* @param object $params plugin params
* @param object &$formModel form model
*
* @return bool
*/
private function _process($params, &$formModel)
{
$clone_times_field_id = $params->get('clone_times_field', '');
$clone_batchid_field_id = $params->get('clone_batchid_field', '');
if ($clone_times_field_id != '') {
$elementModel = FabrikWorker::getPluginManager()->getElementPlugin($clone_times_field_id);
$element = $elementModel->getElement(true);
if ($clone_batchid_field_id != '') {
$elementModel = FabrikWorker::getPluginManager()->getElementPlugin($clone_batchid_field_id);
$id_element = $id_elementModel->getElement(true);
$formModel->_formData[$id_element->name] = $formModel->_fullFormData['rowid'];
$formModel->_formData[$id_element->name . '_raw'] = $formModel->_fullFormData['rowid'];
$listModel = $formModel->getlistModel();
$listModel->_oForm = $formModel;
$primaryKey = FabrikString::shortColName($listModel->getTable()->db_primary_key);
$formModel->_formData[$primaryKey] = $formModel->_fullFormData['rowid'];
$formModel->_formData[$primaryKey . '_raw'] = $formModel->_fullFormData['rowid'];
$listModel->storeRow($formModel->_formData, $formModel->_fullFormData['rowid']);
}
// $clone_times_field = $elementModel->getFullName(false, true, false);
$clone_times = $formModel->_formData[$element->name];
if (is_numeric($clone_times)) {
$clone_times = (int) $clone_times;
$formModel->_formData['Copy'] = 1;
for ($x = 1; $x < $clone_times; $x++) {
$formModel->processToDB();
}
return true;
}
}
JError::raiseNotice(JText::_('CLONEERR'), "Couldn't find a valid number of times to clone!");
return true;
}
示例5: display
function display($tmpl = 'default')
{
FabrikHelperHTML::framework();
FabrikHelperHTML::script('media/com_fabrik/js/list.js');
$model = $this->getModel();
$usersConfig = JComponentHelper::getParams('com_fabrik');
$model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0))));
$this->row = $model->getVisualization();
$model->setListIds();
if ($this->row->published == 0) {
JError::raiseWarning(500, JText::_('JERROR_ALERTNOAUTHOR'));
return '';
}
$calendar = $model->_row;
$this->media = $model->getMedia();
$params = $model->getParams();
$this->assign('params', $params);
$viewName = $this->getName();
$pluginManager = FabrikWorker::getPluginManager();
$plugin = $pluginManager->getPlugIn('media', 'visualization');
$this->assign('containerId', $this->get('ContainerId'));
$this->assign('showFilters', JRequest::getInt('showfilters', $params->get('show_filters')) === 1 ? 1 : 0);
$this->assignRef('filters', $this->get('Filters'));
$this->assign('params', $model->getParams());
$pluginParams = $model->getPluginParams();
$tmpl = $pluginParams->get('media_layout', $tmpl);
$tmplpath = JPATH_ROOT . '/plugins/fabrik_visualization/media/views/media/tmpl/' . $tmpl;
$this->_setPath('template', $tmplpath);
FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/media/views/media/tmpl/' . $tmpl . '/template.css');
echo parent::display();
}
示例6: _process
/**
* Clone the record
*
* @return bool
*/
private function _process()
{
$params = $this->getParams();
/** @var FabrikFEModelForm $formModel */
$formModel = $this->getModel();
$clone_times_field_id = $params->get('clone_times_field', '');
$clone_batchid_field_id = $params->get('clone_batchid_field', '');
if ($clone_times_field_id != '') {
$elementModel = FabrikWorker::getPluginManager()->getElementPlugin($clone_times_field_id);
$element = $elementModel->getElement(true);
if ($clone_batchid_field_id != '') {
$elementModel = FabrikWorker::getPluginManager()->getElementPlugin($clone_batchid_field_id);
$id_element = $elementModel->getElement(true);
$formModel->formData[$id_element->name] = $formModel->fullFormData['rowid'];
$formModel->formData[$id_element->name . '_raw'] = $formModel->fullFormData['rowid'];
$listModel = $formModel->getlistModel();
$listModel->setFormModel($formModel);
$primaryKey = FabrikString::shortColName($listModel->getPrimaryKey());
$formModel->formData[$primaryKey] = $formModel->fullFormData['rowid'];
$formModel->formData[$primaryKey . '_raw'] = $formModel->fullFormData['rowid'];
$listModel->storeRow($formModel->formData, $formModel->fullFormData['rowid']);
}
$clone_times = $formModel->formData[$element->name];
if (is_numeric($clone_times)) {
$clone_times = (int) $clone_times;
$formModel->formData['Copy'] = 1;
for ($x = 1; $x < $clone_times; $x++) {
$formModel->processToDB();
}
return true;
}
}
throw new RuntimeException("Couldn't find a valid number of times to clone!");
}
示例7: validate
/**
* Validate the elements data against the rule
*
* @param string $data to check
* @param object &$elementModel element Model
* @param int $pluginc plugin sequence ref
* @param int $repeatCounter repeat group counter
*
* @return bool true if validation passes, false if fails
*/
public function validate($data, &$elementModel, $pluginc, $repeatCounter)
{
$params = $this->getParams();
$pluginc = trim((string) $pluginc);
// As ornot is a radio button it gets json encoded/decoded as an object
$ornot = (object) $params->get('userexists_or_not');
$ornot = isset($ornot->{$pluginc}) ? $ornot->{$pluginc} : 'fail_if_exists';
$user = JFactory::getUser();
jimport('joomla.user.helper');
$result = JUserHelper::getUserId($data);
if ($user->get('guest')) {
if (!$result) {
if ($ornot == 'fail_if_exists') {
return true;
}
} else {
if ($ornot == 'fail_if_not_exists') {
return true;
}
}
return false;
} else {
if (!$result) {
if ($ornot == 'fail_if_exists') {
return true;
}
} else {
$user_field = (array) $params->get('userexists_user_field', array());
$user_field = $user_field[$pluginc];
$user_id = 0;
if ((int) $user_field !== 0) {
$user_elementModel = FabrikWorker::getPluginManager()->getElementPlugin($user_field);
$user_fullName = $user_elementModel->getFullName(false, true, false);
$user_field = $user_elementModel->getFullName(false, false, false);
}
if (!empty($user_field)) {
// $$$ the array thing needs fixing, for now just grab 0
$formdata = $elementModel->getForm()->_formData;
$user_id = JArrayHelper::getValue($formdata, $user_fullName . '_raw', JArrayHelper::getValue($formdata, $user_fullName, ''));
if (is_array($user_id)) {
$user_id = JArrayHelper::getValue($user_id, 0, '');
}
}
if ($user_id != 0) {
if ($result == $user_id) {
return $ornot == 'fail_if_exists' ? true : false;
}
return false;
} else {
// The connected user is editing his own data
if ($result == $user->get('id')) {
return $ornot == 'fail_if_exists' ? true : false;
}
return false;
}
}
return false;
}
}
示例8: getDataElement
private function getDataElement()
{
$params = $this->getParams();
$elementid = (int) $params->get('googleometer_element');
$element = FabrikWorker::getPluginManager()->getPlugIn('', 'element');
$element->setId($elementid);
return $element;
}
示例9: validate
/**
* Validate the elements data against the rule
*
* @param string $data To check
* @param int $repeatCounter Repeat group counter
*
* @return bool true if validation passes, false if fails
*/
public function validate($data, $repeatCounter)
{
$params = $this->getParams();
$elementModel = $this->elementModel;
// As ornot is a radio button it gets json encoded/decoded as an object
$orNot = $params->get('userexists_or_not', 'fail_if_exists');
jimport('joomla.user.helper');
$result = JUserHelper::getUserId($data);
if ($this->user->get('guest')) {
if (!$result) {
if ($orNot == 'fail_if_exists') {
return true;
}
} else {
if ($orNot == 'fail_if_not_exists') {
return true;
}
}
return false;
} else {
if (!$result) {
if ($orNot == 'fail_if_exists') {
return true;
}
} else {
$userField = $params->get('userexists_user_field');
$userId = 0;
if ((int) $userField !== 0) {
$userElementModel = FabrikWorker::getPluginManager()->getElementPlugin($userField);
$userFullName = $userElementModel->getFullName(true, false);
$userField = $userElementModel->getFullName(false, false);
}
if (!empty($userField)) {
// $$$ the array thing needs fixing, for now just grab 0
$formData = $elementModel->getForm()->formData;
$userId = FArrayHelper::getValue($formData, $userFullName . '_raw', FArrayHelper::getValue($formData, $userFullName, ''));
if (is_array($userId)) {
$userId = FArrayHelper::getValue($userId, 0, '');
}
}
if ($userId != 0) {
if ($result == $userId) {
return $orNot == 'fail_if_exists' ? true : false;
}
return false;
} else {
// The connected user is editing his own data
if ($result == $this->user->get('id')) {
return $orNot == 'fail_if_exists' ? true : false;
}
return false;
}
}
return false;
}
}
示例10: getFieldValue
/**
* Get the fields value regardless of whether its in joined data or no
* @param object $params
* @param string $pname
* @param array posted form $data
*/
private function getFieldValue($params, $pname, $data)
{
$elementModel = FabrikWorker::getPluginManager()->getElementPlugin($params->get($pname));
$group = $elementModel->getGroup();
if ($group->isJoin()) {
$data = $data['join'][$group->getGroup()->join_id];
}
$name = $elementModel->getFullName(false, true, false);
return JArrayHelper::getValue($data, $name);
}
示例11: makeParentElement
/**
* For processing repeat elements we need to make its
* parent id element during the form process
*
* @param plgFabrik_Element $baseElement repeat element (e.g. db join rendered as checkbox)
*
* @return plgFabrik_ElementField
*/
public function makeParentElement($baseElement)
{
$pluginManager = FabrikWorker::getPluginManager();
$groupModel = $baseElement->getGroupModel();
$elementModel = $pluginManager->getPlugIn('field', 'element');
$elementModel->getElement()->name = 'parent_id';
$elementModel->getParams()->set('repeat', $baseElement->isJoin());
$elementModel->getElement()->group_id = $groupModel->getId();
$elementModel->setGroupModel($baseElement->getGroupModel());
// @TODO wrong when element in repeat group
$oJoin = $groupModel->getJoinModel()->getJoin();
$elementModel->_aFullNames['parent_id1_1__1_'] = $oJoin->table_join . '___parent_id';
return $elementModel;
}
示例12: filterValue
/**
* Short cut for getting the element's filter value
*
* @param int $elementId Element id
*
* @since 3.0.7
*
* @return string
*/
public static function filterValue($elementId)
{
$app = JFactory::getApplication();
$pluginManager = FabrikWorker::getPluginManager();
$model = $pluginManager->getElementPlugin($elementId);
$listModel = $model->getListModel();
$listid = $listModel->getId();
$key = 'com_fabrik.list' . $listid . '_com_fabrik_' . $listid . '.filter';
$filters = JArrayHelper::fromObject($app->getUserState($key));
$elementIds = (array) JArrayHelper::getValue($filters, 'elementid', array());
$index = array_search($elementId, $elementIds);
$value = $filters['value'][$index];
return $value;
}
示例13: findAll
/**
* Loads in element's published validation objects
*
* @return PlgFabrik_Validationrule[] Validation objects
*/
public function findAll()
{
if (isset($this->validations)) {
return $this->validations;
}
$params = $this->elementModel->getParams();
$validations = (array) $params->get('validations', 'array');
$usedPlugins = (array) FArrayHelper::getValue($validations, 'plugin', array());
$published = FArrayHelper::getValue($validations, 'plugin_published', array());
$showIcon = FArrayHelper::getValue($validations, 'show_icon', array());
$mustValidate = FArrayHelper::getValue($validations, 'must_validate', array());
$validateIn = FArrayHelper::getValue($validations, 'validate_in', array());
$validationOn = FArrayHelper::getValue($validations, 'validation_on', array());
$mustValidate = FArrayHelper::getValue($validations, 'must_validate', array());
$pluginManager = FabrikWorker::getPluginManager();
$pluginManager->getPlugInGroup('validationrule');
$c = 0;
$this->validations = array();
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('fabrik_validationrule');
$i = 0;
foreach ($usedPlugins as $usedPlugin) {
if ($usedPlugin !== '') {
$isPublished = FArrayHelper::getValue($published, $i, true);
if ($isPublished) {
$class = 'PlgFabrik_Validationrule' . JString::ucfirst($usedPlugin);
$conf = array();
$conf['name'] = JString::strtolower($usedPlugin);
$conf['type'] = JString::strtolower('fabrik_Validationrule');
/** @var PlgFabrik_Validationrule $plugIn */
$plugIn = new $class($dispatcher, $conf);
JPluginHelper::getPlugin('fabrik_validationrule', $usedPlugin);
$plugIn->elementModel = $this->elementModel;
$this->validations[] = $plugIn;
// Set params relative to plugin render order
$plugIn->setParams($params, $i);
$plugIn->getParams()->set('show_icon', FArrayHelper::getValue($showIcon, $i, true));
$plugIn->getParams()->set('validate_in', FArrayHelper::getValue($validateIn, $i, 'both'));
$plugIn->getParams()->set('validation_on', FArrayHelper::getValue($validationOn, $i, 'both'));
$plugIn->getParams()->set('must_validate', FArrayHelper::getValue($mustValidate, $i, '0'));
$plugIn->js();
$c++;
}
}
$i++;
}
return $this->validations;
}
示例14: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
public function display($tpl = 'default')
{
$app = JFactory::getApplication();
$input = $app->input;
$srcs = FabrikHelperHTML::framework();
$srcs[] = 'media/com_fabrik/js/listfilter.js';
$srcs[] = 'media/com_fabrik/js/advanced-search.js';
$model = $this->getModel();
$usersConfig = JComponentHelper::getParams('com_fabrik');
$model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0))));
$this->row = $model->getVisualization();
if (!$model->canView()) {
echo FText::_('JERROR_ALERTNOAUTHOR');
return false;
}
if ($this->row->published == 0) {
JError::raiseWarning(500, FText::_('JERROR_ALERTNOAUTHOR'));
return '';
}
$this->requiredFiltersFound = $this->get('RequiredFiltersFound');
if ($this->requiredFiltersFound) {
$this->chart = $this->get('Chart');
} else {
$this->chart = '';
}
$params = $model->getParams();
$this->params = $params;
$viewName = $this->getName();
$pluginManager = FabrikWorker::getPluginManager();
$plugin = $pluginManager->getPlugIn('chart', 'visualization');
$this->containerId = $this->get('ContainerId');
$this->filters = $this->get('Filters');
$this->showFilters = $model->showFilters();
$this->filterFormURL = $this->get('FilterFormURL');
$tpl = $params->get('chart_layout', $tpl);
$tmplpath = JPATH_ROOT . '/plugins/fabrik_visualization/chart/views/chart/tmpl/' . $tpl;
$this->_setPath('template', $tmplpath);
FabrikHelperHTML::stylesheetFromPath('plugins/fabrik_visualization/chart/views/chart/tmpl/' . $tpl . '/template.css');
// Assign something to Fabrik.blocks to ensure we can clear filters
$ref = $model->getJSRenderContext();
$js = "{$ref} = {};";
$js .= "\n" . "Fabrik.addBlock('{$ref}', {$ref});";
$js .= $model->getFilterJs();
FabrikHelperHTML::iniRequireJs($model->getShim());
FabrikHelperHTML::script($srcs, $js);
echo parent::display();
}
示例15: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
function display($tpl = 'default')
{
$srcs = FabrikHelperHTML::framework();
$srcs[] = 'media/com_fabrik/js/listfilter.js';
$srcs[] = 'media/com_fabrik/js/advanced-search.js';
require_once COM_FABRIK_FRONTEND . '/helpers/html.php';
$model = $this->getModel();
$usersConfig = JComponentHelper::getParams('com_fabrik');
$model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0))));
$this->row = $model->getVisualization();
if ($this->row->published == 0) {
JError::raiseWarning(500, JText::_('JERROR_ALERTNOAUTHOR'));
return '';
}
$calendar = $model->_row;
$this->assign('requiredFiltersFound', $this->get('RequiredFiltersFound'));
if ($this->requiredFiltersFound) {
$this->assign('chart', $this->get('Chart'));
} else {
$this->assign('chart', '');
}
$params = $model->getParams();
$this->assign('params', $params);
$viewName = $this->getName();
$pluginManager = FabrikWorker::getPluginManager();
$plugin = $pluginManager->getPlugIn('chart', 'visualization');
$this->assign('containerId', $this->get('ContainerId'));
$this->assignRef('filters', $this->get('Filters'));
$this->assign('showFilters', JRequest::getInt('showfilters', $params->get('show_filters')) === 1 ? 1 : 0);
$this->assign('filterFormURL', $this->get('FilterFormURL'));
$pluginParams = $model->getPluginParams();
$tpl = $pluginParams->get('chart_layout', $tpl);
$tmplpath = JPATH_ROOT . '/plugins/fabrik_visualization/chart/views/chart/tmpl/' . $tpl;
$this->_setPath('template', $tmplpath);
$ab_css_file = $tmplpath . '/template.css';
if (JFile::exists($ab_css_file)) {
JHTML::stylesheet('plugins/fabrik_visualization/chart/views/chart/tmpl/' . $tpl . '/template.css', true);
}
// Assign something to Fabrik.blocks to ensure we can clear filters
$ref = $model->getJSRenderContext();
$js = "{$ref} = {};";
$js .= "\n" . "Fabrik.addBlock('{$ref}', {$ref});";
$js .= $model->getFilterJs();
FabrikHelperHTML::addScriptDeclaration($srcs, $js);
echo parent::display();
}