/** * Display * * @param string $tmpl Template * * @return void */ public function display($tmpl = 'default') { $srcs = FabrikHelperHTML::framework(); $app = JFactory::getApplication(); $input = $app->input; FabrikHelperHTML::script($srcs); $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0)))); $visualization = $model->getVisualization(); $pluginParams = $model->getPluginParams(); $pluginManager = JModelLegacy::getInstance('Pluginmanager', 'FabrikModel'); $plugin = $pluginManager->getPlugIn($visualization->plugin, 'visualization'); $plugin->_row = $visualization; if ($visualization->published == 0) { return JError::raiseWarning(500, FText::_('COM_FABRIK_SORRY_THIS_VISUALIZATION_IS_UNPUBLISHED')); } // Plugin is basically a model $pluginTask = $input->get('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 . '/plugins/' . $this->_name . '/' . $plugin->_name . '/tmpl/' . $tmpl); $root = $app->isAdmin() ? JPATH_ADMINISTRATOR : JPATH_SITE; $this->addTemplatePath($root . '/templates/' . $app->getTemplate() . '/html/com_fabrik/visualization/' . $plugin->_name . '/' . $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(); }
function passPHP(&$parent, &$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 = trim(str_replace('[:REGEX_ENTER:]', '\\n', $php)); if ($php == '') { $pass = 1; break; } if (!$article && strpos($php, '$article') !== false) { $article = ''; if ($parent->params->option == 'com_content' && $parent->params->view == 'article') { require_once JPATH_SITE . '/components/com_content/models/article.php'; $model = JModelLegacy::getInstance('article', 'contentModel'); $article = $model->getItem($parent->params->id); } } if (!isset($Itemid)) { $Itemid = JFactory::getApplication()->input->getInt('Itemid', 0); } if (!isset($mainframe)) { $mainframe = JFactory::getApplication(); } if (!isset($app)) { $app = JFactory::getApplication(); } if (!isset($document)) { $document = JFactory::getDocument(); } if (!isset($doc)) { $doc = JFactory::getDocument(); } if (!isset($database)) { $database = JFactory::getDBO(); } if (!isset($db)) { $db = JFactory::getDBO(); } if (!isset($user)) { $user = JFactory::getUser(); } $php .= ';return true;'; $temp_PHP_func = create_function('&$article, &$Itemid, &$mainframe, &$app, &$document, &$doc, &$database, &$db, &$user', $php); // evaluate the script ob_start(); $pass = (bool) $temp_PHP_func($article, $Itemid, $mainframe, $app, $document, $doc, $database, $db, $user); unset($temp_PHP_func); ob_end_clean(); if ($pass) { break; } } return $parent->pass($pass, $assignment); }
public function delete($pk = null) { // Get form model $formModel = JModelLegacy::getInstance('form', 'IssnregistryModel'); if ($pk != null) { // Get number of forms related to this publisher $formsCount = $formModel->getFormsCountByPublisherId($pk); // Check result if ($formsCount != 0) { // If there are forms, the publisher can't be deleted JFactory::getApplication()->enqueueMessage(JText::_('COM_ISSNREGISTRY_PUBLISHER_DELETE_FAILED_FORMS_EXIST'), 'warning'); // Return false as the item can't be deleted return false; } // Delete messages //$messageModel = JModelLegacy::getInstance('message', 'IssnregistryModel'); //$messageModel->deleteByPublisherId($pk); } if (parent::delete($pk)) { // If this publisher was created based on a form, remove // publisher created attribute from the form if ($this->form_id != 0) { $formModel->removePublisherCreated($this->form_id); } // Get message model $messageModel = JModelLegacy::getInstance('message', 'IssnregistryModel'); // Delete messages related to this publisher $messageModel->deleteByPublisherId($pk); // Return true return true; } return false; }
/** * Update the ordered items in post save hook */ protected function postSaveHook(JModelLegacy $model, $validData = array()) { $order_id = $model->getState($model->getName() . '.id'); $data = JFactory::getApplication()->input->post->getArray(array('jform' => array('ordered' => 'array', 'deleted' => 'array'))); // We add order items right on order edit view foreach ($data['jform']['ordered'] as $item) { $item['order_id'] = $order_id; $model = JModelLegacy::getInstance('OrderItem', 'DZProductModel'); $form = $model->getForm($item, false); if (!$form) { continue; } $validItem = $model->validate($form, $item); if ($validItem === false) { continue; } if (!$model->save($validItem)) { continue; } } // Make sure the submitted deleted ids are all integer JArrayHelper::toInteger($data['jform']['deleted']); // Remove items $model = JModelLegacy::getInstance('OrderItem', 'DZProductModel'); $model->delete($data['jform']['deleted']); }
private function initialise() { static $loaded = false; if (!$loaded || true) { defined('DS') || define('DS', DIRECTORY_SEPARATOR); require_once JPATH_SITE . '/components/com_sobipro/lib/sobi.php'; Sobi::Initialise(); if (SOBI_CMS == 'joomla3') { SPFactory::header()->initBase(true)->addJsFile(array('sobipro', 'jqnc', 'adm.sobipro', 'adm.jnmenu', 'jquery-base64')); } else { SPFactory::header()->initBase(true)->addJsFile(array('sobipro', 'jquery', 'adm.sobipro', 'adm.jnmenu', 'jquery-migrate', 'jquery-base64'))->addCSSCode('#toolbar-box { display: block }'); } $loaded = true; SPLoader::loadClass('mlo.input'); SPLoader::loadClass('models.datamodel'); SPLoader::loadClass('models.dbobject'); SPLoader::loadModel('section'); $model = JModelLegacy::getInstance('MenusModelItem')->getItem(); self::$mid = $model->id; if (isset($model->params['SobiProSettings']) && strlen($model->params['SobiProSettings'])) { $this->params = json_decode(base64_decode($model->params['SobiProSettings'])); } $jsString = json_encode(array('component' => Sobi::Txt('SOBI_NATIVE_TASKS'), 'buttonLabel' => Sobi::Txt('SOBI_SELECT_FUNCTIONALITY'))); SPFactory::header()->addJsCode("SpStrings = {$jsString}; "); } }
/** * Display the Message templates view * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ function display($tpl = null) { // Get data from the model $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } // Add menu helper file require_once JPATH_COMPONENT . '/helpers/menu.php'; // Add sidebar MenuHelper::addSubmenu('messagetemplates'); // Load message type model $model = JModelLegacy::getInstance('messagetype', 'IssnregistryModel'); // Load message types $types = $model->getMessageTypesHash(); // Pass $types to the layout $this->assignRef('types', $types); // Set the toolbar $this->addToolBar(); // Render the sidebar $this->sidebar = JHtmlSidebar::render(); // Display the template parent::display($tpl); }
function display($tpl = NULL) { /** * @var JSite $app */ $app = JFactory::getApplication(); $this->params = $app->getParams(); /* Default Page fallback*/ $active = $app->getMenu()->getActive(); if (NULL == $active) { $this->params->merge($app->getMenu()->getDefault()->params); $active = $app->getMenu()->getDefault(); } $this->currentItemid = $active->id; $entriesPerPage = $this->params->get('max_events_per_page', 12); $model = $this->getModel('events'); $eventModel = JModelLegacy::getInstance('Event', 'EventgalleryModel'); $recursive = $this->params->get('show_items_per_category_recursive', false); $user = JFactory::getUser(); $usergroups = JUserHelper::getUserGroups($user->id); $entries = $model->getEntries(JRequest::getVar('start', 0), $entriesPerPage, $this->params->get('tags'), $this->params->get('sort_events_by'), $usergroups, $this->params->get('catid', null), $recursive); $this->pageNav = $model->getPagination(); $this->entries = $entries; $this->eventModel = $eventModel; $this->_prepareDocument(); parent::display($tpl); }
public function display($cachable = true, $urlparams = false) { //error_log("IN AkrecipesControllerBrand::display ") ; $app = JFactory::getApplication(); $view = $app->input->getCmd('view', 'brand'); JFactory::getApplication()->input->set('view', $view); //error_log("Recipes Brand Param --> " . print_r($app->getParams(),true)); $brand_id = $app->input->getInt('id'); //error_log("brand_id --> " . $brand_id); JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_akrecipes/models'); //$recipes_model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); $recipes_model = JModelLegacy::getInstance('Recipes', 'AkrecipesModel', array()); $num_recipes = (int) $app->getParams()->get('brandpage_num_recipes', 24); $app->input->set('limit', $num_recipes); $app->input->set('ignore_intro_leading', true); //$recipes_model->setState('list.limit',$num_recipes); $recipes_model->setState('filter.brand_id', $brand_id); $recipes_model->setState('catid.id', ''); $app->input->set('filter_order', 'publish_up'); $app->input->set('filter_order_Dir', 'DESC'); $document = JFactory::getDocument(); $viewType = $document->getType(); $viewName = $this->input->get('view', $this->default_view); $viewLayout = $this->input->get('layout', 'default', 'string'); $view = $this->getView($viewName, $viewType, '', array('base_path' => $this->basePath, 'layout' => $viewLayout)); // // Get/Create the model // if ($model = $this->getModel($viewName)) // { // // Push the model into the view (as default) // $view->setModel($model, true); // } $view->setModel($recipes_model); parent::display($cachable, $urlparams); return $this; }
/** * Return statistics CSV file * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ function display($tpl = null) { $this->item = $this->get('Item'); // Get parameters $jinput = JFactory::getApplication()->input; $type = $jinput->get('type', null, 'string'); $begin = $jinput->get('begin', null, 'string'); $end = $jinput->get('end', null, 'string'); // Convert date strings to JDate objects $beginDate = new JDate($begin); $endDate = new JDate($end . ' 23:59:59'); // Get statistic model $statisticModel = JModelLegacy::getInstance('statistic', 'IssnregistryModel'); // Get statistics $csv = $statisticModel->getStats($type, $beginDate, $endDate); // Set document properties $document = JFactory::getDocument(); $document->setMimeEncoding('text/csv; charset="UTF-8"'); JResponse::setHeader('Content-disposition', 'attachment; filename="statistics.csv"', true); // Write to output $out = fopen('php://output', 'w'); // Loop through CSV data and write each row to output foreach ($csv as $row) { // Columns are tab separated fputcsv($out, $row, "\t"); } // Close output fclose($out); }
/** * Method to display the view. * * @param string The template file to include * @since 1.6 */ public function display($tpl = null) { //load required files JForm::addFormPath(JPATH_SITE . '/components/com_users/models/forms'); JForm::addFieldPath(JPATH_SITE . '/components/com_users/models/fields'); require_once JPATH_SITE . '/components/com_users/models/registration.php'; //load com_users language $lang = JFactory::getLanguage(); $lang->load('com_users'); $model = JModelLegacy::getInstance('Registration', 'UsersModel'); $app = JFactory::getApplication(); // Get the view data. $this->data = $model->getData(); $this->form = $model->getForm(); //$this->state = $model->get('State'); $this->params = $app->getParams('com_hs_users'); // Check for errors. if (count($errors = $model->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } // Check for layout override $active = JFactory::getApplication()->getMenu()->getActive(); if (isset($active->query['layout'])) { $this->setLayout($active->query['layout']); } //Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx')); $this->prepareDocument(); parent::display($tpl); }
/** * Return statistics XLS file * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ function display($tpl = null) { $this->item = $this->get('Item'); // Get parameters $jinput = JFactory::getApplication()->input; $type = $jinput->get('type', null, 'string'); $begin = $jinput->get('begin', null, 'string'); $end = $jinput->get('end', null, 'string'); // Convert date strings to JDate objects $beginDate = new JDate($begin); $endDate = new JDate($end . ' 23:59:59'); // Get statistic model $statisticModel = JModelLegacy::getInstance('statistic', 'IsbnregistryModel'); // Get statistics $data = $statisticModel->getStats($type, $beginDate, $endDate); // Set document properties $document = JFactory::getDocument(); $document->setMimeEncoding('application/vnd.ms-excel; charset="UTF-8"'); JResponse::setHeader('Content-disposition', 'attachment; filename="statistics.xml"', true); // Get Excel helper require_once JPATH_COMPONENT . '/helpers/php-export-data.class.php'; // Create new Excled worksheet $excel = new ExportDataExcel('browser'); $excel->filename = "statistics.xml"; $excel->initialize(); // Loop through data array foreach ($data as $row) { // Add rows $excel->addRow($row); } // Finalize $excel->finalize(); }
/** * Method to change the block status on a record. * * @return void * * @since 0.3.0 */ public function changeBlock() { // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $ids = $this->input->get('cid', array(), 'array'); $values = array('block' => 1, 'unblock' => 0); $task = $this->getTask(); $value = JArrayHelper::getValue($values, $task, 0, 'int'); // Convert from customer ID to Joomla user ID $joomlaUserIds = array(); JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_solidres/tables', 'SolidresTable'); $customerTable = JTable::getInstance('Customer', 'SolidresTable'); foreach ($ids as $id) { $customerTable->load($id); $joomlaUserIds[] = $customerTable->user_id; } if (empty($joomlaUserIds)) { JError::raiseWarning(500, JText::_('SR_CUSTOMERS_NO_ITEM_SELECTED')); } else { // Get the model. JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_users/models', 'UsersModel'); $model = JModelLegacy::getInstance('User', 'UsersModel', array('ignore_request' => true)); // Change the state of the records. if (!$model->block($joomlaUserIds, $value)) { JError::raiseWarning(500, $model->getError()); } else { if ($value == 1) { $this->setMessage(JText::plural('SR_N_CUSTOMERS_BLOCKED', count($joomlaUserIds))); } elseif ($value == 0) { $this->setMessage(JText::plural('SR_N_CUSTOMERS_UNBLOCKED', count($joomlaUserIds))); } } } $this->setRedirect('index.php?option=com_solidres&view=customers'); }
/** * Execute Create Instance * * @param string $path Path of create files */ public static function execute($config = array()) { $item = JModelLegacy::getInstance("Template", "JDeveloperModel")->getItem($config['item_id']); $dir = $item->createDir; // Create folders JFolder::create($dir . "/css"); JFolder::create($dir . "/html"); JFolder::create($dir . "/images"); JFolder::create($dir . "/js"); JFolder::create($dir . "/less"); // Copy files JFile::copy(JDeveloperTEMPLATES . "/template/template.css", $dir . "/css/template.css"); foreach (JFolder::files(JDeveloperCREATE . "/template", "php\$") as $file) { $class = JDeveloperCreate::getInstance("template." . JFile::stripExt($file), $config); if (!$class->create()) { $errors = $class->getErrors(); if (!empty($errors)) { throw new JDeveloperException($errors); } } } JDeveloperCreate::getInstance("language.template", $config)->create(); JDeveloperCreate::getInstance("language.template.sys", $config)->create(); JFile::copy(JDeveloperTEMPLATES . "/template/favicon.ico", $dir . "/favicon.ico"); }
/** * Method to get the field option groups. * * @return array The field option objects as a nested array in groups. * * @since 11.1 * @throws UnexpectedValueException */ protected function getGroups() { $db = JFactory::getDbo(); $groups = array("Components", "Tables"); // Component relations $query = $db->getQuery(true)->select("a.relation")->from("#__jdeveloper_forms AS a")->where("a.relation LIKE 'component%'")->where("a.level = 1"); $rows = $db->setQuery($query)->loadAssocList(); $model = JModelLegacy::getInstance("Component", "JDeveloperModel"); $group = JText::_("COM_JDEVELOPER_FORM_FILTER_GROUP_COMPONENTS"); foreach ($rows as $row) { $id = explode(".", $row->relation)[1]; $item = $model->getItem($id); $groups[$group][] = JHtml::_('select.option', $row->relation, ucfirst($item->name)); } // Table relations $query = $db->getQuery(true)->select("a.relation")->from("#__jdeveloper_forms AS a")->where("a.relation LIKE 'table%'")->where("a.level = 1"); $rows = $db->setQuery($query)->loadObjectList(); $model = JModelLegacy::getInstance("Table", "JDeveloperModel"); $group = JText::_("COM_JDEVELOPER_FORM_FILTER_GROUP_TABLES"); foreach ($rows as $row) { $id = explode(".", $row->relation)[1]; $item = $model->getItem($id); $groups[$group][] = JHtml::_('select.option', $row->relation, ucfirst($item->name)); } return array_merge(parent::getGroups(), $groups); }
public static function getList(&$params) { // Get the dbo $db = JFactory::getDbo(); // Get an instance of the generic tracks model $model = JModelLegacy::getInstance('Sections', 'PlayjoomModel', array('ignore_request' => true)); // Set application parameters in model $app = JFactory::getApplication(); $appParams = $app->getParams(); $model->setState('params', $appParams); // Set the filters based on the module params $model->setState('list.start', 0); $model->setState('list.limit', (int) $params->get('count', 5)); // Access filter $access = !JComponentHelper::getParams('com_playjoom')->get('show_noauth', 1); $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id')); $ordering = 'a.access_datetime'; $dir = 'DESC'; $model->setState('list.ordering', $ordering); $model->setState('list.direction', $dir); $items = $model->getItems(); //create item link foreach ($items as &$item) { //Check for Trackcontrol if (JPluginHelper::isEnabled('playjoom', 'trackcontrol') == false) { $item->link = null; } else { $item->link = JRoute::_('index.php?option=com_playjoom&view=broadcast&id=' . $item->id); } $item->accessinfo = modLastPlayedHelper::GetTimeInfoList($item->access_datetime, $params, 'access'); } return $items; }
public static function getList($params) { // Get an instance of the generic articles model $model = JModelLegacy::getInstance('Category', 'WeblinksModel', array('ignore_request' => true)); // Set application parameters in model $app = JFactory::getApplication(); $appParams = $app->getParams(); $model->setState('params', $appParams); // Set the filters based on the module params $model->setState('list.start', 0); $model->setState('list.limit', (int) $params->get('count', 5)); $model->setState('filter.state', 1); // Access filter $access = !JComponentHelper::getParams('com_weblinks')->get('show_noauth'); $model->setState('filter.access', $access); $ordering = $params->get('ordering', 'ordering'); $model->setState('list.ordering', $ordering == 'order' ? 'ordering' : $ordering); $model->setState('list.direction', $params->get('direction', 'asc')); $catid = (int) $params->get('catid', 0); $model->setState('category.id', $catid); // Create query object $db = JFactory::getDbo(); $query = $db->getQuery(true); $case_when1 = ' CASE WHEN '; $case_when1 .= $query->charLength('a.alias', '!=', '0'); $case_when1 .= ' THEN '; $a_id = $query->castAsChar('a.id'); $case_when1 .= $query->concatenate(array($a_id, 'a.alias'), ':'); $case_when1 .= ' ELSE '; $case_when1 .= $a_id . ' END as slug'; $case_when2 = ' CASE WHEN '; $case_when2 .= $query->charLength('c.alias', '!=', '0'); $case_when2 .= ' THEN '; $c_id = $query->castAsChar('c.id'); $case_when2 .= $query->concatenate(array($c_id, 'c.alias'), ':'); $case_when2 .= ' ELSE '; $case_when2 .= $c_id . ' END as slug'; $model->setState('list.select', 'a.*, c.published AS c_published,' . $case_when1 . ',' . $case_when2 . ',' . 'DATE_FORMAT(a.created, "%Y-%m-%d") AS created'); $model->setState('filter.c.published', 1); // Filter by language $model->setState('filter.language', $app->getLanguageFilter()); $items = $model->getItems(); /* * This was in the previous code before we changed over to using the * weblinkscategory model but I don't see any models using checked_out filters * in their getListQuery() methods so I believe we should not be adding this now */ /* $query->where('(a.checked_out = 0 OR a.checked_out = '.$user->id.')'); */ for ($i = 0, $count = count($items); $i < $count; $i++) { $item =& $items[$i]; if ($item->params->get('count_clicks', $params->get('count_clicks')) == 1) { $item->link = JRoute::_('index.php?option=com_weblinks&task=weblink.go&catid=' . $item->catslug . '&id=' . $item->slug); } else { $item->link = $item->url; } } return $items; }
function display($tpl = null) { $this->config = JBFactory::getConfig(); $input = JFactory::getApplication()->input; AImporter::model('tour'); $cart = JModelLegacy::getInstance('TourCart', 'bookpro'); $cart->load(); $cart->clear(); $model = new BookProModelTour(); $id = $input->getInt('id'); $this->tour = $model->getComplexItem($id); $this->itineraries = TourHelper::buildItinerary($id); //$this->packages = $packages; $date = TourHelper::getDateFirstInPackagerateFromTourid($this->tour->id); $this->date = JFactory::getDate($date)->format(DateHelper::getConvertDateFormat('P')); $this->tour->rdate = $this->date; $dispatcher = JDispatcher::getInstance(); //$this->_prepareDocument(); // $dispatcher = JDispatcher::getInstance(); // $this->event = new stdClass(); // JPluginHelper::importPlugin('bookpro'); // $results = $dispatcher->trigger('onBookproProductAfterTitle', array ($this->tour)); // $this->event->afterDisplayTitle=isset($results[0])?$results[0]:null; parent::display($tpl); }
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(); }
/** * Display the view */ public function display($tpl = null) { $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->authors = $this->get('Authors'); $model = JModelLegacy::getInstance('Categories', 'TZ_Portfolio_PlusModel'); $model->setState('filter.group', $this->state->get('filter.group')); $this->assign('listGroup', $model->getGroups()); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // Levels filter. $options = array(); $options[] = JHtml::_('select.option', '1', JText::_('J1')); $options[] = JHtml::_('select.option', '2', JText::_('J2')); $options[] = JHtml::_('select.option', '3', JText::_('J3')); $options[] = JHtml::_('select.option', '4', JText::_('J4')); $options[] = JHtml::_('select.option', '5', JText::_('J5')); $options[] = JHtml::_('select.option', '6', JText::_('J6')); $options[] = JHtml::_('select.option', '7', JText::_('J7')); $options[] = JHtml::_('select.option', '8', JText::_('J8')); $options[] = JHtml::_('select.option', '9', JText::_('J9')); $options[] = JHtml::_('select.option', '10', JText::_('J10')); $this->assign('f_levels', $options); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } TZ_Portfolio_PlusHelper::addSubmenu('featured'); $this->sidebar = JHtmlSidebar::render(); parent::display($tpl); }
protected function getTagHtml() { $requestID = $this->getParamValue('request_id'); $linkText = $this->getParamValue('link_text'); $linkImage = $this->getParamValue('link_image'); $tagString = ''; if ($requestID != '') { JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_jfbconnect/models'); $requestModel = JModelLegacy::getInstance('Request', "JFBConnectModel"); $request = $requestModel->getData($requestID); if ($request && $request->published) { $message = str_replace("\r\n", " ", $request->message); $linkValue = $linkText; if ($linkImage != '') { $linkValue = '<img src="' . $linkImage . '" alt="' . $request->title . ' "/>'; } $tagString = '<a href="javascript:void(0)" onclick="jfbc.request.popup(' . $requestID . '); return false;">' . $linkValue . '</a>'; $tagString .= <<<EOT <script type="text/javascript"> var jfbcRequests = Object.prototype.toString.call(jfbcRequests) == "[object Array]" ? jfbcRequests : []; var jfbcRequest = new Object; jfbcRequest.title = "{$request->title}"; jfbcRequest.message = "{$message}"; jfbcRequest.destinationUrl = "{$request->destination_url}"; jfbcRequest.thanksUrl = "{$request->thanks_url}"; jfbcRequests[{$requestID}] = jfbcRequest; </script> EOT; } } return $tagString; }
function display($tpl = null) { $objPhpExcel = new PHPExcel(); $data = JRequest::get('donvi_id'); $user = JFactory::getUser(); $user_id = $user->id; $model = JModelLegacy::getInstance('Tuan', 'BaocaotuanModel'); if ($data['task'] == "excelbctuan") { $baocao_id = $data['baocao_id']; $ketqua = $model->getThongtin('ju.name as tennhanvien, bc.*', 'zxbaocao bc', array('inner' => 'jos_users ju on ju.id = bc.user_id'), 'bc.trangthai = 1 and bc.user_id = ' . $user_id . ' and bc.id IN (' . $baocao_id . ')', 'batdau asc, ketthuc asc'); $this->assignRef('rows', $ketqua); if (is_null($tpl)) { $tpl = 'excel_baocaotuan'; } } if ($data['task'] == "excellamthemgio") { $lamthemgio_id = $data['lamthemgio_id']; $thongtin_all = $model->getThongtin('ju.name as tennhanvien, DATE_FORMAT(ltg.timebatdau,"%Hh%i") as timebatdau, DATE_FORMAT(ltg.timeketthuc,"%Hh%i") as timeketthuc,ltg.thoigian,ltg.congvieclamthem as congvieclamthem, DATE_FORMAT(ltg.ngaylamthem,"%d/%m/%Y") as ngaylamthem, DATE_FORMAT(ltg.ngaylamthem,"%m") as thanglamthem, DATE_FORMAT(ltg.ngaylamthem,"%Y") as namlamthem', 'zxlamthemgio ltg', array('inner' => 'jos_users ju on ju.id = ltg.user_id'), ' ltg.user_id = ' . $user_id . ' and ltg.id IN (' . $lamthemgio_id . ')', ' ngaylamthem asc'); $thanglamthem = $model->getThongtin('distinct(DATE_FORMAT(ltg.ngaylamthem,"%m")) as thanglamthem', 'zxlamthemgio ltg', null, ' ltg.user_id = ' . $user_id . ' and ltg.id IN (' . $lamthemgio_id . ')', ' ngaylamthem asc'); $ketqua = array(); for ($i = 0; $i < count($thanglamthem); $i++) { for ($j = 0; $j < count($thongtin_all); $j++) { if ($thanglamthem[$i]->thanglamthem == $thongtin_all[$j]->thanglamthem) { $ketqua[$thanglamthem[$i]->thanglamthem][] = $thongtin_all[$j]; } } } $this->assignRef('rows', $ketqua); if (is_null($tpl)) { $tpl = 'excel_lamthemgio'; } } parent::display($tpl); }
/** * Method to get the list of groups and elements * grouped by group and element. * * @return array The field option objects as a nested array in groups. */ protected function getGroups() { $app = JFactory::getApplication(); $input = $app->input; $db = FabrikWorker::getDbo(true); $query = $db->getQuery(true); $query->select('form_id')->from($db->quoteName('#__{package}_formgroup') . ' AS fg')->join('LEFT', '#__{package}_elements AS e ON e.group_id = fg.group_id')->where('e.id = ' . $input->getInt('elementid')); $db->setQuery($query); $formId = $db->loadResult(); $formModel = JModelLegacy::getInstance('Form', 'FabrikFEModel'); $formModel->setId($formId); $rows = array(); $rows[FText::_('COM_FABRIK_GROUPS')] = array(); $rows[FText::_('COM_FABRIK_ELEMENTS')] = array(); // Get available element types $groups = $formModel->getGroupsHiarachy(); foreach ($groups as $groupModel) { $group = $groupModel->getGroup(); $label = $group->name; $value = 'fabrik_trigger_group_group' . $group->id; $rows[FText::_('COM_FABRIK_GROUPS')][] = JHTML::_('select.option', $value, $label); $elementModels = $groupModel->getMyElements(); foreach ($elementModels as $elementModel) { $label = $elementModel->getFullName(false, false); $value = 'fabrik_trigger_element_' . $elementModel->getFullName(true, false); $rows[FText::_('COM_FABRIK_ELEMENTS')][] = JHTML::_('select.option', $value, $label); } } reset($rows); asort($rows[FText::_('COM_FABRIK_ELEMENTS')]); return $rows; }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { $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 = JModelLegacy::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[] = '<span class="input-append"><input type="text" readonly="readonly" disabled="disabled" value="' . $value . '"' . $size . $class . ' /><a class="btn btn-primary" onclick="SqueezeBox.fromElement(this, {handler:\'iframe\', size: {x: 600, y: 450}, url:\'' . JRoute::_('index.php?option=com_menus&view=menutypes&tmpl=component&recordId=' . $recordId) . '\'})"><i class="icon-list icon-white"></i> ' . JText::_('JSELECT') . '</a></span>'; $html[] = '<input class="input-small" type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" />'; return implode("\n", $html); }
function display($tpl = null) { $option = JRequest::getCmd('option'); $mainframe = JFactory::getApplication(); $project_id = $mainframe->getUserState($option . 'project'); $uri = JFactory::getURI()->toString(); $user = JFactory::getUser(); // Get data from the model $items = $this->get('Data'); $total = $this->get('Total'); $pagination = $this->get('Pagination'); $model = $this->getModel(); $projectws = $this->get('Data', 'project'); $division = $mainframe->getUserStateFromRequest($option . 'tt_division', 'division', '', 'string'); //build the html options for divisions $divisions[] = JHtmlSelect::option('0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_DIVISION')); $mdlDivisions = JModelLegacy::getInstance("divisions", "JoomLeagueModel"); if ($res = $mdlDivisions->getDivisions($project_id)) { $divisions = array_merge($divisions, $res); } $lists['divisions'] = $divisions; unset($divisions); $this->user = $user; $this->lists = $lists; $this->items = $items; $this->projectws = $projectws; $this->division = $division; $this->total = $total; $this->pagination = $pagination; $this->request_url = $uri; $this->addToolbar(); parent::display($tpl); }
/** * Display the view. * * @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 Error object. * * @since 1.0.0 */ public function display($tpl = null) { $jinput = JFactory::getApplication()->input; $campaignId = $jinput->get('campaign', 0, 'integer'); $campaigns = JModelLegacy::getInstance('Campaigns', 'CMDonationModel')->getCampaignsForFilter(); $campaignList = array(); $campaign = array(); if (!empty($campaigns)) { foreach ($campaigns as $camp) { $campaignList[$camp->id] = htmlspecialchars($camp->name); if ($camp->id == $campaignId) { $campaign = $camp; } } } $statistics = array(); if (!empty($campaign)) { $statistics = CMDonationHelper::generateStatistics($campaignId); } $params = JComponentHelper::getParams('com_cmdonation'); // Get payment methods. $paymentMethods = CMDonationHelper::getPaymentMethods(); $this->assignRef('paymentMethods', $paymentMethods); $this->assignRef('params', $params); $this->assignRef('campaignList', $campaignList); $this->assignRef('campaignId', $campaignId); $this->assignRef('campaign', $campaign); $this->assignRef('statistics', $statistics); $this->submenu = CMDonationHelper::addSubmenu('statistics'); $this->addToolbar($campaign, $statistics); parent::display($tpl); }
public static function &getBalance(&$params) { JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_videotranslation/models', 'VideoTranslationModel'); $model = JModelLegacy::getInstance('cart', 'VideoTranslationModel', array('ignore_request' => true)); $item = $model->getBalance(); return $item; }
/** * Deletes a message type. * * @param integer $pk Primary key of the message type to be deleted. * * @return boolean True on success, false on failure. * */ public function delete($pk = null) { // Add configuration helper file require_once JPATH_COMPONENT . '/helpers/configuration.php'; // If message type is defined as default in configuration, it cannot be removed if (ConfigurationHelper::isMessageTypeUsedInConfiguration($this->id)) { // Raise a warning JFactory::getApplication()->enqueueMessage(JText::_('COM_ISSNREGISTRY_MESSAGE_TYPE_DELETE_FAILED_SETTINGS'), 'warning'); // Return false as the item can't be deleted return false; } // Load message template model $messageTemplateModel = JModelLegacy::getInstance('messagetemplate', 'IssnregistryModel'); // Get number of templates that use this message type $templateCount = $messageTemplateModel->getMessageTemplatesCountByMessageType($this->id); // If template count is not zero, message type cannot be deleted if ($templateCount != 0) { // Raise a warning JFactory::getApplication()->enqueueMessage(JText::_('COM_ISSNREGISTRY_MESSAGE_TYPE_DELETE_FAILED_USED'), 'warning'); // Return false as the item can't be deleted return false; } // No ISSNs have been used, delete the item return parent::delete($pk); }
/** * Method to get a list of tasks * * @return array $items The tasks */ public static function getItems($params) { JLoader::register('PFtasksModelTasks', JPATH_SITE . '/components/com_pftasks/models/tasks.php'); $model = JModelLegacy::getInstance('Tasks', 'PFtasksModel', array('ignore_request' => true)); // Set application parameters in model $app = JFactory::getApplication(); $appParams = $app->getParams(); $model->setState('params', $appParams); // Set the filters based on the module params $model->setState('list.start', 0); $model->setState('list.limit', (int) $params->get('count', 10)); $model->setState('filter.published', 1); // Set project filter if (!(int) $params->get('tasks_of')) { $model->setState('filter.project', PFApplicationHelper::getActiveProjectId()); } else { $project = (int) $params->get('project'); if ($project) { $model->setState('filter.project', $project); } else { $model->setState('filter.project', PFApplicationHelper::getActiveProjectId()); } } // Set completition filter $model->setState('filter.complete', $params->get('filter_complete')); // Sort and order $model->setState('list.ordering', $params->get('sort')); $model->setState('list.direction', $params->get('order')); $items = $model->getItems(); return $items; }
/** * 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. */ public function display($tpl = null) { // Do not allow cache JFactory::getApplication()->allowCache(false); $jinput = JFactory::getApplication()->input; $mediaParams = JComponentHelper::getParams('com_media'); $mediaModel = JModelLegacy::getInstance('List', 'MediaModel'); $view = $jinput->get('view'); // Set the path definitions $popup_upload = $jinput->get('pop_up', null); $path = 'file_path'; if (substr(strtolower($view), 0, 6) == 'images' || $popup_upload == 1) { $path = 'image_path'; } $media_path = $mediaParams->get($path, 'images'); define('COM_MEDIA_BASE', JPATH_ROOT . '/' . $media_path); define('COM_MEDIA_BASEURL', JUri::root() . $media_path); $lang = JFactory::getLanguage(); JHtml::_('stylesheet', 'media/popup-imagelist.css', array(), true); if ($lang->isRTL()) { JHtml::_('stylesheet', 'media/popup-imagelist_rtl.css', array(), true); } $document = JFactory::getDocument(); $document->addScriptDeclaration("var ImageManager = window.parent.ImageManager;"); $images = $mediaModel->getImages(); $documents = $mediaModel->getDocuments(); $folders = $mediaModel->getFolders(); $state = $mediaModel->getState(); $this->baseURL = COM_MEDIA_BASEURL; $this->images =& $images; $this->documents =& $documents; $this->folders =& $folders; $this->state =& $state; parent::display($tpl); }
/** * Parse field declaration to render input. * * @return void */ public function getInput() { // Make sure we have options declared if (!isset($this->element->option)) { return JText::_('JSN_TPLFW_LAYOUT_MISSING_COLUMN_DECLARATION'); } // Get template model $templateModel = class_exists('JModelLegacy') ? JModelLegacy::getInstance('Style', 'TemplatesModel') : JModel::getInstance('Style', 'TemplatesModel'); // Get style data $this->data = $templateModel->getItem(JFactory::getApplication()->input->getInt('id')); // Instantiate helper class of JSN Template Framework $helper = JSNTplTemplateHelper::getInstance(); // Finalize template parameters $this->data->params = $helper->loadParams($this->data->params, $this->data->template); // Check for layout ajustment image $this->hasHelper = is_readable(JPATH_ROOT . '/templates/' . $this->data->template . '/template_layout_adjustment.jpg'); // Parse column declaration foreach ($this->element->option as $group) { $gname = (string) $group['name']; // Pass values to options array if (@is_array($this->data->params[$gname])) { foreach ($this->data->params[$gname] as $oname => $value) { $this->options[$gname][preg_replace('/^\\d+:/', '', $oname)] = $value; } } // Parse columns $this->parseColumns($group, $this->options[$gname]); } return parent::getInput(); }