function do_delete_objects($objects, $permanent = false) { $err = 0; // count errors $succ = 0; // count files deleted foreach ($objects as $object) { try { $obj = Objects::findObject($object->getId()); if ($obj instanceof ContentDataObject && $obj->canDelete(logged_user())) { if ($permanent) { if (Plugins::instance()->isActivePlugin('mail') && $obj instanceof MailContent) { $obj->delete(false); } else { $obj->delete(); Members::delete(array("conditions" => "object_id = " . $obj->getId())); } ApplicationLogs::createLog($obj, ApplicationLogs::ACTION_DELETE); $succ++; } else { if ($obj->isTrashable()) { $obj->trash(); ApplicationLogs::createLog($obj, ApplicationLogs::ACTION_TRASH); $succ++; } } } } catch (Exception $e) { $err++; } } return array($succ, $err); }
* You should have received a copy of the GNU General Public License * along with Pusthaka. If not, see <http://www.gnu.org/licenses/>. */ $allow = "ADMIN;LIBSTAFF"; //$allow = "ADMIN"; $PageTitle = "Edit Member"; require('../inc/init.php'); $mem = new Members; // DELETE Member if(isset($_REQUEST['BtnDeleteMember'])){ $mid = $_REQUEST['mid']; $member = $mem->getByID($mid); $mem->delete($member); } // Update member ///////////////////////////////////////////////////// if(isset($_REQUEST['BtnUpdateMember'])){ //[Fill a member data object] ------------------------------ $member['mid'] = $_REQUEST['mid']; $member['mem_no'] = $_REQUEST['mem_no']; $member['type'] = $_REQUEST['type']; $member['surname'] = $_REQUEST['surname']; $member['firstnames'] = $_REQUEST['firstnames']; $member['title'] = $_REQUEST['title']; $member['address'] = $_REQUEST['address']; $member['nic'] = $_REQUEST['nic']; $member['reg_no'] = $_REQUEST['reg_no'];
public function delete($id = '') { /*********************************** Delete members ************************************/ $members = new Members($this->db); $this->f3->set('member', $members->read(array('id=?', $id), [])[0]); $this->f3->set('SESSION.flash', array()); if ($_SERVER['QUERY_STRING'] == "execute") { $members->delete($this->f3->get('member')->id); $this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Member ' . $this->f3->get('member')->name . ' deleted!')); $this->f3->reroute('/mytcg/members'); } $this->f3->set('content', 'app/views/mytcg/members_delete.htm'); echo Template::instance()->render('app/templates/admin.htm'); }