本文整理汇总了PHP中feedback_renumber_items函数的典型用法代码示例。如果您正苦于以下问题:PHP feedback_renumber_items函数的具体用法?PHP feedback_renumber_items怎么用?PHP feedback_renumber_items使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了feedback_renumber_items函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: feedback_delete_item
/**
* deletes a item and also deletes all related values
* @param int $itemid
* @param boolean $renumber should the kept items renumbered Yes/No
* @return void
*/
function feedback_delete_item($itemid, $renumber = true)
{
$item = get_record('feedback_item', 'id', $itemid);
@delete_records("feedback_value", "item", $itemid);
@delete_records("feedback_valuetmp", "item", $itemid);
delete_records("feedback_item", "id", $itemid);
if ($renumber) {
feedback_renumber_items($item->feedback);
}
}
示例2: feedback_movedown_item
/**
* this increased the position of the given item
*
* @global object
* @param object $item
* @return bool
*/
function feedback_movedown_item($item) {
global $DB;
$params = array('feedback'=>$item->feedback);
if (!$items = $DB->get_records('feedback_item', $params, 'position')) {
return false;
}
$movedownitem = null;
foreach ($items as $i) {
if (!is_null($movedownitem) AND $movedownitem->id == $item->id) {
$movedownitem->position = $i->position;
$i->position--;
feedback_update_item($movedownitem);
feedback_update_item($i);
feedback_renumber_items($item->feedback);
return true;
}
$movedownitem = $i;
}
return false;
}
示例3: feedback_delete_item
/**
* deletes a item and also deletes all related values
*
* @global object
* @param int $itemid
* @param boolean $renumber should the kept items renumbered Yes/No
* @return void
*/
function feedback_delete_item($itemid, $renumber = true)
{
global $DB;
$item = $DB->get_record('feedback_item', array('id' => $itemid));
$DB->delete_records("feedback_value", array("item" => $itemid));
$DB->delete_records("feedback_valuetmp", array("item" => $itemid));
$DB->delete_records("feedback_item", array("id" => $itemid));
if ($renumber) {
feedback_renumber_items($item->feedback);
}
}