本文整理汇总了PHP中EEM_Base::delete_or_restore_by_ID方法的典型用法代码示例。如果您正苦于以下问题:PHP EEM_Base::delete_or_restore_by_ID方法的具体用法?PHP EEM_Base::delete_or_restore_by_ID怎么用?PHP EEM_Base::delete_or_restore_by_ID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EEM_Base
的用法示例。
在下文中一共展示了EEM_Base::delete_or_restore_by_ID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _trash_or_restore_items
/**
* Interally used to delete or restore items, using the request data. Meant to be
* flexible between question or question groups
* @param EEM_Base $model
* @param boolean $trash wehter to trash or restore
*/
private function _trash_or_restore_items(EEM_Base $model, $trash = TRUE)
{
do_action('AHEE_log', __FILE__, __FUNCTION__, '');
$success = 1;
//Checkboxes
//echo "trash $trash";
//var_dump($this->_req_data['checkbox']);die;
if (isset($this->_req_data['checkbox'])) {
if (isset($this->_req_data['checkbox']) && !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
// if array has more than one element than success message should be plural
$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
// cycle thru bulk action checkboxes
while (list($ID, $value) = each($this->_req_data['checkbox'])) {
if (!$model->delete_or_restore_by_ID($trash, absint($ID))) {
$success = 0;
}
}
} else {
// grab single id and delete
$ID = absint($this->_req_data['checkbox']);
if (!$model->delete_or_restore_by_ID($trash, $ID)) {
$success = 0;
}
}
} else {
// delete via trash link
// grab single id and delete
$ID = absint($this->_req_data[$model->primary_key_name()]);
if (!$model->delete_or_restore_by_ID($trash, $ID)) {
$success = 0;
}
}
$action = $model instanceof EEM_Question ? 'default' : 'question_groups';
//strtolower( $model->item_name(2) );
//echo "action :$action";
//$action = 'questions' ? 'default' : $action;
if ($trash) {
$action_desc = 'trashed';
$status = 'trash';
} else {
$action_desc = 'restored';
$status = 'all';
}
$this->_redirect_after_action($success, $model->item_name($success), $action_desc, array('action' => $action, 'status' => $status));
}
开发者ID:robert-osborne,项目名称:event-espresso-core-1,代码行数:51,代码来源:Extend_Registration_Form_Admin_Page.core.php