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; }
/** * 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); }
/** * 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; }
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; }
public function delete(&$pks) { // IF delete successfully if (parent::delete($pks)) { $this->updateCounter(); return true; } else { return false; } }
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; }
/** * 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; }
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; }
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); } }
/** * 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); }
/** * 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; }
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; }
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(); } } }
/** * 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); }
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; }
/** * 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. * * @since 12.2 */ public function delete(&$pks) { $params = JComponentHelper::getParams($this->option); /** @var $params Joomla\Registry\Registry */ $folderImages = $params->get("images_directory", "images/crowdfunding"); jimport("joomla.filesystem.path"); jimport("joomla.filesystem.file"); jimport("crowdfunding.project"); foreach ($pks as $id) { $project = new CrowdFundingProject(JFactory::getDbo()); $project->load($id); $this->deleteProjectImages($project, $folderImages); $this->deleteAdditionalImages($project, $folderImages); $this->removeIntentions($project); $this->removeComments($project); $this->removeUpdates($project); $this->removeRewards($project); $this->removeTransactions($project); } return parent::delete($pks); }
/** * 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. * * @since 12.2 */ public function delete(&$pks) { if (!parent::delete($pks)) { return false; } return true; }
function delete(&$pks) { // if($pks){ // $catId = implode(',',$pks); // $query = 'SELECT * FROM #__tz_portfolio_plus_categories' // .' WHERE catid IN('.$catId.')'; // $db = JFactory::getDbo(); // $db -> setQuery($query); // if(!$db -> query()){ // $this -> setError($db -> getErrorMsg()); // return false; // } // if($rows = $db -> loadObjectList()){ // foreach($rows as $row){ // if(!empty($row -> images)){ // $path = JPATH_SITE.DIRECTORY_SEPARATOR.str_replace('/',DIRECTORY_SEPARATOR,$row -> images); // if(JFile::exists($path)){ // JFile::delete($path); // } // } // } // } // $query = 'DELETE FROM #__tz_portfolio_plus_categories' // .' WHERE catid IN('.$catId.')'; // $db -> setQuery($query); // if(!$db -> query()){ // $this -> setError($db -> getErrorMsg()); // return false; // } // } parent::delete($pks); }
public function delete(&$pks) { // IF delete successfully if (parent::delete($pks)) { // DELETE IMAGES foreach ($pks as $pk) { $path_image = $this->images_path . $pk; JFolder::delete($path_image); $db =& $this->getDbo(); $query = 'DELETE FROM #__bt_portfolio_images WHERE item_id = ' . $pk; $db->setQuery($query); $db->query(); } } }
/** * Override delete method to also delete form fields that associated * * @param array &$pks id form * * @return boolean */ public function delete(&$pks) { $pks = (array) $pks; foreach ($pks as $id) { $this->_db->setQuery("DELETE FROM #__jsn_uniform_config WHERE name='position_form_{$id}'"); $this->_db->execute(); $this->_db->setQuery("DELETE FROM #__jsn_uniform_fields WHERE form_id={$id}"); $this->_db->execute(); $this->_db->setQuery("DELETE FROM #__jsn_uniform_submission_data WHERE form_id={$id}"); $this->_db->execute(); $this->_db->setQuery("DELETE FROM #__jsn_uniform_form_pages WHERE form_id={$id}"); $this->_db->execute(); $this->_db->setQuery("DELETE FROM #__jsn_uniform_templates WHERE form_id={$id}"); $this->_db->execute(); $this->_db->setQuery("DELETE FROM #__jsn_uniform_emails WHERE form_id={$id}"); $this->_db->execute(); $this->_db->setQuery("DELETE FROM #__jsn_uniform_submissions WHERE form_id={$id}"); $this->_db->execute(); if (!parent::delete($id)) { return false; } } return true; }
/** * 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) { // Include the componentarchitect plugins for the delete events. JPluginHelper::importPlugin('componentarchitect'); //[%%START_CUSTOM_CODE%%] // Check to prevent delete of pre-defined code templates $ok_pks = $this->check_predefined($pks); if (count($pks) > count($ok_pks)) { if (count($ok_pks) == 0) { $this->setError(JText::_($this->text_prefix . '_ERROR_PREDEFINED_CODETEMPLATE_CANNOT_DELETE')); } else { $result = parent::delete($ok_pks); if ($result) { $this->setError(JText::plural($this->text_prefix . '_ERROR_PREDEFINED_CODETEMPLATE_CANNOT_DELETE_N_ITEMS_DELETED', count($ok_pks))); } } return false; } else { return parent::delete($pks); } //[%%END_CUSTOM_CODE%%] }
/** * 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 JKitHelperImage(JComponentHelper::getParams('com_jkit')); foreach ($pks as $pk) { $imageHelper->deleteImage($pk, 'users'); } return true; }
public function delete(&$pks) { $result = parent::delete($pks); $pks = (array) $pks; $table = $this->getTable(); // Iterate the items to delete each one. foreach ($pks as $i => $pk) { // if the order was deleted, remote the line items too. if (!$table->load($pk)) { // remove lineitems $db = JFactory::getDBO(); $query = $db->getQuery(true)->delete($db->quoteName('#__eventgallery_imagelineitem'))->where('lineitemcontainerid=' . $db->quote($pk)); $db->setQuery($query); $db->query(); //remove servicelineitems $db = JFactory::getDBO(); $query = $db->getQuery(true)->delete($db->quoteName('#__eventgallery_servicelineitem'))->where('lineitemcontainerid=' . $db->quote($pk)); $db->setQuery($query); $db->query(); } } return $result; }
public function delete(&$pks) { $pks = (array) $pks; if (parent::delete($pks)) { //apaga relacionamentos do(s) compromisso(s) return $this->clearCompromissosDirigentes($pks); } return false; }
/** * potentially drop fields then remove element record * @param array $cids to delete */ public function delete($cids) { // Initialize variables $pluginManager = JModel::getInstance('Pluginmanager', 'FabrikFEModel'); $drops = (array) JRequest::getVar('drop'); foreach ($cids as $id) { $drop = array_key_exists($id, $drops) && $drops[$id][0] == '1'; if ((int) $id === 0) { continue; } $pluginModel = $pluginManager->getElementPlugin($id); $pluginModel->onRemove($drop); $element = $pluginModel->getElement(); if ($drop) { if ($pluginModel->isRepeatElement()) { $listModel = $pluginModel->getListModel(); $db = $listModel->getDb(); $tableName = $db->nameQuote($this->getRepeatElementTableName($pluginModel)); $db->setQuery("DROP TABLE {$tableName}"); if (!$db->query()) { JError::raiseNotice(500, 'didnt drop joined db table ' . $tableName); } } $listModel = $pluginModel->getListModel(); $item = $listModel->getTable(); // $$$ hugh - might be a tableless form! if (!empty($item->id)) { $db = $listModel->getDb(); $db->setQuery("ALTER TABLE " . $db->nameQuote($item->db_table_name) . " DROP " . $db->nameQuote($element->name)); $db->query(); } } } return parent::delete($cids); }
public function delete(&$pks) { try { // delete from tc db $dbo = JTrinityCoreDBHelper::getDB(); $accdb = JTrinityCoreDBHelper::getAuthDBName(); // Iterate the items to delete each one. $res = true; $pks = (array) $pks; $table = $this->getTable(); foreach ($pks as $i => $pk) { $realmid = 0; // Get realmid if ($table->load($pk)) { $realmid = $table->realmid; } $query = "DELETE FROM " . $accdb . ".realmlist WHERE id=" . $realmid; $dbo->setQuery($query); $res = $res && $dbo->query(); } if ($res) { $res = parent::delete($pks); } return $res; } catch (Exception $e) { $this->setError($e->getMessage()); return false; } }
public function delete(&$pks) { if ($pks) { $db = JFactory::getDbo(); $this->deleteImage($pks); foreach ($pks as $item) { $this->removeAllAttach($item, 'media'); $query = 'DELETE FROM #__tz_portfolio_xref_content' . ' WHERE contentid = ' . $item; $db->setQuery($query); if (!$db->query()) { $this->setError($db->getErrorMsg()); return false; } $query = 'DELETE FROM #__tz_portfolio' . ' WHERE contentid = ' . $item; $db->setQuery($query); if (!$db->query()) { $this->setError($db->getErrorMsg()); return false; } } $this->deleteTags($pks); } parent::delete($pks); }
/** * @return boolean * @param array of primary_keys */ public function delete($pks) { $errorMsg = ''; if (count($pks) > 1) { $this->setError(JText::_('COM_TAGNYILVANTARTAS_SELECT_ONLY_ONE')); return false; } foreach ($pks as $pk) { // ellenörzi, hogy a "$pk" rekord törölhetõ-? // ha nem ir az errorMessagbe // $errorMsg .= $pk.' '.JText::_('COM_TAGNYILVANTARTAS_CANNOT_DELETE').'<br />'; } if ($errorMsg == '') { return parent::delete($pks); } else { $this->setError($errorMsg); return false; } }
/** * 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) { // Include the knvbapi2 plugins for the delete events. JPluginHelper::importPlugin('knvbapi2'); return parent::delete($pks); }
/** * @return boolean * @param array of primary_keys */ public function delete($pks) { $errorMsg = ''; if (count($pks) > 1) { $this->setError(JText::_('COM_TAGNYILVANTARTAS_SELECT_ONLY_ONE')); return false; } $db = JFactory::getDBO(); foreach ($pks as $pk) { // ellenörzi, hogy a "$pk" rekord törölhetõ-? // ha nem ir az errorMessagbe // $errorMsg .= $pk.' '.JText::_('COM_TAGNYILVANTARTAS_CANNOT_DELETE').'<br />'; $db->setQuery('select kapcs_id from #__tny_felh_terhat where fcsoport_id='.$db->quote($pk).' limit 1'); $res = $db->loadObject(); if ($res) { $errorMsg .= $pk.' '.JText::_('COM_TAGNYILVANTARTAS_CANNOT_DELETE').'<br />'; } } if ($errorMsg == '') { return parent::delete(); } else { $this->setError($errorMsg); return false; } }