本文整理汇总了PHP中XoopsPersistableObjectHandler::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsPersistableObjectHandler::delete方法的具体用法?PHP XoopsPersistableObjectHandler::delete怎么用?PHP XoopsPersistableObjectHandler::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsPersistableObjectHandler
的用法示例。
在下文中一共展示了XoopsPersistableObjectHandler::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Delete an object from the database
* @see XoopsPersistableObjectHandler
*
* @param XoopsObject $obj
* @param bool $force
*
* @return bool
*/
public function delete(XoopsObject $obj, $force = false)
{
if (parent::delete($obj, $force)) {
$field_handler = xoops_getModuleHandler('field');
return $field_handler->updateAll('step_id', 0, new Criteria('step_id', $obj->getVar('step_id')), $force);
}
return false;
}
示例2: delete
/**
* Delete an object from the database
* @see XoopsPersistableObjectHandler
*
* @param profileRegstep $obj
* @param bool $force
*
* @return bool
*/
function delete($obj, $force = false)
{
if (parent::delete($obj, $force)) {
$field_handler =& xoops_getmodulehandler('field');
return $field_handler->updateAll('step_id', 0, new Criteria('step_id', $obj->getVar('step_id')));
}
return false;
}
示例3: delete
function delete(&$forum)
{
global $xoopsModule;
// RMV-NOTIFY
xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'forum', $forum->getVar('forum_id'));
// Get list of all topics in forum, to delete them too
$topic_handler =& xoops_getmodulehandler('topic', 'newbb');
$topic_handler->deleteAll(new Criteria("forum_id", $forum->getVar('forum_id')), true, true);
$this->updateAll("parent_forum", $forum->getVar('parent_forum'), new Criteria("parent_forum", $forum->getVar('forum_id')));
$this->deletePermission($forum);
return parent::delete($forum);
}
示例4: delete
function delete(&$category)
{
global $xoopsModule;
$forum_handler =& xoops_getmodulehandler('forum', 'newbb');
$forum_handler->deleteAll(new Criteria("cat_id", $category->getVar('cat_id')), true, true);
if ($result = parent::delete($category)) {
// Delete group permissions
return $this->deletePermission($category);
} else {
$category->setErrors("delete category error: " . $sql);
return false;
}
}
示例5: setTodelete
/**
* Mark a message as to_delete = 1 or removes it if the sender has also deleted it
* @param object $pm {@link XoopsPrivmessage} object
* @return bool
**/
function setTodelete(&$pm, $val = 1)
{
if ($pm->getVar('from_delete') == 0) {
return $this->updateAll('to_delete', intval($val), new Criteria('msg_id', $pm->getVar('msg_id')));
} else {
return parent::delete($pm);
}
}
示例6: delete
function delete(&$obj, $force = false)
{
$sql = sprintf("DELETE FROM %s WHERE block_id = %u", $this->db->prefix('block_module_link'), $obj->getVar('instanceid'));
if ($this->db->query($sql)) {
$groupperm_handler =& xoops_gethandler('groupperm');
$criteria = new CriteriaCompo(new Criteria('gperm_modid', 1));
$criteria->add(new Criteria('gperm_name', 'block_read'));
$criteria->add(new Criteria('gperm_itemid', $obj->getVar('instanceid')));
if ($groupperm_handler->deleteAll($criteria)) {
return parent::delete($obj, $force);
}
}
//@TODO: LOCALIZE
$obj->setErrors("Could not delete instance link");
return false;
}
示例7: delete
/**
* delete an item from the database
*
* @param object $item reference to the ITEM to delete
* @param bool $force
*
* @return bool FALSE if failed.
*/
public function delete(&$item, $force = false)
{
// Deleting the files
if (!$this->publisher->getHandler('file')->deleteItemFiles($item)) {
$item->setErrors('An error while deleting a file.');
}
if (!parent::delete($item, $force)) {
$item->setErrors('An error while deleting.');
return false;
}
// Removing tags information
if (xoops_isActiveModule('tag')) {
$tag_handler = xoops_getmodulehandler('tag', 'tag');
$tag_handler->updateByItem('', $item->getVar('itemid'), PUBLISHER_DIRNAME, 0);
}
return true;
}
示例8: setTodelete
/**
* Mark a message as to_delete = 1 or removes it if the sender has also deleted it or sent by anonymous
*
* @param XoopsObject|PmMessage $pm
* @param int $val
* @return bool
*/
public function setTodelete(PmMessage $pm, $val = 1)
{
if ($pm->getVar('from_delete') == 0 && $pm->getVar('from_userid') == 0) {
return $this->updateAll('to_delete', (int) $val, new Criteria('msg_id', $pm->getVar('msg_id')));
} else {
return parent::delete($pm);
}
}
示例9: delete
/**
* delete a category from the database
*
* @param object $category reference to the category to delete
* @param bool $force
*
* @return bool FALSE if failed.
*/
public function delete(&$category, $force = false)
{
// Deleting this category ITEMs
$criteria = new Criteria('categoryid', $category->categoryid());
$this->publisher->getHandler('item')->deleteAll($criteria);
unset($criteria);
// Deleting the sub categories
$subcats =& $this->getCategories(0, 0, $category->categoryid());
foreach ($subcats as $subcat) {
$this->delete($subcat);
}
if (!parent::delete($category, $force)) {
$category->setErrors('An error while deleting.');
return false;
}
$moduleId = $this->publisher->getModule()->getVar('mid');
xoops_groupperm_deletebymoditem($moduleId, 'category_read', $category->categoryid());
xoops_groupperm_deletebymoditem($moduleId, 'item_submit', $category->categoryid());
xoops_groupperm_deletebymoditem($moduleId, 'category_moderation', $category->categoryid());
return true;
}
示例10: delete
/**
* delete a file from the database
*
* @param object $file reference to the file to delete
* @param bool $force
*
* @return bool FALSE if failed.
*/
public function delete(&$file, $force = false)
{
$ret = false;
// Delete the actual file
if (is_file($file->getFilePath()) && unlink($file->getFilePath())) {
$ret = parent::delete($file, $force);
}
return $ret;
}
示例11: delete
/**
* delete a user from the database
*
* @param object $user reference to the user to delete
* @param bool $force
* @return bool FALSE if failed.
*/
function delete(&$user, $force = false)
{
if (!parent::delete($user, $force)) {
return false;
}
// delete user profile
return $this->_pHandler->delete($user->getProfile(), $force);
}
示例12: delete
/**
* delete a profile field from the database
*
* @param object $obj reference to the object to delete
* @param bool $force
* @return bool FALSE if failed.
**/
function delete(&$obj, $force = false)
{
$profile_handler =& xoops_getmodulehandler('profile', 'profile');
// remove column from table
$sql = "ALTER TABLE " . $profile_handler->table . " DROP `" . $obj->getVar('field_name', 'n') . "`";
if ($this->db->query($sql)) {
//change this to update the cached field information storage
if (!parent::delete($obj, $force)) {
return false;
}
if ($obj->getVar('field_show') || $obj->getVar('field_edit')) {
$module_handler =& xoops_gethandler('module');
$profile_module = $module_handler->getByDirname('profile');
if (is_object($profile_module)) {
// Remove group permissions
$groupperm_handler =& xoops_gethandler('groupperm');
$criteria = new CriteriaCompo(new Criteria('gperm_modid', $profile_module->getVar('mid')));
$criteria->add(new Criteria('gperm_itemid', $obj->getVar('field_id')));
return $groupperm_handler->deleteAll($criteria);
}
}
}
return false;
}
示例13: delete
/**
* delete an object as well as links relying on it
*
* @param object $object {@link NewbbType}
* @param bool $force flag to force the query execution despite security settings
* @return bool
*/
function delete(&$object, $force = true)
{
if (!is_object($object) || !$object->getVar($this->keyName)) {
return false;
}
$queryFunc = empty($force) ? "query" : "queryF";
/*
* Remove forum-type links
*/
$sql = "DELETE" . " FROM " . $this->db->prefix("bb_type_forum") . " WHERE " . $this->keyName . " = " . $object->getVar($this->keyName);
if (($result = $this->db->{$queryFunc}($sql)) == false) {
// xoops_error($this->db->error());
}
/*
* Reset topic type linked to this type
*/
$sql = "UPATE" . " " . $this->db->prefix("bb_topics") . " SET {$this->keyName}=0" . " WHERE {$this->keyName} = " . $object->getVar($this->keyName);
if (($result = $this->db->{$queryFunc}($sql)) == false) {
//xoops_error($this->db->error());
}
return parent::delete($object, $force);
}
示例14: delete
/**
* delete an object as well as links relying on it
*
* @param object $object {@link TagTag}
* @param bool $force flag to force the query execution despite security settings
* @return bool
*/
function delete(&$object, $force = true)
{
if (!is_object($object) || !$object->getVar($this->keyName)) {
return false;
}
$queryFunc = empty($force) ? "query" : "queryF";
/*
* Remove item-tag links
*/
$sql = "DELETE" . " FROM {$this->table_link}" . " WHERE {$this->keyName} = " . $object->getVar($this->keyName);
if (($result = $this->db->{$queryFunc}($sql)) == false) {
// xoops_error($this->db->error());
}
/*
* Remove stats-tag links
*/
$sql = "DELETE" . " FROM {$this->table_stats}" . " WHERE {$this->keyName} = " . $object->getVar($this->keyName);
if (($result = $this->db->{$queryFunc}($sql)) == false) {
// xoops_error($this->db->error());
}
return parent::delete($object, $force);
}
示例15: delete
/**
* delete a block from the database
*
* @param object XoopsBlock $block reference to the block to delete
* @param bool $force
*
* @return bool TRUE if succesful
**/
function delete(&$block, $force = false)
{
$instance_handler =& xoops_gethandler('blockinstance');
$instances =& $instance_handler->getObjects(new Criteria('bid', $block->getVar('bid')));
if (count($instances) > 0) {
foreach (array_keys($instances) as $i) {
if (!$instance_handler->delete($instances[$i], $force)) {
//@TODO: LOCALIZE!
$block->setErrors("could not delete block instance " . $instances[$i]->getVar('title') . "<br />" . implode('<br />', $instances[$i]->getErrors()));
return false;
}
}
}
if ($block->getVar('template') != '') {
$tplfile_handler =& xoops_gethandler('tplfile');
$btemplate =& $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $block->getVar('bid'));
if (count($btemplate) > 0) {
$tplfile_handler->delete($btemplate[0]);
}
}
return parent::delete($block, $force);
}