public function render() { /** * @todo move the output to a template * @todo make the output XHTML compliant */ $this->_tpl = new icms_view_Tpl(); $this->_tpl->assign('icms_print_pageTitle', $this->_pageTitle ? $this->_pageTitle : $this->_title); $this->_tpl->assign('icms_print_title', $this->_title); $this->_tpl->assign('icms_print_dsc', $this->_dsc); $this->_tpl->assign('icms_print_content', $this->_content); $this->_tpl->assign('icms_print_width', $this->_width); $current_urls = smart_getCurrentUrls(); $current_url = $current_urls['full']; $this->_tpl->assign('icms_print_currenturl', $current_url); $this->_tpl->assign('icms_print_url', $this->url); $this->_tpl->display('db:system_print.html'); }
function render() { /** * @todo move the output to a template * @todo make the output XHTML compliant */ include_once XOOPS_ROOT_PATH . '/class/template.php'; $this->_tpl =& new XoopsTpl(); $this->_tpl->assign('smartobject_print_pageTitle', $this->_pageTitle ? $this->_pageTitle : $this->_title); $this->_tpl->assign('smartobject_print_title', $this->_title); $this->_tpl->assign('smartobject_print_dsc', $this->_dsc); $this->_tpl->assign('smartobject_print_content', $this->_content); $this->_tpl->assign('smartobject_print_width', $this->_width); $current_urls = smart_getCurrentUrls(); $current_url = $current_urls['full']; $this->_tpl->assign('smartobject_print_currenturl', $current_url); $this->_tpl->assign('smartobject_print_url', $this->url); $this->_tpl->display('db:smartobject_print.html'); }
$rating_itemid = $pluginObj->getItemIdForItem($rating_item); $stats = $smartobject_rating_handler->getRatingAverageByItemId($rating_itemid, $module_dirname, $rating_item); $xoopsTpl->assign('smartobject_rating_stats_total', $stats['sum']); $xoopsTpl->assign('smartobject_rating_stats_average', $stats['average']); $xoopsTpl->assign('smartobject_rating_item', $rating_item); if (is_object($xoopsUser)) { $ratingObj = $smartobject_rating_handler->already_rated($rating_item, $rating_itemid, $module_dirname, $xoopsUser->getVar('uid')); $xoopsTpl->assign('smartobject_user_can_rate', true); } if (isset($ratingObj) && is_object($ratingObj)) { $xoopsTpl->assign('smartobject_user_rate', $ratingObj->getVar('rate')); $xoopsTpl->assign('smartobject_rated', true); } else { $xoopsTpl->assign('smartobject_rating_dirname', $module_dirname); $xoopsTpl->assign('smartobject_rating_itemid', $rating_itemid); $urls = smart_getCurrentUrls(); $xoopsTpl->assign('smartobject_rating_current_page', $urls['full']); if (isset($xoTheme) && is_object($xoTheme)) { $xoTheme->addStylesheet(SMARTOBJECT_URL . 'module.css'); } else { //probleme d'inclusion de css apres le flashplayer. Style placé dans css du theme //$xoopsTpl->assign('smartobject_css',"<link rel='stylesheet' type='text/css' href='".XOOPS_URL."/modules/smartobject/module.css' />"); } } } } if (isset($_POST['smartobject_rating_submit'])) { // The rating form has just been posted. Let's save the info $ratingObj = $smartobject_rating_handler->create(); $ratingObj->setVar('dirname', $module_dirname); $ratingObj->setVar('item', $rating_item);
function smart_getCurrentPage() { $urls = smart_getCurrentUrls(); return $urls['full']; }
function render($fetchOnly = false, $debug = false) { include_once XOOPS_ROOT_PATH . '/class/template.php'; $this->_tpl = new XoopsTpl(); /** * We need access to the vars of the SmartObject for a few things in the table creation. * Since we may not have a SmartObject to look into now, let's create one for this purpose * and we will free it after */ $this->_tempObject =& $this->_objectHandler->create(); $this->_criteria->setStart(isset($_GET['start' . $this->_objectHandler->keyName]) ? intval($_GET['start' . $this->_objectHandler->keyName]) : 0); $this->setSortOrder(); if (!$this->_isTree) { $this->_limitsel = isset($_GET['limitsel']) ? $_GET['limitsel'] : smart_getCookieVar($_SERVER['PHP_SELF'] . '_limitsel', '15'); } else { $this->_limitsel = 'all'; } $this->_limitsel = isset($_POST['limitsel']) ? $_POST['limitsel'] : $this->_limitsel; smart_setCookieVar($_SERVER['PHP_SELF'] . '_limitsel', $this->_limitsel); $limitsArray = $this->getLimitsArray(); $this->_criteria->setLimit($this->_limitsel); $this->_filtersel = isset($_GET['filtersel']) ? $_GET['filtersel'] : $this->getDefaultFilter(); $this->_filtersel = isset($_POST['filtersel']) ? $_POST['filtersel'] : $this->_filtersel; smart_setCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_filtersel', $this->_filtersel); $filtersArray = $this->getFiltersArray(); if ($filtersArray) { $this->_tpl->assign('smartobject_optionssel_filtersArray', $filtersArray); } // Check if the selected filter is defined and if so, create the selfilter2 if (isset($this->_filterseloptions[$this->_filtersel])) { // check if method associate with this filter exists in the handler if (is_array($this->_filterseloptions[$this->_filtersel])) { $filter = $this->_filterseloptions[$this->_filtersel]; $this->_criteria->add($filter['criteria']); } else { if (method_exists($this->_objectHandler, $this->_filterseloptions[$this->_filtersel])) { // then we will create the selfilter2 options by calling this method $method = $this->_filterseloptions[$this->_filtersel]; $this->_filtersel2options = $this->_objectHandler->{$method}(); $this->_filtersel2 = isset($_GET['filtersel2']) ? $_GET['filtersel2'] : $this->getDefaultFilter2(); $this->_filtersel2 = isset($_POST['filtersel2']) ? $_POST['filtersel2'] : $this->_filtersel2; $filters2Array = $this->getFilters2Array(); $this->_tpl->assign('smartobject_optionssel_filters2Array', $filters2Array); smart_setCookieVar($_SERVER['PHP_SELF'] . '_filtersel2', $this->_filtersel2); if ($this->_filtersel2 != 'default') { $this->_criteria->add(new Criteria($this->_filtersel, $this->_filtersel2)); } } } } // Check if we have a quicksearch if (isset($_POST['quicksearch_' . $this->_id]) && $_POST['quicksearch_' . $this->_id] != '') { $quicksearch_criteria = new CriteriaCompo(); if (is_array($this->_quickSearch['fields'])) { foreach ($this->_quickSearch['fields'] as $v) { $quicksearch_criteria->add(new Criteria($v, '%' . $_POST['quicksearch_' . $this->_id] . '%', 'LIKE'), 'OR'); } } else { $quicksearch_criteria->add(new Criteria($this->_quickSearch['fields'], '%' . $_POST['quicksearch_' . $this->_id] . '%', 'LIKE')); } $this->_criteria->add($quicksearch_criteria); } $this->_objects = $this->fetchObjects($debug); include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; if ($this->_criteria->getLimit() > 0) { /** * Geeting rid of the old params * $new_get_array is an array containing the new GET parameters */ $new_get_array = array(); /** * $params_of_the_options_sel is an array with all the parameters of the page * but without the pagenave parameters. This array will be used in the * OptionsSelection */ $params_of_the_options_sel = array(); $not_needed_params = array('sortsel', 'limitsel', 'ordersel', 'start' . $this->_objectHandler->keyName); foreach ($_GET as $k => $v) { if (!in_array($k, $not_needed_params)) { $new_get_array[] = "{$k}={$v}"; $params_of_the_options_sel[] = "{$k}={$v}"; } } /** * Adding the new params of the pagenav */ $new_get_array[] = "sortsel=" . $this->_sortsel; $new_get_array[] = "ordersel=" . $this->_ordersel; $new_get_array[] = "limitsel=" . $this->_limitsel; $otherParams = implode('&', $new_get_array); $pagenav = new XoopsPageNav($this->_objectHandler->getCount($this->_criteria), $this->_criteria->getLimit(), $this->_criteria->getStart(), 'start' . $this->_objectHandler->keyName, $otherParams); $this->_tpl->assign('smartobject_pagenav', $pagenav->renderNav()); } $this->renderOptionSelection($limitsArray, $params_of_the_options_sel); // retreive the current url and the query string $current_urls = smart_getCurrentUrls(); $current_url = $current_urls['full_phpself']; $query_string = $current_urls['querystring']; if ($query_string) { $query_string = str_replace('?', '', $query_string); } $query_stringArray = explode('&', $query_string); $new_query_stringArray = array(); foreach ($query_stringArray as $query_string) { if (strpos($query_string, 'sortsel') == FALSE && strpos($query_string, 'ordersel') == FALSE) { $new_query_stringArray[] = $query_string; } } $new_query_string = implode('&', $new_query_stringArray); $orderArray = array(); $orderArray['ASC']['image'] = 'desc.png'; $orderArray['ASC']['neworder'] = 'DESC'; $orderArray['DESC']['image'] = 'asc.png'; $orderArray['DESC']['neworder'] = 'ASC'; $aColumns = array(); foreach ($this->_columns as $column) { $qs_param = ''; $aColumn = array(); $aColumn['width'] = $column->getWidth(); $aColumn['align'] = $column->getAlign(); $aColumn['key'] = $column->getKeyName(); if ($column->_keyname == 'checked') { $aColumn['caption'] = '<input type ="checkbox" id="checkall_smartobjects" name="checkall_smartobjects"' . ' value="checkall_smartobjects" onclick="smartobject_checkall(window.document.form_' . $this->_id . ', \'selected_smartobjects\');" />'; } elseif ($column->getCustomCaption()) { $aColumn['caption'] = $column->getCustomCaption(); } else { $aColumn['caption'] = isset($this->_tempObject->vars[$column->getKeyName()]['form_caption']) ? $this->_tempObject->vars[$column->getKeyName()]['form_caption'] : $column->getKeyName(); } // Are we doing a GET sort on this column ? $getSort = isset($_GET[$this->_objectHandler->_itemname . '_' . 'sortsel']) && $_GET[$this->_objectHandler->_itemname . '_' . 'sortsel'] == $column->getKeyName() || $this->_sortsel == $column->getKeyName(); $order = isset($_GET[$this->_objectHandler->_itemname . '_' . 'ordersel']) ? $_GET[$this->_objectHandler->_itemname . '_' . 'ordersel'] : 'DESC'; if (isset($_REQUEST['quicksearch_' . $this->_id]) && $_REQUEST['quicksearch_' . $this->_id] != '') { $qs_param = "&quicksearch_" . $this->_id . "=" . $_REQUEST['quicksearch_' . $this->_id]; } if (!$this->_enableColumnsSorting || $column->_keyname == 'checked' || !$column->isSortable()) { $aColumn['caption'] = $aColumn['caption']; } elseif ($getSort) { $aColumn['caption'] = '<a href="' . $current_url . '?' . $this->_objectHandler->_itemname . '_' . 'sortsel=' . $column->getKeyName() . '&' . $this->_objectHandler->_itemname . '_' . 'ordersel=' . $orderArray[$order]['neworder'] . $qs_param . '&' . $new_query_string . '">' . $aColumn['caption'] . ' <img src="' . SMARTOBJECT_IMAGES_ACTIONS_URL . $orderArray[$order]['image'] . '" alt="ASC" /></a>'; } else { $aColumn['caption'] = '<a href="' . $current_url . '?' . $this->_objectHandler->_itemname . '_' . 'sortsel=' . $column->getKeyName() . '&' . $this->_objectHandler->_itemname . '_' . 'ordersel=ASC' . $qs_param . '&' . $new_query_string . '">' . $aColumn['caption'] . '</a>'; } $aColumns[] = $aColumn; } $this->_tpl->assign('smartobject_columns', $aColumns); if ($this->_quickSearch) { $this->_tpl->assign('smartobject_quicksearch', $this->_quickSearch['caption']); } $this->createTableRows(); $this->_tpl->assign('smartobject_showFilterAndLimit', $this->_showFilterAndLimit); $this->_tpl->assign('smartobject_isTree', $this->_isTree); $this->_tpl->assign('smartobject_show_action_column_title', $this->_showActionsColumnTitle); $this->_tpl->assign('smartobject_table_header', $this->_tableHeader); $this->_tpl->assign('smartobject_table_footer', $this->_tableFooter); $this->_tpl->assign('smartobject_printer_friendly_page', $this->_printerFriendlyPage); $this->_tpl->assign('smartobject_user_side', $this->_userSide); $this->_tpl->assign('smartobject_has_actions', $this->_hasActions); $this->_tpl->assign('smartobject_head_css_class', $this->_head_css_class); $this->_tpl->assign('smartobject_actionButtons', $this->_actionButtons); $this->_tpl->assign('smartobject_introButtons', $this->_introButtons); $this->_tpl->assign('smartobject_id', $this->_id); if (!empty($this->_withSelectedActions)) { $this->_tpl->assign('smartobject_withSelectedActions', $this->_withSelectedActions); } $smartobject_table_template = $this->_customTemplate ? $this->_customTemplate : 'smartobject_smarttable_display.html'; if ($fetchOnly) { return $this->_tpl->fetch('db:' . $smartobject_table_template); } else { $this->_tpl->display('db:' . $smartobject_table_template); } }