当前位置: 首页>>代码示例>>PHP>>正文


PHP JModelLegacy::getInstance方法代码示例

本文整理汇总了PHP中JModelLegacy::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP JModelLegacy::getInstance方法的具体用法?PHP JModelLegacy::getInstance怎么用?PHP JModelLegacy::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JModelLegacy的用法示例。


在下文中一共展示了JModelLegacy::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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();
 }
开发者ID:ankaau,项目名称:GathBandhan,代码行数:41,代码来源:view.html.php

示例2: passPHP

 function passPHP(&$parent, &$params, $selection = array(), $assignment = 'all', $article = 0)
 {
     if (!is_array($selection)) {
         $selection = array($selection);
     }
     $pass = 0;
     foreach ($selection as $php) {
         // replace \n with newline and other fix stuff
         $php = str_replace('\\|', '|', $php);
         $php = preg_replace('#(?<!\\\\)\\\\n#', "\n", $php);
         $php = trim(str_replace('[:REGEX_ENTER:]', '\\n', $php));
         if ($php == '') {
             $pass = 1;
             break;
         }
         if (!$article && strpos($php, '$article') !== false) {
             $article = '';
             if ($parent->params->option == 'com_content' && $parent->params->view == 'article') {
                 require_once JPATH_SITE . '/components/com_content/models/article.php';
                 $model = JModelLegacy::getInstance('article', 'contentModel');
                 $article = $model->getItem($parent->params->id);
             }
         }
         if (!isset($Itemid)) {
             $Itemid = JFactory::getApplication()->input->getInt('Itemid', 0);
         }
         if (!isset($mainframe)) {
             $mainframe = JFactory::getApplication();
         }
         if (!isset($app)) {
             $app = JFactory::getApplication();
         }
         if (!isset($document)) {
             $document = JFactory::getDocument();
         }
         if (!isset($doc)) {
             $doc = JFactory::getDocument();
         }
         if (!isset($database)) {
             $database = JFactory::getDBO();
         }
         if (!isset($db)) {
             $db = JFactory::getDBO();
         }
         if (!isset($user)) {
             $user = JFactory::getUser();
         }
         $php .= ';return true;';
         $temp_PHP_func = create_function('&$article, &$Itemid, &$mainframe, &$app, &$document, &$doc, &$database, &$db, &$user', $php);
         // evaluate the script
         ob_start();
         $pass = (bool) $temp_PHP_func($article, $Itemid, $mainframe, $app, $document, $doc, $database, $db, $user);
         unset($temp_PHP_func);
         ob_end_clean();
         if ($pass) {
             break;
         }
     }
     return $parent->pass($pass, $assignment);
 }
开发者ID:smart-one,项目名称:3kita,代码行数:60,代码来源:php.php

示例3: delete

 public function delete($pk = null)
 {
     // Get form model
     $formModel = JModelLegacy::getInstance('form', 'IssnregistryModel');
     if ($pk != null) {
         // Get number of forms related to this publisher
         $formsCount = $formModel->getFormsCountByPublisherId($pk);
         // Check result
         if ($formsCount != 0) {
             // If there are forms, the publisher can't be deleted
             JFactory::getApplication()->enqueueMessage(JText::_('COM_ISSNREGISTRY_PUBLISHER_DELETE_FAILED_FORMS_EXIST'), 'warning');
             // Return false as the item can't be deleted
             return false;
         }
         // Delete messages
         //$messageModel = JModelLegacy::getInstance('message', 'IssnregistryModel');
         //$messageModel->deleteByPublisherId($pk);
     }
     if (parent::delete($pk)) {
         // If this publisher was created based on a form, remove
         // publisher created attribute from the form
         if ($this->form_id != 0) {
             $formModel->removePublisherCreated($this->form_id);
         }
         // Get message model
         $messageModel = JModelLegacy::getInstance('message', 'IssnregistryModel');
         // Delete messages related to this publisher
         $messageModel->deleteByPublisherId($pk);
         // Return true
         return true;
     }
     return false;
 }
开发者ID:petkivim,项目名称:id-registry,代码行数:33,代码来源:publisher.php

示例4: postSaveHook

 /**
  * Update the ordered items in post save hook
  */
 protected function postSaveHook(JModelLegacy $model, $validData = array())
 {
     $order_id = $model->getState($model->getName() . '.id');
     $data = JFactory::getApplication()->input->post->getArray(array('jform' => array('ordered' => 'array', 'deleted' => 'array')));
     // We add order items right on order edit view
     foreach ($data['jform']['ordered'] as $item) {
         $item['order_id'] = $order_id;
         $model = JModelLegacy::getInstance('OrderItem', 'DZProductModel');
         $form = $model->getForm($item, false);
         if (!$form) {
             continue;
         }
         $validItem = $model->validate($form, $item);
         if ($validItem === false) {
             continue;
         }
         if (!$model->save($validItem)) {
             continue;
         }
     }
     // Make sure the submitted deleted ids are all integer
     JArrayHelper::toInteger($data['jform']['deleted']);
     // Remove items
     $model = JModelLegacy::getInstance('OrderItem', 'DZProductModel');
     $model->delete($data['jform']['deleted']);
 }
开发者ID:nadsrosun,项目名称:ProductComparisonDemo,代码行数:29,代码来源:order.php

示例5: initialise

 private function initialise()
 {
     static $loaded = false;
     if (!$loaded || true) {
         defined('DS') || define('DS', DIRECTORY_SEPARATOR);
         require_once JPATH_SITE . '/components/com_sobipro/lib/sobi.php';
         Sobi::Initialise();
         if (SOBI_CMS == 'joomla3') {
             SPFactory::header()->initBase(true)->addJsFile(array('sobipro', 'jqnc', 'adm.sobipro', 'adm.jnmenu', 'jquery-base64'));
         } else {
             SPFactory::header()->initBase(true)->addJsFile(array('sobipro', 'jquery', 'adm.sobipro', 'adm.jnmenu', 'jquery-migrate', 'jquery-base64'))->addCSSCode('#toolbar-box { display: block }');
         }
         $loaded = true;
         SPLoader::loadClass('mlo.input');
         SPLoader::loadClass('models.datamodel');
         SPLoader::loadClass('models.dbobject');
         SPLoader::loadModel('section');
         $model = JModelLegacy::getInstance('MenusModelItem')->getItem();
         self::$mid = $model->id;
         if (isset($model->params['SobiProSettings']) && strlen($model->params['SobiProSettings'])) {
             $this->params = json_decode(base64_decode($model->params['SobiProSettings']));
         }
         $jsString = json_encode(array('component' => Sobi::Txt('SOBI_NATIVE_TASKS'), 'buttonLabel' => Sobi::Txt('SOBI_SELECT_FUNCTIONALITY')));
         SPFactory::header()->addJsCode("SpStrings = {$jsString}; ");
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:26,代码来源:native.php

示例6: display

 /**
  * Display the Message templates view
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  */
 function display($tpl = null)
 {
     // Get data from the model
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     // Add menu helper file
     require_once JPATH_COMPONENT . '/helpers/menu.php';
     // Add sidebar
     MenuHelper::addSubmenu('messagetemplates');
     // Load message type model
     $model = JModelLegacy::getInstance('messagetype', 'IssnregistryModel');
     // Load message types
     $types = $model->getMessageTypesHash();
     // Pass $types to the layout
     $this->assignRef('types', $types);
     // Set the toolbar
     $this->addToolBar();
     // Render the sidebar
     $this->sidebar = JHtmlSidebar::render();
     // Display the template
     parent::display($tpl);
 }
开发者ID:petkivim,项目名称:id-registry,代码行数:34,代码来源:view.html.php

示例7: display

 function display($tpl = NULL)
 {
     /**
      * @var JSite $app
      */
     $app = JFactory::getApplication();
     $this->params = $app->getParams();
     /* Default Page fallback*/
     $active = $app->getMenu()->getActive();
     if (NULL == $active) {
         $this->params->merge($app->getMenu()->getDefault()->params);
         $active = $app->getMenu()->getDefault();
     }
     $this->currentItemid = $active->id;
     $entriesPerPage = $this->params->get('max_events_per_page', 12);
     $model = $this->getModel('events');
     $eventModel = JModelLegacy::getInstance('Event', 'EventgalleryModel');
     $recursive = $this->params->get('show_items_per_category_recursive', false);
     $user = JFactory::getUser();
     $usergroups = JUserHelper::getUserGroups($user->id);
     $entries = $model->getEntries(JRequest::getVar('start', 0), $entriesPerPage, $this->params->get('tags'), $this->params->get('sort_events_by'), $usergroups, $this->params->get('catid', null), $recursive);
     $this->pageNav = $model->getPagination();
     $this->entries = $entries;
     $this->eventModel = $eventModel;
     $this->_prepareDocument();
     parent::display($tpl);
 }
开发者ID:sansandeep143,项目名称:av,代码行数:27,代码来源:view.html.php

示例8: display

 public function display($cachable = true, $urlparams = false)
 {
     //error_log("IN AkrecipesControllerBrand::display ")		;
     $app = JFactory::getApplication();
     $view = $app->input->getCmd('view', 'brand');
     JFactory::getApplication()->input->set('view', $view);
     //error_log("Recipes Brand Param --> " . print_r($app->getParams(),true));
     $brand_id = $app->input->getInt('id');
     //error_log("brand_id --> " . $brand_id);
     JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_akrecipes/models');
     //$recipes_model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
     $recipes_model = JModelLegacy::getInstance('Recipes', 'AkrecipesModel', array());
     $num_recipes = (int) $app->getParams()->get('brandpage_num_recipes', 24);
     $app->input->set('limit', $num_recipes);
     $app->input->set('ignore_intro_leading', true);
     //$recipes_model->setState('list.limit',$num_recipes);
     $recipes_model->setState('filter.brand_id', $brand_id);
     $recipes_model->setState('catid.id', '');
     $app->input->set('filter_order', 'publish_up');
     $app->input->set('filter_order_Dir', 'DESC');
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $viewName = $this->input->get('view', $this->default_view);
     $viewLayout = $this->input->get('layout', 'default', 'string');
     $view = $this->getView($viewName, $viewType, '', array('base_path' => $this->basePath, 'layout' => $viewLayout));
     // // Get/Create the model
     // if ($model = $this->getModel($viewName))
     // {
     // 	// Push the model into the view (as default)
     // 	$view->setModel($model, true);
     // }
     $view->setModel($recipes_model);
     parent::display($cachable, $urlparams);
     return $this;
 }
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:35,代码来源:brand.php

示例9: display

 /**
  * Return statistics CSV file
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  */
 function display($tpl = null)
 {
     $this->item = $this->get('Item');
     // Get parameters
     $jinput = JFactory::getApplication()->input;
     $type = $jinput->get('type', null, 'string');
     $begin = $jinput->get('begin', null, 'string');
     $end = $jinput->get('end', null, 'string');
     // Convert date strings to JDate objects
     $beginDate = new JDate($begin);
     $endDate = new JDate($end . ' 23:59:59');
     // Get statistic model
     $statisticModel = JModelLegacy::getInstance('statistic', 'IssnregistryModel');
     // Get statistics
     $csv = $statisticModel->getStats($type, $beginDate, $endDate);
     // Set document properties
     $document = JFactory::getDocument();
     $document->setMimeEncoding('text/csv; charset="UTF-8"');
     JResponse::setHeader('Content-disposition', 'attachment; filename="statistics.csv"', true);
     // Write to output
     $out = fopen('php://output', 'w');
     // Loop through CSV data and write each row to output
     foreach ($csv as $row) {
         // Columns are tab separated
         fputcsv($out, $row, "\t");
     }
     // Close output
     fclose($out);
 }
开发者ID:petkivim,项目名称:id-registry,代码行数:36,代码来源:view.csv.php

示例10: display

 /**
  * Method to display the view.
  *
  * @param	string	The template file to include
  * @since	1.6
  */
 public function display($tpl = null)
 {
     //load required files
     JForm::addFormPath(JPATH_SITE . '/components/com_users/models/forms');
     JForm::addFieldPath(JPATH_SITE . '/components/com_users/models/fields');
     require_once JPATH_SITE . '/components/com_users/models/registration.php';
     //load com_users language
     $lang = JFactory::getLanguage();
     $lang->load('com_users');
     $model = JModelLegacy::getInstance('Registration', 'UsersModel');
     $app = JFactory::getApplication();
     // Get the view data.
     $this->data = $model->getData();
     $this->form = $model->getForm();
     //$this->state	= $model->get('State');
     $this->params = $app->getParams('com_hs_users');
     // Check for errors.
     if (count($errors = $model->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     // Check for layout override
     $active = JFactory::getApplication()->getMenu()->getActive();
     if (isset($active->query['layout'])) {
         $this->setLayout($active->query['layout']);
     }
     //Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->prepareDocument();
     parent::display($tpl);
 }
开发者ID:nickolanack,项目名称:joomla-hs-users,代码行数:37,代码来源:view.html.php

示例11: display

 /**
  * Return statistics XLS file
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  */
 function display($tpl = null)
 {
     $this->item = $this->get('Item');
     // Get parameters
     $jinput = JFactory::getApplication()->input;
     $type = $jinput->get('type', null, 'string');
     $begin = $jinput->get('begin', null, 'string');
     $end = $jinput->get('end', null, 'string');
     // Convert date strings to JDate objects
     $beginDate = new JDate($begin);
     $endDate = new JDate($end . ' 23:59:59');
     // Get statistic model
     $statisticModel = JModelLegacy::getInstance('statistic', 'IsbnregistryModel');
     // Get statistics
     $data = $statisticModel->getStats($type, $beginDate, $endDate);
     // Set document properties
     $document = JFactory::getDocument();
     $document->setMimeEncoding('application/vnd.ms-excel; charset="UTF-8"');
     JResponse::setHeader('Content-disposition', 'attachment; filename="statistics.xml"', true);
     // Get Excel helper
     require_once JPATH_COMPONENT . '/helpers/php-export-data.class.php';
     // Create new Excled worksheet
     $excel = new ExportDataExcel('browser');
     $excel->filename = "statistics.xml";
     $excel->initialize();
     // Loop through data array
     foreach ($data as $row) {
         // Add rows
         $excel->addRow($row);
     }
     // Finalize
     $excel->finalize();
 }
开发者ID:petkivim,项目名称:id-registry,代码行数:40,代码来源:view.xls.php

示例12: changeBlock

 /**
  * Method to change the block status on a record.
  *
  * @return  void
  *
  * @since   0.3.0
  */
 public function changeBlock()
 {
     // Check for request forgeries.
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $ids = $this->input->get('cid', array(), 'array');
     $values = array('block' => 1, 'unblock' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($values, $task, 0, 'int');
     // Convert from customer ID to Joomla user ID
     $joomlaUserIds = array();
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_solidres/tables', 'SolidresTable');
     $customerTable = JTable::getInstance('Customer', 'SolidresTable');
     foreach ($ids as $id) {
         $customerTable->load($id);
         $joomlaUserIds[] = $customerTable->user_id;
     }
     if (empty($joomlaUserIds)) {
         JError::raiseWarning(500, JText::_('SR_CUSTOMERS_NO_ITEM_SELECTED'));
     } else {
         // Get the model.
         JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_users/models', 'UsersModel');
         $model = JModelLegacy::getInstance('User', 'UsersModel', array('ignore_request' => true));
         // Change the state of the records.
         if (!$model->block($joomlaUserIds, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             if ($value == 1) {
                 $this->setMessage(JText::plural('SR_N_CUSTOMERS_BLOCKED', count($joomlaUserIds)));
             } elseif ($value == 0) {
                 $this->setMessage(JText::plural('SR_N_CUSTOMERS_UNBLOCKED', count($joomlaUserIds)));
             }
         }
     }
     $this->setRedirect('index.php?option=com_solidres&view=customers');
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:42,代码来源:customers.php

示例13: execute

 /**
  * Execute Create Instance
  *
  * @param	string	$path	Path of create files
  */
 public static function execute($config = array())
 {
     $item = JModelLegacy::getInstance("Template", "JDeveloperModel")->getItem($config['item_id']);
     $dir = $item->createDir;
     // Create folders
     JFolder::create($dir . "/css");
     JFolder::create($dir . "/html");
     JFolder::create($dir . "/images");
     JFolder::create($dir . "/js");
     JFolder::create($dir . "/less");
     // Copy files
     JFile::copy(JDeveloperTEMPLATES . "/template/template.css", $dir . "/css/template.css");
     foreach (JFolder::files(JDeveloperCREATE . "/template", "php\$") as $file) {
         $class = JDeveloperCreate::getInstance("template." . JFile::stripExt($file), $config);
         if (!$class->create()) {
             $errors = $class->getErrors();
             if (!empty($errors)) {
                 throw new JDeveloperException($errors);
             }
         }
     }
     JDeveloperCreate::getInstance("language.template", $config)->create();
     JDeveloperCreate::getInstance("language.template.sys", $config)->create();
     JFile::copy(JDeveloperTEMPLATES . "/template/favicon.ico", $dir . "/favicon.ico");
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:30,代码来源:template.php

示例14: getGroups

 /**
  * Method to get the field option groups.
  *
  * @return  array  The field option objects as a nested array in groups.
  *
  * @since   11.1
  * @throws  UnexpectedValueException
  */
 protected function getGroups()
 {
     $db = JFactory::getDbo();
     $groups = array("Components", "Tables");
     // Component relations
     $query = $db->getQuery(true)->select("a.relation")->from("#__jdeveloper_forms AS a")->where("a.relation LIKE 'component%'")->where("a.level = 1");
     $rows = $db->setQuery($query)->loadAssocList();
     $model = JModelLegacy::getInstance("Component", "JDeveloperModel");
     $group = JText::_("COM_JDEVELOPER_FORM_FILTER_GROUP_COMPONENTS");
     foreach ($rows as $row) {
         $id = explode(".", $row->relation)[1];
         $item = $model->getItem($id);
         $groups[$group][] = JHtml::_('select.option', $row->relation, ucfirst($item->name));
     }
     // Table relations
     $query = $db->getQuery(true)->select("a.relation")->from("#__jdeveloper_forms AS a")->where("a.relation LIKE 'table%'")->where("a.level = 1");
     $rows = $db->setQuery($query)->loadObjectList();
     $model = JModelLegacy::getInstance("Table", "JDeveloperModel");
     $group = JText::_("COM_JDEVELOPER_FORM_FILTER_GROUP_TABLES");
     foreach ($rows as $row) {
         $id = explode(".", $row->relation)[1];
         $item = $model->getItem($id);
         $groups[$group][] = JHtml::_('select.option', $row->relation, ucfirst($item->name));
     }
     return array_merge(parent::getGroups(), $groups);
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:34,代码来源:formrelation.php

示例15: getList

 public static function getList(&$params)
 {
     // Get the dbo
     $db = JFactory::getDbo();
     // Get an instance of the generic tracks model
     $model = JModelLegacy::getInstance('Sections', 'PlayjoomModel', array('ignore_request' => true));
     // Set application parameters in model
     $app = JFactory::getApplication();
     $appParams = $app->getParams();
     $model->setState('params', $appParams);
     // Set the filters based on the module params
     $model->setState('list.start', 0);
     $model->setState('list.limit', (int) $params->get('count', 5));
     // Access filter
     $access = !JComponentHelper::getParams('com_playjoom')->get('show_noauth', 1);
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $ordering = 'a.access_datetime';
     $dir = 'DESC';
     $model->setState('list.ordering', $ordering);
     $model->setState('list.direction', $dir);
     $items = $model->getItems();
     //create item link
     foreach ($items as &$item) {
         //Check for Trackcontrol
         if (JPluginHelper::isEnabled('playjoom', 'trackcontrol') == false) {
             $item->link = null;
         } else {
             $item->link = JRoute::_('index.php?option=com_playjoom&view=broadcast&id=' . $item->id);
         }
         $item->accessinfo = modLastPlayedHelper::GetTimeInfoList($item->access_datetime, $params, 'access');
     }
     return $items;
 }
开发者ID:TFToto,项目名称:playjoom-builds,代码行数:33,代码来源:helper.php


注:本文中的JModelLegacy::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。