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; }
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); }
/** * 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 __construct() { $app = JFactory::getApplication(); parent::__construct(); $config = JFactory::getConfig(); $paramsC = JComponentHelper::getParams('com_phocadownload') ; $defaultPagination = $paramsC->get( 'default_pagination', '20' ); $file_ordering = $paramsC->get( 'file_ordering', 1 ); $context = $this->_context.'.'; // Get the pagination request variables $this->setState('limit', $app->getUserStateFromRequest($context.'limit', 'limit', $defaultPagination, 'int')); $this->setState('limitstart', $app->input->get('limitstart', 0, 'int')); // In case limit has been changed, adjust limitstart accordingly $this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0)); $this->setState('filter.language',$app->getLanguageFilter()); $this->setState('fileordering', $app->getUserStateFromRequest($context .'fileordering', 'fileordering', $file_ordering, 'int')); // Get the filter request variables $this->setState('filter_order', JRequest::getCmd('filter_order', 'ordering')); $this->setState('filter_order_dir', JRequest::getCmd('filter_order_Dir', 'ASC')); }
public function postSaveHook(JModelLegacy $model, $validData = array()) { $item = $model->getItem(); $sport_id = $item->get('id'); $this->saveconfigs($sport_id); $this->setRedirect(JRoute::_('index.php?option=com_htraininglogs&view=cfgsport&layout=edit&id=' . $sport_id, false)); }
public function postSaveHook(JModelLegacy $model, $validData = array()) { $item = $model->getItem(); $map_id = $item->get('id'); $mapimage = $item->get('mapimage'); $this->prepare_fileupload($map_id, $mapimage); //in case new HR file added $this->setRedirect(JRoute::_('index.php?option=com_htraininglogs&view=omap&layout=edit&id=' . $map_id, false)); }
public function postSaveHook(JModelLegacy $model, $validData = array()) { $item = $model->getItem(); $media_id = $item->get('id'); $mediafile = JRequest::getVar('filename'); $model->storeimage($mediafile, $media_id); $this->prepare_fileupload($media_id, $mediafile); //in case new m fedia file added //$this->setRedirect(JRoute::_('index.php?option=com_htraininglogs&view=media&layout=edit&id='.$media_id, false)); }
public function postSaveHook(JModelLegacy $model, $validData = array()) { $item = $model->getItem(); $sub_id = $item->get('id'); $sport_id = $item->get('sport_id'); $this->saveomap(); $split_id = $this->prepare_fileupload($sub_id, $sport_id); //in case new HR file added $this->setRedirect(JRoute::_('index.php?option=com_htraininglogs&view=session&layout=edit&sub_id=' . $sub_id . '&split_id=' . $split_id, false)); }
protected function postSaveHook(JModelLegacy $model, $validData = array()) { $item = $model->getItem(); $id = $item->get('id'); if ($id) { if ($validData['saveresult'] == 1) { //Create a new datatable if it doesn't allready exist if (!$model->createDataTables($id)) { $this->setMessage($model->getError()); } } } }
/** * 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); }
/** * 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 __construct() { $this->context = APP_EXTENSION . "_fields."; $this->_tablename = '#__' . APP_PREFIX . '_fields'; $this->_tablename_category = '#__' . APP_PREFIX . '_fields_categories'; parent::__construct(); }
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); }
function __construct() { parent::__construct(); $mainframe = JFactory::getApplication(); $option = JRequest::getVar('option'); //Pagination Variabeln $limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'), 'default', 'int'); $limitstart = JRequest::getVar('limitstart', 0, 'default', 'int'); $this->setState('limit', $limit); $this->setState('limitstart', $limitstart); //Suche und Filter $filter_saison = JRequest::getVar('filter_saison', $this->_getAktuelleSaison(), 'default', 'int'); $filter_turnier = JRequest::getVar('filter_turnier', '', 'default', 'int'); $search = JRequest::getVar('search', '', 'default', 'string'); $search = JString::strtolower($search); $this->setState('filter_saison', $filter_saison); $this->setState('filter_turnier', $filter_turnier); $this->setState('search', $search); //Sortierung Variabeln $filter_order = JRequest::getVar('filter_order', 'turnier', 'default', 'cmd'); $filter_order_Dir = JRequest::getVar('filter_order_Dir', 'ASC', 'default', 'word'); $this->setState('filter_order', $filter_order); $this->setState('filter_order_Dir', $filter_order_Dir); // User $this->user = JFactory::getUser(); }
/** * Called via ajax to perform viz ajax task (defined by plugintask method) * * @param boolean $cachable If true, the view output will be cached * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return JController A JController object to support chaining. */ public function display($cachable = false, $urlparams = false) { $document = JFactory::getDocument(); $app = JFactory::getApplication(); $input = $app->input; $id = $input->getInt('visualizationid'); $viz = FabTable::getInstance('Visualization', 'FabrikTable'); $viz->load($id); $modelpaths = JModelLegacy::addIncludePath(JPATH_SITE . '/plugins/fabrik_visualization/' . $viz->plugin . '/models'); $model = $this->getModel($viz->plugin); $model->setId($id); $pluginTask = $input->get('plugintask', '', 'request'); if ($pluginTask !== '') { echo $model->{$pluginTask}(); } else { $task = $input->get('task'); $path = JPATH_SITE . '/plugins/fabrik_visualization/' . $viz->plugin . '/controllers/' . $viz->plugin . '.php'; if (file_exists($path)) { require_once $path; } else { throw new RuntimeException('Could not load visualization: ' . $viz->plugin); } $controllerName = 'FabrikControllerVisualization' . $viz->plugin; $controller = new $controllerName(); $controller->addViewPath(JPATH_SITE . '/plugins/fabrik_visualization/' . $viz->plugin . '/views'); $controller->addViewPath(COM_FABRIK_FRONTEND . '/views'); // Add the model path $modelpaths = JModelLegacy::addIncludePath(JPATH_SITE . '/plugins/fabrik_visualization/' . $viz->plugin . '/models'); $modelpaths = JModelLegacy::addIncludePath(COM_FABRIK_FRONTEND . '/models'); $origId = $input->getInt('visualizationid'); $input->set('visualizationid', $id); $controller->{$task}(); } return $this; }
/** * 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); }
/** * Constructor * * @since 1.5 */ function __construct() { parent::__construct(); //Get configuration $app = JFactory::getApplication(); $config = JFactory::getConfig(); // Get the pagination request variables $this->setState('limit', $app->getUserStateFromRequest('com_search.limit', 'limit', $config->get('list_limit'), 'uint')); $this->setState('limitstart', JRequest::getUInt('limitstart', 0)); // Get parameters. $params = $app->getParams(); if ($params->get('searchphrase') == 1) { $searchphrase = 'any'; } elseif ($params->get('searchphrase') == 2) { $searchphrase = 'exact'; } else { $searchphrase = 'all'; } // Set the search parameters $keyword = urldecode(JRequest::getString('searchword')); $match = JRequest::getWord('searchphrase', $searchphrase); $ordering = JRequest::getWord('ordering', $params->get('ordering', 'newest')); $this->setSearch($keyword, $match, $ordering); //Set the search areas $areas = JRequest::getVar('areas'); $this->setAreas($areas); }
/** * 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); }
/** * 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); }
/** * Constructor * * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). * * @since 12.2 * @throws Exception */ public function __construct($config = []) { if (empty($config['filter_fields'])) { $config['filter_fields'] = ['id', 'a.id', 'name', 'a.name', 'lname', 'a.lname', 'suburb', 'a.suburb', 'state', 'a.state', 'country', 'a.country', 'ordering', 'a.ordering', 'sortname1', 'a.sortname1', 'sortname2', 'a.sortname2', 'sortname3', 'a.sortname3']; } parent::__construct($config); }
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); }
/** * 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); }
function __construct() { parent::__construct(); $input = JFactory::getApplication()->input; $array = $input->get('cid', 0, 'ARRAY'); $this->setId((int) $array[0]); }
/** * 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); }
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}; "); } }
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); }
/** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JController * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array('id', 'name', 'relname'); } parent::__construct($config); }
function __construct() { parent::__construct(); $cids = JRequest::getVar('cid', 0, '', 'array'); $this->setId((int) $cids[0]); global $mainframe, $option; }
function ThemeFlow() { $pathModelShowcaseTheme = JPATH_PLUGINS . DS . $this->_pluginType . DS . $this->_pluginName . DS . 'models'; $pathTableShowcaseTheme = JPATH_PLUGINS . DS . $this->_pluginType . DS . $this->_pluginName . DS . 'tables'; JModelLegacy::addIncludePath($pathModelShowcaseTheme); JTable::addIncludePath($pathTableShowcaseTheme); }
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; }