• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP JModelForm类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testValidatePassesDataAndGroupToJform

 /**
  * Test JModelForm::validate
  *
  * @since   3.4
  *
  * @return  void
  *
  * @testdox validate() passes data and group to JForm
  */
 public function testValidatePassesDataAndGroupToJform()
 {
     $data = array("a" => "b");
     $group = "groupy";
     $formMock = $this->getMockBuilder('JForm')->disableOriginalConstructor()->getMock();
     $formMock->expects($this->once())->method('validate')->with($data, $group)->willReturn(true);
     $formMock->expects($this->once())->method('filter')->with($data)->will($this->returnArgument(0));
     $this->object->validate($formMock, $data, $group);
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:18,代码来源:JModelFormTest.php


示例2: onAfterRoute

 /**
  * onAfterRoute function.
  *
  * @access public
  * @return void
  */
 public function onAfterRoute()
 {
     $option = $this->getOption();
     if ($option === false || !isset(self::$componentList[$option])) {
         return;
     }
     MVCOverrideHelperCodepool::initialize();
     // Add override paths for the current component files
     foreach (MVCOverrideHelperCodepool::addCodePath() as $codePool) {
         if (version_compare(JVERSION, '3.0', '>=')) {
             JViewLegacy::addViewHelperPath($codePool . '/' . $option);
             JViewLegacy::addViewTemplatePath($codePool . '/' . $option);
         } else {
             JView::addViewHelperPath($codePool . '/' . $option);
             JView::addViewTemplatePath($codePool . '/' . $option);
         }
         JModuleHelper::addIncludePath($codePool . '/modules');
         JTable::addIncludePath($codePool . '/' . $option . '/tables');
         JModelForm::addComponentFormPath($codePool . '/' . $option . '/models/forms');
         JModelForm::addComponentFieldPath($codePool . '/' . $option . '/models/fields');
     }
 }
开发者ID:rizwanchaudhry,项目名称:mvcOverride,代码行数:28,代码来源:mvcoverride.php


示例3: display

 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a JError object.
  *
  * @see     fetch()
  * @since   11.1
  */
 public function display($tpl = null)
 {
     // Initialize variables
     $session = JFactory::getSession();
     $seesionQueue = $session->get('application.queue');
     $input = JFactory::getApplication()->input;
     $this->urlAction = $input->getString('tmpl', '');
     $this->_document = JFactory::getDocument();
     $this->_item = $this->get('Item');
     $emailModel = JModelForm::getInstance('EmailSettings', 'JSNUniformModel');
     $this->checkSubmitModal = false;
     if ($seesionQueue[0]['type'] != "warning") {
         unset($_SESSION["__form-design-" . $this->_item->form_id]);
         unset($_SESSION["__form-design-"]);
         if ($seesionQueue[0]) {
             if ($this->urlAction == "component") {
                 $this->checkSubmitModal = true;
             }
         }
     }
     $this->_listFontType = array(" Verdana, Geneva, sans-serif", "\"Times New Roman\", Times, serif", "\"Courier New\", Courier, monospace", "Tahoma, Geneva, sans-serif", "Arial, Helvetica, sans-serif", "\"Trebuchet MS\", Arial, Helvetica, sans-serif", "\"Arial Black\", Gadget, sans-serif", "\"Lucida Sans Unicode\", \"Lucida Grande\", sans-serif", "\"Palatino Linotype\", \"Book Antiqua\", Palatino, serif", "\"Comic Sans MS\", cursive");
     $formContent = $this->_item->form_content;
     $this->_listPage = JSNUniformHelper::getListPage($formContent, $this->_item->form_id);
     $this->_form = $this->get('Form');
     $this->_fromEmail = array();
     if (empty($this->_item->form_id)) {
         $this->_fromConfig = $this->get('DataConfig');
         $this->formAction = 0;
         $this->formActionData = '';
         foreach ($this->_fromConfig as $formConfig) {
             if (isset($formConfig->name) && $formConfig->name == 'email_notification') {
                 $this->_fromEmail = json_decode($formConfig->value);
             }
             if (isset($formConfig->name) && $formConfig->name == 'form_action') {
                 $this->formAction = $formConfig->value;
             }
         }
         foreach ($this->_fromConfig as $formConfig) {
             if ($this->formAction == 1 && $formConfig->name == 'form_action_url') {
                 $this->formActionData = $formConfig->value;
             }
             if ($this->formAction == 2 && $formConfig->name == 'form_action_menu') {
                 $this->formActionData = json_decode($formConfig->value);
             }
             if ($this->formAction == 3 && $formConfig->name == 'form_action_article') {
                 $this->formActionData = json_decode($formConfig->value);
             }
             if ($this->formAction == 4 && $formConfig->name == 'form_action_message') {
                 $this->formActionData = $formConfig->value;
             }
         }
     } else {
         $this->_fromEmail = $this->get('FormEmail');
     }
     $this->form_page = isset($formContent[0]->page_content) ? $formContent[0]->page_content : "";
     $this->actionForm = array('redirect_to_url' => "", 'menu_item' => "", 'menu_item_title' => "", 'article' => "", 'article_title' => "", 'message' => "", 'action' => "1");
     $this->actionForm = JSNUniformHelper::actionFrom($this->_item->form_post_action, $this->_item->form_post_action_data);
     $this->globalFormStyle = JSNUniformHelper::getDataConfig("form_style");
     $this->formStyle = new stdClass();
     if (!empty($this->_item->form_style)) {
         $this->formStyle = json_decode($this->_item->form_style);
     } else {
         $this->formStyle->themes_style->light = '{"background_color":"","background_active_color":"#FCF8E3","border_thickness":"0","border_color":"","border_active_color":"#FBEED5","rounded_corner_radius":"0","padding_space":"10","margin_space":"0","text_color":"#333333","font_type":" Verdana, Geneva, sans-serif","font_size":"14","field_background_color":"#ffffff","field_border_color":"","field_shadow_color":"","field_text_color":"#666666","message_error_background_color":"#B94A48","message_error_text_color":"#FFFFFF"}';
         $this->formStyle->themes_style->dark = '{"background_color":"","background_active_color":"#444444","border_thickness":"0","border_color":"","border_active_color":"#666666","rounded_corner_radius":"0","padding_space":"10","margin_space":"0","text_color":"#C6C6C6","font_type":" Verdana, Geneva, sans-serif","font_size":"14","field_background_color":"#000000","field_border_color":"#111111","field_shadow_color":"#000000","field_text_color":"#333333","message_error_background_color":"#B94A48","message_error_text_color":"#FFFFFF"}';
         $this->formStyle->themes = array('light', 'dark');
     }
     if (!empty($this->globalFormStyle)) {
         $globalFormStyle = json_decode($this->globalFormStyle->value);
         if (!empty($globalFormStyle->themes_style)) {
             foreach ($globalFormStyle->themes_style as $key => $value) {
                 $this->formStyle->themes_style->{$key} = $value;
             }
         }
         if (!empty($globalFormStyle->themes)) {
             foreach ($globalFormStyle->themes as $key => $value) {
                 $this->formStyle->themes[] = $value;
             }
         }
     }
     if (!empty($this->formStyle->theme) && !empty($this->formStyle->themes_style) && $this->formStyle->theme != "jsn-style-light" && $this->formStyle->theme != "jsn-style-dark") {
         $theme = str_replace("jsn-style-", "", $this->formStyle->theme);
         if (!empty($this->formStyle->themes_style->{$theme})) {
             $styles = json_decode($this->formStyle->themes_style->{$theme});
         }
         $this->formStyle->background_color = !empty($styles->background_color) ? $styles->background_color : "";
         $this->formStyle->background_active_color = !empty($styles->background_active_color) ? $styles->background_active_color : "";
         $this->formStyle->border_active_color = !empty($styles->border_active_color) ? $styles->border_active_color : "";
         $this->formStyle->border_thickness = !empty($styles->border_thickness) ? $styles->border_thickness : "";
         $this->formStyle->border_color = !empty($styles->border_color) ? $styles->border_color : "";
         $this->formStyle->rounded_corner_radius = !empty($styles->rounded_corner_radius) ? $styles->rounded_corner_radius : "";
//.........这里部分代码省略.........
开发者ID:densem-2013,项目名称:exikom,代码行数:101,代码来源:view.html.php


示例4: __construct

 public function __construct($config = array())
 {
     $udbPath = UserNotesHelper::userDataPath() . '/usernotes.db3';
     $db = JDatabaseDriver::getInstance(array('driver' => 'sqlite', 'database' => $udbPath));
     $config['dbo'] = $db;
     parent::__construct($config);
 }
开发者ID:ron4mac,项目名称:joomla_com_usernotes,代码行数:7,代码来源:edit.php


示例5: getItem

 /**
  * Method to get the record form.
  *
  * @param   string  $pk  Private key.
  *
  * @since   2.2
  * @return   null
  */
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         // Do any procesing on fields here if needed
     }
     return $item;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:15,代码来源:zoneform.php


示例6:

 function __construct()
 {
     parent::__construct();
     $this->projectid = JRequest::getInt('p', 0);
     $this->ptid = JRequest::getInt('ptid', 0);
     $this->tid = JRequest::getInt('tid', 0);
 }
开发者ID:santas156,项目名称:joomleague-2-komplettpaket,代码行数:7,代码来源:editprojectteam.php


示例7: populateState

 /**
  * Method to auto-populate the model state.
  * Note. Calling getState in this method will result in recursion.
  * @since    1.6
  */
 protected function populateState()
 {
     parent::populateState();
     $app = JFactory::getApplication("Site");
     /** @var $app JApplicationSite * */
     // Get the pk of the record from the request.
     $value = $app->input->getInt("id");
     $this->setState($this->getName() . '.id', $value);
 }
开发者ID:phpsource,项目名称:CrowdFunding,代码行数:14,代码来源:friendmail.php


示例8: __construct

 public function __construct($config = array())
 {
     parent::__construct($config);
     global $ext_name_com, $ext_prefix;
     $this->ext_name_com = $ext_name_com;
     $this->ext_prefix = $ext_prefix;
     $this->context .= $this->getName() && ($layout = JRequest::getVar('layout', 'default')) ? '.' . $layout : '';
     $this->params = JComponentHelper::getParams($this->ext_name_com);
 }
开发者ID:JexyRu,项目名称:Ksenmart,代码行数:9,代码来源:modelksform.php


示例9: populateState

 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @since    1.6
  */
 protected function populateState()
 {
     parent::populateState();
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     // Load the parameters.
     $value = $app->getParams($this->option);
     $this->setState('params', $value);
 }
开发者ID:xop32,项目名称:Proof-of-Identity,代码行数:16,代码来源:proof.php


示例10: getForm

 /**
  * Method to get a form object.
  *
  * @return	mixed		A JForm object on success, false on failure.
  * @since	1.6
  */
 public function getForm()
 {
     // Get the form.
     $form = parent::getForm('application', 'com_config.application', array('array' => 'jform', 'event' => 'onPrepareForm'));
     // Check for an error.
     if (JError::isError($form)) {
         $this->setError($form->getMessage());
         return false;
     }
     return $form;
 }
开发者ID:joebushi,项目名称:joomla,代码行数:17,代码来源:application.php


示例11: preprocessForm

 protected function preprocessForm(JForm $form, $data, $group = 'contact')
 {
     $userParams = JComponentHelper::getParams('com_contact');
     // Deal with captcha
     $captcha = $userParams->get('captcha', '0');
     if ($captcha === '0') {
         $form->removeField('captcha');
     } else {
         $form->setFieldAttribute('captcha', 'plugin', $captcha);
     }
     parent::preprocessForm($form, $data, 'user');
 }
开发者ID:ngxuanmui,项目名称:hanhphuc.vn,代码行数:12,代码来源:contact.php


示例12: populateState

 protected function populateState()
 {
     $app = JFactory::getApplication();
     $id = JRequest::getInt($this->pk_name);
     $this->setState(strtolower($this->model_key) . '.' . $this->pk_name, $id);
     $cmd = JRequest::getCmd('cmd', '');
     $this->setState(strtolower($this->model_key) . '.cmd', $cmd);
     // Load the parameters.
     $params = $app->getParams();
     $this->setState('params', $params);
     parent::populateState();
 }
开发者ID:acculitx,项目名称:fleetmatrixsite,代码行数:12,代码来源:baseedit.php


示例13: populateState

 /**
  * Method to auto-populate the model state.
  * Note. Calling getState in this method will result in recursion.
  * @since    1.6
  */
 protected function populateState()
 {
     parent::populateState();
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     // Get the pk of the record from the request.
     $value = $app->input->getInt('id');
     $this->setState($this->getName() . '.id', $value);
     // Load the parameters.
     $params = $app->getParams();
     $this->setState('params', $params);
 }
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:17,代码来源:friendmail.php


示例14: getForm

 /**
  * Method to get the record form.
  *
  * @return	mixed	JForm object on success, false on failure.
  * @since	1.6
  */
 public function getForm()
 {
     // Get the form.
     $form = parent::getForm('download', 'com_banners.download', array('array' => 'jform'));
     // Check for an error.
     if (JError::isError($form)) {
         $this->setError($form->getMessage());
         return false;
     }
     $form->setValue('basename', $this->getState('basename'));
     $form->setValue('compressed', $this->getState('compressed'));
     return $form;
 }
开发者ID:joebushi,项目名称:joomla,代码行数:19,代码来源:download.php


示例15: getForm

 /**
  * Method to get the record form.
  *
  * @return	mixed	JForm object on success, false on failure.
  */
 public function getForm()
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     // Get the form.
     $form = parent::getForm('config', 'com_messages.config', array('array' => 'jform', 'event' => 'onPrepareForm'));
     // Check for an error.
     if (JError::isError($form)) {
         $this->setError($form->getMessage());
         return false;
     }
     return $form;
 }
开发者ID:joebushi,项目名称:joomla,代码行数:18,代码来源:config.php


示例16: populateState

 /**
  * Method to auto-populate the model state.
  * Note. Calling getState in this method will result in recursion.
  * @since    1.6
  */
 protected function populateState()
 {
     parent::populateState();
     $app = JFactory::getApplication("Site");
     /** @var $app JApplicationSite * */
     // Get the pk of the record from the request.
     $value = $app->input->getInt("id");
     $this->setState('item_id', $value);
     $value = $app->input->getInt("comment_id");
     $this->setState('comment_id', $value);
     // Load the parameters.
     $value = $app->getParams($this->option);
     $this->setState('params', $value);
 }
开发者ID:pippogsm,项目名称:UserIdeas,代码行数:19,代码来源:comment.php


示例17: populateState

 /**
  * Method to auto-populate the model state.
  * Note. Calling getState in this method will result in recursion.
  * @since    1.6
  */
 protected function populateState()
 {
     parent::populateState();
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     // Get the pk of the record from the request.
     $value = $app->input->getInt("id", 0);
     $this->setState($this->getName() . '.id', $value);
     // Get category ID
     $value = $app->getUserState($this->option . ".items.catid");
     $this->setState('category_id', $value);
     // Load the parameters.
     $value = $app->getParams($this->option);
     $this->setState('params', $value);
 }
开发者ID:johngrange,项目名称:wookeyholeweb,代码行数:20,代码来源:form.php


示例18: __construct

 public function __construct($config)
 {
     parent::__construct($config);
     // Чтение username из таблицы User
     $user =& JFactory::getUser();
     $this->username = $user->get('id');
     if ($this->username == null) {
         $this->username = 0;
     }
     // Возвращаем ссылку на глобальный объект базы данных
     $this->db = $this->getDBO();
     if (!$this->db->connected()) {
         echo "Нет соединения с сервером баз данных. Повторите запрос позже";
         jexit();
     }
     ### for test only
     //$this->username = 6334;
 }
开发者ID:rsam,项目名称:com_tsj,代码行数:18,代码来源:snwaters.php


示例19: getForm

 /**
  * Method to get the row form.
  *
  * @return	mixed	JForm object on success, false on failure.
  */
 public function getForm()
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     // Get the form.
     $form = parent::getForm('mail', 'com_users.mail', array('array' => 'jform', 'event' => 'onPrepareForm'));
     // Check for an error.
     if (JError::isError($form)) {
         $this->setError($form->getMessage());
         return false;
     }
     // Check the session for previously entered form data.
     $data = $app->getUserState('com_users.display.mail.data', array());
     // Bind the form data if present.
     if (!empty($data)) {
         $form->bind($data);
     }
     return $form;
 }
开发者ID:joebushi,项目名称:joomla,代码行数:24,代码来源:mail.php


示例20: getForm

 /**
  * Method to get the registration form.
  *
  * The base form is loaded from XML and then an event is fired
  * for users plugins to extend the form with extra fields.
  *
  * @access	public
  * @return	mixed		JForm object on success, false on failure.
  * @since	1.0
  */
 function getForm()
 {
     // Get the form.
     $form = parent::getForm('registration', 'com_users.registration', array('array' => 'jform', 'event' => 'onPrepareForm'));
     // Check for an error.
     if (JError::isError($form)) {
         $this->setError($form->getMessage());
         return false;
     }
     // Get the dispatcher and load the users plugins.
     $dispatcher =& JDispatcher::getInstance();
     JPluginHelper::importPlugin('users');
     // Trigger the form preparation event.
     $results = $dispatcher->trigger('onPrepareUserRegistrationForm', array(&$form));
     // Check for errors encountered while preparing the form.
     if (count($results) && in_array(false, $results, true)) {
         $this->setError($dispatcher->getError());
         return false;
     }
     return $form;
 }
开发者ID:joebushi,项目名称:joomla,代码行数:31,代码来源:registration.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP JModelLegacy类代码示例发布时间:2022-05-23
下一篇:
PHP JModelAdmin类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap