本文整理汇总了PHP中func::MakeOptionsListEx方法的典型用法代码示例。如果您正苦于以下问题:PHP func::MakeOptionsListEx方法的具体用法?PHP func::MakeOptionsListEx怎么用?PHP func::MakeOptionsListEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类func
的用法示例。
在下文中一共展示了func::MakeOptionsListEx方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
function add()
{
if (!$this->haveAccessTo('edit')) {
return $this->showAccessDenied();
}
$nParentID = Func::POSTGET('pid', false, true);
$aData = array('title' => '', 'pid' => $nParentID, 'keyword' => '', 'keyword' => '', 'menu_link' => '', 'menu_target' => '', 'mkeywords' => '', 'mdescription' => '');
if (Func::isPostMethod()) {
Func::setSESSION('pid', $nParentID);
$sKeyword = Func::POST('keyword', true);
$sMenuTarget = Func::POST('target');
if (!in_array($sMenuTarget, array('_self', '_blank'))) {
$sMenuTarget = '_self';
}
$sType = Func::POST('type');
switch ($sType) {
case 'menu_type':
$sMenuTitle = Func::POST('menu_title4', true);
$sMetaKeywords = Func::POST('mkeywords4', true);
$sMetaDescription = Func::POST('mdescription4', true);
$sMenuLink = '#';
break;
case 'page':
$nPageID = Func::POST('page_id', false, true);
$aPageInfo = $this->db->one_array('SELECT * FROM ' . TABLE_PAGES . ' WHERE id=' . $nPageID . ' LIMIT 1');
if (!$aPageInfo) {
$this->adminRedirect(Errors::IMPOSSIBLE);
}
$sMenuTitle = Func::POST('menu_title3', true);
if (!$sMenuTitle) {
$sMenuTitle = $aPageInfo['title'];
}
$sMetaKeywords = $aPageInfo['mkeywords'];
$sMetaDescription = $aPageInfo['mdescription'];
$sMenuLink = $aPageInfo['filename'] . PAGES_EXTENSION;
break;
case 'link':
default:
$sMenuTitle = Func::POST('menu_title2', true);
$sMenuLink = Func::POST('menu_link2', true);
$sMetaDescription = Func::POST('mdescription2', true);
$sMetaKeywords = Func::POST('mkeywords2', true);
}
$_POST['menu_title'] = $sMenuTitle;
$_POST['menu_link'] = $sMenuLink;
$_POST['mdescription'] = $sMetaDescription;
$_POST['mkeywords'] = $sMetaKeywords;
if (!$sMenuTitle || !trim($sMenuTitle)) {
$this->errors->set('empty:title');
}
if ($this->errors->no()) {
$nNodeID = $this->tree_insertNode($nParentID);
$this->addItem($nNodeID, $sMenuTitle, $sKeyword, $sMenuLink, $sMetaKeywords, $sMetaDescription, $sMenuTarget);
$this->adminRedirect(Errors::SUCCESS);
}
$aData = $_POST;
}
if (!$nParentID) {
$nParentID = Func::SESSION('pid');
}
//parent options
$sParentOptions = '';
$aItems = $this->db->select('SELECT I.menu_title, T.id, T.numlevel, I.keyword FROM ' . TABLE_SITEMAP_TREE . ' T, ' . TABLE_SITEMAP . ' I
WHERE T.id=I.node_id AND T.numlevel<=2
ORDER BY T.numleft');
foreach ($aItems as $v) {
if (!empty($v['keyword'])) {
$sParentOptions .= '<option value="' . $v['id'] . '" style="padding-left:' . $v['numlevel'] * 18 . 'px;"
' . ($nParentID == $v['id'] ? ' selected' : '') . '>' . $v['menu_title'] . '</option>';
}
}
$this->tplAssign('aData', $aData);
$this->tplAssign('pid_options', $sParentOptions);
$this->tplAssign('target_options', $this->getTargetsOptions($this->aTargets, $aData['menu_target']));
$this->tplAssign('pages_options', func::MakeOptionsListEx($this->db->select('SELECT * FROM ' . TABLE_PAGES), Func::POSTGET('page_id', false, true), 'title', 'id'));
return $this->tplFetch('admin.add.tpl');
}
示例2: getTargetsOptions
function getTargetsOptions($aTargets, $sCurTarget = '_self')
{
return func::MakeOptionsListEx($aTargets, $sCurTarget, 'text', 'value');
}