本文整理汇总了PHP中AMA_DataHandler::getAllPrepared方法的典型用法代码示例。如果您正苦于以下问题:PHP AMA_DataHandler::getAllPrepared方法的具体用法?PHP AMA_DataHandler::getAllPrepared怎么用?PHP AMA_DataHandler::getAllPrepared使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AMA_DataHandler
的用法示例。
在下文中一共展示了AMA_DataHandler::getAllPrepared方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_menu_children_recursive
/**
* @author giorgio 19/ago/2014
*
* recursively gets all the children of a given menu item
*
* @param number $tree_id the id of the menu tree to load
* @param number $parent_id the id of the parent to get children for
* @param AMA_DataHandler $dbToUse the data handler to be used, either Common or Tester
* @param boolean $get_all set it to true to get also disabled elements.
*
* @return array of found children or null if no children found
*
* @access private
*/
private function get_menu_children_recursive($tree_id = 0, $parent_id, $dbToUse, $get_all)
{
$sql = 'SELECT MI.*, MT.extraClass AS menuExtraClass FROM `menu_items` AS MI JOIN `menu_tree` AS MT ON ' . 'MI.item_id=MT.item_id WHERE MT.tree_id=? AND MT.parent_id=?';
if (!$get_all) {
$sql .= ' AND MI.enabledON!="' . Menu::NEVER_ENABLED . '"';
}
$sql .= ' ORDER BY MI.order ASC';
$res = $dbToUse->getAllPrepared($sql, array($tree_id, $parent_id), AMA_FETCH_ASSOC);
if (AMA_DB::isError($res) || count($res) <= 0 || $res === false) {
return null;
} else {
foreach ($res as $count => $element) {
$res[$count]['children'] = $this->get_menu_children_recursive($tree_id, $element['item_id'], $dbToUse, $get_all);
}
return $res;
}
}