本文整理汇总了PHP中JModelLegacy::addIncludePath方法的典型用法代码示例。如果您正苦于以下问题:PHP JModelLegacy::addIncludePath方法的具体用法?PHP JModelLegacy::addIncludePath怎么用?PHP JModelLegacy::addIncludePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JModelLegacy
的用法示例。
在下文中一共展示了JModelLegacy::addIncludePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Method to delete a row from the database table by primary key value.
*
* @param mixed An optional primary key value to delete. If not set the
* instance property value is used.
* @return boolean True on success.
* @since 1.0
* @link http://docs.joomla.org/JTable/delete
*/
public function delete($pk = null)
{
$query = $this->_db->getQuery(true);
// Delete all rooms belong to it
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_solidres/models', 'SolidresModel');
$query->clear();
$query->select('*')->from($this->_db->quoteName('#__sr_rooms'))->where('room_type_id = ' . $this->_db->quote($pk));
$rooms = $this->_db->setQuery($query)->loadObjectList();
$roomModel = JModelLegacy::getInstance('Room', 'SolidresModel');
foreach ($rooms as $room) {
$roomModel->delete($room->id);
}
// Delete all coupons relation
$query->clear();
$query->delete($this->_db->quoteName('#__sr_room_type_coupon_xref'))->where('room_type_id = ' . $this->_db->quote($pk));
$this->_db->setQuery($query)->execute();
// Delete all extras relation
$query->clear();
$query->delete($this->_db->quoteName('#__sr_room_type_extra_xref'))->where('room_type_id = ' . $this->_db->quote($pk));
$this->_db->setQuery($query)->execute();
// Delete all custom fields
$query->clear();
$query->delete($this->_db->quoteName('#__sr_room_type_fields'))->where('room_type_id = ' . $this->_db->quote($pk));
$this->_db->setQuery($query)->execute();
// Delete all media
$query->clear();
$query->delete($this->_db->quoteName('#__sr_media_roomtype_xref'))->where('room_type_id = ' . $this->_db->quote($pk));
$this->_db->setQuery($query)->execute();
// Delete all prices
$query->clear();
$query->delete($this->_db->quoteName('#__sr_prices'))->where('room_type_id = ' . $this->_db->quote($pk));
$this->_db->setQuery($query)->execute();
// Delete itself
return parent::delete($pk);
}
示例2: delete
/**
* Method to delete a row from the database table by primary key value.
*
* @param mixed $pk An optional primary key value to delete. If not set the
* instance property value is used.
*
* @return boolean True on success.
* @since 0.3.0
*/
public function delete($pk = null)
{
$k = $this->_tbl_key;
$pk = is_null($pk) ? $this->{$k} : $pk;
$query = $this->_db->getQuery(true);
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_solidres/models', 'UsersModel');
// Take care of Customer records
$query->select('COUNT(id)')->from($this->_db->quoteName('#__sr_customers'))->where('customer_group_id = ' . $pk);
$this->_db->setQuery($query);
$result = (int) $this->_db->loadResult();
if ($result > 0) {
$e = new JException(JText::sprintf('SR_ERROR_CUSTOMER_GROUP_CONTAINS_CUSTOMER', $this->name));
$this->setError($e);
return false;
}
// Delete all prices
$query->clear();
$query->delete($this->_db->quoteName('#__sr_prices'))->where('customer_group_id = ' . $this->_db->quote($pk));
$this->_db->setQuery($query)->execute();
// Take care of Coupon
$couponsModel = JModelLegacy::getInstance('Coupons', 'SolidresModel', array('ignore_request' => true));
$couponModel = JModelLegacy::getInstance('Coupon', 'SolidresModel', array('ignore_request' => true));
$couponsModel->setState('filter.customer_group_id', $pk);
$coupons = $couponsModel->getItems();
foreach ($coupons as $coupon) {
$couponModel->delete($coupon->id);
}
// Delete it
return parent::delete($pk);
}
示例3: getCalendar
public function getCalendar()
{
$data = new stdClass();
$pairId = JRequest::getInt('id');
$monday = JRequest::getInt('monday', strtotime('monday this week'));
$pair =& JTable::getInstance('pairslanguage', 'VideoTranslationTable');
$pair->load($pairId);
$language =& JTable::getInstance('language', 'VideoTranslationTable');
$language->load($pair->langId1);
$data->language1 = $language->name;
$language->load($pair->langId2);
$data->language2 = $language->name;
$data->monday = date("F j", $monday);
$data->sunday = date("F j, Y", $monday + 6 * 24 * 60 * 60);
JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_videotranslation/models', 'VideoTranslationModel');
$frontpage = JModelLegacy::getInstance('frontpage', 'VideoTranslationModel', array('ignore_request' => true));
$this->populateState();
$filter_interpreter = $this->getState('filter.interpreter_id');
for ($i = 0; $i < 7; $i++) {
$data->weekdays[] = date("l", $monday + $i * 24 * 60 * 60);
//list items
$data->rows[date("l", $monday + $i * 24 * 60 * 60)] = $frontpage->getItemsForThisDay($monday + $i * 24 * 60 * 60, $monday + $i * 24 * 60 * 60 + 24 * 60 * 60, $pairId, 0, $filter_interpreter);
}
$userspair =& JTable::getInstance('userspair', 'VideoTranslationTable');
// $language->load($pair->langId1);
$data->interpreters = $userspair->getInterpreters($pairId, $filter_interpreter);
for ($i = 0; $i < 96; $i++) {
$data->items[$i] = new stdClass();
$data->items[$i]->time = date("G:i", $monday + $i * 15 * 60);
}
return $data;
}
示例4: selectCategory
static function selectCategory($name, $params=array()) {
$cfg = class_exists('JTheFactoryHelper') ? BidsHelperTools::getConfig() : new BidConfig();//so it can be used in modules too
JModelLegacy::addIncludePath(JPATH_ROOT.DS.'components'.DS.'com_bids'.DS.'models');
$model = JModelLegacy::getInstance('bidscategory','bidsmodel');
$model->loadCategoryTree();
$lang = JFactory::getLanguage();
$lang->load('com_bids');
$treeCat = $model->get('categories');
$spacer = ' ';
$opts = array();
$opts[] = JHTML::_('select.option', '', JText::_('COM_BIDS_CHOOSE_CATEGORY') );
foreach($treeCat as $c) {
$text = ' '.str_repeat($spacer,$c->depth).$c->title.PHP_EOL;
$opts[] = JHTML::_('select.option',$c->id,$text, 'value', 'text', ($cfg->bid_opt_leaf_posting_only && $c->nrSubcategories) );
}
$name = isset($params['name']) ? $params['name'] : 'cat';
$attribs = isset($params['attribs']) ? $params['attribs'] : '';
$selected = isset($params["select"]) ? $params["select"] : '';
return JHTML::_('select.genericlist', $opts, $name, $attribs, 'value', 'text', $selected);
}
示例5: ajaxAction
public function ajaxAction()
{
JSession::checkToken('get') or die;
$actionId = JRequest::getInt('action');
$href = JRequest::getVar('href');
$href = urldecode($href);
$params = JRequest::getVar('params');
if (is_array($params)) {
foreach ($params as $key => $value) {
$params[$key] = rawurldecode($value);
}
} else {
$params = array();
}
JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_jfbconnect/models');
$jfbcOgActionModel = JModelLegacy::getInstance('OpenGraphAction', 'JFBConnectModel');
$action = $jfbcOgActionModel->getAction($actionId);
$response = $jfbcOgActionModel->triggerAction($action, $href, $params);
if ($response->status) {
echo $response->message;
} else {
if (JFBCFactory::config()->getSetting('facebook_display_errors') && $response->message != "") {
echo "Error: " . $response->message;
}
}
exit;
}
示例6: getItems
/**
*
* @return unknown_type
*/
function getItems()
{
// Check the registry to see if our Citruscart class has been overridden
if (!class_exists('Citruscart')) {
JLoader::register("Citruscart", JPATH_ADMINISTRATOR . "/components/com_citruscart/defines.php");
}
// load the config class
Citruscart::load('Citruscart', 'defines');
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables');
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/models');
// get the model
$model = JModelLegacy::getInstance('Manufacturers', 'CitruscartModel');
// 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 = Citruscart::getClass("CitruscartHelperRoute", 'helpers.route')->manufacturer($item->manufacturer_id, false);
if (empty($item->itemid)) {
$item->itemid = $this->params->get('itemid');
}
}
}
return $items;
}
示例7: getInstance
/**
* 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(parent::addIncludePath(null, $prefix), self::_createFileName('model', array('name' => $type)));
if (!$path) {
$path = JPath::find(parent::addIncludePath(null, ''), self::_createFileName('model', array('name' => $type)));
}
if ($path) {
require_once $path;
if (class_exists($modelClass)) {
$result = new $modelClass($config);
return $result;
}
}
} else {
$result = new $modelClass($config);
return $result;
}
}
// Still here ? Then the extension doesn't override this, use regular way
return parent::getInstance($type, $prefix, $config);
}
示例8: _getField
private function _getField()
{
$i = 0;
$html = '';
$customfields = $this->form->getValue('customfield', 'params');
$customfields = $customfields['joomla'];
jimport('joomla.application.component.model');
if (version_compare(JVERSION, '3.0') < 0) {
JModel::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_categories' . DS . 'models', 'categories');
$model = JModel::getInstance('Categories', 'CategoriesModel', array('ignore_request' => true));
} else {
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_categories/models', 'categories');
$model = JModelLegacy::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;
}
示例9: ThemeFlow
function ThemeFlow()
{
$pathModelShowcaseTheme = JPATH_PLUGINS . DS . $this->_pluginType . DS . $this->_pluginName . DS . 'models';
$pathTableShowcaseTheme = JPATH_PLUGINS . DS . $this->_pluginType . DS . $this->_pluginName . DS . 'tables';
JModelLegacy::addIncludePath($pathModelShowcaseTheme);
JTable::addIncludePath($pathTableShowcaseTheme);
}
示例10: 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];
}
示例11: display
function display($tpl = null)
{
$model = JFBCFactory::config();
$jfbcLibrary = JFBCFactory::provider('facebook');
require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php';
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_templates/models');
$templatesModel = JModelLegacy::getInstance('Styles', 'TemplatesModel');
$allTemplates = $templatesModel->getItems();
$templates = array();
foreach ($allTemplates as $template) {
if ($template->client_id == 0) {
// Make it the same as J15 so we can use the same selectlist
$template->directory = $template->id;
$template->name = $template->title;
$templates[] = $template;
}
}
// Add the "Don't Override" option to set no special template
$defaultTemplate = new stdClass();
$defaultTemplate->directory = -1;
$defaultTemplate->name = JText::_('COM_JFBCONNECT_CANVAS_DISPLAY_TEMPLATE_DEFAULT');
array_unshift($templates, $defaultTemplate);
require_once JPATH_ADMINISTRATOR . '/components/com_jfbconnect/controllers/canvas.php';
$canvasProperties = JFBConnectControllerCanvas::setupCanvasProperties();
$canvasTabTemplate = $model->getSetting('canvas_tab_template', -1);
$canvasCanvasTemplate = $model->getSetting('canvas_canvas_template', -1);
$this->assignRef('canvasProperties', $canvasProperties);
$this->assignRef('canvasTabTemplate', $canvasTabTemplate);
$this->assignRef('canvasCanvasTemplate', $canvasCanvasTemplate);
$this->assignRef('templates', $templates);
$this->assignRef('model', $model);
$this->assignRef('jfbcLibrary', $jfbcLibrary);
$this->addToolbar();
parent::display($tpl);
}
示例12: getItems
public static function getItems(&$params)
{
$id = (int) $params->get('autoridade', 0);
$modo = $params->get('modo_agenda', '');
$limit = (int) $params->get('limit_compromissos', -1);
$order = $params->get('order_compromissos', 'NEXT_DESC');
$params_dia = $params->get('dia', '');
$featured = $params->get('featured_compromissos', '');
if (!empty($featured) && !is_numeric($featured)) {
$featured = '';
}
if (empty($params_dia)) {
$params->set('dia', self::getDia($params));
}
JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_agendadirigentes/models', 'AgendaDirigentesModel');
$model = JModelLegacy::getInstance('Compromissos', 'AgendaDirigentesModel', array('ignore_request' => true));
$model->setState('autoridade.id', $id);
$model->setState('participantes.load', false);
$model->setState('filter.featured', $featured);
$model->setState('params', $params);
if ($limit > -1) {
$model->setState('list.limit', $limit);
}
$items = $model->getItems();
for ($i = 0, $limit = count($items); $i < $limit; $i++) {
$items[$i]->horario_inicio = str_replace(':', 'h', $items[$i]->horario_inicio);
$items[$i]->horario_fim = str_replace(':', 'h', $items[$i]->horario_fim);
}
return $items;
}
示例13: display
/**
* Called via ajax to perform viz ajax task (defined by plugintask method)
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController A JController object to support chaining.
*/
public function display($cachable = false, $urlparams = false)
{
$document = JFactory::getDocument();
$app = JFactory::getApplication();
$input = $app->input;
$id = $input->getInt('visualizationid');
$viz = FabTable::getInstance('Visualization', 'FabrikTable');
$viz->load($id);
$modelpaths = JModelLegacy::addIncludePath(JPATH_SITE . '/plugins/fabrik_visualization/' . $viz->plugin . '/models');
$model = $this->getModel($viz->plugin);
$model->setId($id);
$pluginTask = $input->get('plugintask', '', 'request');
if ($pluginTask !== '') {
echo $model->{$pluginTask}();
} else {
$task = $input->get('task');
$path = JPATH_SITE . '/plugins/fabrik_visualization/' . $viz->plugin . '/controllers/' . $viz->plugin . '.php';
if (file_exists($path)) {
require_once $path;
} else {
throw new RuntimeException('Could not load visualization: ' . $viz->plugin);
}
$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 = JModelLegacy::addIncludePath(JPATH_SITE . '/plugins/fabrik_visualization/' . $viz->plugin . '/models');
$modelpaths = JModelLegacy::addIncludePath(COM_FABRIK_FRONTEND . '/models');
$origId = $input->getInt('visualizationid');
$input->set('visualizationid', $id);
$controller->{$task}();
}
return $this;
}
示例14: getTagHtml
protected function getTagHtml()
{
$requestID = $this->getParamValue('request_id');
$linkText = $this->getParamValue('link_text');
$linkImage = $this->getParamValue('link_image');
$tagString = '';
if ($requestID != '') {
JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_jfbconnect/models');
$requestModel = JModelLegacy::getInstance('Request', "JFBConnectModel");
$request = $requestModel->getData($requestID);
if ($request && $request->published) {
$message = str_replace("\r\n", " ", $request->message);
$linkValue = $linkText;
if ($linkImage != '') {
$linkValue = '<img src="' . $linkImage . '" alt="' . $request->title . ' "/>';
}
$tagString = '<a href="javascript:void(0)" onclick="jfbc.request.popup(' . $requestID . '); return false;">' . $linkValue . '</a>';
$tagString .= <<<EOT
<script type="text/javascript">
var jfbcRequests = Object.prototype.toString.call(jfbcRequests) == "[object Array]" ? jfbcRequests : [];
var jfbcRequest = new Object;
jfbcRequest.title = "{$request->title}";
jfbcRequest.message = "{$message}";
jfbcRequest.destinationUrl = "{$request->destination_url}";
jfbcRequest.thanksUrl = "{$request->thanks_url}";
jfbcRequests[{$requestID}] = jfbcRequest;
</script>
EOT;
}
}
return $tagString;
}
示例15: array
public static function &getBalance(&$params)
{
JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_videotranslation/models', 'VideoTranslationModel');
$model = JModelLegacy::getInstance('cart', 'VideoTranslationModel', array('ignore_request' => true));
$item = $model->getBalance();
return $item;
}