本文整理汇总了PHP中mosParameters::getParams方法的典型用法代码示例。如果您正苦于以下问题:PHP mosParameters::getParams方法的具体用法?PHP mosParameters::getParams怎么用?PHP mosParameters::getParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mosParameters
的用法示例。
在下文中一共展示了mosParameters::getParams方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mosParseParams
/**
* @param string
* @return string
* Deprecated - use the code within this function instead - not used in Mambo
*/
function mosParseParams($txt)
{
$pparser = new mosParameters($txt);
return $pparser->getParams();
}
示例2: moveMenu
/**
* Form for moving item(s) to a specific menu
*/
function moveMenu($option, $cid, $menutype)
{
global $database;
if (!is_array($cid) || count($cid) < 1) {
echo "<script> alert('" . T_('Select an item to move') . "'); window.history.go(-1);</script>\n";
exit;
}
## query to list selected menu items
$cids = implode(',', $cid);
$query = "SELECT a.name FROM #__menu AS a WHERE a.id IN ( " . $cids . " )";
$database->setQuery($query);
$items = $database->loadObjectList();
## query to choose menu
$query = "SELECT a.params FROM #__modules AS a WHERE a.module = 'mod_mainmenu' ORDER BY a.title";
$database->setQuery($query);
$modules = $database->loadObjectList();
foreach ($modules as $module) {
$pparser = new mosParameters($module->params);
$params = $pparser->getParams();
// adds menutype to array
$type = trim(@$params->menutype);
$menu[] = mosHTML::makeOption($type, $type);
}
// build the html select list
$MenuList = mosHTML::selectList($menu, 'menu', 'class="inputbox" size="10"', 'value', 'text', null);
HTML_menusections::moveMenu($option, $cid, $MenuList, $items, $menutype);
}
示例3: copyMenu
/**
* Copies a complete menu, all its items and creates a new module, using the name speified
*/
function copyMenu($option, $cid, $type)
{
global $database;
$menu_name = mosGetParam($_POST, 'menu_name', 'New Menu');
$module_name = mosGetParam($_POST, 'module_name', 'New Module');
// check for unique menutype for new menu copy
$query = "SELECT params" . "\n FROM #__modules" . "\n WHERE module = 'mod_mainmenu'";
$database->setQuery($query);
$menus = $database->loadResultArray();
foreach ($menus as $menu) {
$pparser = new mosParameters($menu);
$params = $pparser->getParams();
if ($params->menutype == $menu_name) {
echo "<script> alert('" . T_('A menu with that name already exists - you must enter a unique Menu Name') . "'); window.history.go(-1); </script>\n";
exit;
}
}
// copy the menu items
$mids = mosGetParam($_POST, 'mids', '');
$total = count($mids);
$copy = new mosMenu($database);
$original = new mosMenu($database);
sort($mids);
$a_ids = array();
foreach ($mids as $mid) {
$original->load($mid);
$copy = $original;
$copy->id = NULL;
$copy->parent = $a_ids[$original->parent];
$copy->menutype = $menu_name;
if (!$copy->check()) {
echo "<script> alert('" . $copy->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
if (!$copy->store()) {
echo "<script> alert('" . $copy->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
$a_ids[$original->id] = $copy->id;
}
// create the module copy
$row = new mosModule($database);
$row->load(0);
$row->title = $module_name;
$row->iscore = 0;
$row->published = 1;
$row->position = 'left';
$row->module = 'mod_mainmenu';
$row->params = 'menutype=' . $menu_name;
if (!$row->check()) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
if (!$row->store()) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
$row->checkin();
$row->updateOrder("position='" . $row->position . "'");
// module assigned to show on All pages by default
// ToDO: Changed to become a mambo db-object
$query = "INSERT INTO #__modules_menu VALUES ( {$row->id}, 0 )";
$database->setQuery($query);
if (!$database->query()) {
echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
exit;
}
$msg = sprintf(Tn_('Copy of Menu `%s` created, consisting of %d item', 'Copy of Menu `%s` created, consisting of %d items', $total), $type, $total);
mosRedirect('index2.php?option=' . $option, $msg);
}