/** * 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); }
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); }
private function _getField() { $i = 0; $html = ''; $customfields = $this->form->getValue('customfield', 'params'); $customfields = $customfields['joomla']; jimport('joomla.application.component.model'); JModel::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_categories' . DS . 'models', 'categories'); $model = JModel::getInstance('Categories', 'CategoriesModel', array('ignore_request' => true)); $model->setState('list.limit', '200'); $model->setState('filter.extension', 'com_content'); $mitems = $model->getItems(); $children = array(); if ($mitems) { foreach ($mitems as $v) { $v->parent_id = $v->parentid; $pt = $v->parentid; $list = @$children[$pt] ? $children[$pt] : array(); array_push($list, $v); $children[$pt] = $list; } } $mitems = array(); foreach ($list as $item) { $item->treename = str_repeat('- ', $item->level - 1) . $item->title; $mitems[] = JHTML::_('select.option', $item->id, ' ' . $item->treename); } $output = JHTML::_('select.genericlist', $mitems, $this->name, 'class="inputbox" multiple="multiple" size="15"', 'value', 'text', $this->value, $this->id); return $output; }
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); }
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(); }
/** * * @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; }
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); }
/** * get an element model * @return object element model */ private function getElementModel() { if (!isset($this->_elementModel)) { $this->_elementModel =& JModel::getInstance('element', 'FabrikModel'); } return $this->_elementModel; }
function showAdminForm() { $model = JModel::getInstance('Gateways', 'JTheFactoryModel'); $params = $model->loadGatewayParams($this->name); jimport('joomla.form.form'); $form = JForm::getInstance($this->name, $this->formxml); $form->bind($params->toArray()); $fieldsets = $form->getFieldsets(); if (file_exists($this->pluginfolder . DS . 'logo.png')) { echo "<div style='padding:15px;'><img src='" . $this->getLogo() . "' border='0'></div>"; } echo "<form name='adminForm' action='index.php' method='post'>"; echo "<input name='option' type='hidden' value='" . APP_EXTENSION . "'>"; echo "<input name='task' type='hidden' value='gateways.save'>"; echo "<input name='classname' type='hidden' value='{$this->name}'>"; if (count($fieldsets)) { foreach ($fieldsets as $fieldset) { $fields = $form->getFieldset((string) $fieldset->name); $this->showFieldSet($fields, (string) $fieldset->name); } } else { $fields = $form->getFieldset(); $this->showFieldSet($fields); } echo "</form>"; self::setToolbar(); }
function display($tmpl = 'default') { FabrikHelperHTML::packageJS(); $model =& $this->getModel(); $usersConfig =& JComponentHelper::getParams('com_fabrik'); $model->setId(array('id' => JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0))), 'package_id' => JRequest::getVar('package_id'))); $visualization =& $model->getVisualization(); $pluginParams =& $model->getPluginParams(); $pluginManager =& JModel::getInstance('Pluginmanager', 'FabrikModel'); $plugin =& $pluginManager->getPlugIn($visualization->plugin, 'visualization'); $plugin->_row = $visualization; if ($visualization->state == 0) { return JError::raiseWarning(500, JText::_('SORRY THIS VISUALIZATION IS UNPUBLISHED')); } //plugin is basically a model $pluginTask = JRequest::getVar('plugintask', 'render', 'request'); $plugin->_params = $pluginParams; $tmpl = $plugin->getParams()->get('calendar_layout', $tmpl); $plugin->{$pluginTask}($this); $this->plugin =& $plugin; $viewName = $this->getName(); $this->_setPath('template', $this->_basePath . DS . 'plugins' . DS . $this->_name . DS . $plugin->_name . DS . 'tmpl' . DS . $tmpl); $ab_css_file = JPATH_SITE . "/components/com_fabrik/plugins/" . $viewName . "/" . $plugin->_name . "/tmpl/{$tmpl}/template.css"; if (file_exists($ab_css_file)) { JHTML::stylesheet('template.css', 'components/com_fabrik/plugins/' . $viewName . '/' . $plugin->_name . '/tmpl/' . $tmpl . '/', true); } $model->getCustomJsAction(); if (isset($this->_isMambot) && $this->_isMambot) { return $this->loadTemplate(); } else { parent::display(); } }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { JHTML::_('behavior.modal'); $tStyleId = JRequest::getInt('t_style_id'); $modelTemps = JModel::getInstance('Templates', 'NewsletterModel'); $temps = (object) array('items' => $modelTemps->getStandardTemplates(), 'state' => $modelTemps->getState(), 'listOrder' => $modelTemps->getState('list.ordering'), 'listDirn' => $modelTemps->getState('list.direction')); $this->assignRef('templates', $temps); $script = $this->get('Script'); $this->script = $script; $this->tplForm = $this->get('Form', 'template'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } if ($tStyleId > 0) { $model = $this->getModel(); $template = $model->getTemplateBy($tStyleId); $this->assign('columns', $model->getColumnPlaceholders($template->content)); $this->assign('tplInfo', (object) $template->information); $name = $this->tplForm->getValue('template_name'); if (empty($name)) { $this->tplForm->setValue('template_name', null, $this->escape($this->tplInfo->name)); } } parent::display($tpl); // Set the document $this->setDocument(); }
function save() { $d = JRequest::get('post'); $model = JModel::getInstance('Contact', 'J' . APP_PREFIX . 'PricingModel'); $model->saveItemPrices($d); $this->setRedirect('index.php?option=' . APP_EXTENSION . '&task=pricing.config&item=' . $this->itemname, JText::_('COM_BIDS_SETTINGS_SAVED')); }
public function saveConfig($newParams) { $this->_migrateIplookup($newParams); if (interface_exists('JModel')) { $params = JModelLegacy::getInstance('Storage', 'AdmintoolsModel'); } else { $params = JModel::getInstance('Storage', 'AdmintoolsModel'); } foreach ($newParams as $key => $value) { // Do not save unnecessary parameters if (!array_key_exists($key, $this->defaultConfig)) { continue; } if ($key == 'awayschedule_from' || $key == 'awayschedule_to') { // Sanity check for Away Schedule time format if (!preg_match('#^([0-1]?[0-9]|[2][0-3]):([0-5][0-9])$#', $value)) { $value = ''; } } $params->setValue($key, $value); } // Dealing with special fields if (is_array($newParams['reasons_nolog'])) { $params->setValue('reasons_nolog', implode(',', $newParams['reasons_nolog'])); } if (is_array($newParams['reasons_noemail'])) { $params->setValue('reasons_noemail', implode(',', $newParams['reasons_noemail'])); } $params->save(); }
function showAdminFormParams($params) { JSFactory::loadExtLanguageFile("pm_saferpay"); $orders =& JModel::getInstance('orders', 'JshoppingModel'); //admin model include dirname(__FILE__) . "/adminparamsform.php"; }
/** * Method to get the field input markup with an image tag. * * @return string The field input markup. */ protected function getInput() { // This Form is used outside of our component, therefor fix the path JLoader::import('mapicons', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_simplegeotag' . DS . 'models'); $model = JModel::getInstance('MapIcons', 'SimpleGeoTagModel'); $this->items = $model->getItems(); //var_dump($this->items); // Add Google Map's js $doc =& JFactory::getDocument(); /* $lang = & JFactory::getLanguage(); $langcode = $lang->getTag(); $doc->addScript('http://maps.google.com/maps/api/js?sensor=false&language='.$langcode ); */ // Add data to javascript array (for image preview) $js = array(); $js[] = "var mapicons = "; $js[] = json_encode($this->items); $js[] = ";\n"; $js[] = "function setMapIcon (val) {\n"; $js[] = "\tvar mapicon = mapicons.filter(function(item, index, arr) { if(item[\"id\"] == val) return true; },val)[0];\n"; $js[] = "\tvar imgtag = \$('jform_metadata_mapicon_img')\n"; $js[] = "\timgtag.src = mapicon['image'];\n"; $js[] = "\timgtag.width = mapicon['size_width'];\n"; $js[] = "\timgtag.height = mapicon['size_height'];\n"; $js[] = "}\n"; $doc->addScriptDeclaration(implode($js)); $this->element['onchange'] = "setMapIcon(this.value)"; $html = parent::getInput(); $this->imgid = $this->id . '_' . $this->imgid; $html = $html . '<img id="' . $this->imgid . '" src="" />'; return $html; }
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); }
/** * 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' ); } }
function display($tpl = null) { $sortBy = JRequest::getVar('sortBy', null); $keyword = JRequest::getVar('keyword', null); $categoryId = JRequest::getInt('categoryId', null); $locationId = JRequest::getInt('locationId', null); $task = JRequest::getVar('task', null); //When searching for deal, we will have this variable if ($task != "display") { $locationId = JFactory::getSession()->get('CS_SESSION_LOCATIONID'); } else { $locationId = JRequest::getInt('locationId', null); } $this->assignRef('sortBy', $sortBy); $this->assignRef('keyword', $keyword); $this->assignRef('categoryId', $categoryId); $this->assignRef('locationId', $locationId); $this->dealList = JModel::getInstance('deal', 'enmasseModel')->searchStartedPublishedDeal($keyword, $categoryId, $locationId, $sortBy); $arLoc = JModel::getInstance('location', 'enmasseModel')->listAllPublished(); $arCat = JModel::getInstance('category', 'enmasseModel')->listAllPublished(); $this->assignRef('locationList', $arLoc); $this->assignRef('categoryList', $arCat); $this->_setPath('template', JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "theme" . DS . EnmasseHelper::getThemeFromSetting() . DS . "tmpl" . DS); $this->_layout = "deal_listing"; parent::display($tpl); }
function getUserNotifications() { $user = JFactory::getUser(); $db = FabrikWorker::getDbo(); $sql = "SELECT * FROM #__{package}_notification WHERE user_id = " . $user->get('id'); $db->setQuery($sql); $rows = $db->loadObjectList(); $listModel = JModel::getInstance('list', 'FabrikFEModel'); foreach ($rows as &$row) { /* * {observer_name, creator_name, event, record url * dear %s, %s has %s on %s */ $event = JText::_($row->event); list($listid, $formid, $rowid) = explode('.', $row->reference); $listModel->setId($listid); $data = $listModel->getRow($rowid); $row->url = JRoute::_('index.php?option=com_fabrik&view=details&listid='.$listid.'&formid='.$formid.'&rowid='.$rowid); $row->title = $row->url; foreach ($data as $key => $value) { $k = strtolower(array_pop(explode('___', $key))); if ($k == 'title') { $row->title = $value; } } } return $rows; }
public function getServiceInfo($id = 0) { if (!$id) { $id = JRequest::getInt('id', 0); } if (!$id) { return false; } $db = JFactory::getDbo(); $query = ' SELECT s.* FROM #__hp_business_service s WHERE s.state = 1 AND s.id = ' . (int) $id . ' '; $db->setQuery($query); $return = $db->loadObject(); if ($return) { //Load businessInfo $businessModel = JModel::getInstance('Intro', 'Jnt_HanhPhucModel'); $businessInfo = $businessModel->getBusinessInfo($return->business_id); $return->businessProfile = $businessInfo->profile; $return->businessInfo = $businessInfo; } return $return; }
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); }
function display($tpl = null) { $model = JModel::getInstance('awards', 'BattleModel'); $rows = $model->getAwardNames(); $this->assignRef('rows', $rows); parent::display($tpl); }
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); }
/** * Method to get the field options. * * @return array The field option objects (list of available SMTP profiles). * @since 1.0 */ public function getOptions() { // Initialize variables. $options = array(); // Just to be sure that record for Joomla profile is exist $model = JModel::getInstance('Smtpprofile', 'NewsletterModelEntity'); $model->load(0); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('CASE is_joomla WHEN 1 THEN 0 ELSE smtp_profile_id END AS value, smtp_profile_name AS text, from_name, from_email, reply_to_email, ' . 'reply_to_name, smtp_server, smtp_port, is_ssl, ' . 'pop_before_smtp, username, password, is_joomla'); $query->from('#__newsletter_smtp_profiles AS a'); $query->order('is_joomla DESC, a.smtp_profile_name ASC'); // Get the options. $db->setQuery($query); $options = $db->loadObjectList(); // Check for a database error. if ($db->getErrorNum()) { JError::raiseWarning(500, $db->getErrorMsg()); } // Merge any additional options in the XML definition. //$options = array_merge(parent::getOptions(), $options); if (empty($options)) { $options = array(); } if (empty($this->element['scope']) || $this->element['scope'] != 'withoutDef') { array_unshift($options, JHtml::_('select.option', '-1', JText::_('COM_NEWSLETTER_PROFILE'))); } return $options; }
function display($tmpl = 'default') { FabrikHelperHTML::framework(); $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)))); $visualization = $model->getVisualization(); $pluginParams = $model->getPluginParams(); $pluginManager = JModel::getInstance('Pluginmanager', 'FabrikModel'); $plugin = $pluginManager->getPlugIn($visualization->plugin, 'visualization'); $plugin->_row = $visualization; if ($visualization->published == 0) { return JError::raiseWarning(500, JText::_('COM_FABRIK_SORRY_THIS_VISUALIZATION_IS_UNPUBLISHED')); } //plugin is basically a model $pluginTask = JRequest::getVar('plugintask', 'render', 'request'); // @FIXME cant set params directly like this, but I think plugin model setParams() is not right $plugin->_params = $pluginParams; $tmpl = $plugin->getParams()->get('calendar_layout', $tmpl); $plugin->{$pluginTask}($this); $this->plugin = $plugin; $viewName = $this->getName(); $this->addTemplatePath($this->_basePath . DS . 'plugins' . DS . $this->_name . DS . $plugin->_name . DS . 'tmpl' . DS . $tmpl); $this->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_fabrik' . DS . 'visualization' . DS . $plugin->_name . DS . $tmpl); $ab_css_file = JPATH_SITE . "/plugins/fabrik_visualization/" . $plugin->_name . "/tmpl/{$tmpl}/template.css"; if (JFile::exists($ab_css_file)) { JHTML::stylesheet('template.css', 'plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/', true); } echo parent::display(); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { //TODO: Need to move css/js to SetDocument JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/conflicts.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); //JHTML::script('media/com_newsletter/js/migur/js/filterpanel.js'); JHTML::script('media/com_newsletter/js/migur/js/search.js'); JHTML::script(JURI::root() . "/administrator/components/com_newsletter/views/conflicts/conflicts.js"); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->addToolbar(); // Let's work with model 'conflicts' ! $model = $this->getModel('conflicts'); $items = $model->getItems(); $pagination = $model->getPagination(); $state = $model->getState(); $listOrder = $model->getState('list.ordering'); $listDirn = $model->getState('list.direction'); $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); $this->assignRef('state', $state); $this->assignRef('listOrder', $listOrder); $this->assignRef('listDirn', $listDirn); $this->assignRef('saveOrder', $saveOrder); $this->assignRef('subscriberModel', JModel::getInstance('Subscriber', 'NewsletterModelEntity')); parent::display($tpl); }
/** * Load letter from DB, load SMTP settings * TODO: Move this to NewsletterModel or NewsletterModelEntity * * @param <string> $name - id of a letter * * @return object - letter * @since 1.0 */ public static function loadLetter($id = false) { $letter = JTable::getInstance('Newsletter', 'NewsletterTable'); $letter->load((int) $id); // If letter absent then fail. if (!$letter) { return false; } $letter = (object) $letter->getProperties(); $letter->params = (array) json_decode($letter->params); if (empty($letter->params['encoding'])) { $letter->params['encoding'] = 'utf-8'; } PlaceholderHelper::setPlaceholders($letter->params); $profileEntity = JModel::getInstance('Smtpprofile', 'NewsletterModelEntity'); $profileEntity->load((int) $letter->smtp_profile_id); $letter->smtp_profile = $profileEntity->toObject(); // Set data when using J! SMTP profile if ($letter->smtp_profile_id == NewsletterModelEntitySmtpprofile::JOOMLA_SMTP_ID) { if (!empty($letter->params['newsletter_from_email'])) { $letter->smtp_profile->from_email = $letter->params['newsletter_from_email']; } if (!empty($letter->params['newsletter_from_name'])) { $letter->smtp_profile->from_name = $letter->params['newsletter_from_name']; } if (!empty($letter->params['newsletter_to_email'])) { $letter->smtp_profile->reply_to_email = $letter->params['newsletter_to_email']; } if (!empty($letter->params['newsletter_to_name'])) { $letter->smtp_profile->reply_to_name = $letter->params['newsletter_to_name']; } } return $letter; }
/** * 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; }
function fetchElement($name, $value, &$node, $control_name) { $attributes = array(); foreach ($node->attributes() as $k => $v) { if ($v != '') { $attributes[$k] = $v; } } /* * Required to avoid a cycle of encoding & * html_entity_decode was used in place of htmlspecialchars_decode because * htmlspecialchars_decode is not compatible with PHP 4 */ $value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES), ENT_QUOTES); $attributes['class'] = $node->attributes('class') ? $node->attributes('class') . ' text_area' : 'text_area'; $control = $control_name . '[' . $name . ']'; $html = ''; $attributes['value'] = $value; $attributes['type'] = 'text'; $attributes['name'] = $control; $attributes['id'] = preg_replace('#[^a-z0-9_-]#i', '', $control_name . $name); $filter = isset($attributes['data-filter']) ? $attributes['data-filter'] : ''; $html .= '<input'; foreach ($attributes as $k => $v) { if (!in_array($k, array('default', 'label', 'description'))) { $html .= ' ' . $k . ' = "' . $v . '"'; } } $html .= ' />'; $options = array('width' => 765, 'height' => 480, 'modal' => true, 'id' => $attributes['id'] . '_browser'); $model = JModel::getInstance('WFModel'); $html .= '<a href="' . $model->getBrowserLink($attributes['id'], $filter) . '" class="dialog browser" target="_blank" data-options=\'' . json_encode($options) . '\' title="' . WFText::_('WF_BROWSER_TITLE') . '"><span class="browser"></span></a>'; return $html; }
function onLoginUser($user, $options) { $device = JRequest::getVar('device', ''); if ($_SERVER['REMOTE_ADDR'] == '174.111.57.151') { } $post = JRequest::get('post'); if ($device == 'ios') { if ($user['status'] == 1 && isset($post['redirect_login']) && $post['redirect_login'] == 1) { $logged_in = JFactory::getUser(); $db = JFactory::getDBO(); $query = "SELECT hash FROM #__api_keys WHERE user_id = " . $db->Quote($logged_in->id); $db->setQuery($query); $apikey = $db->loadResult(); if (!$apikey) { jimport('joomla.application.component.model'); JTable::addIncludePath(JPATH_SITE . '/components/com_api/tables'); JModel::addIncludePath(JPATH_SITE . '/components/com_api/models'); JLoader::register('ApiModel', JPATH_SITE . '/components/com_api/libraries/model.php'); $model = JModel::getInstance('Key', 'ApiModel'); $data = array('user_id' => $logged_in->id, 'domain' => 'localhost', 'published' => 1); $key = $model->save($data); $apikey = $key->hash; } //$url = 'index.php?option=com_api&app=community&resource=user&data=1&key='.$apikey; $url = 'hooked://' . $apikey; //JFactory::getApplication()->redirect($url); header("Location: " . $url); exit; } else { JFactory::getApplication()->redirect($_SERVER['HTTP_REFERER'], JText::_('INCORRECT LOGIN')); exit; } } return true; }