function renderSelect($showbutton = false) { if ($this->total < $this->perpage) { return; } $total_pages = ceil($this->total / $this->perpage); $ret = ''; if ($total_pages > 1) { $ret = '<form name="pagenavform" action="' . xoops_getenv('PHP_SELF') . '">'; $ret .= '<select name="pagenavselect" onchange="location=this.options[this.options.selectedIndex].value;">'; $counter = 1; $current_page = intval(floor(($this->current + $this->perpage) / $this->perpage)); while ($counter <= $total_pages) { if ($counter == $current_page) { $ret .= '<option value="' . $this->url . ($counter - 1) * $this->perpage . '" selected="selected">' . $counter . '</option>'; } else { $ret .= '<option value="' . $this->url . ($counter - 1) * $this->perpage . '">' . $counter . '</option>'; } $counter++; } $ret .= '</select>'; if ($showbutton) { $ret .= ' <input type="submit" value="' . _GO . '" />'; } $ret .= '</form>'; } return $ret; }
function setupBlock() { $showFlag = 0; $mid = 0; if ($this->mController->mRoot->mContext->mModule != null) { $showFlag = preg_match("/index\\.php\$/i", xoops_getenv('PHP_SELF')) && $this->mController->mRoot->mContext->mXoopsConfig['startpage'] == $this->mController->mRoot->mContext->mXoopsModule->get('dirname'); $mid = $this->mController->mRoot->mContext->mXoopsModule->get('mid'); } else { // // If you does not have module_contoller, this request is to toppage or other pages of toppage. // // $mid = preg_match("/index\.php$/i", xoops_getenv('PHP_SELF')) ? -1 : 0; $pathArray = parse_url(!empty($_SERVER['PATH_INFO']) ? substr($_SERVER['PHP_SELF'], 0, -strlen($_SERVER['PATH_INFO'])) : $_SERVER['PHP_SELF']); $mid = preg_match("#(/index\\.php|/)\$#i", @$pathArray['path']) ? -1 : 0; } $blockHandler =& xoops_gethandler('block'); $showCenterFlag = SHOW_CENTERBLOCK_LEFT | SHOW_CENTERBLOCK_CENTER | SHOW_CENTERBLOCK_RIGHT; $showRightFlag = SHOW_SIDEBLOCK_RIGHT; $showFlag = SHOW_SIDEBLOCK_LEFT | $showRightFlag | $showCenterFlag; $groups = is_object($this->mController->mRoot->mContext->mXoopsUser) ? $this->mController->mRoot->mContext->mXoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; $blockObjects =& $blockHandler->getBlocks($groups, $mid, $showFlag); foreach ($blockObjects as $blockObject) { $block =& Legacy_Utils::createBlockProcedure($blockObject); if ($block->prepare() !== false) { $this->mController->_mBlockChain[] =& $block; } unset($block); unset($blockObject); } }
function editcat($catid = '') { $name = ''; $description = ''; global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $modify; include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; if ($modify) { $result = $xoopsDB->query("SELECT name, description FROM " . $xoopsDB->prefix("faqcategories") . " WHERE catID = '{$catid}'"); list($name, $description) = mysql_fetch_row($result); if (mysql_num_rows($result) == 0) { redirect_header("index.php", 1, _AM_NOCATTOEDIT); exit; } $sform = new XoopsThemeForm(_AM_MODIFYCAT, "op", xoops_getenv('PHP_SELF')); } else { $sform = new XoopsThemeForm(_AM_ADDCAT, "op", xoops_getenv('PHP_SELF')); } $sform->addElement(new XoopsFormText(_AM_CATNAME, 'name', 50, 80, $name), true); $sform->addElement(new XoopsFormDhtmlTextArea(_AM_CATDESCRIPT, 'description', $description, 15, 60)); $sform->addElement(new XoopsFormHidden('catid', $catid)); $sform->addElement(new XoopsFormHidden('modify', $modify)); $button_tray = new XoopsFormElementTray('', ''); $hidden = new XoopsFormHidden('op', 'addcat'); $button_tray->addElement($hidden); if ($modify == '0') { $button_tray->addElement(new XoopsFormButton('', 'update', _AM_CREATE, 'submit')); } else { $button_tray->addElement(new XoopsFormButton('', 'update', _AM_MODIFY, 'submit')); } $sform->addElement($button_tray); $sform->display(); unset($hidden); }
function redirect($message, $toFrompage = false) { if ($toFrompage) { $url = XOOPS_URL . '/'; /* @var $cookie Openid_Context */ $cookie =& OpenID_Utils::load('context'); $cookie->accept('openid_frompage', 'string', 'cookie'); if ($frompage = $cookie->get('openid_frompage')) { $parsed = parse_url(XOOPS_URL); $url = isset($parsed['scheme']) ? $parsed['scheme'] . '://' : 'http://'; if (isset($parsed['host'])) { $url .= $parsed['host']; if (isset($parsed['port'])) { $url .= ':' . $parsed['port']; } } else { $url .= xoops_getenv('HTTP_HOST'); } $url .= trim($frompage); } } else { $url = XOOPS_URL . '/'; } unset($_SESSION['openid_response']); setcookie('openid_frompage', '', time() - 3600); redirect_header($url, 2, $message); }
function b_legacy_themes_show($options) { global $xoopsConfig; if (count($xoopsConfig['theme_set_allowed']) == 0) { return null; } $block = array(); if (xoops_getenv('REQUEST_METHOD') == 'POST') { $block['isEnableChanger'] = 0; return $block; } $block['isEnableChanger'] = 1; $theme_options = array(); $handler =& xoops_getmodulehandler('theme', 'legacy'); foreach ($xoopsConfig['theme_set_allowed'] as $name) { $theme =& $handler->get($name); if ($theme != null) { $theme_option['name'] = $name; $theme_option['screenshot'] = $theme->getShow('screenshot'); $theme_option['screenshotUrl'] = XOOPS_THEME_URL . "/" . $name . "/" . $theme->getShow('screenshot'); if ($name == $xoopsConfig['theme_set']) { $theme_option['selected'] = 'selected="selected"'; $block['theme_selected_screenshot'] = $theme->getShow('screenshot'); } else { $theme_option['selected'] = ''; } $theme_options[] = $theme_option; } } $block['count'] = count($xoopsConfig['theme_set_allowed']); $block['mode'] = $options[0]; $block['width'] = $options[1]; $block['theme_options'] = $theme_options; return $block; }
/** * XoopsfaqCategory::displayForm() * * @return */ function displayForm() { include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; $caption = $this->isNew() ? _AM_XOOPSFAQ_CREATENEW : sprintf(_AM_XOOPSFAQ_MODIFYITEM, $this->getVar('category_title')); $form = new XoopsThemeForm($caption, 'content', xoops_getenv('PHP_SELF')); $form->addElement(new XoopsFormHiddenToken()); $form->addElement(new xoopsFormHidden('op', 'save')); $form->addElement(new xoopsFormHidden('category_id', $this->getVar('category_id', 'e'))); // title $category_title = new XoopsFormText(_AM_XOOPSFAQ_E_CATEGORY_TITLE, 'category_title', 50, 150, $this->getVar('category_title', 'e')); $category_title->setDescription(_AM_XOOPSFAQ_E_CATEGORY_TITLE_DSC); $form->addElement($category_title, true); // order $category_order = new XoopsFormText(_AM_XOOPSFAQ_E_CATEGORY_WEIGHT, 'category_order', 5, 5, $this->getVar('category_order', 'e')); $category_order->setDescription(_AM_XOOPSFAQ_E_CATEGORY_WEIGHT_DSC); $form->addElement($category_order, false); $btnTray = new XoopsFormElementTray('', ''); $btnSubmit = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); $btnTray->addElement($btnSubmit); $btnCancel = new XoopsFormButton('', '', _CANCEL, 'button'); $btnCancel->setExtra('onclick="history.go(-1)"'); $btnTray->addElement($btnCancel); $form->addElement($btnTray); $form->display(); }
function execute(&$controller) { if (!preg_match("/^\\w+\$/", $this->mActionName)) { die; } // // Create action object by mActionName // $className = "Pm_" . ucfirst($this->mActionName) . "Action"; $fileName = ucfirst($this->mActionName) . "Action"; if ($this->mAdminFlag) { $fileName = XOOPS_MODULE_PATH . "/pm/admin/actions/{$fileName}.class.php"; } else { $fileName = XOOPS_MODULE_PATH . "/pm/actions/{$fileName}.class.php"; } if (!file_exists($fileName)) { die; } require_once $fileName; if (XC_CLASS_EXISTS($className)) { $this->mAction =& new $className(); } if (!is_object($this->mAction)) { $this->doActionNotFoundError($controller); return; } $handler =& xoops_gethandler('config'); $moduleConfig =& $handler->getConfigsByDirname('pm'); $this->mAction->prepare($controller, $controller->mRoot->mContext->mXoopsUser, $moduleConfig); if (!$this->mAction->hasPermission($controller, $controller->mRoot->mContext->mXoopsUser, $moduleConfig)) { $this->doPermissionError($controller); return; } if (xoops_getenv("REQUEST_METHOD") == "POST") { $viewStatus = $this->mAction->execute($controller, $controller->mRoot->mContext->mXoopsUser); } else { $viewStatus = $this->mAction->getDefaultView($controller, $controller->mRoot->mContext->mXoopsUser); } switch ($viewStatus) { case PM_FRAME_VIEW_SUCCESS: $this->mAction->executeViewSuccess($controller, $controller->mRoot->mContext->mXoopsUser, $controller->mRoot->mContext->mModule->getRenderTarget()); break; case PM_FRAME_VIEW_ERROR: $this->mAction->executeViewError($controller, $controller->mRoot->mContext->mXoopsUser, $controller->mRoot->mContext->mModule->getRenderTarget()); break; case PM_FRAME_VIEW_INDEX: $this->mAction->executeViewIndex($controller, $controller->mRoot->mContext->mXoopsUser, $controller->mRoot->mContext->mModule->getRenderTarget()); break; case PM_FRAME_VIEW_INPUT: $this->mAction->executeViewInput($controller, $controller->mRoot->mContext->mXoopsUser, $controller->mRoot->mContext->mModule->getRenderTarget()); break; case PM_FRAME_VIEW_PREVIEW: $this->mAction->executeViewPreview($controller, $controller->mRoot->mContext->mXoopsUser, $controller->mRoot->mContext->mModule->getRenderTarget()); break; case PM_FRAME_VIEW_CANCEL: $this->mAction->executeViewCancel($controller, $controller->mRoot->mContext->mXoopsUser, $controller->mRoot->mContext->mModule->getRenderTarget()); break; } }
/** * form_room_type constructor. * @param $RoomType */ public function __construct(&$RoomType) { $this->Obj =& $RoomType; parent::__construct(_AM_MARTIN_HOTEL_ROOM_CATEGORY, "op", xoops_getenv('PHP_SELF') . "?action=typesave&typeid=" . $RoomType['room_type_id']); $this->setExtra('enctype="multipart/form-data"'); $this->createElements(); $this->createButtons(); }
function My_PageNav( $total_items, $items_perpage, $current_start, $start_name='start', $extra_arg='' ) { $this->total = intval( $total_items ) ; $this->perpage = intval( $items_perpage ) ; $this->current = intval( $current_start ) ; if ( $extra_arg != '' && ( substr( $extra_arg, -5 ) != '&' || substr( $extra_arg, -1 ) != '&' ) ) $extra_arg .= '&' ; $this->url = xoops_getenv( 'PHP_SELF' ).'?'.$extra_arg.trim( $start_name ).'=' ; }
function Openid_Admin_Controller() { require_once XOOPS_ROOT_PATH . "/modules/openid/class/handler/{$this->_control}.php"; $className = 'Openid_Handler_' . ucfirst($this->_control); $this->_handler = new $className(); $this->_keyField = $this->_handler->_keyField; $this->_url = xoops_getenv('PHP_SELF') . '?controller=' . $this->_control; }
function form_hotel_city(&$HotelCityObj) { $this->Obj =& $HotelCityObj; $this->XoopsThemeForm('酒店城市', "op", xoops_getenv('PHP_SELF') . "?action=save"); $this->setExtra('enctype="multipart/form-data"'); $this->createElements(); $this->createButtons(); }
/** * form_hotel_service_type constructor. * @param $HotelServiceTypeObj */ public function __construct(&$HotelServiceTypeObj) { $this->Obj =& $HotelServiceTypeObj; parent::__construct(_AM_MARTIN_SERVICE_CATEGORY, "op", xoops_getenv('PHP_SELF') . "?action=typesave"); $this->setExtra('enctype="multipart/form-data"'); $this->createElements(); $this->createButtons(); }
function isPost() { if (xoops_getenv('REQUEST_METHOD') == "POST") { return 1; } else { return 0; } }
function form_hotel_service_type(&$HotelServiceTypeObj) { $this->Obj =& $HotelServiceTypeObj; $this->XoopsThemeForm('酒店服务类别', "op", xoops_getenv('PHP_SELF') . "?action=typesave"); $this->setExtra('enctype="multipart/form-data"'); $this->createElements(); $this->createButtons(); }
/** * form_hotel_city constructor. * @param $HotelCityObj */ public function __construct(&$HotelCityObj) { $this->Obj =& $HotelCityObj; parent::__construct(_AM_MARTIN_HOTEL_CITY, "op", xoops_getenv('PHP_SELF') . "?action=save"); $this->setExtra('enctype="multipart/form-data"'); $this->createElements(); $this->createButtons(); }
function form_room_type(&$RoomType) { $this->Obj =& $RoomType; $this->XoopsThemeForm('酒店客房类别', "op", xoops_getenv('PHP_SELF') . "?action=typesave&typeid=" . $RoomType['room_type_id']); $this->setExtra('enctype="multipart/form-data"'); $this->createElements(); $this->createButtons(); }
/** * editCategory() * * @param integer $catid * @return */ function editCategory($cat_id = 0) { $category_handler =& xoops_getmodulehandler('category', 'newbb'); if ($cat_id > 0) { $fc =& $category_handler->get($cat_id); } else { $fc =& $category_handler->create(); } $groups_cat_access = null; global $xoopsModule; if ($cat_id) { $sform = new XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . " " . $fc->getVar('cat_title'), "op", xoops_getenv('PHP_SELF')); } else { $sform = new XoopsThemeForm(_AM_NEWBB_CREATENEWCATEGORY, "op", xoops_getenv('PHP_SELF')); $fc->setVar('cat_title', ''); $fc->setVar('cat_image', 'blank.gif'); $fc->setVar('cat_description', ''); $fc->setVar('cat_order', 0); $fc->setVar('cat_state', 0); $fc->setVar('cat_showdescript', 1); $fc->setVar('cat_url', 'http://www.xoops.org XOOPS'); } $sform->addElement(new XoopsFormText(_AM_NEWBB_SETCATEGORYORDER, 'cat_order', 5, 10, $fc->getVar('cat_order')), false); $sform->addElement(new XoopsFormText(_AM_NEWBB_CATEGORY, 'title', 50, 80, $fc->getVar('cat_title', 'E')), true); $sform->addElement(new XoopsFormDhtmlTextArea(_AM_NEWBB_CATEGORYDESC, 'catdescript', $fc->getVar('cat_description', 'E'), 10, 60), false); $displaydescription_radio = new XoopsFormRadioYN(_AM_NEWBB_SHOWDESC, 'show', $fc->getVar('cat_showdescript'), '' . _YES . '', ' ' . _NO . ''); $sform->addElement($displaydescription_radio); $status_select = new XoopsFormSelect(_AM_NEWBB_STATE, "state", $fc->getVar('cat_state')); $status_select->addOptionArray(array('0' => _AM_NEWBB_ACTIVE, '1' => _AM_NEWBB_INACTIVE)); $sform->addElement($status_select); $imgdir = "/modules/" . $xoopsModule->dirname() . "/images/category"; if (!$fc->getVar("cat_image")) { $fc->setVar('cat_image', 'blank.gif'); } $graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $imgdir . "/"); array_unshift($graph_array, _NONE); $indeximage_select = new XoopsFormSelect('', 'indeximage', $fc->getVar('cat_image')); $indeximage_select->addOptionArray($graph_array); $indeximage_select->setExtra("onchange=\"showImgSelected('img', 'indeximage', '/" . $imgdir . "/', '', '" . XOOPS_URL . "')\""); $indeximage_tray = new XoopsFormElementTray(_AM_NEWBB_IMAGE, ' '); $indeximage_tray->addElement($indeximage_select); $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . $imgdir . "/" . $fc->getVar('cat_image') . " 'name='img' id='img' alt='' />")); $sform->addElement($indeximage_tray); $sform->addElement(new XoopsFormText(_AM_NEWBB_SPONSORLINK, 'sponurl', 50, 80, $fc->getVar('cat_url', 'E')), false); $sform->addElement(new XoopsFormHidden('cat_id', $cat_id)); $button_tray = new XoopsFormElementTray('', ''); $button_tray->addElement(new XoopsFormHidden('op', 'save')); $butt_save = new XoopsFormButton('', '', _SUBMIT, 'submit'); $butt_save->setExtra('onclick="this.form.elements.op.value=\'save\'"'); $button_tray->addElement($butt_save); if ($cat_id) { $butt_delete = new XoopsFormButton('', '', _CANCEL, 'submit'); $butt_delete->setExtra('onclick="this.form.elements.op.value=\'default\'"'); $button_tray->addElement($butt_delete); } $sform->addElement($button_tray); $sform->display(); }
/** * form_hotel_service constructor. * @param $HotelServiceObj * @param $TypeList */ public function __construct(&$HotelServiceObj, &$TypeList) { $this->Obj =& $HotelServiceObj; $this->TypeList =& $TypeList; parent::__construct(_AM_MARTIN_HOTEL_SERVICE, "op", xoops_getenv('PHP_SELF') . "?action=save"); $this->setExtra('enctype="multipart/form-data"'); $this->createElements(); $this->createButtons(); }
function form_room_price(&$RoomPriceObj, &$RoomList) { $this->Obj =& $RoomPriceObj; $this->RoomList =& $RoomList; $this->XoopsThemeForm('酒店客房价格', "op", xoops_getenv('PHP_SELF') . "?action=pricesave&room_id=" . @$RoomPriceObj['room_id'] . "&room_date=" . date('Y-m-d', @$RoomPriceObj['room_date'])); $this->setExtra('enctype="multipart/form-data"'); $this->createElements(); $this->createButtons(); }
function form_hotel_promotion(&$HotelPromotionObj, &$HotelList) { $this->Obj =& $HotelPromotionObj; $this->HotelList =& $HotelList; $this->XoopsThemeForm('促销', "op", xoops_getenv('PHP_SELF') . "?action=save"); $this->setExtra('enctype="multipart/form-data"'); $this->createElements(); $this->createButtons(); }
/** * @param $target */ public function __construct(&$target) { $this->publisher =& PublisherPublisher::getInstance(); $this->targetObject =& $target; parent::__construct(_AM_PUBLISHER_UPLOAD_FILE, 'form', xoops_getenv('PHP_SELF')); $this->setExtra('enctype="multipart/form-data"'); $this->createElements(); $this->createButtons(); }
/** * form_room_price constructor. * @param $RoomPriceObj * @param $RoomList */ public function __construct(&$RoomPriceObj, &$RoomList) { $this->Obj =& $RoomPriceObj; $this->RoomList =& $RoomList; parent::__construct(_AM_MARTIN_HOTEL_ROOM_RATES, "op", xoops_getenv('PHP_SELF') . "?action=pricesave&room_id=" . @$RoomPriceObj['room_id'] . "&room_date=" . date('Y-m-d', @$RoomPriceObj['room_date'])); $this->setExtra('enctype="multipart/form-data"'); $this->createElements(); $this->createButtons(); }
/** * If the request is GET, never return token name. * By this logic, a action can have three page in one action. */ function getTokenName() { // // if (xoops_getenv('REQUEST_METHOD') == 'POST') { return "module.user.AvatarSettingsForm.TOKEN"; } else { return null; } }
function form_hotel_service_relation(&$Relation, &$serviceList, &$hotelList) { $this->Obj =& $Relation; $this->serviceList =& $serviceList; $this->hotelList =& $hotelList; $this->XoopsThemeForm('酒店酒店关联', "op", xoops_getenv('PHP_SELF') . "?action=hotelsave&hotel_id={$Relation['hotel_id']}&service_id={$Relation['service_id']}"); $this->setExtra('enctype="multipart/form-data"'); $this->createElements(); $this->createButtons(); }
public function __construct($total_items, $items_perpage, $current_start, $start_name = "start", $extra_arg = "") { $this->total = intval($total_items); $this->perpage = intval($items_perpage); $this->current = intval($current_start); if ($extra_arg != '' && (substr($extra_arg, -5) != '&' || substr($extra_arg, -1) != '&')) { $extra_arg .= '&'; } $this->url = xoops_getenv('PHP_SELF') . '?' . $extra_arg . trim($start_name) . '='; }
/** * form_auction constructor. * @param $AuctionObj * @param $RoomList * @param $HotelList */ public function __construct(&$AuctionObj, &$RoomList, &$HotelList) { $this->Obj =& $AuctionObj; $this->RoomList =& $RoomList; $this->HotelList =& $HotelList; parent::__construct(_AM_MARTIN_HOTEL_BIDDING, "op", xoops_getenv('PHP_SELF') . "?action=save"); $this->setExtra('enctype="multipart/form-data"'); $this->createElements(); $this->createButtons(); }
function form_group(&$GroupObj, &$RoomList, &$HotelList) { $this->Obj =& $GroupObj; $this->RoomList =& $RoomList; $this->HotelList =& $HotelList; $this->XoopsThemeForm('团购', "op", xoops_getenv('PHP_SELF') . "?action=save"); $this->setExtra('enctype="multipart/form-data"'); $this->createElements(); $this->createButtons(); }
/** * If the request is GET, never return token name. * By this logic, a action can have three page in one action. */ function getTokenName() { // // if (xoops_getenv('REQUEST_METHOD') == 'POST') { return "module.legacy.CommentSettingsForm.TOKEN"; } else { return null; } }
/** * If the request is GET, never return token name. * By this logic, a action can have three page in one action. */ function getTokenName() { // //only in case of batchjob not searchresult if (xoops_getenv('REQUEST_METHOD') == 'POST' && isset($_REQUEST['batchjob'])) { return "module.user.UserSearchSettingsForm.TOKEN"; } else { return null; } }
/** * If the request is GET, never return token name. * By this logic, a action can have three page in one action. */ function getTokenName() { // // if (xoops_getenv('REQUEST_METHOD') == 'POST') { return "module.legacy.BlockListForm.TOKEN"; } else { return null; } }