本文整理汇总了PHP中Box::dropdown方法的典型用法代码示例。如果您正苦于以下问题:PHP Box::dropdown方法的具体用法?PHP Box::dropdown怎么用?PHP Box::dropdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box
的用法示例。
在下文中一共展示了Box::dropdown方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tools
/**
* Displays a few tools associated with the currently viewed page
* @return string
*/
function tools($id = false, $extras = true)
{
global $Controller, $ID;
if (!$id) {
$id = $ID;
}
if (is_object($id)) {
$obj = $id;
$id = $obj->ID;
} else {
$obj = $Controller->get($id);
}
if (!$obj) {
return false;
}
$r = array();
if ($extras === true) {
$r[] = icon('small/eye', __('View'), url(array('id' => $id)), true);
$extras = false;
}
if ($obj->mayI(EDIT)) {
if ($editors = $obj->editable) {
foreach ($editors as $editor => $aLevel) {
if ($obj->mayI($aLevel)) {
$r[] = icon($editor::$edit_icon, __($editor::$edit_text), url(array('edit' => $id, 'with' => $editor)), true);
}
}
}
}
if (is_array($extras)) {
$r = array_merge($r, $extras);
} elseif ($extras) {
$r[] = $extras;
}
return Box::dropdown('small/bullet_wrench', false, $r);
}
示例2: makeMenu
/**
* Render the menu for editing
* @param array $array
* @return string
*/
private function makeMenu($array)
{
static $i = 0;
static $recursion = 0;
if (count($array) == 0) {
return;
}
++$recursion;
global $CONFIG, $USER;
if ($this->mayI(EDIT)) {
JS::loadjQuery(false);
JS::lib('menusort');
}
/* $r=''; */
$r = '<ul class="menulist">';
$save = array('edit', 'with', 'id');
while (list(, $obj) = each($array)) {
$r .= '<li id="m' . $obj['id'] . '" class="' . (++$i % 2 ? 'odd' : 'even') . (is_a($obj['object'], 'MenuSection') ? ' menusection' : '') . '"><span class="fixed-width">' . $obj['object'] . '</span>' . Box::tools($obj['object']) . Box::dropdown('small/add', false, array(icon('small/arrow_right', __('New child page'), url(array('action' => 'newpage', 'where' => 'child', 'to' => $obj['id']), $save), true), icon('small/arrow_down', __('New page below'), url(array('action' => 'newpage', 'where' => 'below', 'to' => $obj['id']), $save), true))) . Box::dropdown('small/arrow_out', false, false, 'pagemove') . (isset($obj['children']) ? $this->makeMenu($obj['children']) : '') . '</li>';
}
$r .= '</ul>';
--$recursion;
if ($recursion == 0) {
$i = 0;
}
return $r;
}