当前位置: 首页>>代码示例>>PHP>>正文


PHP JModelAdmin::delete方法代码示例

本文整理汇总了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;
 }
开发者ID:pupsikus,项目名称:bs.test,代码行数:35,代码来源:submission.php

示例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);
	}
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:36,代码来源:message.php

示例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;
 }
开发者ID:moijafcor,项目名称:CHPanel-Lite,代码行数:32,代码来源:hotel.php

示例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;
 }
开发者ID:JozefAB,项目名称:qk,代码行数:10,代码来源:field.php

示例5: delete

 public function delete(&$pks)
 {
     // IF delete successfully
     if (parent::delete($pks)) {
         $this->updateCounter();
         return true;
     } else {
         return false;
     }
 }
开发者ID:Tommar,项目名称:remate,代码行数:10,代码来源:comment.php

示例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;
 }
开发者ID:beingsane,项目名称:DPFields,代码行数:11,代码来源:field.php

示例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;
 }
开发者ID:moijafcor,项目名称:CHPanel-Lite,代码行数:17,代码来源:room.php

示例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;
 }
开发者ID:sansandeep143,项目名称:av,代码行数:15,代码来源:imagetype.php

示例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);
     }
 }
开发者ID:Lothurm,项目名称:J3.x,代码行数:18,代码来源:jt_theme.php

示例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);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:29,代码来源:message.php

示例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;
 }
开发者ID:CloudHotelier,项目名称:com_jkit,代码行数:26,代码来源:type.php

示例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;
 }
开发者ID:andremarceloteixeira,项目名称:relaixamento.com-local,代码行数:10,代码来源:category.php

示例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();
         }
     }
 }
开发者ID:untergasser,项目名称:osbit,代码行数:52,代码来源:section.php

示例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);
 }
开发者ID:MrJookie,项目名称:pm,代码行数:25,代码来源:album.php

示例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;
 }
开发者ID:kidaa30,项目名称:lojinha,代码行数:15,代码来源:shipping.php


注:本文中的JModelAdmin::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。