本文整理汇总了PHP中JModel::addIncludePath方法的典型用法代码示例。如果您正苦于以下问题:PHP JModel::addIncludePath方法的具体用法?PHP JModel::addIncludePath怎么用?PHP JModel::addIncludePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JModel
的用法示例。
在下文中一共展示了JModel::addIncludePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* called via ajax to perform viz ajax task (defined by plugintask method)
*/
public function display()
{
$document = JFactory::getDocument();
$id = JRequest::getInt('visualizationid');
$viz = FabTable::getInstance('Visualization', 'FabrikTable');
$viz->load($id);
$modelpaths = JModel::addIncludePath(JPATH_SITE . '/plugins/fabrik_visualization/' . $viz->plugin . '/models');
$model = $this->getModel($viz->plugin);
$model->setId($id);
$pluginTask = JRequest::getVar('plugintask', '', 'request');
if ($pluginTask !== '') {
echo $model->{$pluginTask}();
} else {
$task = JRequest::getVar('task');
$path = JPATH_SITE . '/plugins/fabrik_visualization/' . $viz->plugin . '/controllers/' . $viz->plugin . '.php';
if (file_exists($path)) {
require_once $path;
} else {
JError::raiseNotice(400, 'could not load viz:' . $viz->plugin);
return;
}
$controllerName = 'FabrikControllerVisualization' . $viz->plugin;
$controller = new $controllerName();
$controller->addViewPath(JPATH_SITE . '/plugins/fabrik_visualization/' . $viz->plugin . '/views');
$controller->addViewPath(COM_FABRIK_FRONTEND . '/views');
//add the model path
$modelpaths = JModel::addIncludePath(JPATH_SITE . '/plugins/fabrik_visualization/' . $viz->plugin . '/models');
$modelpaths = JModel::addIncludePath(COM_FABRIK_FRONTEND . '/models');
$origId = JRequest::getInt('visualizationid');
JRequest::setVar('visualizationid', $id);
$controller->{$task}();
}
}
示例2: onInit
/**
* Method to handle the onInit event.
* - Initializes the JCE WYSIWYG Editor
*
* @access public
* @return string JavaScript Initialization string
* @since 1.5
*/
public function onInit()
{
$app = JFactory::getApplication();
$language = JFactory::getLanguage();
$document = JFactory::getDocument();
// set IE mode
//$document->setMetaData('X-UA-Compatible', 'IE=Edge', true);
// Check for existence of Admin Component
if (!is_dir(JPATH_SITE . DS . 'components' . DS . 'com_jce') || !is_dir(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jce')) {
JError::raiseWarning('SOME_ERROR_CODE', 'WF_COMPONENT_MISSING');
}
$language->load('plg_editors_jce', JPATH_ADMINISTRATOR);
$language->load('com_jce', JPATH_ADMINISTRATOR);
// set admin base path
$base = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jce';
// load constants and loader
require_once($base . DS . 'includes' . DS . 'base.php');
// load model
JModel::addIncludePath($base . DS . 'models');
$model = JModel::getInstance('editor', 'WFModel');
$model->buildEditor();
}
示例3: getItems
/**
*
* @return unknown_type
*/
function getItems()
{
// Check the registry to see if our Tienda class has been overridden
if (!class_exists('Tienda')) {
JLoader::register("Tienda", JPATH_ADMINISTRATOR . "/components/com_tienda/defines.php");
}
// load the config class
Tienda::load('Tienda', 'defines');
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/models');
// get the model
$model = JModel::getInstance('Manufacturers', 'TiendaModel');
// TODO Make this depend on the current filter_category?
// setting the model's state tells it what items to return
$model->setState('filter_enabled', '1');
$model->setState('order', 'tbl.manufacturer_name');
// set the states based on the parameters
// using the set filters, get a list
$items = $model->getList();
if (!empty($items)) {
foreach ($items as $item) {
// this gives error
$item->itemid = Tienda::getClass("TiendaHelperRoute", 'helpers.route')->manufacturer($item->manufacturer_id, false);
if (empty($item->itemid)) {
$item->itemid = $this->params->get('itemid');
}
}
}
return $items;
}
示例4: jimport
function &getModel()
{
jimport('joomla.application.component.model');
JModel::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'pricing' . DS . self::getItemName() . DS . 'models');
$model = JModel::getInstance(self::getItemName(), 'JBidPricingModel');
return $model;
}
示例5: ThemeClassic
function ThemeClassic()
{
$pathModelShowcaseTheme = JPATH_PLUGINS . DS . $this->_pluginType . DS . $this->_pluginName . DS . 'models';
$pathTableShowcaseTheme = JPATH_PLUGINS . DS . $this->_pluginType . DS . $this->_pluginName . DS . 'tables';
JModel::addIncludePath($pathModelShowcaseTheme);
JTable::addIncludePath($pathTableShowcaseTheme);
}
示例6: calculateStatsOrder
/**
* Method to calculate statistics about manufacturers in an order
*
* @param $items Array of order items
*
* @return Array with list of manufacturers and their stats
*/
function calculateStatsOrder($items)
{
$db = JFactory::getDbo();
JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/models');
Tienda::load('TiendaQuery', 'library.query');
$q = new TiendaQuery();
$q->select('manufacturer_id');
$q->from('`#__tienda_products`');
$result = array();
foreach ($items as $item) {
$q->where('product_id = ' . (int) $item->product_id);
$db->setQuery($q);
$res = $db->loadObject();
if ($res == null) {
$man_id = 0;
} else {
$man_id = $res->manufacturer_id;
}
if (!isset($result[$man_id])) {
$model = JModel::getInstance('Manufacturers', 'TiendaModel');
$model->setId($man_id);
if (!($man_item = $model->getItem())) {
$man_item = new stdClass();
}
$result[$man_id] = $man_item;
$result[$man_id]->subtotal = 0;
$result[$man_id]->total_tax = 0;
}
$result[$man_id]->subtotal += $item->orderitem_final_price;
$result[$man_id]->total_tax += $item->orderitem_tax;
}
return $result;
}
示例7: array
/**
* Overrides method to try to load model from extension if it exists
*/
public static function &getInstance($type, $prefix = '', $config = array())
{
$extensions = JoomleagueHelper::getExtensions(JRequest::getInt('p'));
foreach ($extensions as $e => $extension) {
$modelType = preg_replace('/[^A-Z0-9_\\.-]/i', '', $type);
$modelClass = $prefix . ucfirst($modelType) . ucfirst($extension);
$result = false;
if (!class_exists($modelClass)) {
jimport('joomla.filesystem.path');
$path = JPath::find(JModel::addIncludePath(), JModel::_createFileName('model', array('name' => $modelType)));
if ($path) {
require_once $path;
if (class_exists($modelClass)) {
$result = new $modelClass($config);
return $result;
}
}
} else {
$result = new $modelClass($config);
return $result;
}
}
$instance = parent::getInstance($type, $prefix, $config);
return $instance;
}
示例8: post
public function post()
{
// Set variables to be used
JMHelper::setSessionUser();
JFactory::getLanguage()->load('com_users', JPATH_ADMINISTRATOR);
// Include dependencies
jimport('joomla.application.component.controller');
jimport('joomla.form.form');
jimport('joomla.database.table');
JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_users/models');
JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_users/models/forms');
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_users/tables');
// Get user data
$data = JRequest::getVar('jform', array(), 'post', 'array');
if (!isset($data['groups'])) {
$data['groups'] = array();
}
// Save user
$model = JModel::getInstance('User', 'UsersModel');
$model->getState('user.id');
// This is only here to trigger populateState()
$success = $model->save($data);
if ($model->getError()) {
$response = $this->getErrorResponse(400, $model->getError());
} elseif (!$success) {
$response = $this->getErrorResponse(400, JText::_('COM_JM_ERROR_OCURRED'));
} else {
$response = $this->getSuccessResponse(201, JText::_('COM_JM_SUCCESS'));
$response->id = $model->getState('user.id');
}
$this->plugin->setResponse($response);
}
示例9: config
function config()
{
jimport('joomla.html.editor');
JHtml::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'htmlelements');
$model = JModel::getInstance('Comission', 'J' . APP_PREFIX . 'PricingModel');
$r = $model->getItemPrices($this->commissionType);
JModel::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'thefactory' . DS . 'category' . DS . 'models');
$catModel = JModel::getInstance('Category', 'JTheFactoryModel');
$cattree = $catModel->getCategoryTree();
$pricing = $model->loadPricingObject();
$params = new JParameter($pricing->params);
$editor = JFactory::getEditor();
$viewMenu = $this->getView('menu');
$viewMenu->display();
$view = $this->getView('Config');
$view->assign('default_price', $r->default_price);
$view->assign('price_powerseller', $r->price_powerseller);
$view->assign('price_verified', $r->price_verified);
$view->assign('category_pricing_enabled', $r->category_pricing_enabled);
$view->assign('category_pricing', $r->category_pricing);
$view->assign('category_tree', $cattree);
$view->assign('itemname', $this->itemname);
$view->assign('editor', $editor);
$view->assign('email_text', base64_decode($params->get('email_text')));
$view->display();
}
示例10: display
/**
* AS SMVC entity here we treat HTTP request and identifier map
* @access public
* @param $cachable string
* the view output will be cached
* @return void
*/
function display($cachable = false, $urlparams = false)
{
// Id entità risposta ajax che identifica il subtask da eseguire in questo caso
$params = json_decode($this->app->input->getString('data', null));
// Load additional models and make Dependency Injection thanks to JS controls
$DIModels = @$params->DIModels;
$models = array();
if (!empty($DIModels)) {
foreach ($DIModels as $DIModel) {
if ($DIModel->modelside != $this->app->getClientId()) {
// Add extra include paths
JModel::addIncludePath(JPATH_COMPONENT_SITE . 'models/');
}
$models[$DIModel->modelname] = $this->getModel($DIModel->modelname);
}
}
// This model maps Remote Procedure Call
$model = $this->getModel();
$userData = $model->loadAjaxEntity($params->idtask, $params->param, $models);
// Format response for JS client as requested
$document = JFactory::getDocument();
$viewType = $document->getType();
$coreName = $this->getNames();
$view = $this->getView($coreName, $viewType, '', array('base_path' => $this->basePath));
$view->display($userData);
}
示例11: get
public function get()
{
JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_k2/models');
$extraFieldsModel = JModel::getInstance('ExtraFields', 'K2Model');
$groups = $extraFieldsModel->getGroups();
$this->plugin->setResponse($groups);
}
示例12: display
public function display($cachable = false, $urlparams = false)
{
$session = JFactory::getSession();
$session->clear('tienda.opc.method');
$session->clear('tienda.opc.billingAddress');
$session->clear('tienda.opc.shippingAddress');
$session->clear('tienda.opc.shippingRates');
$session->clear('tienda.opc.shippingMethod');
$session->clear('tienda.opc.userCoupons');
$session->clear('tienda.opc.userCredit');
$session->clear('tienda.opc.requireShipping');
if (!$this->user->id) {
$session->set('old_sessionid', $session->getId());
}
$view = $this->getView($this->get('suffix'), 'html');
$view->setTask(true);
$order = $this->_order;
$order = $this->populateOrder();
$view->assign('order', $order);
$view->assign('user', $this->user);
JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/models');
$model = JModel::getInstance('addresses', 'TiendaModel');
$model->setState("filter_userid", $this->user->id);
$model->setState("filter_deleted", 0);
$addresses = $model->getList();
$view->assign('addresses', $addresses);
$view->setModel($model);
$showShipping = $order->isShippingRequired();
$view->assign('showShipping', $showShipping);
$session->set('tienda.opc.requireShipping', serialize($showShipping));
$view->assign('default_country', $this->default_country);
$view->assign('default_country_id', $this->default_country_id);
TiendaController::display($cachable, $urlparams);
}
示例13: _getField
private function _getField()
{
$i = 0;
$html = '';
$customfields = $this->form->getValue('customfield', 'params');
$customfields = $customfields['joomla'];
jimport('joomla.application.component.model');
JModel::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_categories' . DS . 'models', 'categories');
$model = JModel::getInstance('Categories', 'CategoriesModel', array('ignore_request' => true));
$model->setState('list.limit', '200');
$model->setState('filter.extension', 'com_content');
$mitems = $model->getItems();
$children = array();
if ($mitems) {
foreach ($mitems as $v) {
$v->parent_id = $v->parentid;
$pt = $v->parentid;
$list = @$children[$pt] ? $children[$pt] : array();
array_push($list, $v);
$children[$pt] = $list;
}
}
$mitems = array();
foreach ($list as $item) {
$item->treename = str_repeat('- ', $item->level - 1) . $item->title;
$mitems[] = JHTML::_('select.option', $item->id, ' ' . $item->treename);
}
$output = JHTML::_('select.genericlist', $mitems, $this->name, 'class="inputbox" multiple="multiple" size="15"', 'value', 'text', $this->value, $this->id);
return $output;
}
示例14: __construct
/**
* Base Controller Constructor
*
* @param array $config Controller initialization configuration parameters
* @return void
* @since 0.1
*/
public function __construct($config = array())
{
parent::__construct($config);
$this->set('option', JRequest::getCmd('option'));
JModel::addIncludePath(JPATH_SITE . '/components/com_api/models');
JTable::addIncludePath(JPATH_SITE . '/components/com_api/tables');
}
示例15: export
function export()
{
Tienda::load('TiendaCSV', 'library.csv');
$request = JRequest::get('request');
//// load the plugins
JPluginHelper::importPlugin('tienda');
JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/models');
$params = json_decode(base64_decode($request['exportParams']));
$model = JModel::getInstance($params->view, 'TiendaModel');
$list = $model->getList();
$arr = array();
$header = array();
// header -> it'll be filled out when
$fill_header = true;
// we need to fill header
for ($i = 0, $c = count($list); $i < $c; $i++) {
if ($fill_header) {
$list_vars = get_object_vars($list[$i]);
foreach ($list_vars as $key => $value) {
if ($fill_header) {
$header[] = $key;
}
}
$fill_header = false;
// header is filled
}
$arr[] = $this->objectToString($list[$i], true);
}
$f_name = 'tmp/' . $params->view . '_' . time() . '.csv';
$res = TiendaCSV::FromArrayToFile($f_name, $arr, $header);
$this->render_page($f_name, $params->view);
}