示例#1
0
 function delete()
 {
     global $mainframe, $Itemid;
     $key = JRequest::getVar('key');
     $userId = DT_Session::get('register.User.members.' . $key . '.groupUserId');
     $memtot = DTrCommon::cntMemtotInSession(DT_Session::get('register.User.members'));
     $tUser = $this->getModel('user')->table;
     $tUser->load($userId);
     $tEvt = $this->getModel('event')->table;
     $tEvt->load($tUser->eventId);
     $min = $tEvt->min_group_size == "" ? 2 : $tEvt->min_group_size;
     if ($memtot <= $min) {
         $mainframe->redirect("index.php?option=com_dtregister&controller=member&userId=" . $userId . "&Itemid=" . $Itemid, JText::_('DT_MEMBER_REMOVE_ERROR'));
     }
     $memtot = DT_Session::get('register.User.memtot');
     $memtot--;
     DT_Session::set('register.User.memtot', $memtot);
     DT_Session::set('register.User.members.' . $key . '.remove', true);
     $mainframe->redirect("index.php?option=com_dtregister&controller=member&userId=" . $userId . "&Itemid=" . $Itemid);
 }
示例#2
0
 function edit()
 {
     global $mainframe, $Itemid;
     $mUser = $this->getModel('user');
     $tUser = $mUser->table;
     $userId = JRequest::getVar('userId', 0);
     $tUser->load($userId);
     DT_Session::set('register.Event.eventId', $tUser->eventId);
     $userObj = $tUser->getObjData();
     $user = DTrCommon::objectToArray($userObj);
     $user['process'] = 'change';
     if (isset($_POST['formsubmit'])) {
         $data = $_POST['User'];
         if (DT_Session::get('register.User.members')) {
             $memtot = DTrCommon::cntMemtotInSession(DT_Session::get('register.User.members'));
         } else {
             $memtot = DT_Session::get('register.User.memtot');
         }
         $user['fields'] = $_POST['Field'];
         $user['memtot'] = $memtot;
         if (DT_Session::get('register.User.members')) {
             $temp = array();
             foreach (DT_Session::get('register.User.members') as $key => $member) {
                 if (isset($member['remove']) && $member['remove']) {
                 } else {
                     $temp[$key] = $member;
                 }
             }
             $user['members'] = $temp;
         }
         DT_Session::set('register.User', $user);
         DT_Session::set('register.User.process', 'change');
         //unset($_SESSION['DTregister']['register']['members']);
         $mainframe->redirect("index.php?option=com_dtregister&Itemid=" . $Itemid . "&controller=user&task=confirm");
         pr($_POST);
         prd($user);
     } else {
         if (!DT_Session::get('register.User')) {
             DT_Session::set('register.User', $user);
             DT_Session::set('register.Event.eventId', $tUser->eventId);
         }
     }
     $eventId = $tUser->eventId;
     $this->view->assign('header_eventId', $eventId);
     // pr(DTrCommon::objectToArray($userObj));
     // pr($user);
     $type = $tUser->type == 'I' ? 'I' : 'B';
     $tUser->TableEvent->duplicate_check = false;
     $this->view->assign('form', $tUser->TableEvent->form($type, (array) $tUser, false, 'frmcart', true));
     $tUser->TableEvent->load($eventId);
     $this->view->assign('tEvent', $tUser->TableEvent);
     $this->view->assign('mUser', $mUser);
     $this->display();
 }