本文整理汇总了PHP中Library::removeKeys方法的典型用法代码示例。如果您正苦于以下问题:PHP Library::removeKeys方法的具体用法?PHP Library::removeKeys怎么用?PHP Library::removeKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library
的用法示例。
在下文中一共展示了Library::removeKeys方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getComments
public function getComments($menuId)
{
$rows = $this->db->query("SELECT * FROM comment WHERE menu_id=%i", $menuId)->fetchAll();
foreach ($rows as &$row) {
$row['comment_id'] = (int) $row['comment_id'];
}
array_unshift($rows, new \Dibi\Row(array('id' => 0, 'comment_id' => null)));
$tree = $this->library->convertToTree($rows, 'id', 'comment_id', 'comments');
$tree[0]['comments'] = $this->library->removeKeys($tree[0]['comments'], 'comments');
return $tree[0]['comments'];
}
示例2: getMenu
public function getMenu($languageId = null)
{
if (empty($languageId)) {
$languageId = $this->languageId;
}
if (!isset($this->menu[$languageId])) {
$sql = "SELECT m.id,m.menu_id,m.type_id,t.text,t.url,visibility,IF(url IS NULL AND sort = 0, 255, sort) AS sort\n \t\t\tFROM [menu] m\n\t\t\tLEFT JOIN [name_has_text] nht ON m.name_id=nht.name_id AND language_id=%i\n\t\t\tLEFT JOIN [text] t ON t.id=nht.text_id\n\t\t\tWHERE site_id=%i\n\t\t\tORDER BY m.visibility,[sort],[id]";
$rows = $this->db->query($sql, $languageId, $this->siteId)->fetchAll();
foreach ($rows as &$row) {
$row['menu_id'] = (int) $row['menu_id'];
}
array_unshift($rows, new \Dibi\Row(array('id' => 0, 'menu_id' => null)));
$tree = $this->library->convertToTree($rows, 'id', 'menu_id', 'items');
$tree[0]['items'] = $this->library->removeKeys($tree[0]['items'], 'items');
$this->menu[$languageId] = $tree;
}
return $this->menu[$languageId];
}
示例3: getMenu
public function getMenu($type = 'visible')
{
if (!isset($this->menu[$type])) {
$sql = "SELECT m.id,m.menu_id,m.type_id AS type,t.text,t.url,m.visibility FROM [menu] m\n\t\t\tJOIN [name_has_text] nht ON m.name_id=nht.name_id AND language_id=%i\n\t\t\tJOIN [text] t ON t.id=nht.text_id\n\t\t\tWHERE site_id=%i AND m.visibility = %s\n\t\t\tORDER BY [sort],[id]";
$rows = $this->db->query($sql, $this->getLanguageId(), $this->siteId, $type)->fetchAll();
foreach ($rows as &$row) {
$row['menu_id'] = (int) $row['menu_id'];
}
if ($type == 'visible') {
array_unshift($rows, new DibiRow(array('id' => 0, 'menu_id' => null)));
$tree = $this->library->convertToTree($rows, 'id', 'menu_id', 'items');
$tree[0]['items'] = $this->library->removeKeys($tree[0]['items'], 'items');
$this->menu[$type] = $tree;
} else {
$this->menu[$type] = $rows;
}
}
return $this->menu[$type];
}