本文整理汇总了PHP中mosAdminMenus::MenuLinks方法的典型用法代码示例。如果您正苦于以下问题:PHP mosAdminMenus::MenuLinks方法的具体用法?PHP mosAdminMenus::MenuLinks怎么用?PHP mosAdminMenus::MenuLinks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mosAdminMenus
的用法示例。
在下文中一共展示了mosAdminMenus::MenuLinks方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editModule
/**
* Compiles information to add or edit a module
* @param string The current GET/POST option
* @param integer The unique id of the record to edit
*/
function editModule($option, $uid, $client)
{
global $database, $my, $mainframe;
global $mosConfig_absolute_path;
$lists = array();
$row = new mosModule($database);
// load the row from the db table
$row->load((int) $uid);
// fail if checked out not by 'me'
if ($row->isCheckedOut($my->id)) {
mosErrorAlert("The module " . $row->title . " is currently being edited by another administrator");
}
$row->content = htmlspecialchars($row->content);
if ($uid) {
$row->checkout($my->id);
}
// if a new record we must still prime the mosModule object with a default
// position and the order; also add an extra item to the order list to
// place the 'new' record in last position if desired
if ($uid == 0) {
$row->position = 'left';
$row->showtitle = true;
//$row->ordering = $l;
$row->published = 1;
}
if ($client == 'admin') {
$where = "client_id = 1";
$lists['client_id'] = 1;
$path = 'mod1_xml';
} else {
$where = "client_id = 0";
$lists['client_id'] = 0;
$path = 'mod0_xml';
}
$query = "SELECT position, ordering, showtitle, title" . "\n FROM #__modules" . "\n WHERE {$where}" . "\n ORDER BY ordering";
$database->setQuery($query);
if (!($orders = $database->loadObjectList())) {
echo $database->stderr();
return false;
}
$query = "SELECT position, description" . "\n FROM #__template_positions" . "\n WHERE position != ''" . "\n ORDER BY position";
$database->setQuery($query);
// hard code options for now
$positions = $database->loadObjectList();
$orders2 = array();
$pos = array();
foreach ($positions as $position) {
$orders2[$position->position] = array();
$pos[] = mosHTML::makeOption($position->position, $position->description);
}
$l = 0;
$r = 0;
for ($i = 0, $n = count($orders); $i < $n; $i++) {
$ord = 0;
if (array_key_exists($orders[$i]->position, $orders2)) {
$ord = count(array_keys($orders2[$orders[$i]->position])) + 1;
}
$orders2[$orders[$i]->position][] = mosHTML::makeOption($ord, $ord . '::' . addslashes($orders[$i]->title));
}
// build the html select list
$pos_select = 'onchange="changeDynaList(\'ordering\',orders,document.adminForm.position.options[document.adminForm.position.selectedIndex].value, originalPos, originalOrder)"';
$active = $row->position ? $row->position : 'left';
$lists['position'] = mosHTML::selectList($pos, 'position', 'class="inputbox" size="1" ' . $pos_select, 'value', 'text', $active);
// get selected pages for $lists['selections']
if ($uid) {
$query = "SELECT menuid AS value" . "\n FROM #__modules_menu" . "\n WHERE moduleid = " . (int) $row->id;
$database->setQuery($query);
$lookup = $database->loadObjectList();
} else {
$lookup = array(mosHTML::makeOption(0, 'All'));
}
if ($row->access == 99 || $row->client_id == 1 || $lists['client_id']) {
$lists['access'] = 'Administrator<input type="hidden" name="access" value="99" />';
$lists['showtitle'] = 'N/A <input type="hidden" name="showtitle" value="1" />';
$lists['selections'] = 'N/A';
} else {
if ($client == 'admin') {
$lists['access'] = 'N/A';
$lists['selections'] = 'N/A';
} else {
$lists['access'] = mosAdminMenus::Access($row);
$lists['selections'] = mosAdminMenus::MenuLinks($lookup, 1, 1);
}
$lists['showtitle'] = mosHTML::yesnoRadioList('showtitle', 'class="inputbox"', $row->showtitle);
}
// build the html select list for published
$lists['published'] = mosAdminMenus::Published($row);
$row->description = '';
// XML library
require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
// xml file for module
$xmlfile = $mainframe->getPath($path, $row->module);
$xmlDoc = new DOMIT_Lite_Document();
$xmlDoc->resolveErrors(true);
if ($xmlDoc->loadXML($xmlfile, false, true)) {
//.........这里部分代码省略.........
示例2: assignTemplate
function assignTemplate($p_tname, $option, $client)
{
global $database;
// get selected pages for $menulist
if ($p_tname) {
$database->setQuery("SELECT menuid AS value FROM #__templates_menu WHERE client_id='0' AND template='{$p_tname}'");
$lookup = $database->loadObjectList();
}
// build the html select list
$menulist = mosAdminMenus::MenuLinks($lookup, 0, 1);
HTML_templates::assignTemplate($p_tname, $menulist, $option, $client);
}
示例3: editModule
/**
* Compiles information to add or edit a module
* @param string The current GET/POST option
* @param integer The unique id of the record to edit
*/
function editModule($option, $uid, $client)
{
global $database, $my, $mainframe;
global $mosConfig_absolute_path;
$lists = array();
$row = new mosModule($database);
// load the row from the db table
$row->load($uid);
// fail if checked out not by 'me'
if ($row->checked_out && $row->checked_out != $my->id) {
echo "<script>alert('" . sprintf(T_('The module %s is currently being edited by another administrator'), $row->title) . "'); document.location.href='index2.php?option={$option}'</script>\n";
exit(0);
}
$row->title = htmlspecialchars(str_replace('&', '&', $row->title));
$row->content = htmlspecialchars(str_replace('&', '&', $row->content));
if ($uid) {
$row->checkout($my->id);
}
// if a new record we must still prime the mosModule object with a default
// position and the order; also add an extra item to the order list to
// place the 'new' record in last position if desired
if ($uid == 0) {
$row->position = 'left';
$row->showtitle = true;
//$row->ordering = $l;
$row->published = 1;
}
if ($client == 'admin') {
$where = "client_id='1'";
$lists['client_id'] = 1;
$path = 'mod1_xml';
} else {
$where = "client_id='0'";
$lists['client_id'] = 0;
$path = 'mod0_xml';
}
$query = "SELECT position, ordering, showtitle, title" . "\n FROM #__modules" . "\n WHERE " . $where . "\n ORDER BY ordering";
$database->setQuery($query);
if (!($orders = $database->loadObjectList())) {
echo $database->stderr();
return false;
}
$query = "SELECT position, description" . "\n FROM #__template_positions" . "\n WHERE position <> ''";
$database->setQuery($query);
// hard code options for now
$positions = $database->loadObjectList();
$orders2 = array();
$pos = array();
foreach ($positions as $position) {
$orders2[$position->position] = array();
$pos[] = mosHTML::makeOption($position->position, $position->description);
}
$l = 0;
$r = 0;
for ($i = 0, $n = count($orders); $i < $n; $i++) {
$ord = 0;
if (array_key_exists($orders[$i]->position, $orders2)) {
$ord = count(array_keys($orders2[$orders[$i]->position])) + 1;
}
$orders2[$orders[$i]->position][] = mosHTML::makeOption($ord, $ord . '::' . addslashes($orders[$i]->title));
}
// build the html select list
$pos_select = 'onchange="changeDynaList(\'ordering\',orders,document.adminForm.position.options[document.adminForm.position.selectedIndex].value, originalPos, originalOrder)"';
$active = $row->position ? $row->position : 'left';
$lists['position'] = mosHTML::selectList($pos, 'position', 'class="inputbox" size="1" ' . $pos_select, 'value', 'text', $active);
// get selected pages for $lists['selections']
if ($uid) {
$query = 'SELECT menuid AS value FROM #__modules_menu WHERE moduleid=' . $row->id;
$database->setQuery($query);
$lookup = $database->loadObjectList();
} else {
$lookup = array(mosHTML::makeOption(0, 'All'));
}
if ($row->access == 99 || $row->client_id == 1 || $lists['client_id']) {
$lists['access'] = T_('Administrator') . '<input type="hidden" name="access" value="99" />';
$lists['showtitle'] = T_('N/A') . ' <input type="hidden" name="showtitle" value="1" />';
$lists['selections'] = T_('N/A');
} else {
if ($client == 'admin') {
$lists['access'] = T_('N/A');
$lists['selections'] = T_('N/A');
} else {
$lists['access'] = mosAdminMenus::Access($row);
$lists['groups'] = mosAdminMenus::groupAccess($row);
$lists['selections'] = mosAdminMenus::MenuLinks($lookup, 1, 1);
}
$lists['showtitle'] = mosHTML::yesnoRadioList('showtitle', 'class="inputbox"', $row->showtitle);
}
// build the html select list for published
$lists['published'] = mosAdminMenus::Published($row);
// xml file for module
$xmlfile = $mainframe->getPath($path, $row->module);
if ($xmlfile) {
$xmlparser =& new mosXMLDescription($xmlfile);
$row->description = $xmlparser->getDescription('module');
//.........这里部分代码省略.........
示例4: editPoll
function editPoll($uid = 0, $option = 'com_poll')
{
global $database, $my, $adminLanguage;
$row = new mosPoll($database);
// load the row from the db table
$row->load($uid);
// fail if checked out not by 'me'
if ($row->checked_out && $row->checked_out != $my->id) {
mosRedirect("index2.php?option=" . $option, $adminLanguage->A_COMP_POLL_THE . " " . $row->title . " " . $adminLanguage->A_COMP_POLL_BEING);
}
$options = array();
if ($uid) {
$row->checkout($my->id);
$query = "SELECT id, text FROM #__poll_data" . "\n WHERE pollid='{$uid}'" . "\n ORDER BY id";
$database->setQuery($query);
$options = $database->loadObjectList();
} else {
$row->lag = 3600 * 24;
}
// get selected pages
if ($uid) {
$database->setQuery("SELECT menuid AS value FROM #__poll_menu WHERE pollid='{$row->id}'");
$lookup = $database->loadObjectList();
} else {
$lookup = array(mosHTML::makeOption(0, 'All'));
}
// build the html select list
$lists['select'] = mosAdminMenus::MenuLinks($lookup, 1, 1);
HTML_poll::editPoll($row, $options, $lists);
}
示例5: editPoll
function editPoll($uid = 0, $option = 'com_poll')
{
global $database, $my;
$row = new mosPoll($database);
// load the row from the db table
$row->load((int) $uid);
// fail if checked out not by 'me'
if ($row->isCheckedOut($my->id)) {
mosRedirect('index2.php?option=' . $option, 'The poll ' . $row->title . ' is currently being edited by another administrator.');
}
$options = array();
if ($uid) {
$row->checkout($my->id);
$query = "SELECT id, text" . "\n FROM #__poll_data" . "\n WHERE pollid = " . (int) $uid . "\n ORDER BY id";
$database->setQuery($query);
$options = $database->loadObjectList();
} else {
$row->lag = 3600 * 24;
$row->published = 1;
}
// get selected pages
if ($uid) {
$query = "SELECT menuid AS value" . "\n FROM #__poll_menu" . "\n WHERE pollid = " . (int) $row->id;
$database->setQuery($query);
$lookup = $database->loadObjectList();
} else {
$lookup = array(mosHTML::makeOption(0, 'All'));
}
// build the html select list
$lists['select'] = mosAdminMenus::MenuLinks($lookup, 1, 1);
// build the html select list for published
$lists['published'] = mosAdminMenus::Published($row);
HTML_poll::editPoll($row, $options, $lists);
}
示例6: assignTemplate
function assignTemplate($p_tname, $option, $client)
{
global $database;
josSpoofCheck();
// get selected pages for $menulist
if ($p_tname) {
$query = "SELECT menuid AS value" . "\n FROM #__templates_menu" . "\n WHERE client_id = 0" . "\n AND template = " . $database->Quote($p_tname);
$database->setQuery($query);
$lookup = $database->loadObjectList();
}
// build the html select list
$menulist = mosAdminMenus::MenuLinks($lookup, 0, 1);
HTML_templates::assignTemplate($p_tname, $menulist, $option, $client);
}
示例7: editPoll
function editPoll($uid = 0, $option = 'com_poll')
{
global $database, $my;
$row = new mosPoll($database);
// load the row from the db table
$row->load($uid);
// fail if checked out not by 'me'
if ($row->checked_out && $row->checked_out != $my->id) {
$msg = sprintf(T_('The poll %s is currently being edited by another administrator.'), $row->title);
mosRedirect('index2.php?option=' . $option, $msg);
}
$options = array();
if ($uid) {
$row->checkout($my->id);
$query = "SELECT id, text FROM #__poll_data" . "\n WHERE pollid='{$uid}'" . "\n ORDER BY id";
$database->setQuery($query);
$options = $database->loadObjectList();
} else {
$row->lag = 3600 * 24;
}
// get selected pages
if ($uid) {
$database->setQuery("SELECT menuid AS value FROM #__poll_menu WHERE pollid='{$row->id}'");
$lookup = $database->loadObjectList();
} else {
$lookup = array(mosHTML::makeOption(0, 'All'));
}
// build the html select list
$lists['select'] = mosAdminMenus::MenuLinks($lookup, 1, 1);
HTML_poll::editPoll($row, $options, $lists);
}