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


PHP JModelForm::getInstance方法代码示例

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


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

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

示例2: save

 /**
  * Override save method to save form fields to database
  *
  * @param   array  $data  Data form
  *
  * @return boolean
  */
 public function save($data)
 {
     $user = JFactory::getUser();
     $post = $_POST;
     $emailModel = JModelForm::getInstance('EmailSettings', 'JSNUniformModel');
     if (isset($post['jform']['email-settings']['administrator'])) {
         $emailModel->saveForm($post['jform']['email-settings']['administrator']);
     }
     if (isset($post['jform']['email-settings']['submiter'])) {
         $emailModel->saveForm($post['jform']['email-settings']['submiter']);
     }
     $checkCreate = true;
     $data['form_submitter'] = isset($post['form_submitter']) ? json_encode($post['form_submitter']) : '';
     $data['form_post_action_data'] = isset($post['form_post_action_data' . $data['form_post_action']]) ? $post['form_post_action_data' . $data['form_post_action']] : '';
     if ($data['form_post_action_data']) {
         $data['form_post_action_data'] = get_magic_quotes_gpc() == true || get_magic_quotes_runtime() == true ? stripslashes($data['form_post_action_data']) : $data['form_post_action_data'];
     }
     $data['form_notify_submitter'] = isset($data['form_notify_submitter']) ? "1" : "0";
     $globalStyle = array();
     if (!empty($post['form_style']['themes_style'])) {
         $themeStyle = array();
         $themes = array();
         foreach ($post['form_style']['themes_style'] as $key => $value) {
             if ($key == "light" || $key == "dark") {
                 $themeStyle[$key] = $value;
                 $themes[] = $key;
             } else {
                 $globalStyle['themes_style'][$key] = $value;
                 $globalStyle['themes'][] = $key;
             }
         }
         $post['form_style']['themes_style'] = $themeStyle;
         $post['form_style']['themes'] = $themes;
     }
     $formSettings = new stdClass();
     $plgName = JSNUniformHelper::getPluginUniform();
     if (isset($plgName) && !empty($plgName)) {
         if (is_array($plgName)) {
             foreach ($plgName as $k => $v) {
                 $v = (array) $v;
                 $name = form_ . '' . $v['value'];
                 $formSettings->{$name} = !empty($post[$name]) ? $post[$name] : '';
                 JSNUniformControllerForm::do_ajax('saveBackEnd', $v['value'], $post[$name]);
             }
         }
     }
     $formSettings->form_show_mailchimp_subcriber = !empty($_POST['jsn_form_mailchimp_subcriber']['form_show_mailchimp_subcriber']) ? $_POST['jsn_form_mailchimp_subcriber']['form_show_mailchimp_subcriber'] : "No";
     $formSettings->form_mailchimp_subcriber_text = !empty($_POST['jsn_form_mailchimp_subcriber']['form_mailchimp_subcriber_text']) ? $_POST['jsn_form_mailchimp_subcriber']['form_mailchimp_subcriber_text'] : JText::_('JSN_UNIFORM_CUSTOM_MESSAGE_FOR_MAILCHIMP_SUBCRIBER');
     $formSettings->form_payment_money_value_text = !empty($_POST['jsn_form_total_money']['form_payment_money_value_text']) ? $_POST['jsn_form_total_money']['form_payment_money_value_text'] : JText::_('JSN_UNIFORM_TOTAL_MONEY');
     $formSettings->form_payment_money_value = !empty($_POST['jsn_form_total_money']['form_payment_money_value']) ? $_POST['jsn_form_total_money']['form_payment_money_value'] : '';
     $formSettings->form_show_total_money_text = !empty($_POST['jsn_form_total_money']['form_show_total_money_text']) ? $_POST['jsn_form_total_money']['form_show_total_money_text'] : "Yes";
     $formSettings->form_btn_next_text = !empty($_POST['jsn_form_button']['form_btn_next_text']) ? $_POST['jsn_form_button']['form_btn_next_text'] : JText::_('NEXT');
     $formSettings->form_btn_prev_text = !empty($_POST['jsn_form_button']['form_btn_prev_text']) ? $_POST['jsn_form_button']['form_btn_prev_text'] : JText::_('PREV');
     $formSettings->form_btn_submit_text = !empty($_POST['jsn_form_button']['form_btn_submit_text']) ? $_POST['jsn_form_button']['form_btn_submit_text'] : JText::_('SUBMIT');
     $formSettings->form_btn_submit_custom_class = !empty($_POST['jsn_form_button']['form_btn_submit_custom_class']) ? $_POST['jsn_form_button']['form_btn_submit_custom_class'] : '';
     $formSettings->form_btn_reset_text = !empty($_POST['jsn_form_button']['form_btn_reset_text']) ? $_POST['jsn_form_button']['form_btn_reset_text'] : JText::_('RESET');
     $formSettings->form_state_btn_reset_text = !empty($_POST['jsn_form_button']['form_state_btn_reset_text']) ? $_POST['jsn_form_button']['form_state_btn_reset_text'] : "No";
     $formSettings->action_save_submissions = !empty($_POST['jsn_uniform_settings']['action_save_submissions']) ? $_POST['jsn_uniform_settings']['action_save_submissions'] : 0;
     $data['form_settings'] = json_encode($formSettings);
     $data['form_style'] = !empty($post['form_style']) ? json_encode($post['form_style']) : "";
     $data['form_style'] = get_magic_quotes_gpc() == true || get_magic_quotes_runtime() == true ? stripslashes($data['form_style']) : $data['form_style'];
     $globalStyle = !empty($globalStyle) ? json_encode($globalStyle) : "";
     $globalStyle = get_magic_quotes_gpc() == true || get_magic_quotes_runtime() == true ? stripslashes($globalStyle) : $globalStyle;
     $db = JFactory::getDBO();
     $query = "REPLACE INTO `#__jsn_uniform_config` (name, value) VALUES ('form_style'," . $db->quote($globalStyle) . ")";
     $db->setQuery($query);
     if (!$db->execute()) {
         JError::raiseWarning(500, $db->getErrorMsg());
     }
     if (empty($data['form_id']) || $data['form_id'] == 0) {
         $data['form_created_by'] = $user->id;
         $data['form_created_at'] = date('Y-m-d H:i:s');
         $edition = defined('JSN_UNIFORM_EDITION') ? JSN_UNIFORM_EDITION : "free";
         if (strtolower($edition) == "free") {
             $dataListForm = JSNUniformHelper::getForms();
             if (count($dataListForm) >= 3) {
                 $checkCreate = false;
             }
         }
     } else {
         $data['form_modified_by'] = $user->id;
         $data['form_modified_at'] = date('Y-m-d H:i:s');
     }
     if ($checkCreate) {
         if ($result = parent::save($data)) {
             $formId = $this->getState($this->getName() . '.id');
             $this->saveField($data['form_id'], $data['form_layout']);
             $this->saveListEmail($post, $formId);
             $this->EmailTepmplates($formId, $data['form_id']);
         }
         return $result;
     } else {
         $msg = JText::sprintf('JSN_UNIFORM_YOU_HAVE_REACHED_THE_LIMITATION_OF_3_FORM_IN_FREE_EDITION', 0) . ' <a class="jsn-link-action" href="index.php?option=com_uniform&view=upgrade">' . JText::_("JSN_UNIFORM_UPGRADE_EDITION") . '</a>';
//.........这里部分代码省略.........
开发者ID:jovielarmario,项目名称:albay_cms,代码行数:101,代码来源:form.php

示例3: elseif

    } elseif ($integrated_com == 'option') {
        $moduleRender = scloginHelper::loadModuleById($params->get('module_option'));
        $linkOption = $params->get('link_option');
    }
    $linkOption = JRoute::_($linkOption);
}
$user = JFactory::getUser();
$name = $params->get('name');
// LOAD MODEL FROM COM_USERS
$app = JFactory::getApplication();
$params_user = $app->getParams('com_users');
JLoader::import('joomla.application.component.model');
JLoader::import('registration', JPATH_SITE . '/components/com_users/models');
JForm::addFormPath(JPATH_SITE . '/components/com_users/models/forms');
JForm::addFieldPath(JPATH_SITE . '/components/com_users/models/fields');
$userModel = JModelForm::getInstance('Registration', 'UsersModel');
$form = $userModel->getForm();
//setting display type
if ($params->get("display_type") == 1) {
    $effect = 'btl-dropdown';
} else {
    $effect = 'btl-modal';
}
//setting for registration
$usersConfig = JComponentHelper::getParams('com_users');
$enabledRegistration = false;
$viewName = JRequest::getVar('view', 'registry');
$enabledCaptcha = 'none';
if ($usersConfig->get('allowUserRegistration') && $params->get("enabled_registration_tab", 1) == 1 && ($viewName != "registration" || $integrated_com != '')) {
    $enabledRegistration = true;
    $enabledCaptcha = $params->get('use_captcha', 1) == 1 ? JFactory::getConfig()->get('captcha') : $params->get('use_captcha', 0);
开发者ID:Tommar,项目名称:remate,代码行数:31,代码来源:mod_bt_sociallogin.php

示例4:

							<?php 
echo JText::_('JSN_UNIFORM_SEND_TO_SUBMITTER');
?>
					</legend>
					<?php 
echo '<p class="alert alert-info">' . JText::_('JSN_UNIFORM_EMAIL_USUALLY_SENT_TO_THE_PERSON') . '</p>';
?>
					<div class="control-group jsn-items-list-container">
						<div class="controls">
							<div class="email-submitters">
								<ul id="emailSubmitters" class="jsn-items-list ui-sortable"></ul>
							</div>
						</div>
					</div>
					<?php 
$emailModel = JModelForm::getInstance('EmailSettings', 'JSNUniformModel');
$action = JFactory::getApplication()->input->getVar('action', 0);
$item = $emailModel->getItem($action);
$form = $emailModel->getForm();
?>
					<div class="jsn-bootstrap emailsettings email-submiter">
						<fieldset style="border: none;margin: 0;padding: 0;">
							<div class="control-group">
								<label class="control-label jsn-label-des-tipsy" original-title="<?php 
echo JText::_('JSN_UNIFORM_EMAIL_SPECIFY_THE_NAME_' . $action);
?>
"><?php 
echo JText::_('JSN_UNIFORM_EMAIL_SETTINGS_FROM');
?>
</label>
								<div id="from" class="controls">
开发者ID:densem-2013,项目名称:exikom,代码行数:31,代码来源:default.php


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