本文整理汇总了PHP中JModelAdmin::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP JModelAdmin::delete方法的具体用法?PHP JModelAdmin::delete怎么用?PHP JModelAdmin::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JModelAdmin
的用法示例。
在下文中一共展示了JModelAdmin::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete(&$pks)
{
$pks = (array) $pks;
$dir = JPATH_ROOT . '/images/baforms/';
$db = JFactory::getDBO();
foreach ($pks as $pk) {
$query = $db->getQuery(true);
$id = $pk;
$files = array();
$query->select("mesage");
$query->from("#__baforms_submissions");
$query->where("id=" . $pk);
$db->setQuery($query);
$items = $db->loadResult();
$items = explode('_-_', $items);
foreach ($items as $item) {
if ($item != '') {
$item = explode('|-_-|', $item);
if ($item[2] == 'upload') {
if ($item[1] != '') {
array_push($files, $item[1]);
}
}
}
}
if (parent::delete($pk)) {
foreach ($files as $file) {
unlink($dir . $file);
}
} else {
return false;
}
}
return true;
}
示例2: delete
/**
* Check that recipient user is the one trying to delete and then call parent delete method
*
* @param array &$pks An array of record primary keys.
*
* @return boolean True if successful, false if an error occurs.
*
* @since 3.1
*/
public function delete(&$pks)
{
$pks = (array) $pks;
$table = $this->getTable();
$user = JFactory::getUser();
// Iterate the items to delete each one.
foreach ($pks as $i => $pk)
{
if ($table->load($pk))
{
if ($table->user_id_to !== $user->id)
{
// Prune items that you can't change.
unset($pks[$i]);
JLog::add(JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'), JLog::WARNING, 'jerror');
return false;
}
}
else
{
$this->setError($table->getError());
return false;
}
}
return parent::delete($pks);
}
示例3: delete
/**
* Override delete method to add the image processing
*/
public function delete(&$pks)
{
// standard joomla delete
$delete = parent::delete($pks);
if (!$delete) {
return false;
}
// delete images
$imageHelper = new CHPanelHelperImage(JComponentHelper::getParams('com_chpanel'));
foreach ($pks as $pk) {
// delete hotel image file
$imageHelper->deleteImage($pk, 'hotels');
// delete hotel gallery images
$query_images = $this->_db->getQuery(true)->select('id')->from('#__chpanel_images')->where("`hotel_id` = " . (int) $pk);
$images_ids = $this->_db->setQuery($query_images)->loadColumn();
if (count($images_ids)) {
// delete images files
foreach ($images_ids as $image_id) {
$imageHelper->deleteImage($image_id, 'images');
}
// db delete images
$query_delete_images = $this->_db->getQuery(true)->delete('#__chpanel_images')->where("`hotel_id` = " . (int) $pk);
$this->_db->setQuery($query_delete_images)->query();
}
}
// delete hotel translations
$this->_db->setQuery("DELETE FROM `#__chpanel_translations` WHERE `hotel_id` IN(" . implode(',', $pks) . ")")->query();
return true;
}
示例4: delete
public function delete(&$cids)
{
$db = JFactory::getDBO();
parent::delete($cids);
foreach ($cids as $cid) {
$db->setQuery("ALTER TABLE #__rsmembership_subscribers DROP `f" . $cid . "`");
$db->query();
}
return true;
}
示例5: delete
public function delete(&$pks)
{
// IF delete successfully
if (parent::delete($pks)) {
$this->updateCounter();
return true;
} else {
return false;
}
}
示例6: delete
public function delete(&$pks)
{
$success = parent::delete($pks);
if ($success) {
$pks = (array) $pks;
JArrayHelper::toInteger($pks);
$this->_db->setQuery('delete from #__dpfields_fields_values where field_id in (' . implode(',', $pks) . ')');
$this->_db->query();
}
return $success;
}
示例7: delete
/**
* Override delete method to add the image processing
*/
public function delete(&$pks)
{
// standard joomla delete
$delete = parent::delete($pks);
if (!$delete) {
return false;
}
// delete rooms
$imageHelper = new CHPanelHelperImage(JComponentHelper::getParams('com_chpanel'));
foreach ($pks as $pk) {
$imageHelper->deleteImage($pk, 'rooms');
}
return true;
}
示例8: delete
public function delete(&$pks)
{
if (!parent::delete($pks)) {
return false;
}
foreach ($pks as $pk) {
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->delete('#__eventgallery_imagetypeset_imagetype_assignment');
$query->where('imagetypeid = ' . $db->quote($pk));
$db->setQuery($query);
$db->execute();
}
return true;
}
示例9: delete
public function delete($id)
{
// retrieve the default value
$query = $this->_db->getQuery(true);
$query->select(' home ');
$query->from(' #__joaktree_themes ');
$query->where(' id = ' . (int) $id . ' ');
$query->where(' home = 1 ');
$this->_db->setQuery($query);
$ret = $this->_db->loadResult();
if ($ret) {
// Value is default
return false;
} else {
$ret = $this->deleteSource($id);
return parent::delete($id);
}
}
示例10: delete
/**
* Check that recipient user is the one trying to delete and then call parent delete method
*
* @param array &$pks An array of record primary keys.
*
* @return boolean True if successful, false if an error occurs.
*
* @since 3.1
*/
public function delete(&$pks)
{
$pks = (array) $pks;
$table = $this->getTable();
// Iterate the items to delete each one.
foreach ($pks as $i => $pk) {
if ($table->load($pk)) {
if ($table->user_id_to !== \User::get('id')) {
// Prune items that you can't change.
unset($pks[$i]);
\Notify::warning(\Lang::txt('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'));
return false;
}
} else {
$this->setError($table->getError());
return false;
}
}
return parent::delete($pks);
}
示例11: delete
/**
* Override delete method to avoid deletion of default types and types that have items
*/
public function delete(&$pks)
{
// check ids
foreach ($pks as $i => $pk) {
// default types
if ($pk < 100) {
$this->setError(JText::_('COM_JKIT_TYPE_ERROR_DELETE_DEFAULT'));
return false;
}
// check items
$items = $this->_getList('SELECT `id`, `title` FROM `#__jkit_items` WHERE `type_id` IN(' . implode(',', $pks) . ')');
if (count($items)) {
$this->setError(JText::_('COM_JKIT_TYPE_ERROR_DELETE_CURRENT'));
return false;
}
}
// standard joomla delete
$delete = parent::delete($pks);
if (!$delete) {
return false;
}
return true;
}
示例12: delete
public function delete(&$pks)
{
$deleted = parent::delete($pks);
if ($deleted) {
$query = 'DELETE FROM #__djmt_items WHERE catid IN (' . implode(',', $pks) . ')';
$this->_db->setQuery($query);
$this->_db->query();
}
return $deleted;
}
示例13: delete
public function delete(&$pks)
{
if (!parent::delete($pks)) {
return false;
}
// Delete the course section and the registrations
foreach ($pks as $i => $pk) {
/*
* SQL query:
*
* SELECT ID
* FROM #__osbitcoursesection
* WHERE sectionID = $pk
*/
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('ID');
$query->from('#__osbitcoursesection');
$query->where("sectionID = '{$pk}'");
$db->setQuery((string) $query);
$request = $db->loadObjectList();
if (!$request) {
return true;
}
/*
* SQL query:
*
* DELETE FROM #__osbitcoursesection
* WHERE courseID = $pk
*/
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->delete('#__osbitcoursesection');
$query->where("sectionID = '{$pk}'");
$db->setQuery((string) $query);
$db->query();
foreach ($request as $key => $section) {
/*
* SQL query:
*
* DELETE FROM #__osbitregistrations
* WHERE courseID = $section->ID
*/
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->delete('#__osbitregistrations');
$query->where("courseID = '" . $section->ID . "'");
$db->setQuery((string) $query);
$db->query();
}
}
}
示例14: delete
/**
* Method to delete one or more records.
*
* @param array &$pks An array of record primary keys.
*
* @return boolean True if successful, false if an error occurs.
*/
public function delete(&$pks)
{
$pks = (array) $pks;
$db = JFactory::getDbo();
$query = $db->getQuery(true);
// Iterate the items to delete each one.
foreach ($pks as $i => $pk) {
$query->clear();
$query->select('COUNT(a.id)')->from('#__pf_designs AS a')->where('a.album_id = ' . $db->quote((int) $pk));
$db->setQuery($query);
$count = (int) $db->loadResult();
if ($count) {
$this->setError(JText::_('COM_PROJECTFORK_DESIGNS_ALBUM_ERROR_DELETE_NOT_EMPTY_DELETE'));
return false;
}
}
return parent::delete($pks);
}
示例15: delete
public function delete(&$cid)
{
if (parent::delete($cid)) {
if (count($cid)) {
/*$cids = implode(',', $cid);
$this->_db->setQuery("DELETE FROM #__djc2_deliveries_payments WHERE delivery_id IN ( ".$cids." )");
if (!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}*/
}
return true;
}
return false;
}