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


PHP JModelLegacy::getState方法代码示例

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


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

示例1: 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

示例2: getState

 /**
  * Overridden method to get model state variables.
  *
  * @param	string	$property	Optional parameter name.
  * @param	mixed	$default	The default value to use if no state property exists by name.
  * @return	object	The property where specified, the state object where omitted.
  * @since	1.6
  */
 public function getState($property = null, $default = null)
 {
     // if the model state is uninitialized lets set some values we will need from the request.
     if ($this->__state_set === false) {
         $this->__state_set = true;
     }
     $value = parent::getState($property);
     return is_null($value) ? $default : $value;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:17,代码来源:schema.php

示例3: testGetState

 /**
  * Tests the getState method.
  *
  * @since   12.3
  *
  * @return  void
  */
 public function testGetState()
 {
     $state = $this->fixture->getState();
     $this->assertTrue($state instanceof JObject);
     $stateSet = TestReflection::getValue($this->fixture, '__state_set');
     $this->assertTrue($stateSet === true);
     $this->fixture->setState('foo.bar', 'baz');
     $this->assertEquals('baz', $this->fixture->getState('foo.bar'));
     $this->assertEquals('defaultVal', $this->fixture->getState('non.existent', 'defaultVal'));
     $this->assertNull($this->fixture->getState('non.existent'));
 }
开发者ID:karimzg,项目名称:joomla,代码行数:18,代码来源:JModelLegacyTest.php

示例4: getState

	function getState($property = null, $default = null) {
		static $set;

		if (!$set) {
			$folder = JFactory::getApplication()->input->get('folder', '');
			$this->setState('folder', $folder);

			$set = true;
		}
		return parent::getState($property);
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:11,代码来源:imagehandler.php

示例5: getState

 public function getState($property = null, $default = null)
 {
     static $set;
     if (!$set) {
         $input = JFactory::getApplication()->input;
         $fieldid = $input->get('fieldid', '');
         $this->setState('field.id', $fieldid);
         $set = true;
     }
     return parent::getState($property, $default);
 }
开发者ID:sankam-nikolya,项目名称:lptt,代码行数:11,代码来源:fonts.php

示例6: getState

 function getState($property = null, $default = null)
 {
     static $set;
     if (!$set) {
         $folder = JRequest::getVar('folder', '', '', 'path');
         $this->setState('folder', $folder);
         $parent = str_replace("\\", "/", dirname($folder));
         $parent = $parent == '.' ? null : $parent;
         $this->setState('parent', $parent);
         $set = true;
     }
     return parent::getState($property, $default);
 }
开发者ID:NavaINT1876,项目名称:ccustoms,代码行数:13,代码来源:list.php

示例7: getState

 public function getState($property = null, $default = null)
 {
     static $set;
     if (!$set) {
         $input = JFactory::getApplication()->input;
         $folder = $input->get('folder', '', 'path');
         $this->setState('folder', $folder);
         $parent = str_replace("\\", "/", dirname($folder));
         $parent = $parent == '.' ? null : $parent;
         $this->setState('parent', $parent);
         $set = true;
     }
     return parent::getState($property, $default);
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:14,代码来源:list.php

示例8: postSaveHook

 /**
  * Function that allows child controller access to model data after the data has been saved.
  *
  * @param   JModelLegacy  $model      The data model object.
  * @param   array         $validData  The validated data.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function postSaveHook(JModelLegacy $model, $validData = array())
 {
     $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;
     }
     $app->setUserState('com_modules.add.module.params', null);
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:24,代码来源:module.php

示例9: getState

 /**
  * Overridden method to get model state variables.
  *
  * @param	string	$property	Optional parameter name.
  * @param	mixed	$default	The default value to use if no state property exists by name.
  * @return	object	The property where specified, the state object where omitted.
  * @since	1.6
  */
 public function getState($property = null, $default = null)
 {
     // if the model state is uninitialized lets set some values we will need from the request.
     if ($this->__state_set === false) {
         $app = JFactory::getApplication();
         $this->setState('action', $step = $app->getUserState('com_kunena.install.action', null));
         $this->setState('step', $step = $app->getUserState('com_kunena.install.step', 0));
         $this->setState('task', $task = $app->getUserState('com_kunena.install.task', 0));
         $this->setState('version', $task = $app->getUserState('com_kunena.install.version', null));
         if ($step == 0) {
             $app->setUserState('com_kunena.install.status', array());
         }
         $this->setState('status', $app->getUserState('com_kunena.install.status'));
         $this->__state_set = true;
     }
     $value = parent::getState($property);
     return is_null($value) ? $default : $value;
 }
开发者ID:sillysachin,项目名称:teamtogether,代码行数:26,代码来源:model.php

示例10: testGetStateReturnsDefaultValue

 /**
  *Tests the getState method.
  *
  * @since   12.3
  *
  * @return  void
  *
  * @testdox getState() returns default value
  */
 public function testGetStateReturnsDefaultValue()
 {
     $this->assertEquals('defaultVal', $this->fixture->getState('non.existent', 'defaultVal'));
     $this->assertNull($this->fixture->getState('non.existent'));
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:14,代码来源:JModelLegacyTest.php

示例11: postSaveHook

 /**
  * Function that allows child controller access to model data after the data has been saved.
  *
  * @param   JModelLegacy  $model  The data model object.
  * @param   array         $validData   The validated data.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function postSaveHook(JModelLegacy $model, $validData = array())
 {
     $authority = $model->getState('request.authority');
     //$id = $model->getState('form.id');
     if ($validData['payment']['payment_type'] == 'ACCELERATION_CARDS' && $authority) {
         $this->setMessage(JText::_('COM_SIBDIET_REQUEST_SAVED_ONLINE_PAYMENT'));
         //$this->setRedirect(JRoute::_('index.php?&option=com_sibdiet&view=onlinepayment&id=' . $id, false));
         $this->setRedirect('https://www.zarinpal.com/pg/StartPay/' . $authority);
     } elseif ($validData['payment']['payment_type'] == '') {
         $this->setMessage(JText::_('COM_SIBDIET_REQUEST_SAVED_NO_PAYMENT'));
         $this->setRedirect(JRoute::_('index.php?option=com_sibdiet&view=requests', false));
     } else {
         $this->setMessage(JText::_('COM_SIBDIET_REQUEST_SAVED'));
         $this->setRedirect(JRoute::_('index.php?option=com_sibdiet&view=requests', false));
     }
     $this->redirect();
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:27,代码来源:request.php

示例12: postSaveHook

 protected function postSaveHook(JModelLegacy $model, $validData = array())
 {
     $task = $this->getTask();
     if ($task == 'save' || $task == 'apply') {
         $isNew = $model->getState('editevent.new');
         $id = $model->getState('editevent.id');
         $enabled = JPluginHelper::isEnabled('jem', 'mailer');
         if ($enabled) {
             JPluginHelper::importPlugin('jem', 'mailer');
             $dispatcher = JEventDispatcher::getInstance();
             $dispatcher->trigger('onEventEdited', array($id, $isNew));
         } else {
             JError::raiseNotice(100, JText::_('COM_JEM_GLOBAL_MAILERPLUGIN_DISABLED'));
         }
     }
 }
开发者ID:JKoelman,项目名称:JEM-3,代码行数:16,代码来源:editevent.php

示例13: postSaveHook

 /**
  * Function that allows child controller access to model data after the data has been saved.
  *
  * @param     jmodel    $model    The data model object.
  * @param     array     $data     The validated data.
  *
  * @return    void
  */
 protected function postSaveHook(JModelLegacy $model, $data = array())
 {
     $task = $this->getTask();
     $id = (int) $model->getState('form.id');
     switch ($task) {
         case 'save2copy':
         case 'save2new':
             // No redirect because its already set
             break;
         case 'save2tasklist':
             $link = JRoute::_(PFtasksHelperRoute::getTasksRoute() . '&task=tasklistform.add&milestone_id=' . $id);
             $this->setRedirect($link);
             break;
         case 'save2task':
             $link = JRoute::_(PFtasksHelperRoute::getTasksRoute() . '&task=taskform.add&milestone_id=' . $id);
             $this->setRedirect($link);
             break;
         default:
             $this->setRedirect(JRoute::_($this->getReturnPage()));
             break;
     }
 }
开发者ID:eno93,项目名称:Projectfork,代码行数:30,代码来源:form.php


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