/**
  * write session data
  */
 public function write($id, $sess_data)
 {
     $criteria = new Charcoal_SQLCriteria(s('session_id = ?'), v(array($id)));
     $dto = $this->gw->findFirst(qt($this->target), $criteria);
     if (!$dto) {
         $dto = new Charcoal_SessionTableDTO();
         $dto->session_id = $id;
         $dto->save_path = $this->save_path;
         $dto->session_name = $this->session_name;
     }
     $dto->session_data = $sess_data;
     try {
         $this->gw->beginTrans();
         $this->gw->save(s($this->target), $dto);
         $this->gw->commitTrans();
     } catch (Exception $ex) {
         _catch($ex);
         $this->gw->rollbackTrans();
         _throw(new Charcoal_SessionHandlerException('write failed', $ex));
     }
     return true;
 }
Example #2
0
         $q->where('stuID = ?', $decode[0]['stuID'])->_and_()->where('termCode = ?', $_POST['termCode'])->update();
         /**
          * End updating tuition totals.
          */
     }
     redirect(get_base_url() . 'stu/stac' . '/' . $decode[0]['stuID'] . '/' . bm());
     return;
 } elseif (($_POST['status'] == 'W' || $_POST['status'] == 'D') && $date >= $term[0]['termStartDate'] && $date < $term[0]['dropAddEndDate']) {
     $q = $app->db->stu_course_sec()->where('stuID = ?', $decode[0]['stuID'])->_and_()->where('courseSection = ?', $decode[0]['courseSection'])->delete();
     $q = $app->db->stu_acad_cred()->where('stuAcadCredID = ?', $id)->delete();
     if (function_exists('financial_module')) {
         $q = $app->db->stu_acct_fee()->where('stuID = ?', $decode[0]['stuID'])->_and_()->where('description = ?', $decode[0]['courseSection'])->delete();
         /**
          * Begin Updating tuition totals.
          */
         $total = qt('course_sec', 'courseFee', 'courseSection = "' . $decode[0]['courseSection'] . '"') + qt('course_sec', 'labFee', 'courseSection = "' . $decode[0]['courseSection'] . '"') + qt('course_sec', 'materialFee', 'courseSection = "' . $decode[0]['courseSection'] . '"');
         $q = $app->db->stu_acct_tuition();
         $q->total = bcsub($q->total, $total);
         $q->where('stuID = ?', $decode[0]['stuID'])->_and_()->where('termCode = ?', $_POST['termCode'])->update();
         /**
          * End updating tuition totals.
          */
     }
     redirect(get_base_url() . 'stu/stac' . '/' . $decode[0]['stuID'] . '/' . bm());
     return;
 } elseif (($_POST['status'] == 'W' || $_POST['status'] == 'D') && $date >= $term[0]['termStartDate'] && $date > $term[0]['dropAddEndDate']) {
     $q = $app->db->stu_course_sec();
     $q->courseSecCode = $_POST['courseSecCode'];
     $q->termCode = $_POST['termCode'];
     $q->courseCredits = $_POST['attCred'];
     $q->status = $_POST['status'];
 /**
  * ใƒ†ใ‚นใƒˆ
  */
 public function test($action, $context)
 {
     $action = us($action);
     switch ($action) {
         case "open":
             $this->handler->open('/foo/bar', 'test');
             $save_path = Charcoal_System::getObjectVar($this->handler, 'save_path');
             $session_name = Charcoal_System::getObjectVar($this->handler, 'session_name');
             $this->assertEquals('/foo/bar', $save_path);
             $this->assertEquals('test', $session_name);
             return TRUE;
         case "close":
             return TRUE;
         case "read":
             return TRUE;
         case "write":
             $id = Charcoal_System::hash();
             $sess_data = 'test session data';
             $this->handler->open('/foo/bar', 'test');
             $this->handler->write($id, $sess_data);
             $criteria = new Charcoal_SQLCriteria(s('session_id = ?'), v(array($id)));
             $dto = $this->gw->findFirst(qt('session'), $criteria);
             $this->assertEquals($sess_data, $dto->session_data);
             $this->assertEquals('test', $dto->session_name);
             return TRUE;
         case "destroy":
             return TRUE;
         case "gc":
             return TRUE;
     }
     return FALSE;
 }