Exemple #1
0
 protected function _postDelete()
 {
     $tblUserDetail = new Kutu_Core_Orm_Table_UserDetail();
     $rowsetUserDetail = $tblUserDetail->fetchAll("uid='{$this->guid}'");
     foreach ($rowsetUserDetail as $row) {
         // delete
         $row->delete();
     }
     //delete from table KutuUserInvoice
     $tblInvoice = new Kutu_Core_Orm_Table_Invoice();
     $tblInvoice->delete("uid='{$this->guid}'");
     //delete from table KutuUserAccessLog
     $tblUserLog = new Kutu_Core_Orm_Table_UserLog();
     $tblUserLog->delete("user_id='{$this->guid}'");
     //delete from ACL
     $aclMan = Kutu_Acl::manager();
     $aclMan->deleteUser($this->username);
     // delete physical user folder define by guid
     $sDir = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . $this->guid;
     try {
         $this->removeRessource($sDir);
     } catch (Exception $e) {
         throw new Exception($e);
     }
 }
Exemple #2
0
 /**
  * _writeInvoice : Individual & Korporasi
  * @return 
  */
 function _writeInvoice($memberId, $totalPromo, $discPromo, $payment, $access = '')
 {
     $aclMan = new Kutu_Acl_Adapter_Local();
     $tblInvoice = new Kutu_Core_Orm_Table_Invoice();
     $where = $tblInvoice->getAdapter()->quoteInto("uid=?", $memberId);
     $rowInvoice = $tblInvoice->fetchAll($where);
     if (count($rowInvoice) <= 0) {
         $rowInvoice = $tblInvoice->fetchNew();
         $rowInvoice->uid = $memberId;
         $rowInvoice->price = $totalPromo;
         $rowInvoice->discount = $discPromo;
         $rowInvoice->invoiceOutDate = date("Y-m-d");
         $rowInvoice->invoiceConfirmDate = "0000-00-00";
         $temptime = time();
         $temptime = Kutu_Lib_Formater::DateAdd('d', 5, $temptime);
         $rowInvoice->expirationDate = strftime('%Y-%m-%d', $temptime);
         $tblUser = new Kutu_Core_Orm_Table_User();
         $rowUser = $tblUser->fetchRow("kopel=" . $memberId);
         // add user to gacl
         $aclMan->addUser($rowUser->username, 'member_gratis');
         if (empty($access)) {
             $rowInvoice->save();
         } else {
             $result = $rowInvoice->save();
             if ($result) {
                 $response['success'] = true;
             } else {
                 $response['failure'] = true;
             }
             echo Zend_Json::encode($response);
         }
     } else {
         if (!empty($access)) {
             $response['success'] = true;
             echo Zend_Json::encode($response);
         }
     }
 }
Exemple #3
0
 function _writeInvoice($memberId, $totalPromo, $discPromo, $payment)
 {
     $formater = new Kutu_Lib_Formater();
     $tblInvoice = new Kutu_Core_Orm_Table_Invoice();
     $where = $tblInvoice->getAdapter()->quoteInto("memberid=?", $memberId);
     $rowInvoice = $tblInvoice->fetchAll($where);
     if (count($rowInvoice) <= 0) {
         $rowInvoice = $tblInvoice->fetchNew();
         $rowInvoice->memberid = $memberId;
         $rowInvoice->price = $totalPromo;
         $rowInvoice->discount = $discPromo;
         $rowInvoice->dtinvoice_out = date("Y-m-d");
         $rowInvoice->dtinvoice_confirm = "0000-00-00";
         $temptime = time();
         $temptime = $formater->DateAdd('d', 5, $temptime);
         $rowInvoice->expiration_date = strftime('%Y-%m-%d', $temptime);
         $rowInvoice->save();
     }
 }