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


PHP JModel类代码示例

本文整理汇总了PHP中JModel的典型用法代码示例。如果您正苦于以下问题:PHP JModel类的具体用法?PHP JModel怎么用?PHP JModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: 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);
 }
开发者ID:romuland,项目名称:khparts,代码行数:34,代码来源:calendar.php

示例2: getInput

 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     // Initialise variables.
     $html = array();
     $recordId = (int) $this->form->getValue('id');
     $size = ($v = $this->element['size']) ? ' size="' . $v . '"' : '';
     $class = ($v = $this->element['class']) ? ' class="' . $v . '"' : 'class="text_area"';
     // Get a reverse lookup of the base link URL to Title
     $model = JModel::getInstance('menutypes', 'menusModel');
     $rlu = $model->getReverseLookup();
     switch ($this->value) {
         case 'url':
             $value = JText::_('COM_MENUS_TYPE_EXTERNAL_URL');
             break;
         case 'alias':
             $value = JText::_('COM_MENUS_TYPE_ALIAS');
             break;
         case 'separator':
             $value = JText::_('COM_MENUS_TYPE_SEPARATOR');
             break;
         default:
             $link = $this->form->getValue('link');
             // Clean the link back to the option, view and layout
             $value = JText::_(JArrayHelper::getValue($rlu, MenusHelper::getLinkKey($link)));
             break;
     }
     // Load the javascript and css
     JHtml::_('behavior.framework');
     JHtml::_('behavior.modal');
     $html[] = '<input type="text" readonly="readonly" disabled="disabled" value="' . $value . '"' . $size . $class . ' />';
     $html[] = '<input type="button" value="' . JText::_('JSELECT') . '" onclick="SqueezeBox.fromElement(this, {handler:\'iframe\', size: {x: 600, y: 450}, url:\'' . JRoute::_('index.php?option=com_menus&view=menutypes&tmpl=component&recordId=' . $recordId) . '\'})" />';
     $html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" />';
     return implode("\n", $html);
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:40,代码来源:menutype.php

示例3: asField

 /**
  * Load up a field 'select as' statement
  *
  * @param   JModel  $formModel  Form model
  * @param   string  $fieldName  Element full name
  * @param   array   &$asfields  As fields to append as statement to
  * @param   array   $opts       Options
  *
  * @throws RuntimeException
  *
  * @return  void
  */
 private function asField($formModel, $fieldName, &$asfields, $opts)
 {
     $elementModel = $formModel->getElement($fieldName);
     $fields = array();
     if ($elementModel) {
         if ($elementModel->getElement()->published != 1) {
             throw new RuntimeException('Approval ' . $fieldName . ' element must be published', 500);
         }
         $elementModel->getAsField_html($asfields, $fields, $opts);
     }
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:23,代码来源:approvals.php

示例4: postSaveHook

 /**
  * Function that allows child controller access to model data after the data has been saved.
  *
  * @param	JModel	$model	The data model object.
  *
  * @return	void
  * @since	1.6
  */
 protected function postSaveHook(JModel &$model, $validData = array())
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     $task = $this->getTask();
     switch ($task) {
         case 'save2new':
             $app->setUserState('com_modules.add.module.extension_id', $model->getState('module.extension_id'));
             break;
         default:
             $app->setUserState('com_modules.add.module.extension_id', null);
             break;
     }
 }
开发者ID:carmerin,项目名称:cesae-web,代码行数:22,代码来源:module.php

示例5: display

 public function display($tpl = null)
 {
     TOOLBAR_enmasse::_SMENU();
     $task = JRequest::getWord('task');
     switch ($task) {
         case 'show':
             TOOLBAR_enmasse::_BILLTEMPLATE();
             $this->arBillTmpl = JModel::getInstance('billTemplate', 'enmasseModel')->listAll();
             break;
         case 'edit':
             TOOLBAR_enmasse::_BILLTEMPLATE_EDIT();
             $cid = JRequest::getVar('cid', array(), 'method', 'array');
             if (!empty($cid)) {
                 $this->oBillTmpl = JModel::getInstance('billTemplate', 'enmasseModel')->getById($cid[0]);
                 if (!$this->oBillTmpl->id) {
                     $link = JRoute::_('index.php?option=com_enmasse&controller=billTemplate&task=show');
                     $msg = JText::_('BILL_TEMPLATE_INVALID_TEMPLATE_MSG');
                     JFactory::getApplication()->redirect($link, $msg, 'error');
                 }
             } else {
                 $link = JRoute::_('index.php?option=com_enmasse&controller=billTemplate&task=show');
                 $msg = JText::_('BILL_TEMPLATE_INVALID_TEMPLATE_MSG');
                 JFactory::getApplication()->redirect($link, $msg, 'error');
             }
             break;
     }
     parent::display($tpl);
 }
开发者ID:marsa1985,项目名称:kazabiz,代码行数:28,代码来源:view.html.php

示例6: 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);
 }
开发者ID:rcorral,项目名称:com_jm-plugins,代码行数:32,代码来源:user.php

示例7: __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');
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:14,代码来源:controller.php

示例8: display

 function display($tpl = null)
 {
     $option = JRequest::getCmd('option');
     $mainframe = JFactory::getApplication();
     $uri = JFactory::getUri();
     // Get data from the model
     $items = $this->get('Items');
     $this->assignRef('items', $items);
     foreach ($this->items as $item) {
         $item->count_projectdivisions = 0;
         $mdlProjectDivisions = JModel::getInstance("divisions", "JoomleagueModel");
         $item->count_projectdivisions = $mdlProjectDivisions->getProjectDivisionsCount($item->id);
         $item->count_projectpositions = 0;
         $mdlProjectPositions = JModel::getInstance("Projectposition", "JoomleagueModel");
         $item->count_projectpositions = $mdlProjectPositions->getProjectPositionsCount($item->id);
         $item->count_projectreferees = 0;
         $mdlProjectReferees = JModel::getInstance("Projectreferees", "JoomleagueModel");
         $item->count_projectreferees = $mdlProjectReferees->getProjectRefereesCount($item->id);
         $item->count_projectteams = 0;
         $mdlProjecteams = JModel::getInstance("Projectteams", "JoomleagueModel");
         $item->count_projectteams = $mdlProjecteams->getProjectTeamsCount($item->id);
         $item->count_matchdays = 0;
         $mdlRounds = JModel::getInstance("Rounds", "JoomleagueModel");
         $item->count_matchdays = $mdlRounds->getRoundsCount($item->id);
     }
     $this->addToolbar();
     parent::display($tpl);
 }
开发者ID:santas156,项目名称:joomleague-2-komplettpaket,代码行数:28,代码来源:view.html.php

示例9: doCron

 function doCron(&$pluginManager)
 {
     $db = FabrikWorker::getDbo();
     $cid = JRequest::getVar('element_id', array(), 'method', 'array');
     $query = $db->getQuery();
     $query->select('id, plugin')->from('#__{package}_cron');
     if (!empty($cid)) {
         $query->where(" id IN (" . implode(',', $cid) . ")");
     }
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $viewModel = JModel::getInstance('view', 'FabrikFEModel');
     $c = 0;
     foreach ($rows as $row) {
         //load in the plugin
         $plugin =& $pluginManager->getPlugIn($row->plugin, 'cron');
         $plugin->setId($row->id);
         $params =& $plugin->getParams();
         $thisViewModel = clone $viewModel;
         $thisViewModel->setId($params->get('table'));
         $table =& $viewModel->getTable();
         $total = $thisViewModel->getTotalRecords();
         $nav =& $thisViewModel->getPagination($total, 0, $total);
         $data = $thisViewModel->getData();
         // $$$ hugh - added table model param, in case plugin wants to do further table processing
         $c = $c + $plugin->process($data, $thisViewModel);
     }
     $query = $db->getQuery();
     $query->update('#__{package}_cron')->set('lastrun=NOW()')->where("id IN (" . implode(',', $cid) . ")");
     $db->setQuery($query);
     $db->query();
 }
开发者ID:juliano-hallac,项目名称:fabrik,代码行数:32,代码来源:plugin.raw.php

示例10: getPlugins

 /**
  * get the list's active/selected plug-ins
  * @return array
  */
 public function getPlugins()
 {
     $item = $this->getItem();
     // load up the active plug-ins
     $dispatcher =& JDispatcher::getInstance();
     $plugins = JArrayHelper::getValue($item->params, 'plugins', array());
     $return = array();
     //JModel::addIncludePath(JPATH_SITE.DS.'components'.DS.'com_fabrik'.DS.'models');
     $pluginManager = JModel::getInstance('Pluginmanager', 'FabrikFEModel');
     //@todo prob wont work for any other model that extends this class except for the form/list model
     switch (get_class($this)) {
         case 'FabrikModelList':
             $class = 'list';
             break;
         default:
             $class = 'form';
     }
     $feModel = JModel::getInstance($class, 'FabrikFEModel');
     $feModel->setId($this->getState($class . '.id'));
     foreach ($plugins as $x => $plugin) {
         $o = $pluginManager->getPlugIn($plugin, $this->pluginType);
         $o->getJForm()->model = $feModel;
         $data = (array) $item->params;
         $str = $o->onRenderAdminSettings($data, $x);
         //$str = str_replace(array("\n", "\r"), "", $str);
         $str = addslashes(str_replace(array("\n", "\r"), "", $str));
         $location = $this->getPluginLocation($x);
         $event = $this->getPluginEvent($x);
         $return[] = array('plugin' => $plugin, 'html' => $str, 'location' => $location, 'event' => $event);
     }
     return $return;
 }
开发者ID:juliano-hallac,项目名称:fabrik,代码行数:36,代码来源:fabmodeladmin.php

示例11: onValidateSelectShipping

 /**
  * 
  * @param array $values     The input values from the form
  * @return unknown_type
  */
 function onValidateSelectShipping($values)
 {
     $return = new JObject();
     $return->error = null;
     // boolean
     $return->message = null;
     // string
     if (empty($values['billing_address_id']) && empty($values['billing_input_phone_1'])) {
         $return->error = true;
         // boolean
         $return->message = JText::_('Please Include a Phone Number with Your Billing Address');
         // string
     }
     if (!empty($values['billing_address_id'])) {
         // Load the address from the database
         $model = JModel::getInstance('Addresses', 'TiendaModel');
         $model->setId($values['billing_address_id']);
         $address = $model->getItem();
         // Does the address have a phone number associated with it?
         // if not, what do you want to do?
         if (empty($address->phone_1)) {
             $return->error = true;
             // boolean
             $return->message = JText::_('Stored Address Missing Phone Number');
             // string
         }
     }
     return $return;
 }
开发者ID:annggeel,项目名称:tienda,代码行数:34,代码来源:requirephonenumber.php

示例12: display

 function display($tpl = null)
 {
     $model =& JModel::getInstance('jigs', 'BattleModel');
     $player = $model->get_stats();
     // print_r($player[0]);
     $this->assignRef('player', $player);
     $computer_action = JRequest::getCmd('action');
     if ($computer_action != '') {
         $model = $this->getmodel();
         $model->{$computer_action}($player);
     }
     $flags = $player[0]['flags'];
     $flags = explode(',', $flags);
     if (!in_array(2, $flags)) {
     } elseif (in_array(2, $flags)) {
         if (!in_array(3, $flags)) {
             //update flags to 3 so we never have to login again
             $model =& JModel::getInstance('jigs', 'BattleModel');
             $flags[] = 3;
             $model->update_flags($flags);
             $tpl = "computer_page_1";
             // first time view
         } else {
             $tpl = "computer_page_2";
         }
     }
     parent::display($tpl);
 }
开发者ID:yatan,项目名称:JiGS-PHP-RPG-engine,代码行数:28,代码来源:view.html.php

示例13: display

 public function display($tpl = null)
 {
     // get model and update context with current
     $model =& JModel::getInstance('urls', 'Sh404sefModel');
     $context = $model->setContext($this->_context . '.' . $this->getLayout());
     // store it
     $model =& $this->setModel($model, true);
     // read data from model
     $list =& $model->getList((object) array('layout' => $this->getLayout(), 'getPageId' => true));
     // and push it into the view for display
     $this->assign('items', $list);
     $this->assign('itemCount', count($this->items));
     $this->assign('pagination', $model->getPagination((object) array('layout' => $this->getLayout(), 'getPageId' => true)));
     $options = $model->getDisplayOptions();
     $this->assign('options', $options);
     $this->assign('optionsSelect', $this->_makeOptionsSelect($options));
     $this->assign('helpMessage', JText16::_('COM_SH404SEF_PAGEID_HELP'));
     // add behaviors and styles as needed
     $modalSelector = 'a.modalediturl';
     $js = '\\function(){shAlreadySqueezed = false;if(parent.shReloadModal) {parent.window.location=\'' . $this->defaultRedirectUrl . '\';parent.shReloadModal=true}}';
     $params = array('overlayOpacity' => 0, 'classWindow' => 'sh404sef-popup', 'classOverlay' => 'sh404sef-popup', 'onClose' => $js);
     Sh404sefHelperHtml::modal($modalSelector, $params);
     // build the toolbar
     $toolbarMethod = '_makeToolbar' . ucfirst($this->getLayout());
     if (is_callable(array($this, $toolbarMethod))) {
         $this->{$toolbarMethod}($params);
     }
     // add our own css
     JHtml::styleSheet('list.css', Sh404sefHelperGeneral::getComponentUrl() . '/assets/css/');
     // link to  custom javascript
     JHtml::script('list.js', Sh404sefHelperGeneral::getComponentUrl() . '/assets/js/');
     JHtml::script('metas.js', Sh404sefHelperGeneral::getComponentUrl() . '/assets/js/');
     // now display normally
     parent::display($tpl);
 }
开发者ID:justinlyon,项目名称:scc,代码行数:35,代码来源:view.html.php

示例14: passPHP

	/**
	 * passPHP
	 *
	 * @param <object> $params
	 * @param <array> $selection
	 * @param <string> $assignment
	 *
	 * @return <bool>
	 */
	function passPHP( &$main, &$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 = str_replace( '[:REGEX_ENTER:]', '\n', $php );

			if ( trim( $php ) == '' ) {
				$pass = 1;
				break;
			}

			if ( !$article && !( strpos( $php, '$article' ) === false ) && $main->_params->option == 'com_content' && $main->_params->view == 'article' ) {
				require_once JPATH_SITE.'/components/com_content/models/article.php';
				$model = JModel::getInstance( 'article', 'contentModel' );
				$model->setId( $main->_params->id );
				$article = $model->getArticle();
			}
			if ( !isset( $Itemid ) ) {
				$Itemid = JRequest::getInt( 'Itemid' );
			}
			if ( !isset( $mainframe ) ) {
				$mainframe = ( strpos( $php, '$mainframe' ) === false ) ? '' : JFactory::getApplication();
			}
			if ( !isset( $app ) ) {
				$app = ( strpos( $php, '$app' ) === false ) ? '' : JFactory::getApplication();
			}
			if ( !isset( $database ) ) {
				$database = ( strpos( $php, '$database' ) === false ) ? '' : JFactory::getDBO();
			}
			if ( !isset( $db ) ) {
				$db = ( strpos( $php, '$db' ) === false ) ? '' : JFactory::getDBO();
			}
			if ( !isset( $user ) ) {
				$user = ( strpos( $php, '$user' ) === false ) ? '' : JFactory::getUser();
			}

			$vars = '$article,$Itemid,$mainframe,$app,$database,$db,$user';

			$val = '$temp_PHP_Val = create_function( \''.$vars.'\', $php.\';\' );';
			$val .= ' $pass = ( $temp_PHP_Val('.$vars.') ) ? 1 : 0; unset( $temp_PHP_Val );';
			@eval( $val );

			if ( $pass ) {
				break;
			}
		}

		if ( $pass ) {
			return ( $assignment == 'include' );
		} else {
			return ( $assignment == 'exclude' );
		}
	}
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:69,代码来源:php.php

示例15: getState

 function getState($property = null)
 {
     if (!$this->__state_set) {
         $option = JRequest::getCmd('option');
         $app =& JFactory::getApplication();
         $context = $option . '.' . $this->getName();
         $this->setState('filter_published', $app->getUserStateFromRequest($context . '.filter_published', 'filter_published', 0, 'int'));
         $this->setState('filter_catid', $app->getUserStateFromRequest($context . '.filter_catid', 'filter_catid', 0, 'int'));
         $this->setState('filter_species', $app->getUserStateFromRequest($context . '.filter_species', 'filter_species', 0, 'word'));
         $this->setState('filter_location_state', $app->getUserStateFromRequest($context . '.filter_location_state', 'filter_location_state', 0, 'word'));
         $this->setState('filter_adoption_status', $app->getUserStateFromRequest($context . '.filter_adoption_status', 'filter_adoption_status', 0, 'word'));
         $this->setState('filter_real_time_need', $app->getUserStateFromRequest($context . '.filter_real_time_need', 'filter_real_time_need', 0, 'word'));
         $this->setState('filter_real_time_status', $app->getUserStateFromRequest($context . '.filter_real_time_status', 'filter_real_time_status', 0, 'word'));
         $this->setState('filter_search', $app->getUserStateFromRequest($context . '.filter_search', 'filter_search', ''));
         $this->setState('filter_order', $app->getUserStateFromRequest($context . '.filter_order', 'filter_order', 'title', 'cmd'));
         $this->setState('filter_order_Dir', $app->getUserStateFromRequest($context . '.filter_order_Dir', 'filter_order_Dir', 'ASC', 'word'));
         $limit = $app->getUserStateFromRequest($context . '.limit', 'limit', $app->getCfg('list_limit', 5), 'int');
         //strange limitstart
         //	$limitstart	= $app->getUserStateFromRequest( $context.'.limitstart', 'limitstart', 0, 'int' );
         $limitstart = JRequest::getInt('limitstart', 0, '', 'int');
         $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
         $this->setState('limit', $limit);
         $this->setState('limitstart', $limitstart);
         $this->__state_set = true;
     }
     return parent::getState($property);
 }
开发者ID:snellcode,项目名称:ARCNA-Animals,代码行数:27,代码来源:animals.php


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