public function __construct($config = array()) { $udbPath = UserNotesHelper::userDataPath() . '/usernotes.db3'; $db = JDatabaseDriver::getInstance(array('driver' => 'sqlite', 'database' => $udbPath)); $config['dbo'] = $db; parent::__construct($config); }
/** * 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; }
function __construct() { parent::__construct(); $this->projectid = JRequest::getInt('p', 0); $this->ptid = JRequest::getInt('ptid', 0); $this->tid = JRequest::getInt('tid', 0); }
/** * 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); }
/** * 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); }
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); }
/** * 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); }
/** * 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; }
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'); }
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(); }
/** * 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); }
/** * 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; }
/** * 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; }
/** * 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); }
/** * 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); }
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; }
/** * 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; }
/** * 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; }
/** * Method to get a form object. * * @return mixed A JForm object on success, false on failure. * @since 1.6 */ public function getForm() { $option = $this->getState('component.option'); $path = $this->getState('component.path', ''); jimport('joomla.form.form'); if ($path) { // Add the search path for the admin component config.xml file. JForm::addFormPath($path); } else { // Add the search path for the admin component config.xml file. JForm::addFormPath(JPATH_ADMINISTRATOR . DS . 'components' . DS . $option); } // Get the form. $form = parent::getForm('config', 'com_config.component', array('array' => 'jform', 'event' => 'onPrepareForm')); // Check for an error. if (JError::isError($form)) { $this->setError($form->getMessage()); return false; } return $form; }
/** * Method to validate the form data. * * @param object $form The form to validate against. * @param array $data The data to validate. * @return mixed Array of filtered data if valid, false otherwise. * @since 1.1 */ function validate($form, $data) { $return = parent::validate($form, $data); if (!$return) { return false; } // //Check xem da ton tai dich vu loai nay chua // $category = $data['category']; // $id = $data['id']; // if($id == 0) { // $db = JFactory::getDbo(); // $db->setQuery( // 'SELECT * FROM #__hp_business_service WHERE category = '.(int)$category // ); // if($db->loadObject()) { // $this->setError('Bạn đã có dịch vụ này!'); // $return = false; // } // } // return $return; }
/** * 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'); } }
/** * Override JModelAdmin::preprocessForm to ensure the correct plugin group is loaded. * * @param JForm $form A JForm object. * @param mixed $data The data expected for the form. * @param string $group The name of the plugin group to import (defaults to "content"). * * @return void * * @since 1.6 * @throws Exception if there is an error in the form event. */ protected function preprocessForm(JForm $form, $data, $group = 'user') { parent::preprocessForm($form, $data, $group); }
/** * Custom clean the cache * * @param string $group Cache group name. * @param integer $client_id Application client id. * * @return void * * @since 1.6 */ protected function cleanCache($group = null, $client_id = 0) { parent::cleanCache('com_modules'); parent::cleanCache('mod_menu'); }
/** * Method override to check-out a record. * * @param integer $pk The ID of the primary key. * * @return boolean True if successful, false if an error occurs. * * @since 12.2 */ public function checkout($pk = null) { $pk = !empty($pk) ? $pk : (int) $this->getState($this->getName() . '.id'); return parent::checkout($pk); }
/** * Override preprocessForm to load the user plugin group instead of content. * * @param object A form object. * @param mixed The data expected for the form. * @throws Exception if there is an error in the form event. * @since 1.6 */ protected function preprocessForm(JForm $form, $data, $group = 'user') { if (JComponentHelper::getParams('com_users')->get('frontend_userparams')) { $form->loadFile('frontend', false); if (JFactory::getUser()->authorise('core.login.admin')) { $form->loadFile('frontend_admin', false); } } parent::preprocessForm($form, $data, $group); }
/** * Method override to check-out a record. * * @param integer $pk The ID of the primary key. * * @return boolean True if successful, false if an error occurs. * @since 11.1 */ public function checkout($pk = null) { // Initialise variables. $pk = (!empty($pk)) ? $pk : (int) $this->getState($this->getName().'.id'); return parent::checkout($pk); }
/** * Override preprocessForm to load the user plugin group instead of content. * * @param object A form object. * @param mixed The data expected for the form. * @throws Exception if there is an error in the form event. * @since 1.6 */ protected function preprocessForm(JForm $form, $data, $group = 'user') { $userParams = JComponentHelper::getParams('com_users'); //Add the choice for site language at registration time if ($userParams->get('site_language') == 1 && $userParams->get('frontend_userparams') == 1) { $form->loadFile('sitelang', false); } parent::preprocessForm($form, $data, $group); }
/** * 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 : ""; $this->formStyle->padding_space = !empty($styles->padding_space) ? $styles->padding_space : ""; $this->formStyle->margin_space = !empty($styles->margin_space) ? $styles->margin_space : ""; $this->formStyle->text_color = !empty($styles->text_color) ? $styles->text_color : ""; $this->formStyle->font_type = !empty($styles->font_type) ? $styles->font_type : ""; $this->formStyle->font_size = !empty($styles->font_size) ? $styles->font_size : ""; } else { $this->formStyle->background_color = !empty($this->formStyle->background_color) ? $this->formStyle->background_color : ""; $this->formStyle->background_active_color = !empty($this->formStyle->background_active_color) ? $this->formStyle->background_active_color : ""; $this->formStyle->border_active_color = !empty($this->formStyle->border_active_color) ? $this->formStyle->border_active_color : ""; $this->formStyle->border_thickness = !empty($this->formStyle->border_thickness) ? $this->formStyle->border_thickness : ""; $this->formStyle->border_color = !empty($this->formStyle->border_color) ? $this->formStyle->border_color : ""; $this->formStyle->rounded_corner_radius = !empty($this->formStyle->rounded_corner_radius) ? $this->formStyle->rounded_corner_radius : ""; $this->formStyle->padding_space = !empty($this->formStyle->padding_space) ? $this->formStyle->padding_space : ""; $this->formStyle->margin_space = !empty($this->formStyle->margin_space) ? $this->formStyle->margin_space : ""; $this->formStyle->text_color = !empty($this->formStyle->text_color) ? $this->formStyle->text_color : ""; $this->formStyle->font_type = !empty($this->formStyle->font_type) ? $this->formStyle->font_type : ""; $this->formStyle->font_size = !empty($this->formStyle->font_size) ? $this->formStyle->font_size : ""; if (empty($this->formStyle->background_active_color) && empty($this->formStyle->border_active_color) && empty($this->formStyle->border_thickness) && empty($this->formStyle->border_color) && empty($this->formStyle->rounded_corner_radius) && empty($this->formStyle->background_color) && empty($this->formStyle->font_size) && empty($this->formStyle->text_color) && empty($this->formStyle->margin_space) && empty($this->formStyle->padding_space)) { $this->formStyle->theme = ""; $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'); } } // Hide the main menu $input->set('hidemainmenu', true); // Initialize toolbar $this->initToolbar(); // Get config $config = JSNConfigHelper::get(); $msgs = ''; if (!$config->get('disable_all_messages')) { $msgs = JSNUtilsMessage::getList('FORMS'); $msgs = count($msgs) ? JSNUtilsMessage::showMessages($msgs) : ''; } // Assign variables for rendering $this->assignRef('msgs', $msgs); // Display the template parent::display($tpl); // Load assets JSNUniformHelper::addAssets(); $this->addAssets(); }
/** * Constructor * * @param array $config DI Config options */ public function __construct($config = array()) { parent::__construct(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $this->app = ArrayHelper::getValue($config, 'app', JFactory::getApplication()); $this->session = ArrayHelper::getValue($config, 'session', JFactory::getSession()); $this->user = ArrayHelper::getValue($config, 'user', JFactory::getUser()); $this->config = ArrayHelper::getValue($config, 'config', JFactory::getConfig()); $this->lang = ArrayHelper::getValue($config, 'lang', JFactory::getLanguage()); $input = $this->app->input; $id = $input->getInt('listid', $usersConfig->get('listid')); $this->packageId = (int) $input->getInt('packageId', $usersConfig->get('packageId')); $this->setId($id); $this->advancedSearch = JModelLegacy::getInstance('AdvancedSearch', 'FabrikFEModel'); $this->advancedSearch->setModel($this); $this->access = new stdClass(); }
public function getInput() { parent::__construct(); }